/* Cyber Risk Assessor — interface styles.
   Direction: a calm instrument for governance work. Neutral cool paper, one deep harbour-blue accent, and the
   risk-band colours as the only saturated colour in the interface. The band "spine" on register rows is the
   signature element. Mobile first; desktop enhancements at 760px and 1080px. */

@font-face { font-family: "Public Sans"; src: url("/static/fonts/public-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Public Sans"; src: url("/static/fonts/public-sans-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Public Sans"; src: url("/static/fonts/public-sans-latin-wght-italic.woff2") format("woff2");
  font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/static/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --bg: #f5f7f7; --panel: #ffffff; --sunk: #eef1f2; --ink: #17212b; --ink-2: #33414d; --muted: #5b6874;
  --line: #dde3e6; --line-strong: #c3ccd2;
  --accent: #1c4e6b; --accent-hover: #163f57; --accent-ink: #ffffff; --accent-soft: #e3edf2; --focus: #2f7fae;
  --ok: #1d6b45; --ok-soft: #e2f1e8; --warn: #7a4f00; --warn-soft: #fbf0d5; --err: #a3262d; --err-soft: #f9e6e7;
  --low: #92d050; --medium: #ffe066; --high: #ffc000; --extreme: #ff4d4d; --na: #d5dade;
  --radius: 10px; --radius-s: 7px; --gap: 14px; --pad: 16px;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 1px 0 rgba(23, 33, 43, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151b; --panel: #161e26; --sunk: #121920; --ink: #e7ecef; --ink-2: #c6d0d6; --muted: #98a5b0;
    --line: #26313b; --line-strong: #36434f;
    --accent: #7fb6d6; --accent-hover: #9cc8e2; --accent-ink: #0c1a24; --accent-soft: #1b2b37; --focus: #9cc8e2;
    --ok: #74d29e; --ok-soft: #153124; --warn: #f0c66e; --warn-soft: #33290f; --err: #ff9095; --err-soft: #3a1c20;
    --na: #4a5560; --shadow: none;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--sans);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.012em; margin: 0 0 6px; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 650; margin: 22px 0 10px; }
h3 { font-size: 15px; font-weight: 650; margin: 16px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono, code { font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: -.01em; }
.mt0 { margin-top: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right)); }
main.wrap { padding-top: 18px; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------------ header */
header.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top); }
header.top .wrap { display: flex; align-items: center; gap: 18px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 20px; height: 20px; flex: none; }
.bm-low { fill: var(--low); } .bm-med { fill: var(--medium); } .bm-high { fill: var(--high); } .bm-ext { fill: var(--extreme); }
nav.main { display: none; }
.who { display: none; }
details.menu { margin-left: auto; position: static; }
details.menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 0 4px; font-weight: 600; color: var(--ink); cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-icon { display: inline-grid; gap: 3px; width: 18px; }
.menu-icon i { display: block; height: 2px; background: currentColor; border-radius: 2px; }
details.menu[open] > summary .menu-icon i:nth-child(2) { opacity: 0; }
details.menu > nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--panel);
  border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px rgba(15, 21, 27, .12);
  padding: 6px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); }
details.menu > nav a, details.menu > nav button { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 550; width: 100%; text-align: left; }
details.menu > nav a[aria-current] { color: var(--accent); }
details.menu > nav a .muted { font-weight: 400; font-size: 13px; }
details.menu > nav form button { border: 0; border-radius: 0; background: none; font: inherit; font-weight: 550; color: var(--err); }
@media (min-width: 1080px) {
  details.menu { display: none; }
  nav.main { display: flex; gap: 2px; align-self: stretch; }
  nav.main a { display: flex; align-items: center; padding: 0 10px; color: var(--muted); font-weight: 550; font-size: 14px;
    border-bottom: 2px solid transparent; margin-bottom: -1px; }
  nav.main a:hover { color: var(--ink); text-decoration: none; }
  nav.main a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
  .who { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 13.5px; }
  .who-link { color: var(--ink-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

.banner { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); font-size: 13px; }
.banner .wrap { padding-top: 7px; padding-bottom: 7px; }
.banner-long { display: none; }
@media (min-width: 760px) { .banner-long { display: inline; } .banner-short { display: none; } }

/* ------------------------------------------------------------------ page structure */
.page-head { margin: 2px 0 14px; }
.page-head .back { display: inline-block; font-size: 13.5px; margin-bottom: 6px; padding: 4px 0; }
.page-head .back::before { content: "‹ "; }
.page-head .meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 0; }
.status-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.row.between > div:first-child { min-width: 0; flex: 1 1 320px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad);
  margin-bottom: var(--gap); box-shadow: var(--shadow); min-width: 0; }
.panel > h2:first-child, .panel > .row:first-child h2 { margin-top: 0; }
.grid { display: grid; gap: var(--gap); }
.grid > .panel { margin-bottom: 0; }
.grid + .panel, .grid + .grid, .panel + .grid { margin-top: var(--gap); }
.grid { margin-bottom: var(--gap); }
.g2, .g3 { grid-template-columns: minmax(0, 1fr); }
.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) {
  :root { --pad: 20px; --gap: 16px; }
  body { font-size: 14.5px; }
  h1 { font-size: 28px; }
  .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.narrow { max-width: 560px; }
.login { max-width: 400px; margin: 8vh auto 0; }
.empty { text-align: center; padding: 32px 12px; color: var(--muted); }

/* stat tiles: the number leads, the label explains it in plain words */
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-size: 26px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; line-height: 1.35; }
.n-bad { color: var(--err); }

/* ------------------------------------------------------------------ stepper (a real sequence, so it is numbered) */
.stepper { display: flex; gap: 8px; margin: 0 -16px 16px; padding: 2px 16px 6px; overflow-x: auto;
  scroll-snap-type: x proximity; scrollbar-width: none; counter-reset: none; }
.stepper::-webkit-scrollbar { display: none; }
.step { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); scroll-snap-align: start; min-height: 44px; }
.step:hover { text-decoration: none; border-color: var(--line-strong); }
.step-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--sunk); color: var(--muted); font-size: 12.5px; font-weight: 700; }
.step-n svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.step.done .step-n { background: var(--ok-soft); color: var(--ok); }
.step[aria-current] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.step[aria-current] .step-n { background: var(--accent); color: var(--accent-ink); }
.step-t b { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.step-t .sub { display: none; }
@media (min-width: 1080px) {
  .stepper { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0 0 18px; padding: 0; overflow: visible; }
  .step { border-radius: var(--radius-s); align-items: flex-start; padding: 10px 12px; }
  .step-t { display: flex; flex-direction: column; min-width: 0; }
  .step-t b { white-space: normal; line-height: 1.3; }
  .step-t .sub { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
}

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--panel); }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
tr.retired td { opacity: .55; }
tr.newrow td { background: var(--accent-soft); }

/* Narrow containers (phones, and half-width panels on desktop): wide tables become stacked records.
   Driven by the panel's own width, not the screen, so a table never spills out of its box.
   app.js labels each cell from its column header. */
.panel { container-type: inline-size; }
@container (max-width: 640px) {
  .table-wrap { overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack tr { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 12px; margin: 0 0 10px; background: var(--panel); }
  table.stack td { border: 0; padding: 5px 0 5px calc(34% + 12px); position: relative; min-height: 30px; text-align: left; }
  table.stack td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 34%;
    color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.4; }
  table.stack td:first-child, table.stack td.lead { padding-left: 0; }
  table.stack td:first-child { font-weight: 600; padding-top: 8px; }
  table.stack td:first-child::before, table.stack td.lead::before { display: none; }
  table.stack td:empty { display: none; }
  table.stack td.nowrap, table.stack td.right { white-space: normal; text-align: left; }
  table.stack tbody tr:hover td { background: none; }
  table.stack tbody tr:last-child { margin-bottom: 0; }
  /* tables that keep their columns scroll sideways inside the panel instead of spilling out */
  table:not(.stack) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table:not(.stack) > * { display: table-row-group; }
  table:not(.stack) > thead { display: table-header-group; }
  tr[class*="spine-"] { box-shadow: inset 5px 0 0 var(--spine, var(--na)); padding-left: 16px !important; }
  tr[class*="spine-"] td:first-child { box-shadow: none; padding-left: 0; }
  details.edit[open] { min-width: 0 !important; }
}
/* long file names, codes and URLs wrap instead of pushing the table wider than its panel */
td, th, .kv dd, .qa-a, .evidence, h1, h2, h3 { overflow-wrap: anywhere; }
td.nowrap, th { overflow-wrap: normal; }

/* the band spine: the residual band runs down the edge of each register record */
tr[class*="spine-"] td:first-child { box-shadow: inset 4px 0 0 var(--spine, var(--na)); padding-left: 14px; }
.spine-LOW { --spine: var(--low); } .spine-MEDIUM { --spine: var(--medium); }
.spine-HIGH { --spine: var(--high); } .spine-EXTREME { --spine: var(--extreme); } .spine- { --spine: var(--na); }

/* ------------------------------------------------------------------ badges and risk pills */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6;
  border: 1px solid transparent; white-space: nowrap; }
.b-answered, .b-accepted, .b-done, .b-closed { background: var(--ok-soft); color: var(--ok); }
.b-partial, .b-inferred, .b-needs_review, .b-running, .b-queued, .b-in_progress, .b-due_soon { background: var(--warn-soft); color: var(--warn); }
.b-missing, .b-insufficient, .b-cancelled { background: var(--sunk); color: var(--muted); }
.b-conflicting, .b-failed, .b-overdue, .b-expired { background: var(--err-soft); color: var(--err); }
.b-rated, .b-pending, .b-open { background: var(--accent-soft); color: var(--accent); }
.b-internal { background: var(--accent-soft); color: var(--accent); }
.b-external { background: #efe7f7; color: #5b2a86; }
@media (prefers-color-scheme: dark) { .b-external { background: #2c2238; color: #cdb2ea; } }
.risk { display: inline-block; min-width: 86px; text-align: center; padding: 2px 9px; border-radius: 6px; font-weight: 700;
  font-size: 12.5px; color: #17212b; white-space: nowrap; }
.r-LOW { background: var(--low); } .r-MEDIUM { background: var(--medium); } .r-HIGH { background: var(--high); }
.r-EXTREME { background: var(--extreme); color: #fff; } .r- { background: var(--na); }
.appetite-mark { color: var(--err); font-size: 12px; }
.pill { display: inline-flex; align-items: center; min-height: 30px; padding: 2px 11px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pill.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ------------------------------------------------------------------ forms and buttons */
label { display: block; font-weight: 600; font-size: 13.5px; margin: 12px 0 5px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search],
input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--panel); color: var(--ink); font: inherit; font-size: 16px; }
input[type=file] { font: inherit; font-size: 14px; max-width: 100%; padding: 6px 0; }
select { appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 8px 0; min-height: 28px; }
.check input { margin-top: 2px; }
@media (min-width: 760px) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
    min-height: 40px; font-size: 14.5px; }
}
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); padding: 8px 16px;
  border-radius: var(--radius-s); font: inherit; font-weight: 600; font-size: 14.5px; cursor: pointer; text-align: center; }
button:hover, .btn:hover { border-color: var(--ink-2); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 55%, transparent); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 550; font-size: inherit; }
button.link:hover { text-decoration: underline; }
button:disabled, button:disabled:hover { opacity: .5; cursor: not-allowed; border-color: var(--line-strong); }
button.primary:disabled { background: var(--accent); }
.btn.block, button.block { display: flex; width: 100%; }
form.inline { display: inline; }
@media (min-width: 760px) { button, .btn { min-height: 38px; padding: 7px 15px; font-size: 14px; } }
@media (max-width: 759px) {
  /* touch: inline text buttons get a bigger hit area without changing their look */
  button.link { padding: 8px 2px; margin: -8px 0; }
  .actions-stack > * { flex: 1 1 auto; }
}
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
details > summary { cursor: pointer; color: var(--accent); min-height: 36px; display: list-item; padding: 6px 0; }

/* ------------------------------------------------------------------ data display */
.kv { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 7px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 760px) {
  .kv { grid-template-columns: minmax(150px, 34%) 1fr; gap: 6px 14px; }
}
.evidence { border-left: 3px solid var(--line-strong); padding: 3px 12px; margin: 8px 0; color: var(--ink-2); font-size: 13.5px; }
.flags { padding-left: 18px; }
.flags li { color: var(--warn); }
.flash { padding: 11px 14px; border-radius: var(--radius-s); margin-bottom: 12px; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--err-soft); color: var(--err); }
.pre-err { white-space: pre-wrap; color: var(--err); overflow-wrap: anywhere; }
.danger-link { color: var(--err) !important; }
.matrix td { text-align: center; font-weight: 700; font-size: 12px; border: 2px solid var(--panel); }

/* job progress */
.job { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: var(--gap); background: var(--panel); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .4s; }

/* tabs scroll sideways on phones */
.tabs { display: flex; gap: 2px; align-items: center; border-bottom: 1px solid var(--line); margin: 10px 0 16px;
  overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 550; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .spacer { flex: 1; }
.spacer { flex: 1; }

/* editors */
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 16px; }
.checkgrid .check { font-weight: 400; font-size: 14px; }
.inline-check { display: inline-flex; margin: 0 12px 0 0; font-weight: 400; }
.matrix-edit td { padding: 6px; border: 2px solid var(--panel); }
.matrix-edit input.score { width: 64px; margin-bottom: 4px; min-height: 36px; }
.matrix-edit select { width: 100%; font-size: 13px; padding: 4px 26px 4px 6px; min-height: 34px; }
.cond { display: grid; gap: 10px; }
@container (min-width: 641px) { .cond { min-width: 280px; } }
.cond select { width: auto; padding: 2px 26px 2px 6px; min-height: 34px; }
.steps-list { padding-left: 20px; }
.steps-list li { margin: 5px 0; }
.qr svg { display: block; margin: 10px 0; border: 1px solid var(--line); border-radius: var(--radius-s); max-width: 100%; height: auto; }
.divider { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0; border-top: 1px solid var(--line); line-height: 0; }
.divider span { background: var(--panel); padding: 0 10px; }

/* gates and states */
.gate { border-left: 4px solid var(--line-strong); }
.gate-met { border-left-color: var(--ok); }
.gate-not-met { border-left-color: var(--err); }
.gate-insufficient { border-left-color: var(--warn); }
.progress-line { height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.progress-line i { display: block; height: 100%; background: var(--accent); }

/* ------------------------------------------------------------------ charts */
svg.chart { height: auto; display: block; max-width: 100%; margin: 0 auto; }
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); }
.chart-scroll svg.chart { max-width: none; margin: 0; }
.chart-scroll svg.wide-m { min-width: 480px; }
.chart-scroll svg.wide-l { min-width: 760px; }
@media (min-width: 760px) { .chart-scroll svg.chart { max-width: 100%; } .chart-scroll { margin: 0; padding: 0; } }
.ch-label { fill: var(--ink); font-size: 11.5px; font-family: var(--sans); }
.ch-muted { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.ch-value { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; font-family: var(--sans); }
.ch-cell { fill: #17212b; font-size: 15px; font-weight: 700; font-family: var(--sans); }
.ch-cell-sub { fill: #17212b; font-size: 10px; font-family: var(--sans); }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-ring { stroke: var(--panel); stroke-width: 2; }
.ch-move { stroke: var(--muted); stroke-width: 1.25; opacity: .7; }
.ch-arrow { fill: var(--muted); }
.ch-dot { fill: var(--panel); stroke: var(--ink); stroke-width: 1.25; }
.ch-dot-label { fill: var(--ink); font-size: 9.5px; font-weight: 700; font-family: var(--sans); }
.ch-link { fill: var(--accent); }

/* ------------------------------------------------------------------ print (board packs) */
@media print {
  header.top, .banner, .stepper, details.menu, form, .btn, button { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .panel { border: 0; box-shadow: none; padding: 0; break-inside: avoid; }
}

/* inline editors inside tables */
details.edit > summary { font-weight: 600; font-size: 14px; }
details.edit[open] { background: var(--sunk); border-radius: var(--radius-s); padding: 4px 12px 8px; margin: 4px 0; }
.grid.tight { gap: 0 12px; margin-bottom: 0; }
@media (min-width: 760px) { td details.edit[open] { min-width: 420px; } }
.link-tile { color: var(--ink); }
.link-tile:hover { text-decoration: none; border-color: var(--line-strong); }

/* pilot decision */
.decision { border-left: 4px solid var(--warn); }
.decision-go { border-left-color: var(--ok); }
.decision-no-go { border-left-color: var(--err); }
.checks { list-style: none; padding: 0; margin: 0 0 12px; }
.checks li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: baseline; padding: 9px 0;
  border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks .mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: 12px;
  background: var(--sunk); color: var(--muted); }
.check-met .mark { background: var(--ok-soft); color: var(--ok); }
.check-failed .mark { background: var(--err-soft); color: var(--err); }
.checks b { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 759px) { .checks li { grid-template-columns: 28px 1fr; } .checks b { grid-column: 2; } }

/* document answers */
.qa-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qa-q { margin: 8px 0 6px; font-size: 15.5px; line-height: 1.4; }
.qa-a { margin: 0 0 8px; color: var(--ink); }
blockquote.evidence { margin: 6px 0 0; }
.link-tile .go { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--accent); }
.link-tile .go::after { content: " ›"; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ------------------------------------------------------------------ form rhythm */
/* a clear gap between the last field and the form's buttons */
form > :is(input:not([type=hidden]), select, textarea, .grid, label, .check) ~ p:has(> button, > .btn),
form > :is(input:not([type=hidden]), select, textarea, .grid, label, .check) ~ :is(button, .btn) { margin-top: 16px; }
.row > form > p { margin: 0; }
form > p:has(> button):last-child { margin-bottom: 0; }
/* fields side by side: labels may wrap to two lines, so align the controls on a common baseline */
.grid > div:has(> label + :is(input, select, textarea):last-child) { display: flex; flex-direction: column; justify-content: flex-end; }
/* checkboxes: consistent box in both themes */
input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 5px;
  border: 1.5px solid var(--line-strong); background: var(--panel); display: inline-grid; place-content: center; cursor: pointer; }
input[type=checkbox]::before { content: ""; width: 11px; height: 11px; transform: scale(0); transition: transform .12s ease;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: var(--accent-ink); }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::before { transform: scale(1); }
input[type=checkbox]:disabled { opacity: .55; cursor: not-allowed; }
input[type=file] { color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; font-size: 14px; color: var(--ink); background: var(--sunk);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 8px 14px; margin-right: 12px; cursor: pointer; }
.tlist { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.tlist li { padding: 2px 0; }
.tlist li + li { border-top: 1px dashed var(--line); padding-top: 4px; margin-top: 2px; }
details.more > summary { font-size: 13px; min-height: 0; padding: 4px 0; }
.notice { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px;
  margin-bottom: var(--gap); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius);
  background: var(--panel); }

/* ---- Form footer and secondary action blocks ---- */
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.subsect { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.subsect-text { flex: 1 1 240px; min-width: 0; }
.subsect-text h3 { margin: 0 0 4px; }
.subsect-text p { margin: 0; }
.subsect > form { flex: 0 0 auto; margin: 0; }

/* ---- Copyable prompt block ---- */
.copy-box { position: relative; }
.copy-box pre { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 14px;
  max-height: 340px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.5; margin: 0; }
.steps { padding-left: 20px; margin: 8px 0 0; }
.steps li { margin: 6px 0; }
.ctx-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.intro { max-width: 72ch; margin-top: -4px; }
.ctx-status { padding-top: 12px; padding-bottom: 12px; }
.form-actions + p, form + p.muted { margin-top: 10px; }

/* ---- Page-level rhythm: every top-level block is separated from the next, whatever it is ---- */
main.wrap > .row { margin-bottom: 18px; }
main.wrap > .row.between { align-items: flex-end; row-gap: 14px; }
main.wrap > .row.between h1 { margin-bottom: 4px; }
main.wrap > .row.between p { margin-bottom: 0; }
main.wrap > :is(form, .filters, .tabs, .stepper, .notice, .table-wrap, table, details):not(:last-child) { margin-bottom: var(--gap); }
.panel > .row + :is(.flash, p, table, .table-wrap, form, .grid, .tlist, dl, div) { margin-top: 12px; }

/* ---- Modifier conditions ---- */

/* ---- Any label wrapping a checkbox or radio keeps a gap between box and text ---- */
label:not(.check):has(> input[type=checkbox], > input[type=radio]) { display: inline-flex; align-items: center; gap: 8px; }
.check, .inline-check { column-gap: 8px; }
@container (min-width: 641px) { .reason-cell { min-width: 150px; } }
@container (min-width: 1000px) { .reason-cell { min-width: 240px; } }

/* ---- Modifier conditions: one bordered, labelled box per group ---- */
.cgroup { border: 1px solid var(--line); border-radius: var(--radius-s); margin: 0; padding: 6px 12px 10px; min-width: 0; }
.cgroup legend { padding: 0 6px; margin-left: -6px; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.cgroup legend span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.cgroup .items { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.cgroup .check { display: inline-flex; align-items: center; gap: 8px; margin: 0; min-height: 32px; font-weight: 400; }
.cgroup .check input { margin: 0; }
.cflags .items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 8px 20px; }
.cflags label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; font-weight: 400; }
.cgroup legend span { white-space: nowrap; }
.cflags label > select { flex: none; }
td.adj { min-width: 92px; }
td.adj select { min-width: 76px; }
/* Stacked (phone) view: the conditions get the full card width, with their label above */
@container (max-width: 640px) {
  table.stack td.cond-cell { padding-left: 0; }
  table.stack td.cond-cell::before { position: static; display: block; width: auto; margin-bottom: 8px; }
  td.adj { min-width: 0; }
}

/* ---- Danger zone and budget meter ---- */
details.danger-zone { margin-top: 20px; border: 1px solid color-mix(in srgb, var(--err) 40%, var(--line)); border-radius: var(--radius-s); padding: 0 14px; }
details.danger-zone > summary { cursor: pointer; padding: 12px 0; color: var(--err); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
details.danger-zone[open] { padding-bottom: 14px; }
.meter { margin: 4px 0 12px; }
.meter.near i { background: var(--high); }
.meter.over i { background: var(--err); }
.injection { border-left: 3px solid var(--err); }
.notice.notice-err { border-left-color: var(--err); }
.narrow-panel { max-width: 640px; margin: 4vh auto 0; }

/* ---- Sign-in methods and passkeys ---- */
.methods { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.methods li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-s); }
.methods .m-name { font-weight: 650; }
.methods .m-desc { grid-column: 1; color: var(--muted); font-size: 13px; }
.methods li > .badge, .methods li > a { grid-column: 2; grid-row: 1 / span 2; justify-self: end; }
.methods li > a { grid-row: auto; font-size: 13px; }
.passkey-add { margin-top: 12px; }
.err-text { color: var(--err); }

/* ---- Sign-in page ---- */
.signin-options { display: grid; gap: 10px; margin-top: 14px; }
.signin-options .passkey-msg:empty { display: none; }
.sso-off { margin: -4px 0 0; text-align: center; }
button:disabled, .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 14px; }
.label-row label { margin: 0; }

/* ------------------------------------------------------------------ installed (home-screen) app */
button.app-back { flex: none; font-weight: 600; padding: 8px 4px; margin-right: -8px; min-height: 44px; }
@media (max-width: 420px) { html.standalone .brand span { display: none; } }
