:root {
  --bg: #f5f6f9; --panel: #ffffff; --ink: #1b1f2b; --muted: #5a6273; --line: #dfe2ea; --soft: #eef0f5;
  --accent: #3d4fa8; --accent-ink: #ffffff; --accent-soft: #e6e9f7;
  --ok: #1d7a4b; --ok-soft: #e2f3ea; --warn: #8f5600; --warn-soft: #fcefd8;
  --bad: #b3261e; --bad-soft: #fbe5e3; --idle: #5d6670; --idle-soft: #eceef1;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10131a; --panel: #171b24; --ink: #e5e8ef; --muted: #9aa1b0; --line: #2a303d; --soft: #1e2330;
    --accent: #8d9cf0; --accent-ink: #10131a; --accent-soft: #252c4a;
    --ok: #5cc98f; --ok-soft: #173326; --warn: #f0b35a; --warn-soft: #3a2c14;
    --bad: #f28b82; --bad-soft: #3d1c1a; --idle: #9aa3ab; --idle-soft: #232831;
  }
}
:root[data-theme="dark"] {
  --bg: #10131a; --panel: #171b24; --ink: #e5e8ef; --muted: #9aa1b0; --line: #2a303d; --soft: #1e2330;
  --accent: #8d9cf0; --accent-ink: #10131a; --accent-soft: #252c4a;
  --ok: #5cc98f; --ok-soft: #173326; --warn: #f0b35a; --warn-soft: #3a2c14;
  --bad: #f28b82; --bad-soft: #3d1c1a; --idle: #9aa3ab; --idle-soft: #232831;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h2 { font-size: 15px; margin: 0 0 8px; }
h3 { font-size: 11.5px; margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.logo { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; left: 6px; top: 8px; width: 14px; height: 10px; border: 2px solid var(--accent-ink); border-radius: 2px; }
.title { font-size: 15px; margin: 0; font-weight: 700; }
.sub { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; }
.tab { font: inherit; background: none; border: 0; padding: 6px 10px; border-radius: 6px; color: var(--muted); cursor: pointer; text-decoration: none; }
.tab:hover { background: var(--soft); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tab:focus-visible, .btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.notice { margin: 0; padding: 7px 18px; font-size: 12.5px; color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line); }

.layout { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.1fr) minmax(320px, 1.2fr); gap: 14px; padding: 14px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.col-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
select, input[type=text], textarea { font: inherit; font-size: 13px; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
textarea { font-family: var(--sans); resize: vertical; }
.email label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.email label input, .email label textarea { margin-top: 3px; color: var(--ink); }
.row { margin: 10px 0 4px; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.btn { font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); width: 100%; margin-top: 10px; padding: 9px; font-weight: 650; }
.btn.primary:disabled { opacity: .5; cursor: wait; }

.stages { list-style: none; margin: 0; padding: 0; position: relative; }
.stage { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; position: relative; }
.stage:not(:last-child)::after { content: ""; position: absolute; left: 15px; bottom: -9px; height: 8px; border-left: 2px solid var(--line); }
.stage p { margin: 4px 0 0; }
.st-h { display: flex; align-items: center; gap: 8px; }
.st-h .tag { margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle); flex: none; }
.stage.pass .dot { background: var(--ok); } .stage.stop .dot { background: var(--warn); } .stage.fail .dot { background: var(--bad); }
.stage.skip .dot { background: var(--idle); }
.stage.notrun { opacity: .45; }
.note { color: var(--muted); padding: 4px 2px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; list-style: none; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: var(--idle-soft); color: var(--idle); }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.bad { background: var(--bad-soft); color: var(--bad); }
pre.json, pre.digest { font-family: var(--mono); font-size: 11.5px; background: var(--soft); border-radius: 6px; padding: 8px 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; margin: 6px 0; }
pre.digest { font-size: 12.5px; }

.decision { border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.decision.ok { background: var(--ok-soft); } .decision.warn { background: var(--warn-soft); } .decision.idle { background: var(--idle-soft); } .decision.bad { background: var(--bad-soft); }
.d-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.d-value { font-size: 24px; font-weight: 750; }
.decision.ok .d-value { color: var(--ok); } .decision.warn .d-value { color: var(--warn); } .decision.idle .d-value { color: var(--idle); } .decision.bad .d-value { color: var(--bad); }
.kv { border-collapse: collapse; width: 100%; font-size: 13px; }
.kv td { padding: 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 120px; padding-right: 8px; }
.case { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.case-h { font-weight: 650; margin-bottom: 4px; }
.hist { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }

.batch { padding: 14px; max-width: 1180px; margin: 0 auto; }
.batch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 12px 0; }
.stats > div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.k { font-size: 11.5px; color: var(--muted); }
.big { font-size: 24px; font-weight: 750; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.grid th, .grid td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { color: var(--muted); font-weight: 600; font-size: 12px; }
.grid tr.diff { background: var(--warn-soft); }
.grid td.mono { white-space: nowrap; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr 1fr; }
  .out-col { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; padding: 10px 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .batch { padding: 10px 16px; }
  .batch-head { flex-direction: column; }
}
