/*
 * Red Shadow Security: vCISO Workspace
 *
 * The idea: a dark rail carries the five-stage engagement loop, and each view to its right
 * is a plain ledger under a short summary. Red belongs to the brand and to things that are
 * wrong; it never means "click here". Data marks are teal. Green, amber and red always come
 * with an icon and a word.
 *
 * The display face (Big Shoulders) always speaks in capitals, as the Red Shadow wordmark
 * does. The body face (IBM Plex Sans) never does.
 */

@font-face { font-family: "Big Shoulders Display"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/big-shoulders-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Big Shoulders Display"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/big-shoulders-display-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;

  /* Brand. To rebrand, change these and assets/brand.js. */
  --red: #D7332A;
  --shadow: #0B151C;
  --shadow-2: #14262F;
  --shadow-line: #23404B;
  --on-shadow: #F2F5F6;
  --on-shadow-muted: #93A4AD;

  /* Surfaces and ink: cool neutrals that lean toward the brand's teal-black. */
  --paper: #F3F5F6;
  --surface: #FFFFFF;
  --surface-2: #E9EDEF;
  --ink: #0F1A20;
  --ink-2: #3F4D55;
  --muted: #5A6870;
  --line: #D5DBDF;
  --btn: #0B151C;
  --on-btn: #FFFFFF;

  /* Data marks and state. */
  --teal: #028A9B;        /* checked with the dataviz palette validator against --surface */
  --teal-track: #D0E8EC;
  --link: #1A5F67;
  --good: #0CA30C;
  --warn: #FAB219;
  --bad: #D03B3B;
  --focus: #1F6F78;

  --font-display: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", Impact, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 6px;
  --bar-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --red: #F0483D;
    --shadow: #070D12;
    --shadow-2: #101E26;
    --shadow-line: #1E3640;
    --paper: #0A1218;
    --surface: #111C23;
    --surface-2: #18262E;
    --ink: #EEF2F4;
    --ink-2: #C2CDD3;
    --muted: #8FA0A9;
    --line: #25343D;
    --btn: #EEF2F4;
    --on-btn: #0A1218;
    --teal: #13A5B2;
    --teal-track: #12383D;
    --link: #7CCBD5;
    --bad: #E0605F;
    --focus: #56B6C2;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol { margin: 0; }
a { color: var(--link); text-underline-offset: 2px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.92em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -48px; z-index: 50; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: var(--radius); }
.skip:focus { top: 8px; }
.noscript { margin: 24px; }

/* ---------- shell ---------- */

.app {
  min-height: 100%;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: var(--bar-h) 1fr;
  grid-template-areas: "bar bar" "rail main";
}
.bar, .rail {
  background-color: var(--shadow);
  background-image:
    linear-gradient(to right, rgba(86, 182, 194, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(86, 182, 194, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--on-shadow);
}
.bar {
  grid-area: bar;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--shadow-line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--on-shadow); min-width: 0; }
.brand-mark { flex: none; width: 14px; height: 14px; background: var(--red); box-shadow: 4px 4px 0 var(--shadow-line); margin-right: 4px; }
.brand-logo { flex: none; height: 32px; width: auto; display: block; }
.brand-name { font: 800 24px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.035em; white-space: nowrap; }
.brand-product { font-size: 13px; color: var(--on-shadow-muted); white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--shadow-line); }
.bar-fill { flex: 1; }
.bar select {
  font: 500 14px var(--font-body);
  color: var(--on-shadow);
  background: var(--shadow-2);
  border: 1px solid var(--shadow-line);
  border-radius: var(--radius);
  padding: 7px 10px;
  max-width: 280px;
  min-width: 0;
}
.save { font-size: 12.5px; color: var(--on-shadow-muted); white-space: nowrap; }
.save[data-state="error"] { color: #FFB4AE; font-weight: 600; }
.bar .btn { background: transparent; color: var(--on-shadow); border-color: var(--shadow-line); }
.bar .btn:hover { border-color: var(--on-shadow-muted); }
.bar :focus-visible, .rail :focus-visible { outline-color: #7CCBD5; }

.rail {
  grid-area: rail;
  position: sticky;
  top: var(--bar-h);
  align-self: start;
  height: calc(100vh - var(--bar-h));
  overflow-y: auto;
  padding: 16px 12px 24px;
  border-right: 1px solid var(--shadow-line);
  font-size: 14px;
}
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--on-shadow);
  border-left: 2px solid transparent;
}
.nav-link:hover { background: var(--shadow-2); }
.nav-link[aria-current="page"] { background: var(--shadow-2); border-left-color: var(--red); font-weight: 600; }
.nav-client { margin: 14px 10px 6px; font-size: 12.5px; color: var(--on-shadow-muted); overflow-wrap: anywhere; }
.count {
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 20px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--shadow-line);
  color: var(--on-shadow);
}
.count[data-tone="bad"] { background: #D03B3B; color: #FFFFFF; }
.count[data-tone="warn"] { background: #FAB219; color: #0B0B0B; }

/* the loop: five numbered stages on one line, the open stage lit */
.loop { list-style: none; margin: 10px 0 0; padding: 0; position: relative; }
.loop::before { content: ""; position: absolute; left: 12px; top: 14px; bottom: 30px; width: 1px; background: var(--shadow-line); }
.stage { position: relative; padding: 0 0 10px 34px; }
.stage-n {
  position: absolute;
  left: 0;
  top: 2px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 15px/1 var(--font-display);
  background: var(--shadow);
  border: 1px solid var(--shadow-line);
  color: var(--on-shadow-muted);
}
.stage[data-here="1"] .stage-n { background: var(--red); border-color: var(--red); color: #FFFFFF; }
.stage-name { display: block; padding: 6px 10px 3px; font: 700 15px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; color: var(--on-shadow-muted); }
.stage[data-here="1"] .stage-name { color: var(--on-shadow); }
.loop-back { margin: 2px 0 0 34px; padding: 0 10px; font-size: 12.5px; color: var(--on-shadow-muted); }

main { grid-area: main; min-width: 0; padding: 28px 32px 72px; }
main > * { max-width: 1180px; }
.loading { color: var(--muted); }

/* ---------- view header ---------- */

.vh { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.vh h1 { font: 800 44px/0.95 var(--font-display); text-transform: uppercase; letter-spacing: 0.015em; text-wrap: balance; overflow-wrap: anywhere; margin-bottom: 8px; }
.lede { color: var(--ink-2); max-width: 68ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
h2.sec { font: 700 24px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; margin: 30px 0 10px; }
.sec-note { color: var(--muted); font-size: 13.5px; margin: 10px 0; max-width: 80ch; }
h2.sec + .sec-note { margin-top: -4px; }

/* ---------- controls ---------- */

.btn {
  font: 500 14px/1.2 var(--font-body);
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--on-btn); font-weight: 600; }
.btn.primary:hover { opacity: 0.88; }
.btn.destroy { background: var(--bad); border-color: var(--bad); color: #FFFFFF; font-weight: 600; }
.btn.small { padding: 5px 9px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; }
.link.strong { color: var(--ink); font-weight: 600; text-decoration: none; }
.link.strong:hover { text-decoration: underline; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
}
select.inline, input.inline { padding: 4px 6px; font-size: 13.5px; }
input.inline.num { width: 76px; text-align: right; }

/* ---------- tables ---------- */

/* position: relative keeps the visually hidden labels inside from widening the page */
.scroll-x { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th {
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: color-mix(in srgb, var(--teal) 5%, var(--surface)); }
.grid .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
.grid td.act, .grid td.nw { white-space: nowrap; }
.grid td.act { text-align: right; }
.sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; font-weight: 400; }
.dim { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 3px; margin: 2px 4px 0 0; color: var(--ink-2); white-space: nowrap; }

/* ---------- state: always an icon and a word ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 2px 9px 2px 3px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  white-space: nowrap;
}
.pill i {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 11px/1 var(--font-body);
  font-style: normal;
  background: var(--muted);
  color: #FFFFFF;
}
.pill.mark { padding: 3px; background: none; }
.pill[data-tone="good"] { background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.pill[data-tone="good"] i { background: var(--good); }
.pill[data-tone="warn"] { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); }
.pill[data-tone="warn"] i { background: var(--warn); color: #0B0B0B; }
.pill[data-tone="bad"] { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.pill[data-tone="bad"] i { background: var(--bad); }
.pill[data-tone="info"] { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); }
.pill[data-tone="info"] i { background: var(--link); color: var(--surface); }
.pill.mark[data-tone] { background: none; }

/* ---------- figures: one ruled band, not a row of cards ---------- */

.figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.figure { padding: 14px 18px 13px; border-left: 1px solid var(--line); min-width: 0; }
.figure:first-child { border-left: 0; }
.figure .label { font-size: 13px; color: var(--muted); }
.figure .value { font-size: 28px; font-weight: 600; line-height: 1.25; margin: 2px 0; overflow-wrap: anywhere; }
.figure .note { font-size: 12.5px; color: var(--muted); }

.meter { display: inline-block; vertical-align: middle; width: 64px; height: 8px; border-radius: 4px; background: var(--teal-track); overflow: hidden; margin-right: 8px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--teal); }

.bars { display: grid; grid-template-columns: minmax(110px, 36%) minmax(0, 1fr) auto; gap: 9px 12px; align-items: center; font-size: 14px; }
.bars .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { display: block; height: 14px; border-left: 1px solid var(--line); cursor: default; }
.track i { display: block; height: 100%; width: 0; min-width: 2px; background: var(--teal); border-radius: 0 4px 4px 0; }
.track:hover i, .track:focus-visible i { background: color-mix(in srgb, var(--teal) 76%, var(--ink)); }
.bars .val, .idle .val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.idle { display: grid; grid-template-columns: minmax(70px, 1fr) 82px; gap: 10px; align-items: center; min-width: 180px; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.panel.after { margin-top: 24px; }
.panel h2, .panel h3 { font: 700 19px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; }
.panel h3 { margin-bottom: 4px; }
.cols.after { margin-top: 24px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.contacts { list-style: none; margin: 0; padding: 0; }
.contacts li { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.contacts li:first-child { border-top: 0; padding-top: 0; }
.contacts li > div { min-width: 0; overflow-wrap: anywhere; }
.tag.spend { font-weight: 500; }
th.group { text-align: center; border-bottom: 1px solid var(--line); }
.todo { list-style: none; padding: 0; display: grid; gap: 9px; }
.todo li { display: flex; gap: 8px; align-items: flex-start; }
.todo a { color: var(--ink); text-decoration: none; }
.todo a:hover { text-decoration: underline; }
.plain { list-style: none; padding: 0; margin-top: 8px; display: grid; gap: 4px; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--teal); background: var(--surface); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.notice.warn { border-left-color: var(--warn); }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px 28px; text-align: center; color: var(--ink-2); background: var(--surface); }
.empty h2 { font: 700 26px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 6px; color: var(--ink); }
.empty p { max-width: 62ch; margin: 0 auto; }
.empty .actions { justify-content: center; margin-top: 16px; }
.foot-note { margin-top: 12px; font-size: 13px; color: var(--muted); max-width: 90ch; }

.moves { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; font-size: 14px; max-width: 440px; }
.moves .n { text-align: right; font-variant-numeric: tabular-nums; }
.moves .total { font-weight: 600; border-top: 1px solid var(--line); padding-top: 6px; }
.assume { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 14px; color: var(--ink-2); }
.assume label { font-weight: 500; color: var(--ink); }
.overlap { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

/* ---------- controls: a client against its standard ---------- */

.ctl-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 6px; }
.ctl-sum strong { font-size: 20px; font-weight: 600; margin-right: 6px; }
.grid tbody th[scope="row"] { text-align: left; font-weight: 500; font-size: 14px; color: var(--ink); background: none; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: normal; }
.grid tbody tr:last-child th[scope="row"] { border-bottom: 0; }
.areas td:last-child { width: 30%; min-width: 140px; vertical-align: middle; }
/* one bar per area; each segment is a state, with a 2px gap so adjacent states never merge */
.seg-bar { display: flex; gap: 2px; height: 12px; }
.seg { display: block; height: 100%; width: 0; min-width: 3px; border-radius: 2px; background: var(--muted); }
.seg[data-state="met"] { background: var(--good); }
.seg[data-state="partial"] { background: var(--warn); }
.seg[data-state="gap"] { background: var(--bad); }
.seg[data-state="na"] { background: var(--line); }
.seg[data-state="open"] { background: var(--teal-track); }
/* minmax(0, 1fr): the column may be narrower than the open section's table, which then scrolls */
.sections { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.sect { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sect h3 { font: inherit; }
.sect-head {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 10px 14px;
  background: none;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.sect-head:hover { background: color-mix(in srgb, var(--teal) 5%, var(--surface)); }
.sect-name { font-weight: 600; }
.sect-name::before { content: "+"; display: inline-block; width: 16px; color: var(--muted); font-weight: 400; }
.sect.open .sect-name::before { content: "\2013"; }
.sect-count { color: var(--muted); font-size: 13px; }
.sect .scroll-x { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.reqs td:first-child { min-width: 260px; }
.req-name { font-weight: 500; }
.req-text { display: block; color: var(--ink-2); margin-top: 2px; max-width: 78ch; }
.reqs select.inline { max-width: 230px; }
.reqs .plan { font-size: 13px; margin-right: 10px; }
.uncovered { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 4px; font-size: 14px; }
/* several checkboxes under one heading, folded away until wanted */
details.checks { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
details.checks summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.check-list { display: grid; gap: 6px; margin-top: 10px; max-height: 240px; overflow-y: auto; }
/* a row of buttons inside a form, such as "load a standard" */
.form-actions { border-top: 1px solid var(--line); padding-top: 12px; }
.form-actions-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-actions .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-actions .hint:empty { display: none; }
.form-actions [role="status"] { color: var(--ink); font-weight: 500; }
.reqs .act .btn + .btn { margin-left: 6px; }

/* ---------- priority grid ---------- */

.pgrid { display: grid; grid-template-columns: 76px repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.rowlab { font-size: 12.5px; color: var(--muted); align-self: center; line-height: 1.3; }
.collab { font-size: 12.5px; color: var(--muted); text-align: center; padding-top: 2px; }
.cell { min-height: 112px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.cell.first { background: color-mix(in srgb, var(--teal) 9%, var(--surface)); }
.cell.over { outline: 2px dashed var(--teal); outline-offset: -2px; }
.cap { font-size: 12px; font-weight: 600; color: var(--muted); }
.chip {
  font: 400 13px/1.3 var(--font-body);
  text-align: left;
  padding: 5px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  color: var(--ink);
  cursor: grab;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.chip[data-status="funded"] { font-weight: 600; background: color-mix(in srgb, var(--teal) 14%, var(--surface)); }
.chip[data-status="declined"] { border-left-color: var(--muted); color: var(--muted); text-decoration: line-through; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 22px; }
.legend .proposed, .legend .funded, .legend .declined { padding-left: 8px; border-left: 3px solid var(--teal); }
.legend .funded { font-weight: 600; color: var(--ink-2); }
.legend .declined { border-left-color: var(--muted); text-decoration: line-through; }

/* ---------- quarterly pack ---------- */

.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; margin-bottom: 14px; }
.sheet h2 { font: 700 24px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 12px; padding-left: 10px; border-left: 4px solid var(--red); }
.sheet h3 { font-size: 14px; font-weight: 600; margin: 14px 0 4px; }
.sheet ul { padding-left: 20px; display: grid; gap: 5px; }
.sheet .scroll-x { margin-top: 10px; }
.sheet .after { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.sheet.cover { background: var(--shadow); color: var(--on-shadow); border-color: var(--shadow-line); padding: 28px 26px; }
.cover .who { font: 800 17px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; min-height: 17px; }
.cover .rule { width: 56px; height: 5px; background: var(--red); margin: 26px 0 14px; }
.cover h2 { border: 0; padding: 0; font-size: 40px; font-weight: 800; margin-bottom: 6px; overflow-wrap: anywhere; }
.cover p { color: var(--on-shadow-muted); }
.mini { display: grid; grid-template-columns: 64px repeat(3, minmax(0, 1fr)); gap: 4px; font-size: 12.5px; }
.mini .cell { min-height: 74px; padding: 6px 8px; gap: 3px; }
.mini .t { line-height: 1.3; overflow-wrap: anywhere; hyphens: auto; }

/* ---------- dialog, toast, tooltip ---------- */

dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  width: min(660px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
}
dialog::backdrop { background: rgba(7, 13, 18, 0.6); }
#dlgForm { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dlg-head { padding: 18px 22px 0; }
.dlg-head h2 { font: 800 30px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.dlg-head p { color: var(--ink-2); font-size: 14px; margin-top: 8px; }
.dlg-body { position: relative; padding: 16px 22px 18px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; overflow-y: auto; }
.field { min-width: 0; }
.dlg-body > .wide { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
.field textarea { resize: vertical; min-height: 64px; display: block; }
.field.check { display: flex; gap: 8px; align-items: flex-start; align-self: end; padding-bottom: 8px; }
.field.check input { width: auto; margin: 4px 0 0; }
.field.check label { margin: 0; font-weight: 400; font-size: 14px; }
.hint { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.form-head { font: 700 15px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 8px 0 -4px; padding-top: 10px; border-top: 1px solid var(--line); }
.dlg-body > .form-head:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.dlg-foot { padding: 12px 22px 16px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 18px; }
.dlg-body + .dlg-foot { margin-top: 0; }
.dlg-foot .left { margin-right: auto; }
.dlg-error { grid-column: 1 / -1; color: var(--bad); font-size: 13.5px; font-weight: 500; }
.preview { position: relative; max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 6px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--shadow);
  color: var(--on-shadow);
  border: 1px solid var(--shadow-line);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  width: max-content;
  max-width: min(640px, calc(100vw - 24px));
  display: flex;
  gap: 14px;
  align-items: center;
}
.toast[data-kind="error"] { border-color: #D03B3B; border-left-width: 4px; }
.toast a { color: var(--on-shadow); font-weight: 600; white-space: nowrap; }
.toast .btn { background: transparent; color: var(--on-shadow); border-color: var(--on-shadow-muted); }
.tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 70;
  pointer-events: none;
  background: var(--shadow);
  color: var(--on-shadow);
  border: 1px solid var(--shadow-line);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12.5px;
  max-width: 280px;
}
.tip b { display: block; font-size: 13.5px; font-weight: 600; }
.tip span { display: block; }

/* ---------- narrow screens ---------- */

@media (max-width: 1080px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(odd) { border-left: 0; }
  .figure:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "bar" "rail" "main"; }
  .bar { flex-wrap: wrap; padding: 8px 14px; gap: 8px 10px; position: static; }
  .brand-name { font-size: 20px; }
  .brand-product, .save, .bar-fill { display: none; }
  .bar select { flex: 1 1 140px; }
  .rail { position: sticky; top: 0; z-index: 15; height: auto; display: flex; gap: 4px; overflow-x: auto; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--shadow-line); }
  .loop, .stage { display: contents; }
  .loop::before, .stage-n, .stage-name, .loop-back, .nav-client { display: none; }
  .nav-link { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; border-radius: var(--radius) var(--radius) 0 0; }
  .nav-link[aria-current="page"] { border-bottom-color: var(--red); }
  main { padding: 20px 14px 64px; }
  .vh h1 { font-size: 34px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .dlg-body { grid-template-columns: minmax(0, 1fr); }
  .pgrid { grid-template-columns: 52px repeat(3, minmax(0, 1fr)); gap: 4px; }
  .cell { padding: 6px; }
  .mini { grid-template-columns: 52px repeat(3, minmax(0, 1fr)); }
  .sheet { padding: 18px 16px; }
}

/* On a phone each requirement is a block: its text first, then its rating, state and note
   on one line, so answering never needs a sideways scroll. */
@media (max-width: 640px) {
  .reqs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .reqs, .reqs tbody { display: block; }
  .reqs tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .reqs tbody tr:last-child { border-bottom: 0; }
  .reqs td, .reqs tbody tr:hover td { display: block; padding: 0; border: 0; background: none; }
  .reqs td:first-child { flex: 1 0 100%; min-width: 0; }
  .reqs td.act { margin-left: auto; }
  .reqs select.inline { max-width: 100%; }
}

@media (max-width: 520px) {
  .figures { grid-template-columns: minmax(0, 1fr); }
  .figure { border-left: 0; }
  .figure + .figure { border-top: 1px solid var(--line); }
  .bars { grid-template-columns: minmax(84px, 40%) minmax(0, 1fr) auto; gap: 8px; }
  .bars .name { white-space: normal; line-height: 1.25; }
}

/* ---------- print: the quarterly pack on paper or as a PDF ---------- */

@media print {
  :root { --paper: #FFFFFF; --surface: #FFFFFF; --surface-2: #F2F5F6; --ink: #0F1A20; --ink-2: #3F4D55; --muted: #5A6870; --line: #D5DBDF; --teal: #028A9B; --red: #D7332A; --bad: #D03B3B; --link: #0F1A20; }
  body { background: #FFFFFF; font-size: 12px; }
  .app { display: block; }
  .bar, .rail, .vh, .toast, .tip, .no-print, dialog { display: none !important; }
  main { padding: 0; }
  main > * { max-width: none; }
  .sheet { break-inside: avoid; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 0; margin: 0; }
  .sheet.cover { background: #FFFFFF; color: var(--ink); padding: 0 0 14px; }
  .cover p { color: var(--muted); }
  .scroll-x { overflow: visible; }
}
