/* Web UI — Monokai Pro theme */

:root {
  --bg-0: #19181a;
  --bg-1: #221f22;
  --bg-2: #2d2a2e;
  --bg-3: #363437;
  --line: #403e41;
  --line-2: #5b595c;
  --dim: #727072;
  --muted: #939293;
  --text: #c1c0c0;
  --bright: #fcfcfa;

  --red: #ff6188;
  --orange: #fc9867;
  --yellow: #ffd866;
  --green: #a9dc76;
  --cyan: #78dce8;
  --purple: #ab9df2;

  --radius: 8px;
  --radius-sm: 5px;
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-1);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--bright); }
code, pre, .mono { font-family: var(--mono); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { margin: 0; color: var(--bright); font-weight: 600; }
::selection { background: rgba(255, 216, 102, .3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--bg-1); }
::-webkit-scrollbar-track { background: transparent; }

/* ── Gate (no key) ─────────────────────────────────────────────────────── */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-0);
}
.gate form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.gate svg { width: 28px; height: 28px; color: var(--dim); }
.gate input { width: 100%; text-align: center; letter-spacing: .08em; }
.gate .gate-err { color: var(--red); font-size: 12px; min-height: 16px; }
.gate.shake form { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ── App bar ───────────────────────────────────────────────────────────── */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 52px;
  background: var(--bg-0);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--bright); font-weight: 700; white-space: nowrap; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--yellow); color: var(--bg-0);
  font: 800 14px var(--mono);
}
.nav { display: flex; align-items: stretch; gap: 2px; height: 100%; overflow-x: auto; }
.nav a {
  display: flex; align-items: center;
  padding: 0 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: var(--bright); }
.nav a.active { color: var(--bright); border-bottom-color: var(--yellow); }
.nav a.secondary { font-size: 12.5px; color: var(--dim); }
.nav a.secondary.active { color: var(--text); border-bottom-color: var(--purple); }
.nav .sep { width: 1px; background: var(--line); margin: 14px 6px; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ver { font: 11px var(--mono); color: var(--dim); padding: 2px 8px; border: 1px solid var(--line); border-radius: 99px; white-space: nowrap; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.page { max-width: 1480px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.page-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-h h1 { font-size: 18px; }
.page-h .sub { color: var(--dim); font-size: 12.5px; }
.page-h .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { min-width: 0; }
.grow { flex: 1 1 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.split > aside { position: sticky; top: 68px; max-height: calc(100vh - 84px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }

.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-h h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.card-h .hint { font-size: 12px; color: var(--dim); }
.card-h .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card.tight { padding: 12px; }

/* ── Controls ──────────────────────────────────────────────────────────── */
.input, select.input, textarea.input {
  background: var(--bg-0);
  color: var(--bright);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font: 13px var(--sans);
  outline: none;
  min-width: 0;
}
.input:focus { border-color: var(--yellow); }
.input::placeholder { color: var(--dim); }
.input.sm { padding: 4px 8px; font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, .label { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text); font-size: 13px; }
.check input { accent-color: var(--yellow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font: 500 13px var(--sans);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { color: var(--bright); border-color: var(--line-2); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.primary { background: var(--yellow); color: var(--bg-0); border-color: var(--yellow); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); color: var(--bg-0); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--bright); background: var(--bg-3); }
.btn.block { width: 100%; padding: 9px; }

.seg { display: inline-flex; background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px; flex-wrap: wrap; }
.seg button {
  background: transparent; border: 0; color: var(--muted);
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
  font: 500 12px var(--sans); white-space: nowrap;
}
.seg button:hover { color: var(--bright); }
.seg button.on { background: var(--bg-3); color: var(--bright); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 8px 14px; cursor: pointer; font: 500 13px var(--sans); white-space: nowrap;
}
.tabs button:hover { color: var(--bright); }
.tabs button.on { color: var(--bright); border-bottom-color: var(--yellow); }
.tabs button .count { font: 11px var(--mono); color: var(--dim); margin-left: 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--bg-0);
  color: var(--muted);
  font: 12px var(--sans);
  cursor: pointer;
  user-select: none;
}
.chip:hover { color: var(--bright); border-color: var(--line-2); }
.chip.on { color: var(--bright); border-color: var(--chip-c, var(--yellow)); background: color-mix(in srgb, var(--chip-c, var(--yellow)) 14%, var(--bg-0)); }
.chip .sw { width: 8px; height: 8px; border-radius: 2px; background: var(--chip-c, var(--yellow)); }
.chip .x { color: var(--dim); font-size: 14px; line-height: 1; }
.chip .x:hover { color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

details.fold { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
details.fold > summary {
  list-style: none; cursor: pointer; padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "›"; font-size: 16px; color: var(--dim); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary .badge { margin-left: auto; }
details.fold > .fold-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }

/* ── KPI tiles ─────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .k-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); }
.kpi .k-value { font: 600 26px/1.2 var(--mono); color: var(--bright); margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-sub { font: 12px var(--mono); color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-accent { display: inline-block; width: 6px; height: 6px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--dim); padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--bright); }
.tbl td { padding: 6px 10px; border-bottom: 1px solid rgba(64, 62, 65, .6); vertical-align: middle; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, .025); }
.tbl tr.open td { background: var(--bg-3); }
.tbl .trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl td.detail-cell { padding: 0; background: var(--bg-1) !important; }

.share { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.share .track { flex: 1; height: 6px; background: var(--bg-0); border-radius: 3px; overflow: hidden; }
.share .fill { height: 100%; border-radius: 3px; background: var(--cyan); }
.share .pct { font: 11px var(--mono); color: var(--muted); width: 38px; text-align: right; }

.badge { display: inline-flex; align-items: center; gap: 4px; font: 11px var(--mono); padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.badge.warn { color: var(--orange); border-color: color-mix(in srgb, var(--orange) 40%, transparent); }
.badge.err { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.badge.info { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 40%, transparent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

.delta { font: 12px var(--mono); white-space: nowrap; }
.delta.faster { color: var(--green); }
.delta.slower { color: var(--red); }
.delta.same { color: var(--dim); }

.ua { display: flex; flex-direction: column; min-width: 0; }
.ua b { color: var(--bright); font-weight: 500; }
.ua small { color: var(--dim); font: 11px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }

.empty { color: var(--dim); font-size: 13px; text-align: center; padding: 28px 12px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.err-text { color: var(--red); }

/* ── Charts ────────────────────────────────────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.cols { position: relative; display: flex; gap: 0; height: var(--h, 220px); padding: 10px 0 0 44px; overflow-x: auto; overflow-y: hidden; }
.cols .axis { position: absolute; left: 0; top: 10px; bottom: 22px; width: 100%; pointer-events: none; }
.cols .axis div { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(91, 89, 92, .45); }
.cols .axis div span { position: absolute; left: 0; top: -8px; font: 10px var(--mono); color: var(--dim); background: var(--bg-2); padding-right: 4px; }
.cols .col {
  flex: 1 0 var(--cw, 12px);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch;
  padding: 0 2px; position: relative; cursor: default;
}
.cols .col .stack { flex: 1; display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 2px; min-height: 0; }
.cols .col .seg-bar { border-radius: 0; min-height: 0; }
.cols .col .stack .seg-bar:last-child { border-radius: 4px 4px 0 0; }
.cols .col .lbl { height: 22px; font: 10px var(--mono); color: var(--dim); text-align: center; white-space: nowrap; overflow: hidden; padding-top: 5px; }
.cols .col:hover .stack { filter: brightness(1.15); }
.cols .col:hover { background: rgba(255, 255, 255, .03); }

.gcols { position: relative; display: flex; align-items: stretch; height: var(--h, 300px); padding-left: 52px; overflow-x: auto; overflow-y: hidden; }
.gcols .axis { position: absolute; left: 0; top: 8px; bottom: 120px; width: 100%; pointer-events: none; }
.gcols .axis div { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(91, 89, 92, .45); }
.gcols .axis div span { position: absolute; left: 0; top: -8px; font: 10px var(--mono); color: var(--dim); background: var(--bg-2); padding-right: 4px; }
.gcols .group { flex: 1 0 var(--gw, 44px); display: flex; flex-direction: column; padding: 8px 4px 0; position: relative; }
.gcols .group:hover { background: rgba(255, 255, 255, .03); }
.gcols .bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; min-height: 0; }
.gcols .bars .b { flex: 0 1 18px; min-width: 4px; border-radius: 4px 4px 0 0; }
.gcols .glbl {
  height: 120px; font: 10.5px var(--mono); color: var(--muted);
  writing-mode: vertical-rl; transform: rotate(180deg);
  text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  align-self: center; padding-top: 6px;
}

.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) 80px; gap: 10px; align-items: center; font-size: 12px; }
.hbar .name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; }
.hbar .track { height: 10px; background: var(--bg-0); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; }
.hbar .val { font: 11.5px var(--mono); color: var(--bright); text-align: right; }

.tip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--bg-0); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 8px 10px; font-size: 12px; color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); max-width: 340px;
}
.tip .t-h { color: var(--bright); font-weight: 600; margin-bottom: 4px; font-family: var(--mono); font-size: 11.5px; }
.tip .t-row { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px; }
.tip .t-row .v { margin-left: auto; padding-left: 12px; color: var(--bright); }

/* ── Playground ────────────────────────────────────────────────────────── */
.drop {
  display: block;
  position: relative; border: 1.5px dashed var(--line-2); border-radius: var(--radius);
  padding: 18px; text-align: center; color: var(--muted); cursor: pointer; background: var(--bg-0);
}
.drop:hover, .drop.over { border-color: var(--yellow); color: var(--bright); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 64px; display: flex; flex-direction: column; gap: 3px; }
.thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; }
.thumb .x {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); color: var(--bg-0); border: 0; font-weight: 700; cursor: pointer; font-size: 12px; line-height: 18px; padding: 0;
}
.thumb input { width: 100%; font: 9.5px var(--mono); padding: 2px 4px; }
.thumb.pick { cursor: pointer; }
.thumb.pick.on img { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(255, 216, 102, .35); }
.thumb .name { font-size: 10px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.feat-group { display: flex; flex-direction: column; gap: 6px; }
.feat-group .label { display: flex; align-items: center; gap: 6px; }
.feat-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 4px; }

.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.rcard {
  background: var(--bg-1); border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; word-break: break-word;
}
.rcard.pass { border-left-color: var(--green); }
.rcard.fail { border-left-color: var(--red); }
.rcard.info { border-left-color: var(--cyan); }
.rcard.error { border-left-color: var(--orange); }
.rcard.stopped { border-left-color: var(--red); opacity: .65; }
.rcard.skipped { border-left-color: var(--dim); opacity: .55; }
.rcard.clickable { cursor: pointer; }
.rcard.clickable:hover { border-color: var(--line-2); }
.rcard .rc-h { display: flex; align-items: center; gap: 6px; justify-content: space-between; margin-bottom: 6px; }
.rcard .rc-h h4 { font: 600 12px var(--mono); color: var(--bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcard .rc-t { font: 10.5px var(--mono); color: var(--dim); white-space: nowrap; }
.rcard .kv { font-size: 11.5px; line-height: 1.55; color: var(--text); }
.rcard .kv .k { color: var(--dim); }
.rcard .kv .t { color: var(--green); }
.rcard .kv .f { color: var(--red); }
.rcard .kv .n { color: var(--purple); font-family: var(--mono); }
.rcard .kv code { background: var(--bg-0); border-radius: 3px; padding: 0 4px; font-size: 10.5px; color: var(--muted); }
.rcard .big { font: 600 18px var(--mono); color: var(--bright); }
.rcard pre { margin: 0; font-size: 10.5px; color: var(--muted); white-space: pre-wrap; max-height: 180px; overflow: auto; }

.section-h { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; margin: 4px 0 10px; }
.banner { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; border: 1px solid var(--line); background: var(--bg-1); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.banner.ok { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.banner.bad { border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.banner.note { border-color: color-mix(in srgb, var(--cyan) 45%, transparent); }
.banner .mono { font-size: 12px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.tile { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.tile .v { font: 600 17px var(--mono); color: var(--bright); white-space: nowrap; }
.tile .l { font-size: 11px; color: var(--dim); }

.rule-row { display: flex; align-items: center; gap: 8px; background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; font: 11.5px var(--mono); }
.rule-row .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.thresh { display: flex; flex-direction: column; gap: 2px; }
.thresh label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text); }
.thresh label .num { color: var(--yellow); font-size: 11px; }
.thresh input[type=range] { width: 100%; accent-color: var(--yellow); }

pre.json { background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; font-size: 11.5px; color: var(--text); max-height: 460px; overflow: auto; margin: 0; }

/* ── Steps (simplify) ──────────────────────────────────────────────────── */
.steps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.step i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--mono); font-style: normal; background: var(--bg-3); color: var(--dim); }
.step.running i { background: var(--yellow); color: var(--bg-0); animation: pulse 1.2s infinite; }
.step.done i { background: var(--green); color: var(--bg-0); }
.step.error i { background: var(--red); color: var(--bg-0); }
.step.skipped { opacity: .4; }
.steps .line { width: 24px; height: 1px; background: var(--line); }
@keyframes pulse { 50% { opacity: .5; } }

/* YOLO overlay */
.overlay-wrap { position: relative; display: inline-block; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-0); max-width: 100%; }
.overlay-wrap img { display: block; max-width: 100%; max-height: 440px; object-fit: contain; }
.overlay-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.det-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.det-row:hover { background: var(--bg-3); }
.det-row.muted { opacity: .35; }
.det-row .meter { height: 5px; background: var(--bg-0); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.det-row .meter div { height: 100%; border-radius: 3px; }
.mask-thumb { width: 30px; height: 30px; border-radius: 4px; border: 1px solid var(--line); object-fit: contain; background: var(--bg-0); }

/* ── Overlays ──────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(15, 14, 15, .78); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal .sheet { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; width: 100%; max-width: 1040px; padding: 20px; position: relative; display: flex; flex-direction: column; gap: 14px; }
.modal .close { position: absolute; top: 12px; right: 12px; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(10, 10, 10, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: zoom-out; padding: 16px; }
.lightbox img, .lightbox canvas { max-width: 92vw; max-height: 86vh; border-radius: 6px; }
.lightbox .cap { color: var(--text); font: 12px var(--mono); }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--yellow); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--dim); padding: 28px; }
.status-line { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > aside { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .page { padding: 16px; }
  .app-bar { padding: 0 12px; gap: 10px; }
  .brand .brand-name, .ver { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .k-value { font-size: 20px; }
  .hbar { grid-template-columns: minmax(80px, 120px) minmax(0, 1fr) 64px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
}
