:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #16191f;
  --ink-soft: #545b66;
  --ink-faint: #808894;
  --line: #e0e4ea;
  --line-soft: #eef1f5;
  --accent: #0a5ad6;
  --accent-ink: #ffffff;
  --pass: #12704a;
  --pass-bg: #e6f4ed;
  --fail: #b02a1d;
  --fail-bg: #fceceb;
  --unknown: #8a5a00;
  --unknown-bg: #fdf3e0;
  --code-bg: #f2f4f7;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  --bg: #10131a;
  --panel: #171b24;
  --ink: #e9ecf1;
  --ink-soft: #a8b1bf;
  --ink-faint: #79828f;
  --line: #2a303c;
  --line-soft: #21262f;
  --accent: #5c9dff;
  --accent-ink: #08101f;
  --pass: #5cd6a0;
  --pass-bg: #10291f;
  --fail: #ff8b7d;
  --fail-bg: #2d1614;
  --unknown: #f0c164;
  --unknown-bg: #2c2311;
  --code-bg: #1e232d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}
a { color: var(--accent); }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-faint); font-size: 0.86rem; }
.opt { color: var(--ink-faint); font-weight: 400; font-size: 0.82rem; }

/* ---- header ---- */
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 650; }
.brand-mark { color: var(--accent); font-size: 1.1rem; }
.brand-name { white-space: nowrap; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-block; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 5px 12px; font-size: 0.84rem; text-decoration: none;
  cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.credits { font-size: 0.84rem; color: var(--ink-soft); white-space: nowrap; }

/* ---- lane switcher ---- */
.lanes { background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.lanes-in {
  max-width: 1120px; margin: 0 auto; padding: 8px 16px;
  display: flex; gap: 18px; align-items: flex-end; min-width: max-content;
}
.lane-stage { display: flex; flex-direction: column; gap: 4px; }
.stage-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint); padding-left: 2px;
}
.lane-stage { flex-direction: row; align-items: center; gap: 6px; flex-wrap: wrap; }
.lane-stage .stage-label { align-self: center; }
.lane {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 8px; padding: 6px 12px; font-size: 0.88rem; cursor: pointer; white-space: nowrap;
}
.lane:hover { border-color: var(--accent); color: var(--ink); }
.lane[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

/* ---- layout ---- */
main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 60px; }
.hero h1 { font-size: 1.5rem; line-height: 1.3; margin: 14px 0 6px; }
.blurb { color: var(--ink-soft); margin: 0 0 18px; max-width: 78ch; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 18px;
}
.panel h2 { font-size: 1.05rem; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel h3 { font-size: 0.92rem; margin: 18px 0 8px; color: var(--ink-soft); }

/* ---- form ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field.grow { flex: 1 1 240px; }
.field-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
label { font-weight: 600; font-size: 0.9rem; }
.hint { color: var(--ink-faint); font-size: 0.82rem; }
textarea, input[type="text"], input[type="search"], select {
  width: 100%; max-width: 100%; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); padding: 9px 11px; font-size: 0.92rem; font-family: inherit;
}
#template, #maskTerms { font-family: var(--mono); font-size: 0.85rem; }
#template { min-height: 230px; resize: vertical; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.drop { border: 1px dashed var(--line); border-radius: 8px; padding: 8px; }
.drop.over { border-color: var(--accent); background: var(--pass-bg); }
.drop-hint { margin: 6px 2px 0; font-size: 0.8rem; color: var(--ink-faint); }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

.mask { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
.mask summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.mask-body { padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; font-size: 0.88rem; }
.check input { margin-top: 3px; flex: none; }
.mask-report { margin: 4px 0 0; font-size: 0.84rem; color: var(--ink-soft); }
.mask-report.on { color: var(--pass); }
.mask-report.warn { color: var(--fail); font-weight: 600; }
.pill {
  display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 0.74rem;
  background: var(--code-bg); color: var(--ink-soft); font-weight: 600;
}
.free { font-size: 0.74rem; font-weight: 500; color: var(--pass); background: var(--pass-bg); border-radius: 999px; padding: 2px 9px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
button.primary {
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 8px; padding: 9px 18px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; font-size: 0.88rem; cursor: pointer;
}
button.ghost:hover { border-color: var(--accent); }
button.small { padding: 5px 11px; font-size: 0.82rem; }
.estimate { font-size: 0.83rem; color: var(--ink-faint); }
.shortfall { font-size: 0.86rem; color: var(--fail); margin: 10px 0 0; }
.empty { color: var(--ink-faint); font-size: 0.88rem; padding: 6px 0; }

/* ---- prescan ---- */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 96px; }
.stat b { display: block; font-size: 1.25rem; line-height: 1.2; }
.stat span { font-size: 0.75rem; color: var(--ink-faint); }
.stat.is-fail b { color: var(--fail); }
.stat.is-unknown b { color: var(--unknown); }
.stat.is-pass b { color: var(--pass); }
.tri { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.79rem; color: var(--ink-faint); margin-bottom: 12px; }
.tri-item b { font-family: var(--mono); margin-right: 4px; }
.v-pass { color: var(--pass); }
.v-fail { color: var(--fail); }
.v-unknown { color: var(--unknown); }
.blind {
  border: 1px solid var(--unknown); background: var(--unknown-bg); color: var(--unknown);
  border-radius: 8px; padding: 10px 12px; font-size: 0.86rem; margin-bottom: 12px;
}
.blind strong { color: inherit; }
.scan-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.scan-cols > div { min-width: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.83rem; }
th, td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--ink-faint); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 140px; }

.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 9px 12px; }
.checks li.pass { border-left-color: var(--pass); }
.checks li.fail { border-left-color: var(--fail); }
.checks li.unknown { border-left-color: var(--unknown); }
.check-head { display: flex; gap: 9px; align-items: baseline; flex-wrap: wrap; }
.verdict {
  font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 4px; padding: 1px 6px; font-weight: 700; flex: none;
}
.verdict.pass { color: var(--pass); background: var(--pass-bg); }
.verdict.fail { color: var(--fail); background: var(--fail-bg); }
.verdict.unknown { color: var(--unknown); background: var(--unknown-bg); }
.check-title { font-weight: 600; font-size: 0.89rem; }
.sev { font-size: 0.72rem; color: var(--ink-faint); }
.check-detail { font-size: 0.86rem; color: var(--ink-soft); margin: 5px 0 0; }
.why-unknown {
  font-size: 0.81rem; color: var(--unknown); margin: 6px 0 0;
  border-left: 2px solid var(--unknown); padding-left: 9px;
}
.scan-actions, .result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---- progress ---- */
.timer { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-faint); font-weight: 400; }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.steps li { display: flex; gap: 10px; align-items: baseline; font-size: 0.88rem; color: var(--ink-faint); }
.steps li .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.steps li.doing { color: var(--ink); font-weight: 600; }
.steps li.doing .dot { background: var(--accent); }
.steps li.done { color: var(--ink-soft); }
.steps li.done .dot { background: var(--pass); }

/* ---- result ---- */
.result-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.result-meta { display: flex; gap: 9px; align-items: baseline; flex-wrap: wrap; }
.partial {
  border: 1px solid var(--unknown); background: var(--unknown-bg); color: var(--unknown);
  border-radius: 8px; padding: 10px 12px; font-size: 0.87rem; margin-bottom: 12px;
}
.reconcile {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-size: 0.86rem; margin-bottom: 12px; background: var(--code-bg);
}
.reconcile ul { margin: 6px 0 0; padding-left: 20px; }
.sec { margin-bottom: 18px; }
.sec-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.sec h3 { margin: 0 0 6px; color: var(--ink); font-size: 0.98rem; }
.sec p { margin: 0 0 8px; }
.sec ul, .sec ol { margin: 0 0 8px; padding-left: 22px; }
.sec li { margin-bottom: 4px; }
.sec pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; overflow-x: auto; margin: 0 0 8px; max-width: 100%;
}
.finding { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; }
.finding.critical, .finding.high { border-left-color: var(--fail); }
.finding.medium { border-left-color: var(--unknown); }
.finding.low { border-left-color: var(--line); }
.finding-head { display: flex; gap: 9px; align-items: baseline; flex-wrap: wrap; }
.finding-head b { font-size: 0.9rem; }
.handoffs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.handoffs button { background: var(--pass-bg); color: var(--pass); border: 1px solid var(--pass); border-radius: 8px; padding: 7px 13px; font-size: 0.85rem; cursor: pointer; }

/* ---- history ---- */
.history-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.history-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.history-tools input, .history-tools select { width: auto; min-width: 130px; max-width: 100%; }
.history-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.history-list li { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; align-items: baseline; }
.history-list .h-title { font-weight: 600; font-size: 0.89rem; }
.history-list .h-meta { font-size: 0.78rem; color: var(--ink-faint); }
.history-list .h-score { font-size: 0.78rem; font-family: var(--mono); }

.scope ul { margin: 0; padding-left: 22px; }
.scope li { margin-bottom: 7px; color: var(--ink-soft); font-size: 0.89rem; }

.foot { border-top: 1px solid var(--line); padding: 20px 16px 40px; }
.foot p { max-width: 1120px; margin: 0 auto 8px; font-size: 0.82rem; color: var(--ink-faint); }

/* ---- docs pages ---- */
.doc { max-width: 900px; margin: 0 auto; padding: 22px 16px 60px; }
.doc h1 { font-size: 1.4rem; }
.doc h2 { font-size: 1.05rem; margin-top: 30px; }
.doc h3 { font-size: 0.95rem; margin-top: 22px; }
.doc p, .doc li { color: var(--ink-soft); }
.doc pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; max-width: 100%; font-size: 0.82rem; line-height: 1.55;
}
.doc pre code { background: none; padding: 0; }
.doc table { margin-bottom: 14px; }
.doc .table-wrap { margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs button {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 6px; padding: 4px 10px; font-size: 0.8rem; cursor: pointer;
}
.tabs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.step { border-left: 2px solid var(--line); padding-left: 16px; margin-bottom: 26px; }
.tokrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.tokval {
  font-family: var(--mono); font-size: 0.8rem; background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 9px; overflow-x: auto; max-width: 100%; word-break: break-all;
}

@media (max-width: 620px) {
  .hero h1 { font-size: 1.22rem; }
  .top-in { padding: 8px 12px; }
  main { padding: 14px 12px 44px; }
  .panel { padding: 13px; }
  .scan-cols { grid-template-columns: 1fr; }
  .brand-name { font-size: 0.92rem; }
}

/* ---- small-viewport wrapping -------------------------------------------
 * The rendered model output is full of long unbreakable identifiers —
 * `Microsoft.ContainerService/managedClusters@2024-05-01`,
 * `properties.agentPoolProfiles`, `Standard_NC24ads_A100_v4`. With the default
 * `overflow-wrap: normal` none of them can break, so at 320px the result panel
 * was 405px wide and the whole page scrolled sideways by 85px. Only a real
 * browser at a real narrow viewport shows this; no offline check can.
 * Flex and grid children also need `min-width: 0`, because their default
 * `min-width: auto` refuses to shrink below their content's minimum. */
.sec, .sec p, .sec li, .sec h3,
.finding, .finding-head, .finding-head b, .check-detail,
.checks li, .check-head, .check-title, .why-unknown,
.reconcile, .reconcile li, .partial, .blind,
.mask-report, .mask-body, .mask-body label, .check span,
.history-list li, .history-list .h-title, .history-list .h-meta,
.result-head, .result-meta, .hero h1, .blurb,
.scope li, .foot p, .empty, .shortfall, .estimate {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
.sec, .panel, main, .result-head, .finding, .checks li { max-width: 100%; }
.check { min-width: 0; }
.check span { flex: 1 1 auto; }
