/* パソコンはふつうの文字 12px で詰める。iPhone（幅 640px まで）は指で押す大きさ（決まり35） */
:root {
  --bg: #EEF1F4; --panel: #fff; --ink: #17212B; --sub: #4C5763; --line: #D3D9E0; --line2: #E6EAEF;
  --accent: #1A56A8; --accent-d: #123F7D; --turn: #A8430C; --turn-bg: #FDF1EA; --turn-row: #FDF6F1; --turn-ink: #7F3208;
  --urgent: #B3261E; --urgent-bg: #FDECEA; --chip: #E6EAEF; --time-bg: #DCE8F8; --muted: #8A949F;
  --fs: 12px; --fs-s: 11px; --h-btn: 28px; --h-row: 30px; --pad: 8px;
  color-scheme: light;
}
@media (max-width: 640px) {
  :root { --fs: 15px; --fs-s: 13px; --h-btn: 44px; --h-row: 48px; --pad: 12px; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: 'BIZ UDPGothic', 'Yu Gothic', 'Hiragino Sans', sans-serif; font-size: var(--fs); line-height: 1.4; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.sub { font-size: var(--fs-s); color: var(--sub); }
.btn { min-height: var(--h-btn); padding: 0 8px; border: 1px solid #AEB7C2; border-radius: 6px; background: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #F2F5F8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--accent-d); }
.btn.turn { background: var(--turn); border-color: var(--turn); color: #fff; font-weight: 700; }
.btn.small { min-height: calc(var(--h-btn) - 4px); padding: 0 6px; font-size: var(--fs-s); }
.btn.big { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn:focus-visible, .field:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { min-height: var(--h-btn); padding: 0 6px; border: 1px solid #AEB7C2; border-radius: 6px; background: #fff; min-width: 0; }
.chip { display: inline-flex; align-items: center; min-height: 18px; padding: 0 5px; border-radius: 4px; font-size: var(--fs-s); background: var(--chip); color: #2C3744; white-space: nowrap; }
.chip.time { background: var(--time-bg); color: var(--accent-d); font-weight: 700; }
.chip.turn { background: #FBE6DA; color: var(--turn-ink); font-weight: 700; }
.chip.carry { background: #FBE6DA; color: var(--turn-ink); }
.chip.part { background: var(--ink); color: #fff; }
.chip.urgent { background: var(--urgent); color: #fff; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 6px 10px; border-radius: 6px; background: var(--ink); color: #fff; font-weight: 700; z-index: 5; }

/* 全体の枠 */
.app { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px; padding: 8px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); align-items: start; }
.side { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.stat { padding: 8px; }
.stat .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nav { display: flex; flex-direction: column; padding: 3px; }
.nav a { display: flex; justify-content: space-between; align-items: center; min-height: 28px; padding: 0 6px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--ink); color: #fff; font-weight: 700; }
.nav a:hover:not(.on) { background: #F2F5F8; }
.main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.capture { display: flex; gap: 4px; padding: 6px; }
.capture .field { flex: 1 1 auto; }

/* 今日の画面 */
.turnsum { border: 2px solid var(--turn); background: var(--turn-bg); }
.bandhead { display: flex; align-items: baseline; gap: 6px; padding: 6px 8px; flex-wrap: wrap; }
.bandname { font-size: 13px; font-weight: 700; }
.now { font-size: var(--fs-s); font-weight: 700; color: #fff; background: var(--accent); padding: 1px 5px; border-radius: 4px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px 8px; border-top: 1px solid var(--line2); min-height: var(--h-row); }
.row.done .ttl { text-decoration: line-through; color: #6B7682; }
.row.turnrow { background: var(--turn-row); }
.row.urgent { background: var(--urgent-bg); box-shadow: inset 4px 0 0 var(--urgent); }
.row.dropbefore { box-shadow: inset 0 2px 0 var(--accent); }
.row[draggable="true"] { cursor: grab; }
.grip { flex: none; width: 12px; color: var(--muted); user-select: none; font-size: 11px; line-height: 1; }
.check { display: flex; align-items: center; gap: 6px; flex: 1 1 240px; min-height: 28px; min-width: 0; cursor: pointer; }
.check input { width: 14px; height: 14px; flex: none; accent-color: var(--accent); }
.ttl { min-width: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 3px; flex: 0 0 220px; min-width: 0; }
.acts { display: grid; grid-template-columns: 66px 82px 84px; gap: 3px; align-items: center; flex: 0 0 auto; }
.acts > * { width: 100%; justify-content: center; text-align: center; padding: 0 2px; }
.acts .a1 { grid-column: 1; } .acts .a2 { grid-column: 2; } .acts .a3 { grid-column: 3; }
.formbox { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; background: #F2F5F8; border-radius: 6px; }
.turnbox { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; background: #fff; border: 1px solid #E8CBB8; border-radius: 6px; }
.cmd { font-family: Consolas, monospace; font-size: 11px; background: var(--ink); color: #E6EAEF; padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.panel.over { outline: 2px dashed var(--accent); outline-offset: -2px; background: #F5F9FE; }
.dropstrip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 8px; }
.dropday { display: inline-flex; align-items: baseline; gap: 4px; min-height: 26px; padding: 3px 8px; border: 1px dashed #AEB7C2; border-radius: 6px; background: #fff; font-weight: 700; }
.dropday.over { border: 2px dashed var(--accent); background: #F5F9FE; }

/* 一覧 */
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding: 6px; }
.lab { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-s); font-weight: 700; }
.tablewrap { overflow-x: auto; }
.line { display: grid; grid-template-columns: 48px 130px minmax(240px, 1fr) 110px 90px 90px 90px 70px; align-items: center; gap: 4px; min-height: 32px; padding: 2px 8px; border-top: 1px solid var(--line2); min-width: 900px; }
.line.top { min-height: 26px; border-top: 0; font-size: var(--fs-s); font-weight: 700; color: var(--sub); }
.line.done .ttl { color: #59636F; text-decoration: line-through; }
.noproj { color: var(--muted); }

/* ログインと招待なし */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 24px; max-width: 360px; width: 100%; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.login-box h1 { margin: 0; font-size: 20px; }

/* iPhone: メニューは下、入力欄も下 */
@media (max-width: 640px) {
  .app { grid-template-columns: minmax(0, 1fr); padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px)); }
  .side { position: static; }
  .side .nav, .side .stat-extra { display: none; }
  .capture { position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom, 0px)); border-radius: 0; border-left: 0; border-right: 0; z-index: 4; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 4; }
  .tabs a { flex: 1 1 0; min-height: 56px; display: flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; font-size: 12px; }
  .tabs a.on { background: var(--ink); color: #fff; font-weight: 700; }
  .chips { flex: 1 1 auto; justify-content: flex-start; }
  .acts { grid-template-columns: repeat(3, minmax(0, 1fr)); flex: 1 1 100%; }
  .dropstrip, .grip { display: none; }
}
@media (min-width: 641px) { .tabs { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 一覧の追加分（list.js 用）: 見出し・状態の札の色・チェック欄 */
.list-h1 { margin: 0; font-size: 16px; }
.line .chip { justify-self: start; }
.line input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); }
.chip.doing { background: var(--time-bg); color: var(--accent-d); font-weight: 700; }
.chip.review { background: #FBE6DA; color: var(--turn-ink); font-weight: 700; }
.chip.wait { background: #E9E3F5; color: #47307A; font-weight: 700; }
@media (max-width: 640px) { .line input[type="checkbox"] { width: 22px; height: 22px; } }
