/*
 * Parapet design tokens and components, carried over from the prototype.
 * No web fonts or CDNs: the product must render fully offline.
 */
:root {
  --bg: #eef1f3; --surface: #ffffff; --surface-2: #f5f7f8; --line: #d8dee3; --line-2: #e7ebee;
  --fg: #16212b; --muted: #5b6874; --faint: #8a96a0;
  --accent: #0d6b72; --accent-ink: #ffffff; --accent-soft: #dcecec;
  --rail: #13232b; --rail-fg: #c9d6dc; --rail-muted: #7f939c; --rail-active: #1e3741;
  --crit: #b3261e; --crit-bg: #fbe7e5; --high: #c4520c; --high-bg: #fdeee2;
  --med: #946c00; --med-bg: #fbf2d6; --low: #2b67a6; --low-bg: #e4eef9;
  --pass: #1d7440; --pass-bg: #e2f3e8; --code-bg: #f6f8f9;
  --f-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1418; --surface: #151d22; --surface-2: #1a242a; --line: #2a363e; --line-2: #222d34;
    --fg: #e2e8ec; --muted: #9aa8b1; --faint: #6f7e88;
    --accent: #4fb2b6; --accent-ink: #08191b; --accent-soft: #173238;
    --rail: #0a1013; --rail-active: #17262d;
    --crit: #ff7a6e; --crit-bg: #3a1916; --high: #ff9d5c; --high-bg: #3a2414;
    --med: #e2b84c; --med-bg: #362c12; --low: #78afee; --low-bg: #162a40;
    --pass: #5fcf8a; --pass-bg: #15301f; --code-bg: #10171b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--f-sans); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--f-mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.bad { color: var(--crit); }
.r { text-align: right; }
.push { margin-left: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* Shell */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--rail); color: var(--rail-fg); display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; text-decoration: none; color: inherit; }
.brand b { font-size: 18px; color: #fff; letter-spacing: .02em; }
.brand small { display: block; font-size: 11px; color: var(--rail-muted); letter-spacing: .06em; text-transform: uppercase; }
.brand--dark b { color: var(--fg); }
.brand--dark small { color: var(--muted); }
.logo path { fill: #4fb2b6; }
.logo .logo__line { fill: none; stroke: var(--rail); stroke-width: 1.6; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--rail-muted); padding: 12px 10px 6px; }
.nav__link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--rail-fg); text-decoration: none; font-size: 13.5px; }
.nav__icon { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__ct { margin-left: auto; font: 500 11px var(--f-mono); color: var(--rail-muted); }
.nav__link[aria-current="page"] .nav__ct { color: var(--rail-fg); }
.proj { border: 1px solid rgba(255,255,255,.09); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.proj__k { color: var(--rail-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.proj__form { display: flex; gap: 6px; }
select.proj__select {
  appearance: none; -webkit-appearance: none; width: 100%; margin: 0; padding: 0 22px 0 0; border: 0; border-radius: 0; box-shadow: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23c9d6dc' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 2px center;
  color: #fff; font: 500 14px/1.35 var(--f-sans); cursor: pointer; text-overflow: ellipsis; color-scheme: dark;
}
select.proj__select:hover { background-color: transparent; color: #fff; }
select.proj__select:focus { outline: none; }
select.proj__select:focus-visible { outline: 2px solid #4fb2b6; outline-offset: 3px; border-radius: 2px; }
select.proj__select option { background: var(--rail); color: var(--rail-fg); }
.proj__meta { color: var(--rail-muted); }
.proj__all { color: var(--rail-fg); font-size: 12px; }
.rail__foot { margin-top: auto; font-size: 11.5px; color: var(--rail-muted); padding: 0 8px; line-height: 1.6; }
.rail__dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3fbf7f; margin-right: 6px; }
.nav__link:hover { background: rgba(255,255,255,.05); }
.nav__link[aria-current="page"] { background: var(--rail-active); color: #fff; box-shadow: inset 2px 0 0 #4fb2b6; }
.rail__user { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 8px 0; font-size: 12.5px; }
.rail__name { color: #fff; font-weight: 500; }
.rail__role { color: var(--rail-muted); }
.rail__links { display: flex; gap: 12px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.rail__links a, .linklike { color: var(--rail-fg); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font-size: 12.5px; }
.rail__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail__body { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.rail__toggle { display: none; background: none; border: 1px solid rgba(255,255,255,.18); color: var(--rail-fg); border-radius: 6px; padding: 5px 12px; font: 500 13px var(--f-sans); cursor: pointer; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--surface); color: var(--fg); padding: 8px 14px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.skip-link:focus { top: 12px; }
.main:focus { outline: none; }
.work { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 28px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.top h1 { font-size: 20px; margin: 2px 0 0; font-weight: 600; text-wrap: balance; }
.crumbs { font-size: 12.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.top__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.main { padding: 22px 28px 48px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.flashes { padding: 16px 28px 0; }
.flash { margin: 0; padding: 9px 14px; border-radius: 6px; font-size: 13px; }
.flash--notice { background: var(--pass-bg); color: var(--pass); }
.flash--alert { background: var(--crit-bg); color: var(--crit); }
.demo-accounts { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.demo-accounts ul { margin: 6px 0; padding-left: 18px; }
.demo-banner { margin: 12px 28px 0; padding: 8px 14px; border-radius: 6px; font-size: 13px; background: var(--med-bg); color: var(--med); }
@media (max-width: 860px) { .demo-banner { margin: 12px 16px 0; } }
@media print { .demo-banner { display: none; } }
.flash--info { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); margin-bottom: 16px; }

/* Panels and tables */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.panel.narrow { max-width: 640px; padding: 20px 22px; }
.panel__head { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px 4px; flex-wrap: wrap; }
.panel__head h2, .h2 { font-size: 15px; margin: 0; font-weight: 600; }
.panel__head .sub { font-size: 12.5px; color: var(--muted); }
.panel__body { padding: 12px 18px 18px; min-width: 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr.dim td { opacity: .55; }
tr.row-note td { padding-top: 0; font-size: 12.5px; }
th.r, td.r { text-align: right; }
td.r form { display: inline-block; }
.host { font-family: var(--f-mono); font-weight: 600; font-size: 13px; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); }
.pager__links { display: flex; align-items: center; gap: 8px; }
@media print { .pager { display: none; } }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--fg); font-size: 15px; margin-bottom: 6px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.kpi { padding: 14px 18px; border-left: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi__k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.kpi__v { font-size: 28px; font-weight: 600; line-height: 1.1; }
.kpi__s { font-size: 12.5px; color: var(--muted); }
.dhead { display: flex; flex-wrap: wrap; gap: 14px 32px; padding: 16px 18px; }
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv__k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.kv__v { font-weight: 500; overflow-wrap: anywhere; }

/* Chips and badges */
.chip { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip--ok { border-color: transparent; background: var(--pass-bg); color: var(--pass); }
.chip--warn { border-color: transparent; background: var(--med-bg); color: var(--med); }
.chip--bad { border-color: transparent; background: var(--crit-bg); color: var(--crit); }
.chip--accent { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.vb { font: 600 10px/16px var(--f-mono); padding: 0 5px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); letter-spacing: .03em; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 7px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 13px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--danger { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 4px 9px; font-size: 12px; }
.btn--block { width: 100%; justify-content: center; }
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, details summary { font-size: 13px; font-weight: 500; }
details summary { cursor: pointer; }
details[open] > summary { margin-bottom: 10px; }
.hint { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--surface); width: 100%; }
textarea.mono { background: var(--code-bg); }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.errors { border: 1px solid var(--crit); background: var(--crit-bg); color: var(--crit); border-radius: 6px; padding: 8px 12px; font-size: 13px; margin: 0; }
.note { font-size: 13px; background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 0 6px 6px 0; margin: 0 0 14px; }
.temp-password { display: inline-block; font-size: 18px; padding: 8px 14px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; letter-spacing: .05em; user-select: all; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg a { padding: 6px 10px; font-size: 12.5px; text-decoration: none; color: var(--fg); border-left: 1px solid var(--line-2); }
.seg a:first-child { border-left: 0; }
.seg a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Import progress */
.import-status { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 16px 18px; }
.import-status .muted { grid-column: 1 / -1; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

/* Configuration viewer */
.cfg { counter-reset: line; list-style: none; margin: 0; padding: 0; background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 640px; font: 12.5px/1.6 var(--f-mono); }
.cfg li { counter-increment: line; display: grid; grid-template-columns: 56px minmax(0, 1fr); }
.cfg li::before { content: counter(line); color: var(--faint); text-align: right; padding-right: 12px; user-select: none; }
.cfg li code { white-space: pre; font-size: inherit; padding-right: 12px; }
.cfg li:target { background: var(--med-bg); }
pre.code { margin: 0; background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; overflow: auto; max-height: 420px; font: 12.5px/1.55 var(--f-mono); }

/* Sign-in */
body.auth { display: grid; place-items: center; padding: 24px 16px; }
.auth__card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.auth__title { font-size: 20px; margin: 0; }
.auth .flashes { padding: 0; }
.auth .logo .logo__line { stroke: var(--surface); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; padding: 12px; }
  .rail__foot { display: none; }
  .rail--collapsible .rail__toggle { display: inline-block; }
  .rail--collapsible:not(.rail--open) .rail__body { display: none; }
  .top, .main, .flashes { padding-left: 16px; padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-status { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Phase 2: coverage and parsed model */
.cfg li.cfg__unknown { background: var(--med-bg); }
.cfg li.cfg__unknown::before { color: var(--med); }
.cfg--sparse li { display: block; }
.cfg--sparse li::before { content: none; }
.cfg__ln { display: inline-block; min-width: 44px; color: var(--faint); }
details.panel > summary { list-style: none; cursor: pointer; padding-bottom: 14px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2::before { content: "\25B8  "; color: var(--muted); }
details.panel[open] > summary h2::before { content: "\25BE  "; }
.contract td { vertical-align: top; }

/* Phase 3: findings */
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px 2px 7px; border-radius: 4px; white-space: nowrap; }
.sev::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.sev--critical { color: var(--crit); background: var(--crit-bg); }
.sev--high { color: var(--high); background: var(--high-bg); }
.sev--medium { color: var(--med); background: var(--med-bg); }
.sev--low { color: var(--low); background: var(--low-bg); }
.sev--info { color: var(--muted); background: var(--surface-2); }
td.stripe, th.stripe { width: 3px; padding: 0; }
.stripe--critical { background: var(--crit); } .stripe--high { background: var(--high); } .stripe--medium { background: var(--med); } .stripe--low { background: var(--low); } .stripe--info { background: var(--line); }
.counts { display: inline-flex; gap: 4px; }
.counts > span { min-width: 24px; text-align: center; font: 600 11.5px/18px var(--f-mono); border-radius: 3px; padding: 0 4px; }
.counts__critical { color: var(--crit); background: var(--crit-bg); } .counts__high { color: var(--high); background: var(--high-bg); }
.counts__medium { color: var(--med); background: var(--med-bg); } .counts__low { color: var(--low); background: var(--low-bg); }
.counts__zero { color: var(--faint); background: var(--surface-2); font-weight: 400; }
a.plain { text-decoration: none; }
.sevtiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.sevtile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); border-left-width: 4px; background: var(--surface); text-decoration: none; color: var(--fg); }
.sevtile[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface-2); }
.sevtile__n { font-size: 24px; font-weight: 600; line-height: 1.1; }
.sevtile__k { font-size: 12.5px; color: var(--muted); }
.sevtile--critical { border-left-color: var(--crit); } .sevtile--high { border-left-color: var(--high); } .sevtile--medium { border-left-color: var(--med); } .sevtile--low { border-left-color: var(--low); } .sevtile--info { border-left-color: var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type="search"] { flex: 1 1 220px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: var(--surface); }
.filters select { width: auto; }
.seg + .filters { margin-top: 12px; }
.access-form input[type="text"] { flex: 1 1 180px; min-width: 0; }
.access-form .access-form__service { flex: 0 1 140px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.bulkbar__count { font-size: 13px; color: var(--muted); }
.bulkbar--active .bulkbar__count { color: var(--fg); font-weight: 500; }
.bulkbar .bulkbar__all { color: var(--accent); font-size: 13px; }
.bulkbar__reason { flex: 1 1 260px; min-width: 0; }
.bulkbar select { width: auto; }
th.pick, td.pick { width: 32px; padding-right: 0; }
@media print { .bulkbar, .pick { display: none; } }
th .sort { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
th .sort:hover { text-decoration: underline; }
th .sort__arrow { font-size: 10px; color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.split__main, .split__side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.prose p { margin: 0 0 10px; max-width: 70ch; }
.evidence { display: flex; flex-direction: column; }
.evidence__item { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 4px 12px; padding: 10px 18px; border-top: 1px solid var(--line-2); font-size: 13px; }
.evidence__item code { display: inline-block; margin-top: 3px; background: var(--code-bg); padding: 1px 6px; border-radius: 3px; overflow-wrap: anywhere; }
pre.code--wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.radios { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.radio { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.history { list-style: none; margin: 0; padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.history li { display: flex; flex-direction: column; gap: 3px; border-left: 2px solid var(--line); padding-left: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .sevtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Phase 4: compliance, risk and reports */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; color: var(--fg); font-weight: 500; }
.tab[aria-current="page"] { border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.matrix th.matrix__control { text-align: center; padding: 8px 6px; }
.matrix td.cc { text-align: center; padding: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; border-left: 2px solid var(--surface); }
.cc--pass { background: var(--pass-bg); color: var(--pass); }
.cc--fail { background: var(--crit-bg); }
.cc--fail a { color: var(--crit); }
.cc--na { color: var(--faint); background: var(--surface-2); font-weight: 400; }
.risk { display: inline-block; min-width: 34px; text-align: center; font: 600 12px/20px var(--f-mono); border-radius: 4px; padding: 0 6px; }
.risk--critical { color: var(--crit); background: var(--crit-bg); } .risk--high { color: var(--high); background: var(--high-bg); }
.risk--medium { color: var(--med); background: var(--med-bg); } .risk--low { color: var(--low); background: var(--low-bg); }
.risk--none { color: var(--pass); background: var(--pass-bg); }
.posture { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 10px 18px 18px; }
.posture__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--fg); }
.posture__item progress { grid-column: 1 / -1; height: 6px; }
.plainlist { list-style: none; margin: 0; padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
@media (max-width: 860px) { .posture { grid-template-columns: minmax(0, 1fr); } }

/* Printable report. "Save as PDF" in the browser print dialog produces the PDF. */
.report__page { width: 100%; max-width: 960px; min-width: 0; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 40px 48px; }
.report__cover { border-bottom: 2px solid var(--accent); padding-bottom: 20px; margin-bottom: 8px; }
.report__cover .report__title { font-size: 28px; margin: 24px 0 6px; }
.report__lead { color: var(--muted); margin: 0 0 16px; }
.report__meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.report__meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.report__meta dd { margin: 2px 0 0; font-weight: 500; }
.report__section { padding-top: 18px; }
.report__section h2 { font-size: 18px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.report__stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 12px 0 16px; }
.report__stats div { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; }
.report__stats b { font-size: 22px; }
.report__stats span { font-size: 12px; color: var(--muted); }
.report__wrap { margin-bottom: 8px; }
.report__table td { overflow-wrap: anywhere; }
.report__evidence-cell { min-width: 220px; max-width: 360px; }
.hash { word-break: break-all; }
.report__finding { border-left: 4px solid var(--line); padding: 2px 0 6px 14px; margin: 18px 0; }
.report__finding h3 { font-size: 15px; margin: 0 0 4px; }
.report__finding p { margin: 4px 0; }
.report__finding--critical { border-left-color: var(--crit); } .report__finding--high { border-left-color: var(--high); }
.report__finding--medium { border-left-color: var(--med); } .report__finding--low { border-left-color: var(--low); }
.report__evidence { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; }
.report__evidence code { background: var(--code-bg); padding: 0 4px; border-radius: 3px; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .report__page { padding: 20px 16px; margin: 0; border-radius: 0; }
  .report__meta, .report__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #f5f7f8; --line: #d8dee3; --line-2: #e7ebee;
    --fg: #16212b; --muted: #5b6874; --faint: #8a96a0; --accent: #0d6b72; --accent-soft: #dcecec;
    --crit: #b3261e; --crit-bg: #fbe7e5; --high: #c4520c; --high-bg: #fdeee2; --med: #946c00; --med-bg: #fbf2d6;
    --low: #2b67a6; --low-bg: #e4eef9; --pass: #1d7440; --pass-bg: #e2f3e8; --code-bg: #f6f8f9;
    color-scheme: light;
  }
  body { background: #fff; color: #000; }
  .rail, .top, .flashes, .no-print { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .report__wrap { overflow: visible; }
  .report__page { border: 0; margin: 0; padding: 0; max-width: none; }
  .report__section { break-inside: auto; }
  .report__section h2 { break-after: avoid; }
  .report__finding, .report__table tr { break-inside: avoid; }
  pre.code { max-height: none; overflow: visible; }
  a { color: inherit; text-decoration: none; }
}

/* Phase 5: rule studio and bundles */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.radios--row { flex-direction: row; flex-wrap: wrap; gap: 6px 18px; }
.radios--row legend { width: 100%; margin-bottom: 4px; }
details.inline-form { display: inline-block; text-align: left; vertical-align: top; }
details.inline-form > summary { list-style: none; }
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form[open] form { margin-top: 8px; min-width: 260px; }
.plainlist--flush { padding: 0; }
.errors ul { margin: 6px 0 0; padding-left: 18px; }
[aria-invalid="true"] { border-color: var(--crit) !important; box-shadow: 0 0 0 1px var(--crit); }
input[type="file"] { font-size: 13px; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }

/* Phase 6: history and diffs */
.chart { width: 100%; height: auto; display: block; }
.chart .axis { font: 10px var(--f-mono); fill: var(--muted); }
.chart .axis--y { text-anchor: end; }
.chart .axis--x { text-anchor: middle; }
.chart .axis-line, .chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .grid-line { stroke-dasharray: 3 3; }
.bar--critical { fill: var(--crit); background: var(--crit); } .bar--high { fill: var(--high); background: var(--high); }
.bar--medium { fill: var(--med); background: var(--med); } .bar--low { fill: var(--low); background: var(--low); }
.chart .series { fill: none; stroke-width: 2; }
.series--0 { stroke: var(--accent); fill: var(--accent); } .series--1 { stroke: var(--high); fill: var(--high); }
.series--2 { stroke: var(--low); fill: var(--low); } .series--3 { stroke: var(--med); fill: var(--med); }
.chart polyline.series { fill: none; }
.series-key--0 { background: var(--accent); } .series-key--1 { background: var(--high); } .series-key--2 { background: var(--low); } .series-key--3 { background: var(--med); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; color: var(--muted); }
.legend__key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.legend__key:first-child { margin-left: 0; }
.diff { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.diff__head { padding: 6px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); }
.diff__table { font: 12.5px/1.55 var(--f-mono); }
.diff__table td { padding: 0 8px; border: 0; }
.diff__no { width: 1%; text-align: right; color: var(--faint); user-select: none; white-space: nowrap; }
.diff__no a { color: inherit; }
.diff__sign { width: 1%; user-select: none; }
.diff__text code { white-space: pre-wrap; overflow-wrap: anywhere; font-size: inherit; }
.diff__line--added { background: var(--pass-bg); }
.diff__line--removed { background: var(--crit-bg); }
.diff-stat { font: 600 12px var(--f-mono); }
.diff-stat--added { color: var(--pass); } .diff-stat--removed { color: var(--crit); }

/* Clickable table rows */
tr.row-link { cursor: pointer; }
tr.row-link:hover td:not(.stripe) { background: var(--surface-2); }
