:root {
  --bg: #f5f6f8; --surface: #ffffff; --text: #1b1f24; --muted: #5f6b7a; --border: #dde2e8;
  --accent: #1f4e9c; --accent-text: #ffffff; --ok: #1d7a4a; --warn: #a65d00; --bad: #b3261e; --chip: #eef2f7;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root:not([data-theme="light"]) { }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --surface: #1a1f26; --text: #e8ecf1; --muted: #9aa6b4; --border: #2b333d;
    --accent: #6ea0ff; --accent-text: #0b1220; --ok: #5fd08f; --warn: #ffb454; --bad: #ff7b72; --chip: #232a33;
  }
}
:root[data-theme="dark"] {
  --bg: #111418; --surface: #1a1f26; --text: #e8ecf1; --muted: #9aa6b4; --border: #2b333d;
  --accent: #6ea0ff; --accent-text: #0b1220; --ok: #5fd08f; --warn: #ffb454; --bad: #ff7b72; --chip: #232a33;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1180px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 4px; } h2 { font-size: 1.05rem; margin: 0 0 8px; }
small, .small { font-size: 0.85em; } .muted { color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; } .logo { color: var(--accent); font-size: 1.3em; }
nav { display: flex; gap: 4px; }
.tab { background: transparent; border: 0; padding: 8px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; font: inherit; }
.tab.active { background: var(--chip); color: var(--text); font-weight: 600; }
.user { display: flex; align-items: center; gap: 8px; }
.btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.ghost { background: transparent; } .btn.small { padding: 5px 10px; font-size: 0.9em; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 28px; text-align: center; background: var(--surface); cursor: pointer; margin: 12px 0; }
.dropzone.over { border-color: var(--accent); }
.file-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.file-list .f { background: var(--chip); border-radius: 6px; padding: 4px 8px; font-size: 0.85em; font-family: var(--mono); }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; min-width: 220px; }
input[type=text], select { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.actions { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.status { color: var(--muted); font-size: 0.9em; }
.status.err { color: var(--bad); } .status.ok { color: var(--ok); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; min-width: 0; }
.span2 { grid-column: span 2; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } .span2 { grid-column: span 1; } }
.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; }
.verdict { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.category { font-size: 1.4rem; font-weight: 700; }
.big { font-size: 2rem; font-weight: 700; }
.label-small { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { background: var(--chip); border-radius: 999px; padding: 2px 10px; font-size: 0.8em; }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); }
.explanation { margin: 10px 0 6px; }
.ranked { display: grid; gap: 6px; margin-top: 8px; }
.bar { display: grid; grid-template-columns: 300px 1fr 50px; gap: 8px; align-items: center; font-size: 0.9em; }
.bar .track { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); }
@media (max-width: 760px) { .bar { grid-template-columns: 1fr; } }
.reasons { margin-top: 10px; font-size: 0.9em; color: var(--warn); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { font: inherit; border: 0; padding: 6px 10px; background: transparent; color: var(--muted); cursor: pointer; }
.seg-btn.active { background: var(--chip); color: var(--text); }
.img-wrap { margin-top: 10px; background: #000; border-radius: 8px; overflow: hidden; display: flex; justify-content: center; }
.img-wrap img { max-width: 100%; max-height: 70vh; object-fit: contain; }
.img-nav { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.evidence { margin: 10px 0 0; padding-left: 20px; font-size: 0.9em; }
table.kv { width: 100%; border-collapse: collapse; font-size: 0.92em; }
table.kv td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.kv td:first-child { color: var(--muted); width: 42%; }
table.kv .v { font-family: var(--mono); overflow-wrap: anywhere; }
table.kv .c { color: var(--muted); font-size: 0.85em; white-space: nowrap; }
.null { color: var(--muted); font-style: italic; }
.pre { font-family: var(--mono); font-size: 0.8em; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--chip); padding: 10px; border-radius: 8px; max-height: 420px; overflow: auto; }
details summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
.review-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; align-items: center; }
.chk { display: flex; gap: 6px; align-items: center; font-size: 0.9em; }
table.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 0.92em; }
table.table th, table.table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.table th { color: var(--muted); font-weight: 600; font-size: 0.85em; }
table.table tr.row { cursor: pointer; } table.table tr.row:hover { background: var(--chip); }
table.table img.thumb { width: 72px; height: 45px; object-fit: cover; border-radius: 4px; background: #000; }
.wrap-table { overflow-x: auto; }
footer { text-align: center; padding: 20px; }

.progress { margin: 8px 0 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.progress-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.progress-track { height: 10px; background: var(--chip); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; width: 2%; background: var(--accent); border-radius: 5px; transition: width 0.6s ease; }
.progress-fill.indeterminate { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.steps { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; margin: 10px 0 6px; font-size: 0.85em; color: var(--muted); }
.steps li::before { content: "○ "; }
.steps li.done { color: var(--ok); } .steps li.done::before { content: "● "; }
.steps li.active { color: var(--text); font-weight: 600; } .steps li.active::before { content: "◐ "; }
