:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #16202c; --muted: #5c6b7a; --line: #d9dee5;
  --accent: #1f5fbf; --accent-ink: #fff; --ok: #1b7f3b; --warn: #b26a00; --bad: #b3261e; --demo: #7a3fb0;
  --radius: 10px; font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f141a; --panel: #18212b; --ink: #e8edf2; --muted: #9aa8b6; --line: #2a3542;
          --accent: #5b9bff; --accent-ink: #08121f; --ok: #4cc27a; --warn: #f0a640; --bad: #ff6b60; --demo: #c08cff; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; line-height: 1.5; }
header.top { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top h1 { font-size: 1.1rem; margin: 0; }
header.top nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
main { padding: 16px; max-width: 1280px; margin: 0 auto; }
main.narrow { max-width: 520px; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; margin: 1.2em 0 .5em; } h3 { font-size: 1rem; }
.banner { padding: 8px 12px; border-radius: var(--radius); margin: 8px 0; font-weight: 600; font-size: .9rem; }
.banner.demo { background: color-mix(in srgb, var(--demo) 15%, transparent); color: var(--demo); }
.banner.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.banner.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.banner.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); font-size: .9rem; }
.btn, button { font: inherit; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); cursor: pointer; min-height: 40px; }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger, button.danger { color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); min-height: 40px; max-width: 100%; }
input.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--bg)); }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; border: 1px solid currentColor; white-space: nowrap; }
.s-confirmed { color: var(--ok); } .s-not_reported { color: var(--muted); }
.s-conflict, .s-failed, .s-rejected { color: var(--bad); }
.s-needs_review, .s-revision_pending, .s-pending_hq_review { color: var(--warn); }
.s-ocr_pending, .s-ocr_done, .s-uploaded { color: var(--accent); }
.split { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .split { grid-template-columns: 1fr 1fr; } }
.photo { width: 100%; max-height: 70vh; object-fit: contain; background: #000; border-radius: 8px; }
.demo-photo { white-space: pre-wrap; font-family: monospace; font-size: .8rem; padding: 10px; background: var(--bg);
  border: 1px dashed var(--demo); border-radius: 8px; word-break: break-all; }
.kpi { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.tabs button.active { background: var(--accent); color: var(--accent-ink); }
.hidden { display: none !important; }
.toast { position: fixed; bottom: 16px; left: 16px; right: 16px; max-width: 560px; margin: 0 auto; z-index: 50;
  padding: 12px 14px; border-radius: var(--radius); background: var(--ink); color: var(--bg); }
.offline-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--ok); }
.offline-dot.off { background: var(--bad); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink);
  max-width: min(960px, 96vw); width: 100%; }
pre { white-space: pre-wrap; word-break: break-word; font-size: .8rem; }

/* ---------- TV 16:9 ---------- */
body.tv { background: #070b12; color: #f2f5f9; overflow: hidden; }
.tv-wrap { width: 100vw; height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: 2vh 3vw; gap: 1.5vh; }
.tv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 2vw; }
.tv-title { font-size: 4.2vh; font-weight: 800; }
.tv-meta { font-size: 2.4vh; color: #b9c4d0; text-align: right; }
.tv-bars { display: flex; flex-direction: column; gap: 1.4vh; justify-content: center; }
.tv-bar { display: grid; grid-template-columns: 6vh 26vw 1fr 16vw; align-items: center; gap: 1.5vw; font-size: 4.4vh; }
.tv-no { font-weight: 800; color: #9cc3ff; }
.tv-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-track { height: 4.6vh; background: #18222e; border-radius: 1vh; overflow: hidden; }
.tv-fill { height: 100%; background: #3d8bff; border-radius: 1vh; transition: width .6s ease; }
.tv-votes { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.tv-foot { display: flex; justify-content: space-between; font-size: 2.3vh; color: #ffcf66; gap: 2vw; }
.tv-offline { color: #ff7b72; font-weight: 800; }
