:root {
  --ink: #1E2B33; --muted: #5B6B75; --porcelain: #F2F5F6; --surface: #FFFFFF; --line: #D5DEE2;
  --lumen: #136F86; --lumen-ink: #0E5568; --auto: #2E7D5B; --refer: #A86A12; --reject: #9E3A3A; --far: #6B7780;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--porcelain); color: var(--ink); }
body { font-family: 'Be Vietnam Pro', 'Segoe UI', Arial, sans-serif; font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
.page { max-width: 1160px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; padding-top: max(1.5rem, env(safe-area-inset-top)); }
.head h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.35rem; }
.head p { margin: 0; color: var(--muted); max-width: 70ch; }

.status { margin: 1.2rem 0 0.6rem; }
.status p { margin: 0 0 0.35rem; color: var(--muted); font-size: 0.92rem; }
.status .bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.status .bar div { height: 100%; width: 0; background: var(--lumen); transition: width 0.2s ease; }
.status.done .bar { display: none; }
.status.error p { color: var(--reject); }

.controls { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 0.8rem 0 1rem; }
.controls label { font-weight: 500; }
select, button, .button-like { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0.45rem 0.7rem; }
select { min-width: min(100%, 26rem); }
button, .button-like { cursor: pointer; }
button:disabled, select:disabled { opacity: 0.55; cursor: default; }
.button-like { background: var(--lumen); border-color: var(--lumen); color: #fff; font-weight: 500; display: inline-block; }
:focus-visible { outline: 3px solid var(--lumen); outline-offset: 2px; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; padding: 0.55rem 0.9rem; color: var(--muted); font-weight: 500; }
.tabs button[aria-selected="true"] { color: var(--lumen-ink); border-bottom-color: var(--lumen); }

.panel.one { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .panel.one { grid-template-columns: 1fr; } }
.drop { display: flex; align-items: center; justify-content: center; min-height: 300px; border: 1.5px dashed #AFC0C7; border-radius: 10px; background: var(--surface); cursor: pointer; padding: 0.6rem; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--lumen); background: #EAF4F6; }
.drop img { max-width: 100%; max-height: 420px; border-radius: 6px; display: block; }
.examples p { margin: 0.9rem 0 0.4rem; color: var(--muted); font-size: 0.9rem; }
#example-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
#example-list button { padding: 0; border-radius: 6px; overflow: hidden; width: 74px; height: 74px; }
#example-list img { width: 100%; height: 100%; object-fit: cover; display: block; }

.verdict { border-left: 6px solid var(--line); background: var(--surface); padding: 1.1rem 1.3rem; border-radius: 0 8px 8px 0; }
.verdict-auto { border-left-color: var(--auto); } .verdict-refer { border-left-color: var(--refer); }
.verdict-reject { border-left-color: var(--reject); } .verdict-not_endo { border-left-color: var(--far); }
.verdict-title { font-size: 1.5rem; font-weight: 600; line-height: 1.28; margin: 0 0 0.45rem; }
.verdict-auto .verdict-title { color: var(--auto); } .verdict-refer .verdict-title { color: var(--refer); }
.verdict-reject .verdict-title { color: var(--reject); } .verdict-not_endo .verdict-title { color: var(--far); }
.verdict-body { margin: 0 0 0.6rem; max-width: 62ch; }
.verdict-notes { margin: 0.4rem 0 0.6rem 1.1rem; padding: 0; max-width: 64ch; }
.verdict-notes li { margin-bottom: 0.35rem; }
.verdict-meta { color: var(--muted); font-size: 0.85rem; margin: 0; font-variant-numeric: tabular-nums; }
.verdict-empty .verdict-title { font-size: 1.2rem; }

.probs h2, .cams h2 { font-size: 1rem; font-weight: 600; margin: 1.3rem 0 0.5rem; }
.probs ol { list-style: none; margin: 0; padding: 0; }
.probs li { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.8rem; margin-bottom: 0.55rem; }
.probs .track { grid-column: 1 / -1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.probs .fill { height: 100%; background: var(--lumen); }
.probs .val { font-variant-numeric: tabular-nums; color: var(--muted); }
#cam-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.8rem; }
#cam-list figure { margin: 0; } #cam-list img { width: 100%; border-radius: 6px; display: block; }
#cam-list figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.3rem; }
.note { font-size: 0.82rem; color: var(--muted); margin: 0.5rem 0 0; max-width: 70ch; }

.batch-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.batch-summary { margin: 0.9rem 0; }
.tally { margin-left: 0.9rem; white-space: nowrap; } .tally b { font-variant-numeric: tabular-nums; }
.tally-auto b { color: var(--auto); } .tally-refer b { color: var(--refer); } .tally-reject b { color: var(--reject); } .tally-not_endo b { color: var(--far); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; } td.num { font-variant-numeric: tabular-nums; }

.foot { margin-top: 2.2rem; color: var(--muted); font-size: 0.85rem; max-width: 90ch; padding-bottom: env(safe-area-inset-bottom); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.verdict-organ { border-left-color: #2F6F8F; } .verdict-organ .verdict-title { color: #2F6F8F; }
.alert { margin: 0.2rem 0 0.7rem; padding: 0.6rem 0.8rem; border-radius: 6px; background: #FDF1E6; border: 1px solid #E8B98A; color: #6B3A0C; max-width: 64ch; }
.alert b { color: #8A3A00; }
.tally-organ b { color: #2F6F8F; }
.scope { margin-top: 1.4rem; font-size: 0.9rem; color: var(--muted); max-width: 90ch; }
.scope summary { cursor: pointer; font-weight: 500; color: var(--ink); }
.scope ul { columns: 2; column-gap: 2rem; padding-left: 1.1rem; } @media (max-width: 700px) { .scope ul { columns: 1; } }
.verdict-gate { border-left-color: var(--far); } .verdict-gate .verdict-title { color: var(--far); }
.gate-line { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--muted); } .gate-line b { color: var(--ink); font-weight: 500; }
.force-btn { margin-top: 0.7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0.45rem 0.8rem; font: inherit; cursor: pointer; }
.force-btn:hover { border-color: var(--lumen); color: var(--lumen-ink); }
.tally-gate b { color: var(--far); }
