/* kev-sentinel portal v0.3 — same identity as the PDF report: ink on paper, one deep teal used only for marks
   (logo, current page, links), never as a fill; buttons, selected choices, notes and tags are ink and grey.
   v0.1 had teal buttons; v0.2 teal tints. Public Sans for text,
   Source Serif 4 for titles. Severity colors differ in hue and lightness and always carry their word. */
:root {
  color-scheme: light;
  --paper: #ffffff; --mist: #f2f5f7; --rule: #d5dbe3; --rule-strong: #b8c1cd;
  --ink: #1d2433; --ink2: #3a4356; --muted: #5f6878;
  --teal: #0f5c5a; --teal-ink: #0b4644; --teal-tint: #e6f0ef; --on-teal: #ffffff;
  --crit: #8c1d18; --crit-tint: #f8e8e6; --high: #4a2c7d; --high-tint: #efe9f7;
  --med: #7a5c00; --med-tint: #f8f0d4; --low: #33577a; --low-tint: #e6edf5;
  --ok: #1f6b3a; --ok-tint: #e5f2ea;
  --action: #1d2433; --action-hover: #33405a; --on-action: #ffffff;
  --focus: #1a5fb4;
  --sans: 'Public Sans', Helvetica, Arial, sans-serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --mono: 'Source Code Pro', Menlo, Consolas, monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #12161d; --mist: #1a1f28; --rule: #2c3340; --rule-strong: #3d4757;
    --ink: #e6e9ee; --ink2: #c3c9d3; --muted: #98a1b0;
    --teal: #5fb3ad; --teal-ink: #8fd0ca; --teal-tint: #15302f; --on-teal: #08201f;
    --crit: #f0a29c; --crit-tint: #3a1715; --high: #c4aef0; --high-tint: #2a1f40;
    --med: #e3c463; --med-tint: #352b0c; --low: #9dbde0; --low-tint: #1a2836;
    --ok: #86d0a0; --ok-tint: #15301f;
    --action: #e6e9ee; --action-hover: #ffffff; --on-action: #12161d;
    --focus: #8ab4f8;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--sans); font-feature-settings: "tnum" 1;
}
a { color: var(--teal-ink); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin-top: 2.25rem; }
h3 { font-size: 1.05rem; font-family: var(--sans); font-weight: 650; }
p { margin: 0 0 1rem; max-width: 68ch; }
code, .mono { font-family: var(--mono); font-size: .92em; }
td.mono { white-space: nowrap; }
small, .muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); padding: .5rem .75rem; z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- frame ---------------------------------------------------------------------------------------- */
.bar { border-bottom: 1px solid var(--rule); background: var(--paper); }
.bar-in { max-width: 1040px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px;
  min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
  font: 600 1.05rem var(--serif); white-space: nowrap; }
.brand svg { flex: none; color: var(--teal); }
.brand .for { font: 400 .9rem var(--sans); color: var(--muted); }
nav.main { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav.main a { color: var(--ink2); text-decoration: none; padding: 18px 10px 16px; border-bottom: 3px solid transparent;
  font-weight: 500; font-size: .95rem; }
nav.main a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
nav.main a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--teal); font-weight: 650; }
.who { display: flex; align-items: center; gap: 12px; font-size: .9rem; color: var(--muted); }
.who form { margin: 0; }
main { max-width: 1040px; margin: 0 auto; padding: 36px 24px 72px; }
main.narrow { max-width: 480px; padding-top: 56px; }
footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: .85rem; }
footer .in { max-width: 1040px; margin: 0 auto; padding: 18px 24px; display: flex; gap: 24px; flex-wrap: wrap; }
.lede { font-size: 1.05rem; color: var(--ink2); }
.page-head { margin-bottom: 1.75rem; }
.page-head p { color: var(--ink2); margin: .25rem 0 0; }

/* ---- forms ---------------------------------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .95rem; margin: 0 0 .35rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; margin-top: .15rem; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule-strong); border-radius: var(--r); padding: .62rem .75rem; min-height: 44px;
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[aria-invalid=true] { border-color: var(--crit); }
input.code { font: 600 1.35rem/1 var(--mono); letter-spacing: .18em; text-align: center; max-width: 16rem; }
.field { margin-bottom: 1.1rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
button, .btn {
  font: 600 .98rem var(--sans); border-radius: var(--r); padding: .65rem 1.1rem; min-height: 44px; cursor: pointer;
  border: 1px solid var(--action); background: var(--action); color: var(--on-action); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
button:hover, .btn:hover { background: var(--action-hover); border-color: var(--action-hover); }
button.secondary, .btn.secondary { background: var(--paper); color: var(--ink); border-color: var(--rule-strong); }
button.secondary:hover, .btn.secondary:hover { background: var(--mist); border-color: var(--ink2); }
button.link { background: none; border: 0; color: var(--teal-ink); padding: 0; min-height: 0; text-decoration: underline;
  text-underline-offset: 2px; font-weight: 500; }
button.danger { background: var(--paper); color: var(--crit); border-color: var(--crit); }
button.danger:hover { background: var(--crit-tint); border-color: var(--crit); }
button.link:hover { background: none; }
button.wide, .btn.wide { width: 100%; }
button[disabled] { opacity: .55; cursor: not-allowed; }
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-weight: 650; margin-bottom: .6rem; padding: 0; }
.choice { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; padding: 14px 16px;
  border: 1px solid var(--rule); border-radius: var(--r); margin-bottom: 10px; cursor: pointer; font-weight: 400; }
.choice:hover { border-color: var(--rule-strong); }
.choice:has(input:checked) { border-color: var(--ink); background: var(--mist); box-shadow: inset 0 0 0 1px var(--ink); }
.choice input { margin: 4px 0 0; width: 18px; height: 18px; accent-color: var(--action); }
.choice b { font-weight: 650; }
.choice span { grid-column: 2; color: var(--ink2); font-size: .92rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--action); flex: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .88rem; margin: 1.5rem 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }

/* ---- messages ------------------------------------------------------------------------------------- */
.msg { border-left: 4px solid var(--ink2); background: var(--mist); padding: .75rem 1rem; border-radius: 0 var(--r) var(--r) 0;
  margin: 0 0 1.25rem; max-width: 68ch; }
.msg.err { border-color: var(--crit); background: var(--crit-tint); color: var(--ink); }
.msg.ok { border-color: var(--ok); background: var(--ok-tint); }
.msg p:last-child { margin: 0; }

/* ---- data ----------------------------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
caption { text-align: left; font-weight: 650; padding-bottom: .5rem; }
th, td { text-align: left; padding: .6rem .75rem .6rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: .82rem; font-weight: 650; color: var(--muted); border-bottom-color: var(--rule-strong); }
td.num, th.num { text-align: right; padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.sev { display: inline-block; min-width: 5.2rem; font-size: .8rem; font-weight: 700; padding: .12rem .5rem; border-radius: 3px;
  border-left: 4px solid currentColor; }
.sev.critical { color: var(--crit); background: var(--crit-tint); }
.sev.high { color: var(--high); background: var(--high-tint); }
.sev.medium { color: var(--med); background: var(--med-tint); }
.sev.low { color: var(--low); background: var(--low-tint); }
.kev { font-size: .78rem; font-weight: 700; color: var(--crit); border: 1px solid var(--crit); padding: 0 .35rem;
  border-radius: 3px; margin-left: .35rem; white-space: nowrap; }
.tally { display: flex; gap: 0; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; margin: 0 0 1.5rem; }
.tally div { flex: 1; padding: .7rem 1rem; border-left: 1px solid var(--rule); }
.tally div:first-child { border-left: 0; }
.tally b { display: block; font: 600 1.6rem/1.1 var(--serif); }
.tally span { font-size: .85rem; color: var(--muted); }
.tally .critical b { color: var(--crit); } .tally .high b { color: var(--high); }
.tally .medium b { color: var(--med); } .tally .low b { color: var(--low); }
.tally .zero b { color: var(--muted); font-weight: 400; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.5rem; margin: 0 0 1.5rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.status { font-size: .85rem; font-weight: 650; white-space: nowrap; }
.status.queued, .status.waiting-approval { color: var(--med); }
.status.applied { color: var(--ok); }
.status.rejected { color: var(--crit); }
ul.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.plain li { padding: .55rem 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between;
  gap: 16px; align-items: center; flex-wrap: wrap; }
ul.plain li:last-child { border-bottom: 0; }
.empty { color: var(--muted); padding: 1rem 0; }

/* ---- layout pieces -------------------------------------------------------------------------------- */
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 48px; }
.aside h2:first-child, .split > div > h2:first-child { margin-top: 0; }
section + section { margin-top: 2.5rem; }
.panel { border: 1px solid var(--rule); border-radius: var(--r); padding: 20px 22px; margin-bottom: 1.25rem; }
.panel h3 { margin-bottom: .35rem; }
.panel > :last-child { margin-bottom: 0; }
.txt-record { background: var(--mist); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px;
  display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: .92rem; margin: .75rem 0 1rem; }
.txt-record dt { color: var(--muted); }
.txt-record dd { margin: 0; font-family: var(--mono); word-break: break-all; }
details.disclose > summary { cursor: pointer; color: var(--teal-ink); font-weight: 600; list-style: none; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose[open] > summary { color: var(--muted); }
details.disclose > div { padding-top: .9rem; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; font: 600 1.1rem var(--mono);
  background: var(--mist); border: 1px solid var(--rule); border-radius: var(--r); padding: 18px 22px; margin: 0 0 1rem;
  list-style: none; }
.qr { display: block; width: 220px; height: 220px; background: #fff; border: 1px solid var(--rule); border-radius: var(--r);
  padding: 6px; margin: .5rem 0 1rem; }
.seed { font: 600 1rem var(--mono); letter-spacing: .04em; word-spacing: .25em; }
.report-frame { width: 100%; height: 78vh; min-height: 560px; border: 1px solid var(--rule); border-radius: var(--r);
  background: #fff; }
.tag { font-size: .78rem; font-weight: 650; color: var(--ink2); background: var(--mist); box-shadow: inset 0 0 0 1px var(--rule); padding: .1rem .45rem;
  border-radius: 3px; }

@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; gap: 8px; }
  .bar-in { gap: 0 16px; padding: 0 16px; }
  nav.main { order: 3; flex-basis: 100%; margin: 0 -10px; overflow-x: auto; flex-wrap: nowrap; }
  nav.main a { padding: 10px 10px 12px; white-space: nowrap; }
  .who { margin-left: auto; }
  .who .email { display: none; }
  main { padding: 24px 16px 56px; }
  main.narrow { padding-top: 32px; }
  footer .in { padding: 16px; }
  .tally { flex-wrap: wrap; }
  .tally div { flex-basis: 50%; border-top: 1px solid var(--rule); }
  .tally div:nth-child(-n+2) { border-top: 0; }
  .tally div:nth-child(3) { border-left: 0; }
  .codes { grid-template-columns: 1fr; }
  .stack thead { display: none; }
  .stack tr { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .stack td { border: 0; padding: 0; }
  .stack td:nth-child(2) { grid-column: 2; }
  .stack td:nth-child(3) { grid-column: 2; color: var(--muted); }
  html, body { overflow-x: clip; }
  .mono, td.mono { white-space: normal; overflow-wrap: anywhere; }
  h1 { font-size: 1.6rem; }
  .report-frame { height: 70vh; min-height: 420px; }
}
@media print {
  .bar, footer, .no-print { display: none !important; }
  main { padding: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .btn, nav.main a { transition: border-color .12s, background-color .12s; }
}
.is-disabled { opacity: .55; cursor: not-allowed; }
[data-gap="md"] { margin-top: 1.5rem; }
[data-gap="lg"] { margin-top: 2rem; }
