/* vCFO Cockpit
 *
 * A cockpit, not a brochure. Kripa's deep teal and gold, but the field is a
 * warm grey-ivory so white surfaces lift off it — the old flat-on-flat paper
 * was why nothing read as a panel. Type is the brand's own: Fraunces for
 * titles, Karla for the interface, IBM Plex Mono for every figure. All three
 * ship with the app, so it looks the same on a factory-floor machine with no
 * internet as it does here.
 *
 * The one loud thing is the figure tape — the row of numbers a CFO reads
 * first. Everything else stays quiet on purpose.
 */

/* ------------------------------------------------------------- faces --- */

@font-face {
  font-family: 'Fraunces'; src: url('../fonts/fraunces.woff2') format('woff2-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Karla'; src: url('../fonts/karla.woff2') format('woff2-variations');
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono'; src: url('../fonts/plexmono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono'; src: url('../fonts/plexmono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --teal: #0B3B36;
  --teal-deep: #072B27;
  --teal-700: #14514A;
  --teal-300: #7FB3A8;
  --teal-wash: #E6F0ED;
  --gold: #C9A227;
  --gold-soft: #F6EBC8;

  --field: #EFEDE6;
  --surface: #FFFFFF;
  --surface-2: #F8F7F3;
  --ink: #10201D;
  --ink-2: #344743;
  --muted: #6B7B77;
  --line: #E2E0D7;
  --line-strong: #C8C5B8;

  --good: #2C6E5D;
  --warn: #8C6410;
  --bad: #A8402C;

  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Karla', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --rail: 250px;
  --console: 412px;

  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;

  --lift: 0 1px 2px rgba(16, 32, 29, .04), 0 10px 24px -18px rgba(16, 32, 29, .30);
  --lift-high: 0 24px 60px -28px rgba(7, 43, 39, .45);
}

* { box-sizing: border-box; }

/* A class that sets `display` outruns the browser's own [hidden] rule, which is
 * why the assistant panel and the toast were on screen permanently. This puts
 * the attribute back in charge. */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--field);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--serif); font-weight: 600; margin: 0;
  font-variation-settings: 'SOFT' 0, 'WONK' 0;
  letter-spacing: -0.012em; line-height: 1.2;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .96rem; }
p { margin: 0; }

button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 3px; }

.num, .fig {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-weight: 500; letter-spacing: -0.025em;
}
.pos { color: var(--good); }
.neg { color: var(--bad); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CFCDC3; border: 3px solid var(--field); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #B4B1A5; }

/* ------------------------------------------------------------- layout --- */

.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
}
.app.with-console { grid-template-columns: var(--rail) minmax(0, 1fr) var(--console); }

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* --------------------------------------------------------------- rail --- */

.rail {
  background: linear-gradient(180deg, var(--teal) 0%, var(--teal-deep) 100%);
  color: #DCE9E6;
  display: flex; flex-direction: column;
  padding: 16px 12px 12px;
  min-height: 0;
  overflow-y: auto;
}
.rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-color: transparent; }

.mark { display: flex; align-items: center; gap: 11px; padding: 2px 6px 18px; }
.mark-k {
  /* The kit's own mark, reverse variant. It carries its own colour and its own
   * optical centring — no tile, no border, nothing drawn around it. Clear space
   * is one K-stem all round, which is what the padding below buys. */
  width: 38px; height: 38px; flex: 0 0 38px; display: block;
}
.mark { gap: 13px; padding: 4px 6px 20px; }
.mark-name { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; color: #F2F7F5; }
.mark-name em { font-style: normal; font-size: 11px; font-weight: 400; color: var(--teal-300); letter-spacing: .01em; }

.company {
  width: 100%; text-align: left; margin-bottom: 20px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: var(--r-md); padding: 11px 13px;
  color: inherit; transition: background .12s ease, border-color .12s ease;
}
.company:hover { background: rgba(255, 255, 255, .10); border-color: rgba(201, 162, 39, .5); }
.company-name { display: block; font-weight: 600; font-size: 13.5px; color: #FFFFFF; line-height: 1.3; }
.company-period {
  display: block; margin-top: 4px; font-family: var(--mono);
  font-size: 11px; color: var(--teal-300); letter-spacing: -.01em;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group {
  font-size: 11px; color: #7FA49C; padding: 16px 10px 6px;
  letter-spacing: .02em;
}
.nav-group:first-child { padding-top: 2px; }
.nav button {
  position: relative; display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: none; border: 0; border-radius: var(--r-sm);
  padding: 8px 11px; color: #CBDDD9; font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.nav button:hover { background: rgba(255, 255, 255, .07); color: #FFFFFF; }
.nav button[aria-current="true"] {
  background: rgba(255, 255, 255, .11); color: #FFFFFF; font-weight: 600;
}
.nav button[aria-current="true"]::before {
  content: ''; position: absolute; left: -12px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}
.nav .tag { margin-left: auto; }

.tag {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  padding: 1px 6px; border-radius: 99px; background: rgba(255,255,255,.14); color: #EAF2F0;
}
.tag.alert { background: rgba(168, 64, 44, .9); color: #FFF1ED; }

.rail-foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.rail-foot .ghost {
  background: transparent; border: 1px solid rgba(255, 255, 255, .16);
  color: #CBDDD9; border-radius: var(--r-sm); padding: 8px 11px; font-size: 13px;
  text-align: left; transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.rail-foot .ghost:hover { border-color: rgba(201,162,39,.6); color: #FFFFFF; background: rgba(255,255,255,.06); }
.rail-note {
  font-size: 10.5px; color: #7FA49C; font-family: var(--mono);
  margin-top: 6px; padding: 0 2px; line-height: 1.4;
}

/* ------------------------------------------------------------- topbar --- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 26px; background: var(--surface);
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.crumb h1 { font-size: 1.32rem; }
.crumb p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.period {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
}
.period input {
  font: inherit; font-family: var(--mono); font-size: 12.5px; color: var(--ink);
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--r-sm); padding: 6px 8px;
}
.period input:focus { border-color: var(--teal-300); outline: none; background: var(--surface); }

.ghost {
  background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--ink); border-radius: var(--r-sm); padding: 7px 13px; font-size: 13px;
  transition: border-color .12s ease, background .12s ease;
}
.ghost:hover { border-color: var(--teal); background: var(--surface-2); }
.ghost.small { padding: 5px 10px; font-size: 12px; }

.primary {
  background: var(--teal); border: 1px solid var(--teal); color: #F4FAF8;
  border-radius: var(--r-sm); padding: 8px 15px; font-size: 13px; font-weight: 600;
  transition: background .12s ease;
}
.primary:hover { background: var(--teal-700); }
.primary:disabled { opacity: .5; cursor: default; }

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

.view { padding: 22px 26px 32px; overflow-y: auto; flex: 1; min-height: 0; }
.view > * + * { margin-top: 20px; }

.cols { display: grid; gap: 20px; }
.cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid2 { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--lift);
}
.panel + .panel { margin-top: 20px; }

.section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.section-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------------------------------------------------- the figure tape --- */

.tape {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr));
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--lift);
}
.tape > div {
  padding: 15px 18px 16px;
  border-right: 1px solid var(--line); border-top: 1px solid var(--line);
}
.tape > div:last-child { border-right: 0; }
.tape > div:nth-child(-n+6) { border-top: 0; }

.tape dt { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tape dd {
  margin: 0; font-family: var(--mono); font-weight: 500;
  font-size: 1.42rem; letter-spacing: -0.035em; line-height: 1.1;
}
.tape .sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.35; }

.tape > div.lead {
  background: linear-gradient(160deg, var(--teal) 0%, var(--teal-deep) 100%);
  border-right-color: var(--teal-deep); border-top-color: var(--teal);
}
.lead dt { color: var(--gold); }
.lead dd { color: #FFFFFF; }
.lead .sub { color: #9FC3BB; }

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

.scroll { overflow-x: auto; }

table.stmt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stmt th {
  text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted);
  padding: 0 12px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.stmt th.r, .stmt td.r { text-align: right; }
.stmt td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.stmt tbody tr:last-child td { border-bottom: 0; }
.stmt td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.stmt tr.sub td { color: var(--ink-2); padding-left: 26px; font-size: 13px; }
.stmt tr.sub td.num { padding-left: 12px; }
.stmt tr.head td { font-weight: 600; background: var(--surface-2); font-size: 12.5px; }
.stmt tr.total td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.stmt tr.grand td {
  font-weight: 700; border-top: 1px solid var(--ink);
  border-bottom: 3px double var(--ink); background: var(--surface-2);
}
.stmt tr.click { cursor: pointer; }
.stmt tr.click:hover td { background: var(--teal-wash); }

.row-label { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------ findings --- */

.finding {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.finding:last-child { border-bottom: 0; }
.finding:first-child { padding-top: 0; }
.finding h3 { font-family: var(--sans); font-size: 14px; font-weight: 600; }
.finding p { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

.sev {
  flex: 0 0 auto; align-self: flex-start; margin-top: 1px;
  font-size: 11px; padding: 3px 9px; border-radius: 99px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.sev.high { background: #FBEAE6; color: var(--bad); border-color: #F0CFC8; }
.sev.medium { background: var(--gold-soft); color: var(--warn); border-color: #E8D7A4; }
.sev.low { background: var(--teal-wash); color: var(--good); border-color: #CFE2DC; }

.items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 99px; padding: 3px 10px;
}

/* -------------------------------------------------------------- charts --- */

.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); letter-spacing: -.02em; }
.axis-line { stroke: var(--line); stroke-width: 1; }
.spark { display: block; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend-row > span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }

.bar-track {
  display: flex; background: var(--surface-2); border-radius: 99px;
  overflow: hidden; height: 9px;
}
.bar-track i { display: block; height: 100%; flex: 0 0 auto; }

.donut-label { font-size: 11.5px; fill: var(--muted); }
.donut-value { font-family: var(--mono); font-size: 15px; font-weight: 500; fill: var(--ink); }

/* -------------------------------------------------------------- empty --- */

.empty {
  background: var(--surface); border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg); padding: 46px 30px; text-align: center;
}
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--muted); font-size: 13.5px; max-width: 52ch; margin: 0 auto 16px; }

.spacer { flex: 1; }
.loading { color: var(--muted); font-size: 13px; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; opacity: .8; }
  * { transition: none !important; }
}

/* ------------------------------------------------------------ console --- */

.console {
  border-left: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
}
.console-top {
  padding: 15px 18px 13px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.console-top h2 { font-size: 1.05rem; }
.console-top p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.console-top-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.hats { display: flex; gap: 6px; padding: 11px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hat {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px;
  padding: 4px 12px; font-size: 12px; color: var(--muted);
  transition: border-color .12s ease, color .12s ease;
}
.hat:hover { border-color: var(--teal-300); color: var(--ink); }
.hat[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #F2F8F6; }

.thread {
  flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 15px; min-height: 0;
}
.msg { font-size: 13.5px; line-height: 1.55; }
.msg.user {
  align-self: flex-end; max-width: 88%; background: var(--teal); color: #F2F8F6;
  padding: 9px 13px; border-radius: 13px 13px 3px 13px;
}
.msg.bot { max-width: 100%; }
.msg.bot h4 { font-family: var(--sans); font-size: 13.5px; margin: 12px 0 4px; }
.msg.bot p + p { margin-top: 8px; }
.msg.bot ul, .msg.bot ol { margin: 7px 0; padding-left: 20px; }
.msg.bot li { margin: 3px 0; }
.msg.bot code {
  font-family: var(--mono); font-size: 12.5px; background: var(--surface-2);
  border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px;
}
.msg.bot table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 10px 0; }
.msg.bot th, .msg.bot td { border-bottom: 1px solid var(--line); padding: 5px 7px; text-align: left; }
.msg.bot th { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.msg.bot td:not(:first-child), .msg.bot th:not(:first-child) { text-align: right; font-family: var(--mono); }
.msg.err {
  color: var(--bad); font-size: 13px; background: #FBEAE6;
  border: 1px solid #F0CFC8; border-radius: var(--r-sm); padding: 9px 12px;
}

.tooluse {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  border-left: 2px solid var(--gold); padding: 3px 0 3px 11px;
}
.tooluse b { color: var(--teal); font-weight: 500; }

.cta {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 15px; background: var(--surface-2);
}
.cta h4 { font-family: var(--sans); font-size: 13px; margin: 0 0 5px; }
.cta pre {
  font-family: var(--sans); font-size: 12.5px; white-space: pre-wrap;
  margin: 6px 0 11px; color: var(--ink-2);
}
.cta-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.composer { border-top: 1px solid var(--line); padding: 12px 18px 15px; flex: 0 0 auto; }
.suggests { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.suggests button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 99px;
  padding: 5px 11px; font-size: 12px; color: var(--ink-2); text-align: left;
  transition: border-color .12s ease, background .12s ease;
}
.suggests button:hover { border-color: var(--teal-300); background: var(--surface-2); }
.composer textarea {
  width: 100%; font: inherit; font-size: 13.5px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
}
.composer textarea:focus { outline: none; border-color: var(--teal-300); box-shadow: 0 0 0 3px rgba(11, 59, 54, .07); }
.composer-row { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.hint { font-size: 11.5px; color: var(--muted); flex: 1; line-height: 1.35; }

/* ------------------------------------------------------------ dialogs --- */

dialog.dlg {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0;
  background: var(--surface); color: var(--ink);
  width: min(560px, 92vw); box-shadow: var(--lift-high);
}
dialog.dlg::backdrop { background: rgba(9, 32, 29, .42); backdrop-filter: blur(2px); }
dialog.dlg > h2, dialog.dlg > form > h2, dialog.dlg > .dlg-body > h2 { padding: 0 0 4px; }
dialog.dlg > h2 { padding: 20px 22px 0; }
.dlg-lede { padding: 6px 22px 0; font-size: 13.5px; color: var(--muted); }
.dlg > form, .dlg-body { padding: 18px 22px 20px; }
.dlg-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.dlg-help { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.45; }

.field { display: flex; flex-direction: column; gap: 5px; margin-top: 14px; }
.field:first-child, .grid2 > .field { margin-top: 0; }
.field > label, .field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.field input, .field select {
  font: inherit; font-size: 13.5px; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--teal-300); box-shadow: 0 0 0 3px rgba(11,59,54,.07); }
.field-note { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

.dlg .grid2 { gap: 14px; margin-top: 14px; }
.connector { display: flex; gap: 10px; align-items: flex-end; }
.connector .field { margin-top: 0; flex: 1; }
.connect-state { font-size: 12.5px; color: var(--muted); margin-top: 12px; font-family: var(--mono); }
.connect-state.bad { color: var(--bad); }
.drill-body { max-height: 60vh; overflow-y: auto; }

/* -------------------------------------------------------------- toast --- */

.toast {
  position: fixed; right: 26px; bottom: 24px;
  background: var(--teal-deep); color: #EAF3F1;
  padding: 11px 18px; border-radius: 99px; font-size: 13px;
  box-shadow: var(--lift-high); z-index: 60; max-width: min(430px, 60vw); line-height: 1.4;
}

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 1240px) {
  .app.with-console { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .app.with-console .console {
    position: fixed; inset: 0 0 0 auto; width: min(430px, 100%); z-index: 40;
    box-shadow: -18px 0 50px rgba(11, 59, 54, .18);
  }
  .cols.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app, .app.with-console { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .rail { flex-direction: row; align-items: center; gap: 10px; overflow-x: auto; padding: 10px 14px; }
  .rail .mark-name, .rail-foot { display: none; }
  .company { margin: 0; width: auto; flex: 0 0 auto; }
  .nav { flex-direction: row; }
  .nav-group { display: none; }
  .nav button { white-space: nowrap; }
  .nav button[aria-current="true"]::before { display: none; }
  .cols.two, .cols.three, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 16px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar-actions { flex-wrap: wrap; width: 100%; }
  /* A dense chart squeezed into a phone stops being a chart. Let it keep a
     workable width and scroll sideways instead. */
  .chart-slot { overflow-x: auto; }
}

/* ------------------------------------------------------------------ print --
   Ctrl+P, and "Save this screen as PDF". Statements should come out looking
   like statements: no navigation, no assistant, no buttons, and never a table
   row split across a page.                                                  */

@media print {
  @page { margin: 14mm 12mm; }

  html, body { background: #fff; height: auto; }
  .app { display: block; height: auto; overflow: visible; }
  .rail, .console, .topbar-actions, .rail-foot, .toast, dialog { display: none !important; }

  .topbar {
    position: static; border: 0; padding: 0 0 10px;
    border-bottom: 2px solid var(--ink); margin-bottom: 14px;
  }
  .crumb h1 { font-size: 18pt; }
  .crumb p { font-size: 9pt; }

  .view { padding: 0; overflow: visible; height: auto; }
  .view > * + * { margin-top: 14px; }

  .panel, .tape { box-shadow: none; border-color: #999; break-inside: avoid; page-break-inside: avoid; }
  .panel { padding: 0; border: 0; }
  table { break-inside: auto; }
  thead { display: table-header-group; }
  tr, .tape > div, .finding { break-inside: avoid; page-break-inside: avoid; }

  button { display: none !important; }
}

/* -------------------------------------------------- chart internals ----
   These sit inside SVG and deliberately do not share names with the layout
   classes above — an earlier `.connector` and `.row-label` collision meant the
   gridlines and the waterfall's step connectors were never drawn.          */

.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-link { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-cat { font-family: var(--sans); font-size: 11px; fill: var(--ink-2); }
.chart-legend { font-family: var(--sans); font-size: 12px; fill: var(--ink-2); }
.chart-legend.num { font-family: var(--mono); fill: var(--muted); }
.bar-label { font-family: var(--sans); font-size: 12.5px; fill: var(--ink-2); }
.chart .axis { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.chart-slot { width: 100%; min-width: 0; }
