/* FilmOS ダッシュボード — 落ち着いた業務画面。色はすべて変数、ダークモードは OS 設定に追従。外部 CDN なし。 */
:root {
  color-scheme: light dark;
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f6f7f9; --surface-3: #eceef2;
  --ink: #1b2130; --ink-2: #394154; --muted: #687184; --faint: #9aa2b1;
  --line: #e3e6eb; --line-2: #d2d7df;
  --accent: #2f55d4; --accent-2: #2446b5; --accent-soft: #e9eefc; --accent-ink: #ffffff;
  --ok: #17784a; --ok-bg: #e2f3e9; --run: #2556d0; --run-bg: #e4ebfc; --wait: #8f5700; --wait-bg: #fcefd5;
  --stop: #b3261e; --stop-bg: #fce6e4; --todo: #7a8291; --todo-bg: #eef0f3; --sched: #6340c9; --sched-bg: #efe9fd;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .06);
  --shadow-lg: 0 16px 40px rgb(16 24 40 / .16);
  --r: 12px; --r-sm: 8px; --side: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --surface: #171b23; --surface-2: #1c212b; --surface-3: #252b37;
    --ink: #e8ebf1; --ink-2: #c6ccd7; --muted: #939bab; --faint: #6c7483;
    --line: #29303c; --line-2: #353d4b;
    --accent: #7d9cff; --accent-2: #a2b8ff; --accent-soft: #1f2947; --accent-ink: #0d1016;
    --ok: #5fd09a; --ok-bg: #15342a; --run: #88a9ff; --run-bg: #1b2a4c; --wait: #f1b862; --wait-bg: #382a12;
    --stop: #ff8f86; --stop-bg: #42201e; --todo: #8f97a6; --todo-bg: #232834; --sched: #baa6ff; --sched-bg: #2a234f;
    --shadow: 0 0 0 1px rgb(255 255 255 / .02); --shadow-lg: 0 18px 44px rgb(0 0 0 / .55);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.6 var(--font); color: var(--ink); background: var(--bg); overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0; font-weight: 700; letter-spacing: .01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 13px; color: var(--ink-2); margin: 16px 0 8px; }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.text-stop { color: var(--stop); }
.text-wait { color: var(--wait); }

/* ---- 外枠: 左の縦タブ + 右のパネル ---- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px 14px; background: var(--surface); border-right: 1px solid var(--line); z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--ink); font-weight: 800; font-size: 16px; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #7b5cf0);
  color: #fff; font-size: 15px; font-weight: 800; flex: none; }
.tabs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tabs a, .navbtn, .who, .daemon { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2);
  font-weight: 600; font-size: 14px; border: 0; background: none; width: 100%; font-family: inherit; cursor: pointer; text-align: left; }
.tabs a:hover, .navbtn:hover, .who:hover { background: var(--surface-2); text-decoration: none; }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
/* 左の列 = discoveryOS の OS 切り替え（FilmOS / AdOS / SalesOS / BrandOS）。
   OS ごとに別の Mac・別 URL で動くので、押すとそのアドレスへ移動する。準備中のものは押せない。 */
.oslist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.os { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2);
  font-weight: 700; font-size: 14px; width: 100%; }
.os .lbl { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.os small { font-weight: 600; font-size: 11.5px; color: var(--muted); }
.os:hover { background: var(--surface-2); text-decoration: none; }
.os.on { background: var(--accent-soft); color: var(--accent); }
.os.on small { color: color-mix(in srgb, var(--accent) 75%, var(--muted)); }
.os.off { opacity: .5; cursor: default; }
.os.off:hover { background: none; }
.osdot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); flex: none; }
.os.on .osdot { background: linear-gradient(135deg, var(--accent), #7b5cf0); }
.brand .logo { background: none; }
.brand .logo img { display: block; width: 100%; height: 100%; }

/* 上の帯 = いまの OS の中のページ（ボード・投入 …）。ブラウザのタブと同じ見た目。 */
.col { display: flex; flex-direction: column; min-width: 0; }
.pagebar { position: sticky; top: 0; z-index: 40; padding: 7px 14px 0; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--surface-3) 58%, var(--line-2)); }
.pagebar::-webkit-scrollbar { display: none; }
.pagebar .tabs { flex-direction: row; gap: 2px; align-items: flex-end; }
.pagebar .tabs a { width: auto; gap: 8px; height: 34px; padding: 0 15px; border-radius: 10px 10px 0 0;
  font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pagebar .tabs a:hover { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.pagebar .tabs a.active { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgb(16 24 40 / .06); }
.pagebar .tabs a svg { width: 17px; height: 17px; }
.tabs a.active .ic { stroke-width: 2.1; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.who .lbl { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.who .lbl, .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.who.muted { color: var(--muted); }
.daemon { font-size: 12.5px; color: var(--muted); padding: 6px 12px; }
.daemon:hover { text-decoration: none; background: var(--surface-2); }
.daemon i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin: 0 5px; flex: none; }
.daemon.bad i { background: var(--stop); box-shadow: 0 0 0 4px var(--stop-bg); }
.daemon.bad { color: var(--stop); }
.logout { margin: 0; }
main#panel { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 72px; outline: none; }
.topbar { display: none; }
.scrim { display: none; }

.panel { max-width: 1480px; margin: 0 auto; }
.panel.loading { opacity: .55; transition: opacity .15s .1s; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head-text { min-width: 0; }
.panel-head h1 { overflow-wrap: anywhere; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- 部品 ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card.slim { padding: 12px 16px; }
details.card > summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.card[open] > summary::before { transform: rotate(90deg); }
details.card[open] > summary { margin-bottom: 12px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--surface-3);
  color: var(--ink-2); font-size: 11.5px; font-weight: 700; }
.empty { color: var(--muted); padding: 18px; text-align: center; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--r-sm); margin: 0; }
.hint { color: var(--muted); font-size: 12.5px; }
.flash { padding: 10px 14px; border-radius: var(--r-sm); margin: 0 0 16px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.flash.error { background: var(--stop-bg); border-color: color-mix(in srgb, var(--stop) 30%, transparent); color: var(--stop); }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r); background: var(--stop-bg); color: var(--stop); margin-bottom: 16px; font-weight: 500; }
.banner > span { min-width: 0; overflow-wrap: anywhere; } /* 長いパス（heartbeat の場所）でページが横に伸びないように */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
/* 列数は置かれた枠の幅で決める（案件詳細の中央列のように狭い所では自動で折り返す） */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px 16px; }
.grid2.tight { gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.action-row form { margin: 0; }
form.inline { display: inline; margin: 0; }

/* チップ（完了=緑 / 実行中=青・点滅 / 待ち=琥珀 / 停止=赤 / 未=灰） */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
  white-space: nowrap; background: var(--todo-bg); color: var(--todo); line-height: 1.6; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  position: relative; } /* 中の .sr（読み上げ用・absolute）が表の横スクロールの外へ出てページを横に伸ばさないように */
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip.lg { font-size: 13px; padding: 4px 12px 4px 10px; }
.chip.done { background: var(--ok-bg); color: var(--ok); }
.chip.running { background: var(--run-bg); color: var(--run); }
.chip.running::before { animation: pulse 1.4s ease-in-out infinite; }
.chip.waiting { background: var(--wait-bg); color: var(--wait); }
.chip.stopped, .chip.stale { background: var(--stop-bg); color: var(--stop); }
.chip.queued { background: var(--surface-3); color: var(--ink-2); }
.chip.queued::before { background: transparent; border: 1.6px solid currentColor; }
.chip.scheduled { background: var(--sched-bg); color: var(--sched); }
.chip.todo { background: transparent; color: var(--faint); }
.chip.todo::before { background: transparent; border: 1.4px dashed currentColor; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .chip.running::before, .spinner { animation: none !important; } }

/* ボタン・入力 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 600 13.5px/1.3 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--stop); border-color: color-mix(in srgb, var(--stop) 30%, var(--line)); }
.card.danger-zone { border-color: color-mix(in srgb, var(--stop) 30%, var(--line)); }
.card.danger-zone > h2 { color: var(--stop); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.lg { padding: 11px 20px; font-size: 14.5px; }
.btn.busy { pointer-events: none; opacity: .7; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select, textarea { font: 14px/1.5 var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 7px 10px; min-width: 0; max-width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
input[type=radio], input[type=checkbox] { accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 6px; }
.input-with { display: flex; gap: 6px; align-items: center; }
.input-with input { flex: 1; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.seg-btn, .seg-radio span { display: inline-block; padding: 5px 12px; border-radius: 8px; border: 0; background: none; color: var(--ink-2); font: 600 13px/1.4 var(--font); cursor: pointer; }
.seg-btn[aria-pressed=true], .seg-radio input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-radio { position: relative; }
.seg-radio input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg-radio input:focus-visible + span { outline: 2px solid var(--accent); }
.drop { position: relative; display: grid; place-items: center; text-align: center; padding: 20px; border: 1.5px dashed var(--line-2); border-radius: var(--r);
  background: var(--surface-2); color: var(--muted); font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.drop.big { padding: 38px 20px; }
.drop span { display: inline-flex; align-items: center; gap: 8px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop:focus-within { border-color: var(--accent); }
.drop .picked { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-2); }

/* 表 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); -webkit-overflow-scrolling: touch; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
thead th { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > * { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.card .table-wrap { border-radius: var(--r-sm); }

/* ---- ボード ---- */
.ctabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; scrollbar-width: thin; }
.ctab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
.ctab:hover { text-decoration: none; border-color: var(--line-2); }
.ctab.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.ctab .n { font-size: 11.5px; opacity: .7; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat:hover { text-decoration: none; border-color: var(--line-2); }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--todo); }
.stat.waiting::before { background: var(--wait); } .stat.running::before { background: var(--run); }
.stat.stopped::before { background: var(--stop); } .stat.done::before { background: var(--ok); }
.stat.on { outline: 2px solid var(--accent); outline-offset: -1px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-num { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 14px; align-items: center; }
.pills { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.pills-label { font-size: 12px; color: var(--muted); font-weight: 700; padding: 0 8px 0 6px; }
.pill { padding: 4px 11px; border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.pill:hover { text-decoration: none; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.pill.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
table.board th, table.board td { padding: 8px 8px; }
table.board td.st { text-align: center; }
table.board td.st.cur { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
table.board thead th:not(.case-cell) { text-align: center; }
.case-cell { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 240px; max-width: 320px; box-shadow: 1px 0 0 var(--line); }
thead .case-cell { background: var(--surface-2); z-index: 3; }
.case-link { display: block; font-weight: 700; color: var(--ink); font-size: 13.5px; overflow-wrap: anywhere; }
.case-link:hover { color: var(--accent); }
.case-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 2px; }
.case-meta .tag { padding: 0 6px; }
/* 頼んだ本数に足りない・途中で失敗した、を行の中で言う（2026-09-24） */
.case-meta.warn { color: var(--warn-ink, #8a5a00); }
.case-meta.warn .ic { width: 14px; height: 14px; flex: none; }
.foot-note { color: var(--faint); font-size: 12px; margin-top: 10px; }
.case-list { list-style: none; margin: 0; padding: 0; }
.case-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.case-row:last-child { border-bottom: 0; }
.case-row > div { min-width: 0; overflow-wrap: anywhere; }
.case-row > .chip { flex: none; } /* 状態は省略しない（案件名のほうを折り返す） */

/* ---- 案件詳細 ---- */
.case-head { display: flex; flex-direction: column; gap: 10px; }
.case-facts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.people { color: var(--ink-2); font-size: 13px; margin: 0; }
.stop-reason { display: flex; gap: 8px; align-items: flex-start; color: var(--stop); background: var(--stop-bg); padding: 8px 12px; border-radius: var(--r-sm); margin: 0; }
.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.stepper .chip { font-size: 11.5px; }
.case-links { display: flex; flex-wrap: wrap; gap: 6px; }
.case-body { display: grid; gap: 16px; align-items: start;
  grid-template-columns: 168px minmax(0, 1fr) minmax(360px, 42%); grid-template-areas: "tabs sub player"; }
.case-body.no-player { grid-template-columns: 168px minmax(0, 1fr); grid-template-areas: "tabs sub"; }
.subtabs { grid-area: tabs; position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: 6px; box-shadow: var(--shadow); }
.subtabs [role=tab] { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 9px 12px; border: 0; border-radius: 8px;
  background: none; color: var(--ink-2); font: 600 13.5px/1.3 var(--font); cursor: pointer; text-align: left; white-space: nowrap; }
.subtabs [role=tab]:hover { background: var(--surface-2); }
.subtabs [role=tab][aria-selected=true] { background: var(--accent-soft); color: var(--accent); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--wait-bg); color: var(--wait); font-size: 11px; font-weight: 800; }
.player-col { grid-area: player; position: sticky; top: 16px; min-width: 0; }
.sub-col { grid-area: sub; min-width: 0; }
.player { padding: 12px; }
.player video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--r-sm); margin: 10px 0 8px; }
.player .seg { max-width: 100%; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 0 0 8px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.path-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.path-row code { flex: 1 1 280px; }
pre.doc { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.65 var(--mono); background: var(--surface-2); border-radius: var(--r-sm); padding: 14px; max-height: 32rem; overflow: auto; }
.timeline { list-style: none; margin: 0; padding: 0; max-height: 28rem; overflow: auto; }
.timeline li { display: grid; grid-template-columns: 92px auto minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.tc { font: 600 12.5px var(--mono); color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 6px; padding: 2px 8px; cursor: pointer; font-variant-numeric: tabular-nums; }
.tc:hover { background: var(--accent); color: var(--accent-ink); }
.fx-table td:first-child { width: 1%; white-space: nowrap; }
.fx-table td:nth-child(2) { width: 1%; white-space: nowrap; }
.kind { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.kind.k-head { background: var(--accent-soft); color: var(--accent); }
.kind.k-emph { background: var(--wait-bg); color: var(--wait); }
.kind.k-slide { background: var(--sched-bg); color: var(--sched); }
.kind.k-note { background: var(--ok-bg); color: var(--ok); }
.checks, .flags { list-style: none; margin: 0; padding: 0; }
.check { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.check:last-child { border-bottom: 0; }
.check-kind { font-weight: 700; color: var(--ink-2); }
.check.medical { border-left: 3px solid var(--stop); padding-left: 10px; }
.flags li { padding: 5px 0; font-size: 13px; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.thumb { margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.thumb.on { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-bg); }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-3); }
.thumb figcaption { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.thumb-title { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.thumb-copy { margin: 0; font-weight: 700; line-height: 1.4; }
.thumb-copy small { font-weight: 500; color: var(--muted); }
.adopted-row { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 16px; align-items: start; }
.adopted-row img { width: 100%; height: auto; border-radius: var(--r-sm); border: 1px solid var(--line); }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.frames legend { grid-column: 1 / -1; }
.frame { position: relative; display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.frame input { position: absolute; opacity: 0; }
.frame img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; border: 2px solid transparent; background: var(--surface-3); }
.frame.none span:first-of-type { display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 6px; border: 2px dashed var(--line-2); font-weight: 700; color: var(--ink-2); }
.frame input:checked ~ img, .frame.none input:checked ~ span { border-color: var(--accent); border-style: solid; }
.frame input:focus-visible ~ img { outline: 2px solid var(--accent); }
.radio-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 6px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-text { flex: 1; display: flex; flex-direction: column; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.asset-group h3 { margin-top: 0; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.files li:last-child { border-bottom: 0; }
.files li > a { overflow-wrap: anywhere; min-width: 0; flex: 1 1 160px; }
.uplist { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.up b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.up .bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.up .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s; }
.up.done .bar i { background: var(--ok); }
.up.error .bar i { background: var(--stop); }
.up .st { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.up.error .st { color: var(--stop); }
.tasks { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 13px; }
.task.running, .task.queued { background: var(--run-bg); }
.task.error { background: var(--stop-bg); color: var(--stop); }
.task.done .ic { color: var(--ok); }
.task-state { font-weight: 700; font-size: 12px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--run) 30%, transparent); border-top-color: var(--run); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 投入・クライアント・設定 ---- */
.intake-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 16px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.howto { margin: 0 0 12px; padding-left: 22px; font-size: 13.5px; }   /* 手順（番号つき。flex にすると番号が消える） */
.howto li { margin-bottom: 6px; }
.boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.boxes .card { margin: 0; }
.box .guide { color: var(--muted); font-size: 12.5px; margin: -4px 0 12px; padding-left: 10px; border-left: 3px solid var(--accent-soft); }
.box.designer { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.canva-form input[type=url] { font-size: 15px; padding: 10px 12px; }
.row-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.row-form input { flex: 1 1 160px; }
.row-form input.num { flex: 0 1 96px; }
.row-form.add { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
table.ctr td { padding: 6px 8px; }
table.ctr td > form.inline { margin-left: 4px; }
table.ctr td { display: table-cell; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 8px; }
.shot { margin: 0; font-size: 11.5px; color: var(--muted); }
.shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.prefs { list-style: none; margin: 0; padding: 0; }
.pref { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.pref-text { flex: 1 1 180px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.chip-btn { border: 0; border-radius: 999px; padding: 2px 10px; font: 700 12px/1.6 var(--font); cursor: pointer; }
.chip-btn.like { background: var(--ok-bg); color: var(--ok); }
.chip-btn.ng { background: var(--stop-bg); color: var(--stop); }
.learn { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.learn > div { flex: 1 1 320px; }
.learn h2 { margin-bottom: 4px; }
details.file { border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 8px; }
details.file summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; list-style: none; flex-wrap: wrap; }
details.file pre { margin: 0 8px 8px; }
.file.missing { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px dashed var(--line); border-radius: var(--r-sm); margin-bottom: 8px; }
.staff-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.staff-list li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-form.staff { flex: 1 1 auto; }
.row-form.staff input[name=name] { flex: 0 1 140px; }
.row-form.staff input[type=email] { flex: 1 1 220px; }
/* クライアントのパターン（型）の一覧 */
.pattern-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pattern-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pattern-list li:last-child { border-bottom: 0; }
.pattern-list .row-form { flex: 1 1 auto; }
.row-form input.narrow { flex: 0 1 110px; text-transform: uppercase; }
.pattern-list li.add { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.src-line { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.src-edit { flex: 1 1 100%; margin-top: 2px; }
.src-edit > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 4px 0; }
.src-edit > summary:hover { color: var(--accent); }
/* 折りたたみの見出しをボタンの見た目にする（文字リンクだと押せると分からない。2026-09-22 指摘） */
.src-edit > summary.btn { color: var(--ink); font-size: 12.5px; padding: 5px 10px; list-style: none; }
.src-edit > summary.btn::-webkit-details-marker { display: none; }
.src-edit > summary.btn::marker { content: ""; }
.src-edit > summary.btn:hover { color: var(--ink); background: var(--surface-2); }
.src-edit[open] > summary.btn { background: var(--surface-3); }
.src-edit .stack { padding: 8px 0 4px; }
.sw { display: inline-block; width: 13px; height: 13px; border-radius: 3px; border: 1px solid var(--line-2); margin-left: 3px; vertical-align: -2px; }
.checks-table th[scope=row] { white-space: nowrap; }

/* ツールチップ・通知 */
#tip { position: fixed; z-index: 90; max-width: 320px; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: var(--surface);
  font-size: 12px; line-height: 1.5; pointer-events: none; box-shadow: var(--shadow-lg); white-space: pre-line; }
#toast { position: fixed; right: 20px; bottom: 20px; z-index: 95; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
#toast .t { pointer-events: auto; max-width: min(420px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 10px; background: var(--ink); color: var(--surface);
  box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13.5px; animation: rise .2s ease-out; }
#toast .t.error { background: var(--stop); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ログイン */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.login .brand { padding: 0; }

/* ---- 幅に合わせる ---- */
@media (max-width: 1280px) {
  .case-body { grid-template-columns: 160px minmax(0, 1fr); grid-template-areas: "tabs player" "tabs sub"; }
  .player-col { position: static; }
  .player video { max-height: 56vh; }
}
@media (max-width: 1100px) {
  :root { --side: 76px; }
  .side { padding: 14px 8px; align-items: stretch; }
  .side .brand { justify-content: center; padding: 4px 0 14px; }
  .side .brand .lbl { display: none; }
  .side-foot .navbtn, .side-foot .who, .side-foot .daemon { flex-direction: column; gap: 3px; padding: 9px 4px; font-size: 10.5px; text-align: center; justify-content: center; }
  .side-foot .who .lbl, .side-foot .daemon .lbl, .side-foot .navbtn .lbl { display: none; }
  .os { flex-direction: column; gap: 3px; padding: 9px 4px; font-size: 10.5px; text-align: center; justify-content: center; }
  .os .lbl { align-items: center; white-space: nowrap; letter-spacing: -.02em; }
  .os small { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intake-grid, .boxes { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 45; align-items: center; gap: 10px; height: 54px; padding: 0 12px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; font-size: 15px; }
  .topbar .logo { width: 26px; height: 26px; font-size: 13px; }
  .topbar-title { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
  .menu-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
  .app { display: block; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 82vw); height: 100%; transform: translateX(-105%); transition: transform .2s ease;
    box-shadow: var(--shadow-lg); padding: 18px 12px; }
  body.drawer .side { transform: none; }
  .side .brand { justify-content: flex-start; padding: 4px 10px 18px; }
  .side .brand .lbl { display: inline; }
  .side-foot .navbtn, .side-foot .who, .side-foot .daemon { flex-direction: row; gap: 12px; padding: 11px 12px; font-size: 15px; text-align: left; justify-content: flex-start; }
  .side-foot .who .lbl, .side-foot .daemon .lbl, .side-foot .navbtn .lbl { display: flex; }
  .os { flex-direction: row; gap: 12px; padding: 11px 12px; font-size: 15px; text-align: left; justify-content: flex-start; }
  .os .lbl { align-items: flex-start; }
  .os small { display: block; font-size: 12px; }
  .pagebar { top: 54px; padding: 6px 10px 0; }
  .pagebar .tabs { align-items: flex-end; }
  .pagebar .tabs a { flex-direction: row; gap: 7px; height: 34px; padding: 0 12px; font-size: 12.5px; text-align: left; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / .35); }
  .scrim[hidden] { display: none; }
  main#panel { padding: 16px 16px 64px; }
  h1 { font-size: 19px; }
  .panel-head { margin-bottom: 14px; }
  .card { padding: 14px; border-radius: 10px; }
  .stats { gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat-num { font-size: 22px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .case-body, .case-body.no-player { grid-template-columns: minmax(0, 1fr); grid-template-areas: "player" "tabs" "sub"; gap: 12px; }
  .case-body.no-player { grid-template-areas: "tabs" "sub"; }
  .subtabs { position: sticky; top: 54px; z-index: 20; flex-direction: row; overflow-x: auto; padding: 4px; scrollbar-width: none; }
  .subtabs [role=tab] { flex: none; padding: 8px 12px; }
  .case-cell { min-width: 170px; max-width: 200px; }
  table.board td.st .chip { font-size: 0; gap: 0; padding: 5px; }
  table.board td.st .chip::before { width: 9px; height: 9px; }
  table.board th, table.board td { padding: 7px 5px; }
  table.board thead th:not(.case-cell) { font-size: 10.5px; writing-mode: vertical-rl; letter-spacing: .05em; padding: 8px 4px; }
  .adopted-row { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 8px; }
  #toast { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .filters { gap: 8px; }
  .pills { overflow-x: auto; max-width: 100%; }
  .checks-table th[scope=row] { white-space: normal; min-width: 7.5em; overflow-wrap: anywhere; } /* 状態の列が画面内に入るように */
}

/* 教師の取り込み進捗（学習ページ） */
.tbar { display:block; height:6px; border-radius:3px; background:var(--surface-3); margin:4px 0 2px; overflow:hidden; }
.tbar > span { display:block; height:100%; background:var(--accent,#2563eb); transition:width .4s ease; }
.frames { display:flex; flex-wrap:wrap; gap:10px; margin-top:8px; }
.frames figure { margin:0; width:220px; }
.frames img { width:100%; border-radius:6px; display:block; }
.frames figcaption { font-size:12px; color:var(--muted,#6b7280); margin-top:2px; }
