/* Prophit. Tokens first; everything else reads roles, never raw colours.
   Design: 1970s print, after the finance-software polish of Mercury
   (Awwwards nominee) but warmer: cream paper, ink rules and hard offset
   shadows, racing stripes in mustard / orange / tomato / brown, a soft
   retro serif for figures. Green is actual, cobalt is forecast, tomato is
   the hand that edits. Motion is mechanical: things roll, press and slide. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* the retro set */
  --mustard: #f2b134;
  --orange: #ea7d2c;
  --tomato: #e0552f;
  --brown: #7b3f1d;
  --cream: #fbf6ea;
  --on-accent: #211b16;
  --stripes: linear-gradient(180deg, var(--mustard) 0 25%, var(--orange) 25% 50%, var(--tomato) 50% 75%, var(--brown) 75% 100%);
  --stripes-x: linear-gradient(90deg, var(--mustard) 0 25%, var(--orange) 25% 50%, var(--tomato) 50% 75%, var(--brown) 75% 100%);
  /* paper and ink */
  --ink: #211b16;
  --paper: #ece2cb;
  --bg: var(--paper);
  --surface: #fbf6ea;
  --surface-2: #f4ecda;
  --surface-3: #eadfc6;
  --line: #e2d6bb;
  --line-strong: #c4b48f;
  --grid: #ece2cc;
  --edge: var(--ink);
  --drop: var(--ink);
  --text: #211b16;
  --text-2: #594e40;
  --text-3: #7f7159;
  --brand: var(--tomato);
  --brand-ink: #b23e1b;
  --brand-wash: rgba(224, 85, 47, 0.1);
  --series-1: #1f8a5f;
  --series-1-wash: rgba(31, 138, 95, 0.1);
  --fc: #3156c4;
  --fc-ink: #2a48a6;
  --fc-wash: rgba(49, 86, 196, 0.1);
  --neg: #b3261e;
  --good: #2e8b57;
  --good-text: #1f6b40;
  --warn: var(--mustard);
  --warn-text: #845400;
  --warn-wash: #fbedc8;
  --crit: #b3261e;
  --crit-wash: #f6e0d6;
  --changed: #fae6a0;
  --focus: var(--fc);
  --hover: rgba(33, 27, 22, 0.05);
  /* Actual vs forecast: actual columns sit on a green wash; the cut-off is a cobalt rule. */
  --actual: color-mix(in srgb, var(--series-1) 8%, var(--surface));
  --actual-head: color-mix(in srgb, var(--series-1) 16%, var(--surface));
  --actual-ink: color-mix(in srgb, var(--series-1) 70%, var(--text));
  --mixed: color-mix(in srgb, var(--series-1) 4%, var(--surface));
  --forecast-ink: var(--fc-ink);
  --cut: var(--fc);
  /* Units in Analytics: a fixed order, checked for colour-blind separation
     (scripts in the dataviz guide). Never reused for status. */
  --u-UK: #d9512b;
  --u-US: #2f68c8;
  --u-EU: #c99212;
  --u-ROW: #8250c8;
  --u-JL: #17a08a;
  --u-Retail: #a26a28;
  --u-Wholesale: #c43d86;
  --u-ALL: var(--text);
  --heat: #b5541c;
  --radius: 14px;
  --radius-sm: 9px;
  --pill: 999px;
  --bw: 1.5px;
  --hard-sm: 2px 2px 0 var(--drop);
  --hard: 4px 4px 0 var(--drop);
  --hard-lg: 7px 7px 0 var(--drop);
  --shadow: var(--hard);
  --shadow-pop: var(--hard-lg);
  --ctl-h: 34px;
  /* the sidebar and headline panel: an ink block in both themes */
  --block: #211b16;
  --side-text: #f6eedb;
  --side-text-2: #bfb197;
  --side-text-3: #8c7e66;
  --side-hover: rgba(246, 238, 219, 0.08);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.5, 0.64, 1);
  --font: "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.13 0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23211b16' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --mustard: #f2b844;
    --orange: #f08a3c;
    --tomato: #ee6a43;
    --brown: #a65d2e;
    --ink: #0f0c09;
    --paper: #15110d;
    --surface: #211b16;
    --surface-2: #29221b;
    --surface-3: #332a21;
    --line: #382e25;
    --line-strong: #54473a;
    --grid: #2c241d;
    --edge: #5d4f3f;
    --drop: #050403;
    --text: #f3ead6;
    --text-2: #cbbea4;
    --text-3: #9d8f76;
    --brand-ink: #f58a66;
    --brand-wash: rgba(238, 106, 67, 0.15);
    --series-1: #45a37c;
    --series-1-wash: rgba(69, 163, 124, 0.15);
    --fc: #6c85e2;
    --fc-ink: #a5b5f2;
    --fc-wash: rgba(108, 133, 226, 0.15);
    --u-UK: #e56a44;
    --u-US: #5a8ae6;
    --u-EU: #b8861a;
    --u-ROW: #9a78e4;
    --u-JL: #23a08a;
    --u-Retail: #bb7d3c;
    --u-Wholesale: #dc5c9c;
    --heat: #f08a3c;
    --neg: #ef6a5f;
    --good-text: #6cc795;
    --warn-text: #f2b844;
    --warn-wash: #33280f;
    --crit: #ef6a5f;
    --crit-wash: #3b1f19;
    --changed: #4a3b12;
    --hover: rgba(243, 234, 214, 0.06);
    --block: #0f0c09;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.95 0 0 0 0 0.85 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23f3ead6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--grain), var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--brand-ink); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--mustard); color: var(--on-accent); }
.display, h1, h2 { font-family: var(--display); font-optical-sizing: auto; font-variation-settings: "SOFT" 100, "WONK" 0; }

.boot { padding: 48px; color: var(--text-3); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; font-size: 12px; }

/* ---- shell: an ink sidebar and a cream sheet, both floating on paper ---- */

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 10px; height: calc(100vh - 20px); margin: 10px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 20px 12px 16px; border-radius: 18px;
  background: var(--block); color: var(--side-text); box-shadow: var(--hard);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 26px; text-decoration: none; color: var(--side-text); }
.brand-mark { width: 32px; height: 32px; flex: none; transition: transform 0.6s var(--ease-spring); }
.brand:hover .brand-mark { transform: rotate(-12deg) scale(1.06); }
.brand-name { font-family: var(--display); font-variation-settings: "SOFT" 100, "WONK" 1; font-weight: 700; font-size: 23px; letter-spacing: -0.02em; line-height: 1; }
.brand-sub { font-family: var(--mono); font-size: 9.5px; color: var(--side-text-3); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; isolation: isolate; display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--side-text-2); text-decoration: none; font-weight: 480;
  transition: color 0.2s;
}
.nav a:hover { color: var(--side-text); background: var(--side-hover); }
.nav a:hover svg { transform: rotate(-8deg) scale(1.1); }
/* The active page is a mustard tab with a tomato shadow; it slides from the last page to this one. */
.nav a[aria-current="page"] { color: var(--on-accent); font-weight: 600; background: none; }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--radius-sm);
  background: var(--mustard); box-shadow: 3px 3px 0 var(--tomato);
  animation: nav-slide 0.55s var(--ease-spring) both;
}
@keyframes nav-slide { from { transform: translate(var(--fx, 0), var(--fy, 0)); } }
.nav svg { width: 17px; height: 17px; flex: none; stroke-width: 1.8; transition: transform 0.3s var(--ease-spring); }
/* Group headings: the mono label, folding the pages under it. Folded, it shows how many it holds. */
.nav-section {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 18px 0 4px; padding: 4px 12px;
  border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left;
  font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--side-text-2);
  transition: color 0.2s;
}
.nav > .nav-section:first-child { margin-top: 2px; }
.nav-section:hover { color: var(--side-text); }
.nav-section:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--mustard); }
.nav-section-label { flex: 1; }
.nav-count { font-size: 10.5px; letter-spacing: 0.05em; color: var(--side-text-3); }
.nav-section[aria-expanded="true"] .nav-count { display: none; }
.nav-chev { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s var(--ease-out); margin-right: 4px; opacity: 0.8; }
.nav-section[aria-expanded="true"] .nav-chev { transform: rotate(45deg) translate(-1px, -1px); }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-items[hidden] { display: none; }
/* The nav scrolls on its own if groups open past the window; Data and Admin sit at its foot. */
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px 6px; scrollbar-width: none; }
.nav-foot { margin-top: auto; padding-top: 10px; }
.nav-foot > .nav-section:first-child { margin-top: 8px; }
.sidebar-foot { margin-top: auto; padding: 0 4px; }
.sidebar-foot::before { content: ""; display: block; height: 14px; margin: 0 4px 14px; border-radius: 3px; background: var(--stripes); background-size: 100% 100%; }
.who { display: flex; align-items: center; gap: 10px; padding: 4px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 650; font-size: 11.5px; letter-spacing: 0.02em;
  background: var(--mustard); color: var(--on-accent); border: var(--bw) solid var(--edge);
}
.sidebar .avatar { border-color: var(--mustard); box-shadow: 2px 2px 0 var(--tomato); }
.who-name { font-weight: 600; font-size: 13px; }
.who-role { font-size: 12px; color: var(--text-3); text-transform: capitalize; }
.sidebar .who-role, .sidebar .link-button { color: var(--side-text-3); }
.sidebar .link-button:hover { color: var(--mustard); }
.link-button { background: none; border: 0; padding: 0; color: var(--text-3); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.link-button:hover { color: var(--text); }

.main {
  min-width: 0; display: flex; flex-direction: column;
  margin: 10px 18px 18px 0; min-height: calc(100vh - 28px);
  background: var(--surface); border-radius: 18px;
  border: var(--bw) solid var(--edge); box-shadow: var(--hard-lg);
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 24px 36px 22px; border-radius: 17px 17px 0 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: padding 0.3s var(--ease-out);
}
/* Racing stripes under the title bar, the full width of the sheet. */
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; background: var(--stripes); transform-origin: left; }
.main:has(.content.enter) .topbar::after { animation: stripe-in 0.9s var(--ease-out) both; }
@keyframes stripe-in { from { transform: scaleX(0); } }
.topbar h1 { font-size: 42px; margin: 0; font-weight: 640; letter-spacing: -0.025em; line-height: 1.05; transition: font-size 0.3s var(--ease-out); }
.topbar.condensed { padding-top: 12px; padding-bottom: 12px; }
.topbar.condensed h1 { font-size: 26px; }
.topbar .spacer { flex: 1; }
.topbar .row > .muted.small { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em; }
/* Title words rise out of a slot, one after another. */
.topbar h1 .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.topbar h1 .w > span { display: inline-block; animation: word-up 0.75s var(--ease-spring) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes word-up { from { transform: translateY(105%) rotate(4deg); } }
.content { padding: 36px 36px 112px; display: flex; flex-direction: column; gap: 26px; width: 100%; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; margin: 10px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 14px; }
  .brand { padding: 0 8px 0 0; }
  .brand-sub, .nav-section, .sidebar-foot::before { display: none; }
  .side-scroll { display: contents; }
  /* On a phone the headings are hidden, so every page shows, folded or not. */
  .nav-items, .nav-items[hidden] { display: contents; }
  .nav-foot { margin-top: 0; padding-top: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { height: 32px; padding: 0 10px; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; }
  .main { margin: 0 10px 10px; min-height: 0; box-shadow: var(--hard); }
  .topbar { padding: 16px; }
  .topbar h1 { font-size: 30px; }
  .content { padding: 26px 16px 112px; }
}

/* ---- building blocks ----------------------------------------------- */

.card { background: var(--surface); border: var(--bw) solid var(--edge); border-radius: var(--radius); box-shadow: var(--hard); }
.card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 18px 20px 0; }
.card-head h2 { margin: 0; font-size: 20px; font-weight: 620; letter-spacing: -0.015em; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; }
.card-body { padding: 16px 20px 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }

/* Buttons are chunky pills on an ink rule: they lift on hover and press flat when clicked. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--ctl-h); padding: 0 16px; border-radius: var(--pill); white-space: nowrap;
  border: var(--bw) solid var(--edge); background: var(--surface); color: var(--text);
  cursor: pointer; font-weight: 560; font-size: 13.5px; box-shadow: var(--hard-sm);
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out), background-color 0.15s;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--drop); background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--drop); transition-duration: 0.05s; }
.btn svg { width: 16px; height: 16px; flex: none; stroke-width: 1.9; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--tomato); color: #fff8ec; }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--tomato) 88%, #000); }
.btn.danger { color: var(--crit); }
.btn.danger:hover:not(:disabled) { background: var(--crit-wash); }
.btn.small { height: 28px; padding: 0 12px; font-size: 12.5px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.12em; }
input.input, select.input, textarea.input {
  height: var(--ctl-h); padding: 0 12px; border-radius: var(--radius-sm); border: var(--bw) solid var(--edge);
  background: var(--surface); min-width: 0; transition: box-shadow 0.15s var(--ease-out);
}
input.input:focus, select.input:focus, textarea.input:focus { outline: none; box-shadow: 3px 3px 0 var(--fc); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; background: var(--surface) var(--chevron) no-repeat right 11px center / 12px; cursor: pointer; font-weight: 520; }
.topbar select.input { border-radius: var(--pill); padding-left: 14px; max-width: 340px; text-overflow: ellipsis; box-shadow: var(--hard-sm); }
.cell-input.inherited::placeholder { color: var(--text-3); font-style: italic; }
/* Dropdowns (web/lib/ui.js dropdown): a pill that opens a printed card, never the browser's own menu. */
.dd { display: inline-flex; align-items: center; gap: 8px; height: 32px; max-width: 340px; padding: 0 12px 0 14px; border: var(--bw) solid var(--edge); border-radius: var(--pill); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 540; cursor: pointer; white-space: nowrap; box-shadow: var(--hard-sm); transition: box-shadow 0.15s var(--ease-out), background-color 0.15s; }
.dd.small { height: 28px; font-size: 12.5px; box-shadow: none; }
.dd.dd-field { height: var(--ctl-h); border-radius: var(--radius-sm); justify-content: space-between; box-shadow: none; min-width: 160px; }
.dd:hover:not(:disabled) { background: var(--surface-2); }
.dd:focus-visible, .dd[aria-expanded="true"] { outline: none; box-shadow: 3px 3px 0 var(--fc); }
.dd:disabled { opacity: 0.5; cursor: default; }
.dd-text { overflow: hidden; text-overflow: ellipsis; }
.topbar .dd.version-dd { height: var(--ctl-h); font-size: 13.5px; }
.dd-chev { flex: none; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s var(--ease-out); }
.dd[aria-expanded="true"] .dd-chev { transform: rotate(180deg); }
.dd-menu { position: fixed; z-index: 100; overflow: auto; padding: 5px; background: var(--surface); color: var(--text); border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--hard); animation: dd-in 0.14s var(--ease-out) both; scrollbar-width: thin; }
.dd-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 12px; border-radius: 7px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; }
.dd-item:hover, .dd-item:focus { outline: none; background: var(--hover); }
.dd-item:focus-visible { box-shadow: inset 0 0 0 1.5px var(--fc); }
.dd-item[aria-selected="true"] { background: var(--text); color: var(--surface); font-weight: 600; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } }
textarea.input { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; }

/* Segmented control: an ink-ruled strip; the chosen option is set in ink. */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--pill); border: var(--bw) solid var(--edge); background: var(--surface); max-width: 100%; overflow-x: auto; scrollbar-width: none; box-shadow: var(--hard-sm); }
.seg button { flex: none; border: 0; background: none; height: 28px; padding: 0 13px; border-radius: var(--pill); cursor: pointer; color: var(--text-2); font-weight: 520; font-size: 13px; transition: background-color 0.15s, color 0.15s; }
.seg button:hover:not([aria-pressed="true"]):not(:disabled) { color: var(--text); background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--pill); font-family: var(--mono); font-size: 10.5px; font-weight: 560; text-transform: uppercase; letter-spacing: 0.08em; background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: var(--bw) solid var(--edge); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.draft { color: var(--on-accent); background: var(--mustard); }
.badge.draft::before { animation: blink 1.6s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.badge.review { color: var(--on-accent); background: var(--orange); }
.badge.signed_off { color: #fff8ec; background: var(--series-1); }
.badge.superseded { color: var(--text-3); }
.badge.plain::before { display: none; }

.notice { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); border: var(--bw) solid var(--edge); }
.notice .icon { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--fc); color: #fff8ec; font-family: var(--display); font-style: italic; font-weight: 700; font-size: 14px; }
.notice.warn { background: var(--warn-wash); color: var(--text); }
.notice.warn .icon { background: var(--mustard); color: var(--on-accent); font-style: normal; }

/* ---- figures --------------------------------------------------------- */

/* The headline panel: an ink block with a striped 70s sun rising behind the numbers. */
.sunset { position: relative; isolation: isolate; overflow: hidden; background: var(--grain), var(--block); color: var(--side-text); }
.hero-card .hero { display: grid; grid-template-columns: auto minmax(200px, 1fr) minmax(0, 480px); align-items: end; gap: 28px; }
.hero-card .hero-figure { grid-column: 1; grid-row: 1; }
.hero-card .hero > .tiles { grid-column: 3; grid-row: 1; }
/* The sun sets on the racing stripes, in its own column between the figure and the tiles. */
.hero-card .hero::before {
  content: ""; grid-column: 2; grid-row: 1; justify-self: center; align-self: end;
  width: min(100%, 300px); aspect-ratio: 2 / 1; margin-bottom: -30px; border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, var(--mustard) 0%, var(--orange) 45%, var(--tomato) 80%, var(--brown) 100%);
  -webkit-mask: repeating-linear-gradient(180deg, #000 0 15px, transparent 15px 21px);
  mask: repeating-linear-gradient(180deg, #000 0 15px, transparent 15px 21px);
}
.sunset::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; z-index: -1; background: var(--stripes); transform-origin: left; }
.content.enter .hero-card .hero::before { animation: sunrise 1.4s var(--ease-out) 0.15s both; }
.content.enter .sunset::after { animation: stripe-in 1s var(--ease-out) 0.4s both; }
@keyframes sunrise { from { transform: translateY(105%); } }
.hero-card { border-radius: 20px; }
.hero-card .card-body { padding: 30px 30px 44px; }
.hero-card .tiles { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
.hero-card .hero-figure .label { color: var(--mustard); }
.hero-card .hero-figure .value { color: var(--side-text); }
.hero-card .hero-figure .delta { color: var(--side-text-2); }
.hero-card .tile { background: color-mix(in srgb, var(--block) 78%, transparent); border: var(--bw) solid color-mix(in srgb, var(--side-text) 22%, transparent); transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-out), border-color 0.2s; }
.hero-card .tile:hover { transform: translate(-3px, -3px); border-color: var(--mustard); box-shadow: 3px 3px 0 var(--mustard); }
.hero-card .tile .label { color: var(--mustard); }
.hero-card .tile .value { color: var(--side-text); }
.hero-card .tile .sub { color: var(--side-text-3); }
.hero { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-end; }
.hero-figure .label { font-family: var(--mono); color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; }
.hero-figure .value { font-family: var(--display); font-variation-settings: "SOFT" 100, "WONK" 0; font-size: 104px; font-weight: 560; letter-spacing: -0.035em; line-height: 0.95; margin: 12px 0 4px; font-variant-numeric: lining-nums proportional-nums; }
.hero-figure .delta { font-size: 13px; color: var(--text-2); margin-top: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; flex: 1; }
.tile { padding: 14px 16px; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--surface-2); }
.tile .label { font-family: var(--mono); color: var(--text-3); font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; }
.tile .value { font-family: var(--display); font-variation-settings: "SOFT" 100, "WONK" 0; font-size: 32px; font-weight: 560; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.05; font-variant-numeric: lining-nums proportional-nums; }
.tile .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Rolling digits: each numeral is a strip of 0-9 that turns to its value, like an old counter. */
.roll { display: inline-flex; white-space: pre; }
.roll .d { display: inline-block; height: 1em; line-height: 1; overflow: hidden; vertical-align: top; }
.roll .d > span { display: flex; flex-direction: column; align-items: center; transition: transform 1.3s var(--ease-out); transition-delay: calc(var(--i) * 60ms); }
.roll .d > span > span { height: 1em; line-height: 1; }
.roll .c { display: inline-block; line-height: 1; }

/* The ticker: a stock-exchange strip of headline figures by year. */
.ticker { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: var(--block); color: var(--side-text); border: var(--bw) solid var(--edge); box-shadow: var(--hard); font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; height: 38px; display: flex; align-items: center; }
.ticker::before { content: "Years"; flex: none; z-index: 1; align-self: stretch; display: grid; place-items: center; padding: 0 12px; background: var(--tomato); color: #fff8ec; font-weight: 650; letter-spacing: 0.14em; }
.ticker-track { display: flex; flex: none; gap: 0; animation: ticker 60s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; gap: 8px; padding: 0 22px; white-space: nowrap; border-right: 1px solid color-mix(in srgb, var(--side-text) 18%, transparent); }
.ticker-item .k { color: var(--mustard); }
.ticker-item .up { color: #6cc795; }
.ticker-item .down { color: #ff8a6b; }
@keyframes ticker { to { transform: translateX(-50%); } }

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

.table-wrap { overflow: auto; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--surface); max-height: 70vh; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 8px 14px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.data thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); border-bottom: var(--bw) solid var(--edge); font-family: var(--mono); font-size: 10.5px; font-weight: 520; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-2); text-align: right; }
table.data th:first-child, table.data td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; }
table.data thead th:first-child { z-index: 3; background: var(--surface-2); }
table.data td.num { text-align: right; }
table.data tr.strong td { font-weight: 620; color: var(--text); }
table.data tr.ratio td { color: var(--text-3); font-size: 12.5px; font-style: italic; }
table.data tr.section td { background: var(--surface-2); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-2); padding-top: 12px; }
table.data tr:hover td { background: color-mix(in srgb, var(--mustard) 10%, var(--surface)); }
/* Crosshair: the hovered column lights up too, so a month and a line meet at the number. */
table.data td.col-hover, table.data th.col-hover { box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--mustard) 13%, transparent); }
table.data td.cut.col-hover, table.data th.cut.col-hover { box-shadow: inset -2px 0 0 var(--cut), inset 0 0 0 9999px color-mix(in srgb, var(--mustard) 13%, transparent); }
table.data tr:hover td.col-hover { box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--mustard) 26%, transparent); outline: var(--bw) solid var(--edge); outline-offset: -1px; }
table.data td.neg { color: var(--neg); }
table.data td.pos-delta { color: var(--good-text); }
table.data td.neg-delta { color: var(--neg); }
/* Negative figures are red wherever they show (web/lib/ui.js marks them). */
.is-neg, table.data td.is-neg, table.data tr.strong td.is-neg, table.grid td.act input.cell-input.is-neg, .cell-input.is-neg { color: var(--neg); }
.hero-card .hero-figure .value.is-neg, .hero-card .tile .value.is-neg { color: #ef6a5f; } /* the hero card is dark in both themes */
.chart text.is-neg { fill: var(--neg); }
table.list td, table.list th { text-align: left; }
table.list td { white-space: normal; min-width: 90px; }
table.list td:first-child { min-width: 240px; }
table.data th.num { text-align: right; }
.table-wrap.free { max-height: none; }
.row.actions { flex-wrap: nowrap; }
table.list thead th { text-align: left; }

/* ---- assumptions grid ---------------------------------------------- */

table.grid td.cell { padding: 0; }
table.grid input.cell-input {
  width: 92px; padding: 7px 10px; border: 0; background: transparent; text-align: right;
  font-variant-numeric: tabular-nums;
}
table.grid input.cell-input:focus { outline: 2px solid var(--focus); outline-offset: -2px; background: var(--surface); }
table.grid input.cell-input:read-only { color: var(--text-2); }
table.grid input.cell-input::placeholder { color: var(--text-3); opacity: 0.6; }
table.grid td.cell.changed { background: var(--changed); }
table.grid td.cell.invalid input { color: var(--crit); }
/* Set by a person (not imported): a corner mark, like a spreadsheet comment. */
table.grid td.cell.recent { background-image: linear-gradient(225deg, var(--brand) 5px, transparent 5px); }
.driver-name { font-weight: 600; }
.driver-unit { color: var(--text-3); font-size: 12px; margin-left: 6px; }

.tray {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 20px;
  background: var(--block); color: var(--side-text); border-radius: var(--pill); border: var(--bw) solid var(--edge); box-shadow: 5px 5px 0 var(--tomato);
}
.tray[hidden] { display: none; }
.tray .btn { border-color: transparent; }
.tray .btn { box-shadow: none; }
.tray .btn:not(.primary) { background: transparent; color: var(--side-text); }
.tray .btn:not(.primary):hover { background: var(--side-hover); }
.tray .btn.primary { background: var(--mustard); border-color: var(--mustard); color: var(--on-accent); }

.side-panel { padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.history-item { border-top: 1px solid var(--grid); padding: 8px 0; font-size: 13px; }

/* ---- actual vs forecast ------------------------------------------- */

table.data td.act, table.data th.act { background: var(--actual); }
table.data thead th.act { background: var(--actual-head); color: var(--actual-ink); }
table.data td.mixed, table.data thead th.mixed { background: var(--mixed); }
table.data .cut { box-shadow: inset -2px 0 0 var(--cut); }
table.data tr:hover td.act { background: color-mix(in srgb, var(--series-1) 11%, var(--surface)); }
table.data thead tr.groups th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; text-align: left; padding: 6px 12px; border-bottom: 1px solid var(--line); }
table.data thead tr.groups th.act { color: var(--actual-ink); text-align: right; }
table.data thead tr.groups th.fc { color: var(--forecast-ink); background: var(--fc-wash); }
table.data thead tr.groups + tr th { top: 28px; }
.ktag { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; vertical-align: 1px; }
.ktag.actual { background: color-mix(in srgb, var(--series-1) 16%, transparent); color: var(--actual-ink); }
.ktag.forecast { background: var(--fc-wash); color: var(--forecast-ink); }
.ktag.mixed { background: linear-gradient(90deg, color-mix(in srgb, var(--series-1) 16%, transparent) 50%, var(--fc-wash) 50%); color: var(--text-2); }
.legend { display: inline-flex; gap: 14px; align-items: center; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line-strong); }
.legend .swatch.act { background: var(--actual-head); }
.legend .swatch.fc { background: var(--surface); }
.legend .swatch.cut { width: 3px; border: 0; background: var(--cut); }


/* ---- actuals: as built or up to date (top bar) ------------------- */

.actuals-switch button, .actuals-chip { display: inline-flex; align-items: center; gap: 7px; }
.chip-label { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.8; }
.actuals-switch button:last-child[aria-pressed="true"] { background: var(--series-1); color: #fff8ec; }
.actuals-chip { height: 34px; padding: 0 13px; border-radius: var(--pill); border: var(--bw) solid var(--edge); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 520; box-shadow: var(--hard-sm); }

/* ---- month close --------------------------------------------------- */

.close-strip { display: grid; grid-template-columns: 1fr 1fr; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--hard); }
.close-strip .zone { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; min-width: 0; }
.close-strip .zone + .zone { border-left: var(--bw) solid var(--edge); }
.close-strip .zone.act { background: var(--actual-head); color: var(--actual-ink); }
.close-strip .zone.fc { background: var(--fc-wash); color: var(--forecast-ink); }
.close-strip .zone-label { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; }
.close-strip .zone-value { font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.15; color: var(--text); }
.close-strip .zone-sub { font-size: 12px; color: var(--text-2); }
.close-next { margin-top: 20px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.checklist li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.close-act { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; max-width: 720px; }
.close-buttons { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.close-reopen { display: flex; gap: 10px; align-items: center; margin-top: 18px; max-width: 720px; }
.close-reopen .input { flex: 1; min-width: 0; }
.close-moved { margin-top: 20px; }
.close-history { margin-top: 18px; }
.close-history summary { cursor: pointer; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-2); padding: 4px 0 10px; }
@media (max-width: 700px) {
  .close-strip { grid-template-columns: 1fr; }
  .close-strip .zone + .zone { border-left: 0; border-top: var(--bw) solid var(--edge); }
  .checklist li { grid-template-columns: 1fr; gap: 2px; }
  .close-reopen { flex-direction: column; align-items: stretch; }
}

table.grid td.act input.cell-input { color: var(--text-2); cursor: default; }
table.grid td.act input.cell-input:focus { background: var(--actual); }
table.grid td.ref { background: var(--actual-head); font-weight: 600; }
table.grid td.ref input.cell-input { color: var(--actual-ink); font-weight: 600; }
table.grid tr.subtotal td { background: var(--surface-2); font-weight: 560; padding: 7px 10px; text-align: right; }
table.grid tr.subtotal td:first-child { text-align: left; }
table.grid tr.subtotal td.act { background: color-mix(in srgb, var(--series-1) 10%, var(--surface-2)); }
table.grid tr.category td { background: var(--surface); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); padding: 12px 12px 4px; font-weight: 600; }
.driver-cell { display: flex; flex-direction: column; min-width: 220px; max-width: 300px; white-space: normal; }
.driver-cell .driver-sub { color: var(--text-3); font-size: 11.5px; }
@media (max-width: 700px) {
  .driver-cell { min-width: 130px; max-width: 160px; }
  .driver-cell .driver-sub { display: none; }
  .legend { display: none; }
  .tray { left: 12px; right: 12px; transform: none; border-radius: 14px; flex-wrap: wrap; }
}
.planning-tag { font-size: 10.5px; font-weight: 600; color: var(--warn-text); background: var(--warn-wash); border-radius: 4px; padding: 0 5px; margin-left: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .spacer { flex: 1; }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px dashed var(--line-strong); }
.subnav button { background: none; border: var(--bw) solid transparent; height: 34px; padding: 0 16px; border-radius: var(--pill); font-family: var(--display); font-variation-settings: "SOFT" 100; font-size: 16px; font-weight: 560; color: var(--text-2); cursor: pointer; transition: transform 0.2s var(--ease-spring), box-shadow 0.2s, background-color 0.15s, color 0.15s; }
.subnav button:hover { color: var(--text); border-color: var(--edge); }
.subnav button[aria-pressed="true"] { color: var(--on-accent); background: var(--mustard); border-color: var(--edge); box-shadow: 3px 3px 0 var(--drop); transform: translate(-1px, -1px); }
label.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); cursor: pointer; }

/* ---- data page ------------------------------------------------------- */

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--good-text); }
.status.warn { color: var(--warn-text); }
.status.bad { color: var(--crit); }
.source { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 0; border-top: 1px solid var(--grid); }
.source:first-child { border-top: 0; padding-top: 0; }
.source .name { font-weight: 560; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }

/* ---- dialog ---------------------------------------------------------- */

dialog.modal { border: var(--bw) solid var(--edge); border-radius: 18px; padding: 0; width: min(880px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); }
dialog.modal::backdrop { background: rgba(33, 27, 22, 0.42); }
.modal-head { padding: 22px 24px 8px; display: flex; align-items: baseline; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 26px; font-weight: 620; letter-spacing: -0.02em; }
.modal-body { padding: 8px 24px 4px; display: flex; flex-direction: column; gap: 14px; max-height: 64vh; overflow: auto; }
.modal-body > * { flex-shrink: 0; }
dialog.modal.narrow { width: min(520px, calc(100vw - 32px)); }
.field-error { color: var(--crit); font-size: 12.5px; min-height: 1em; }
.field-error:empty { display: none; }
.modal-foot { padding: 16px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.check { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; padding: 1px 7px; border-radius: 999px; margin-right: 4px; }
.check.error { background: var(--crit-wash); color: var(--crit); }
.check.warning { background: var(--warn-wash); color: var(--warn-text); }
.check.note { background: var(--surface-2); color: var(--text-3); }

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

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart .label { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .value-label { fill: var(--text-2); font-size: 11px; font-weight: 600; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar { fill: var(--series-1); }
.chart .bar.neg { fill: var(--neg); }
.chart .bar.total { fill: var(--text-2); }
.chart .bar.fc { fill: url(#hatch-fc); }
.chart .bar.fc.neg { fill: url(#hatch-neg); }
.chart .series-area { fill: color-mix(in srgb, var(--series-1) 12%, transparent); }
.hatch-fc-bg { fill: color-mix(in srgb, var(--series-1) 18%, var(--surface)); }
.hatch-fc-line { stroke: var(--series-1); stroke-width: 2.4; }
.hatch-neg-bg { fill: color-mix(in srgb, var(--neg) 16%, var(--surface)); }
.hatch-neg-line { stroke: var(--neg); stroke-width: 2.4; }
.chart .series-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-line.fc { stroke-dasharray: 4 3; stroke: color-mix(in srgb, var(--series-1) 70%, var(--surface)); }
.chart .series-point { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .series-point.fc { fill: var(--surface); stroke: color-mix(in srgb, var(--series-1) 70%, var(--surface)); }
.chart .series-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; }
.chart .cutline { stroke: var(--cut); stroke-width: 2; stroke-dasharray: 4 3; }
.chart .cutlabel { fill: var(--text-2); font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em; }
.chart .connector { stroke: var(--line-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { opacity: 0.8; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 30; min-width: 120px;
  padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface); border: var(--bw) solid var(--edge);
  box-shadow: var(--hard-sm); font-size: 12.5px; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
}
.tooltip .t-title { color: var(--text-3); font-size: 11.5px; }
.tooltip .t-value { font-weight: 540; font-variant-numeric: tabular-nums; }

/* ---- analytics charts (web/lib/viz.js) ---------------------------- */

.viz-tip { min-width: 170px; }
.viz-tip.flip { transform: translate(calc(-100% + 12px), calc(-100% - 10px)); }
.viz-tip.flop { transform: translate(-12px, calc(-100% - 10px)); }
.viz-tip .t-title { margin-bottom: 4px; }
.viz-tip .t-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; line-height: 1.55; }
.viz-tip .t-row.strong { border-top: 1px solid var(--line); margin-top: 3px; padding-top: 3px; font-weight: 600; }
.viz-tip .t-swatch { width: 10px; height: 10px; border-radius: 3px; }
.viz-tip .t-swatch.none { background: transparent; }
.viz-tip .t-label { color: var(--text-2); }
.viz-tip .t-value { text-align: right; }
.viz-tip .t-foot { margin-top: 4px; color: var(--text-3); font-size: 11.5px; white-space: normal; max-width: 260px; }
.chart .vcol { stroke: none; }
.chart .vhatch { fill: url(#hatch-over); pointer-events: none; }
.hatch-over-line { stroke: var(--surface); stroke-width: 2.6; opacity: 0.85; }
.chart .viz-band { fill: var(--hover); }
.chart .viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .viz-line.fc { stroke-dasharray: 5 4; }
.chart .viz-line.faint { opacity: 0.45; }
.chart .viz-point { fill: var(--c); stroke-width: 2; stroke: var(--surface) !important; }
.chart .viz-point.fc { fill: var(--surface); stroke: var(--c) !important; }
.chart .viz-dot { stroke: var(--surface); stroke-width: 2; }
.chart .viz-end { fill: var(--text-2); font-size: 11.5px; font-weight: 560; }
.chart .viz-ref { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 2 3; }
.chart .viz-gap.up { fill: color-mix(in srgb, var(--good) 16%, transparent); }
.chart .viz-gap.down { fill: color-mix(in srgb, var(--neg) 16%, transparent); }
.chart .viz-cell { stroke: none; transition: stroke 0.1s; }
.chart .viz-cell.hover { stroke: var(--edge); stroke-width: 2; }
.chart .vhatch.cell { fill: url(#hatch-over); }
.chart .viz-cell-text { fill: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; pointer-events: none; }
.chart .viz-cell-text.on-dark { fill: var(--surface); }
.chart .viz-axis-title { fill: var(--text-3); font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em; }
.chart .viz-trail { fill: none; stroke-width: 1.5; opacity: 0.5; }
.chart .viz-bubble { fill: color-mix(in srgb, var(--c) 78%, transparent); stroke: var(--surface); stroke-width: 2; cursor: default; }
.chart .viz-bubble.fc { fill: var(--surface); stroke: var(--c); stroke-width: 2; stroke-dasharray: 3 2; }
.chart .viz-bubble.faint { opacity: 0.45; }
.chart .viz-bubble:hover { stroke: var(--edge); }
.chart .viz-row-label { fill: var(--text-2); font-size: 12.5px; }
.chart .viz-tbar.up { fill: var(--good); }
.chart .viz-tbar.down { fill: var(--neg); }
.chart .viz-tbar.clip { stroke: var(--edge); stroke-width: 1.5; stroke-dasharray: 3 2; }
.chart .viz-tval { fill: #fff8ec; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
/* Inside a bar the figure is light whatever its sign (the red-negatives rule would hide it on a red bar);
   outside, it's ink, and red when negative. */
.chart .viz-tval.is-neg:not(.out) { fill: #fff8ec; }
.chart .viz-tval.out { fill: var(--text-2); font-weight: 560; }
.chart .viz-tval.out.is-neg { fill: var(--neg); }
.chart .viz-wbar.up { fill: var(--good); }
.chart .viz-wbar.down { fill: var(--neg); }
.chart .viz-wbar.total { fill: var(--text-2); }
.chart .viz-wbar.total.neg { fill: var(--neg); }
.chart .viz-ghost { fill: none; stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 3 2; }
.chart .label.strong { fill: var(--text); font-weight: 600; }
.viz-lede { margin: -8px 0 0; color: var(--text-2); max-width: 780px; font-size: 14px; }
.viz-filters { gap: 14px 18px; }
.viz-filter { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.viz-filter-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-3); }
.viz-select { height: 32px; border-radius: var(--pill); padding-left: 14px; padding-right: 32px; box-shadow: var(--hard-sm); }
.viz-select.small { height: 30px; font-size: 13px; box-shadow: none; }
.seg.small button { height: 24px; font-size: 12.5px; padding: 0 10px; }
.seg.small { box-shadow: none; }
.viz-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.viz-change.up { color: var(--good-text); }
.viz-change.down { color: var(--neg); }
.viz-change .muted { color: var(--text-3); }
.viz-card .card-head .row { gap: 8px; }
.viz-legend-row { margin-bottom: 10px; }
.viz-note { margin: 12px 0 0; color: var(--text-3); font-size: 12.5px; max-width: 760px; }
.viz-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
@media (max-width: 1300px) { .viz-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .viz-grid-3 { grid-template-columns: 1fr; } }
.viz-dot-key { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 8px; vertical-align: 1px; }
.viz-scorecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.viz-score { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 10px; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--hard-sm); color: var(--text); text-decoration: none; border-top: 5px solid var(--c); transition: transform 0.2s var(--ease-spring), box-shadow 0.2s; }
.viz-score:hover { transform: translate(-2px, -2px); box-shadow: var(--hard); }
.viz-score-head { display: flex; align-items: center; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-2); }
.viz-score-head .spacer { flex: 1; }
.viz-score-head .viz-change { font-family: var(--sans, inherit); letter-spacing: 0; text-transform: none; font-size: 12px; }
.viz-score-value { font-family: var(--display); font-size: 30px; font-weight: 560; letter-spacing: -0.02em; line-height: 1.1; }
.viz-score-sub { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.viz-period { padding: 10px 12px; border: var(--bw) dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.viz-vs { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: var(--pill); background: var(--surface); border: 1.5px solid var(--line-strong); font-size: 13px; font-weight: 520; color: var(--text-2); }
.viz-move { align-items: center; }
.viz-move-value { font-family: var(--display); font-size: 24px; font-weight: 600; min-width: 74px; font-variant-numeric: tabular-nums; }
.viz-slider { -webkit-appearance: none; appearance: none; flex: 1 1 220px; min-width: 160px; max-width: 560px; height: 12px; border-radius: var(--pill); border: var(--bw) solid var(--edge); background: linear-gradient(90deg, var(--tomato) var(--fill, 1%), var(--surface) var(--fill, 1%)); cursor: pointer; }
.viz-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--mustard); border: var(--bw) solid var(--edge); box-shadow: 2px 2px 0 var(--drop); }
.viz-slider::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--mustard); border: var(--bw) solid var(--edge); box-shadow: 2px 2px 0 var(--drop); }
.viz-slider:focus-visible { outline: none; box-shadow: 3px 3px 0 var(--fc); }
.viz-lock { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.viz-lock-amount { display: inline-flex; align-items: center; gap: 4px; font-weight: 560; color: var(--text-2); }
.viz-lock-amount.off { opacity: 0.45; }
.viz-lock-input { width: 76px; height: 30px; padding: 0 10px; border-radius: var(--pill); font-variant-numeric: tabular-nums; }
.link-button.small { font-size: 12px; }
/* The view's controls: one row inside the sticky title bar, scrolling sideways if the window is narrow. */
.topbar .viz-bar { flex: 1 0 100%; display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-top: -4px; padding: 8px 2px 2px; border-top: 1.5px dashed var(--line-strong); }
.topbar .viz-bar .viz-range[hidden] { display: none; }
/* On a phone the bar stays one line that scrolls sideways, so the sticky header doesn't fill the screen. */
@media (max-width: 900px) { .topbar .viz-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } }
.topbar .viz-bar > * { flex: none; }
.topbar .viz-bar .seg { box-shadow: none; }
.topbar .viz-bar .seg button { height: 26px; font-size: 12.5px; padding: 0 10px; }
.topbar .viz-bar .viz-select { height: 30px; box-shadow: none; font-size: 13px; }
.topbar .viz-bar .viz-vs { padding: 3px 10px; font-size: 12.5px; }
.topbar .viz-bar-sep { width: 1.5px; align-self: stretch; background: var(--line); margin: 2px 0; }
.topbar.condensed .viz-bar { padding-top: 6px; }
.viz-empty { padding: 28px 0; text-align: center; color: var(--text-3); font-size: 13px; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.viz-key { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: var(--pill); border: 1.5px solid var(--line); background: transparent; color: var(--text-3); font: inherit; font-size: 12px; cursor: pointer; transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s; }
.viz-key:not(.on) .viz-swatch { background: var(--line-strong); }
.viz-key:not(.on):hover { color: var(--text-2); border-color: var(--line-strong); }
/* On: filled in the series' own colour, bold, with the hard print shadow. */
.viz-key.on { color: var(--text); font-weight: 600; border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--surface)); box-shadow: 2px 2px 0 var(--c); }
.viz-key.agg.on { color: var(--surface); background: var(--text); border-color: var(--text); box-shadow: 2px 2px 0 var(--line-strong); }
.viz-key.agg.on .viz-swatch { background: var(--surface); }
.viz-key.agg { margin-right: 6px; }
.viz-swatch { width: 11px; height: 11px; border-radius: 3px; background: var(--c); }
.viz-swatch.line { height: 3px; border-radius: 2px; width: 14px; }
.viz-swatch.dash { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px); }
.viz-spark { width: 100%; height: 36px; display: block; overflow: visible; }

/* ---- sign in ------------------------------------------------------- */

.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; isolation: isolate; overflow: hidden; }
.signin::before { content: ""; position: absolute; z-index: -1; left: 50%; bottom: -46vmin; width: 110vmin; height: 110vmin; margin-left: -55vmin; border-radius: 50%; background: linear-gradient(180deg, var(--mustard) 0%, var(--orange) 40%, var(--tomato) 70%, var(--brown) 100%); -webkit-mask: repeating-linear-gradient(180deg, #000 0 34px, transparent 34px 46px); mask: repeating-linear-gradient(180deg, #000 0 34px, transparent 34px 46px); animation: sunrise 1.6s var(--ease-out) both; }
.signin .card { animation: pop 0.7s var(--ease-spring) 0.3s both; }
.signin .card { width: min(440px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 20px; border-radius: 20px; box-shadow: var(--shadow-pop); }
.signin h1 { margin: 0; font-size: 36px; font-weight: 680; letter-spacing: -0.02em; line-height: 1; }
.signin .card { box-shadow: var(--hard-lg); }
.account { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color 0.12s, background-color 0.12s; }
.account { border: var(--bw) solid var(--edge); }
.account:hover { background: var(--mustard); color: var(--on-accent); box-shadow: var(--hard-sm); transform: translate(-1px, -1px); }
.account:hover .muted { color: var(--on-accent); }

/* ---- toasts ---------------------------------------------------------- */

.toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--block); color: var(--side-text); border: var(--bw) solid var(--edge); border-left: 6px solid var(--mustard); box-shadow: var(--hard); max-width: 420px; font-size: 13.5px; }
.toast.error { background: var(--crit); color: #fff; }

.empty { padding: 32px; text-align: center; color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- Acquisition: inputs on a basis, what they produce, over time ---- */
table.basis-grid td[colspan] { position: static; background: var(--surface); padding: 0; }
table.basis-grid .sticky-left { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; padding: 10px 12px; max-width: min(100vw - 120px, 900px); white-space: normal; }
table.basis-grid tr.section td { border-top: 1px solid var(--line-strong); text-transform: none; letter-spacing: 0; font-size: 13px; padding-top: 0; }
table.basis-grid tr.section .section-title { font-size: 11.5px; font-weight: 560; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-ink); }
table.basis-grid tr.section .section-sub { color: var(--text-3); font-size: 12px; white-space: normal; }
table.basis-grid tr.driver-band td { border-top: 1px solid var(--line); }
table.basis-grid .driver-band-inner { padding: 12px 12px 6px; display: flex; flex-wrap: nowrap; box-sizing: border-box; width: var(--pane-w, 100%); max-width: none; }
table.basis-grid .driver-band-inner > span:not(.set-as-group):not(.driver-sub) { flex: none; }
table.basis-grid .driver-band-inner > .driver-sub { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.basis-grid .set-as-group { margin-left: auto; padding-left: 12px; display: inline-flex; align-items: center; gap: 8px; flex: none; white-space: nowrap; }
table.basis-grid .driver-band-inner .driver-sub { color: var(--text-3); font-size: 12px; }
table.basis-grid .set-as { color: var(--text-3); font-size: 12px; }
.seg.small button { padding: 3px 10px; font-size: 12px; }
.seg button:disabled { cursor: default; }
table.basis-grid .line-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 210px; padding-left: 14px; font-size: 12.5px; color: var(--text-2); }
table.basis-grid .line-tag { font-size: 10.5px; font-weight: 560; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
table.basis-grid .line-tag.input { background: var(--brand-wash); color: var(--brand-ink); }
table.basis-grid .line-tag.calc { color: var(--text-3); }
table.basis-grid .line-tag.mixed { color: var(--text-2); background: var(--surface-2); }
table.basis-grid tr.is-input td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
table.basis-grid tr.is-input .line-label { color: var(--text); font-weight: 600; }
table.basis-grid td.cell.calc input.cell-input { color: var(--text-3); font-style: italic; }
table.basis-grid td.cell:not(.calc):not(.act) { background: var(--surface); }
table.basis-grid td.cell:not(.calc):not(.act) input.cell-input { color: var(--text); font-weight: 550; }
table.basis-grid tr.output-line td { background: var(--surface-2); font-variant-numeric: tabular-nums; padding: 7px 10px; }
table.basis-grid tr.output-line td.act { background: color-mix(in srgb, var(--series-1) 10%, var(--surface-2)); }
table.basis-grid tr.output-line.abs td { font-weight: 560; color: var(--text); }
table.basis-grid tr.output-line.yoy td { color: var(--text-2); font-size: 12px; }
table.basis-grid tr.output-line .line-label { padding-left: 14px; }
table.annual td.yoy { color: var(--text-2); }
table.annual tr.act-row td { background: var(--actual); }
table.annual tr.mixed-row td { background: var(--mixed); }
.acq-charts { display: flex; flex-direction: column; gap: 18px; }
.chart-panel-title { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-2); margin-bottom: 6px; }
@media (max-width: 700px) {
  table.basis-grid .line-label { min-width: 150px; padding-left: 8px; }
  table.basis-grid .driver-band-inner .driver-sub { display: none; }
  table.basis-grid .driver-band-inner { flex-wrap: wrap; }
}

/* ---- basis pages: selection, fill handle ---- */
table.basis-grid td.cell { position: relative; }
table.basis-grid td.cell.sel { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); box-shadow: inset 0 1px 0 var(--brand), inset 0 -1px 0 var(--brand); }
table.basis-grid td.cell.sel input.cell-input { background: transparent; }
table.basis-grid td.cell.fill-preview { box-shadow: inset 0 0 0 1px var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.fill-handle { position: absolute; right: -4px; bottom: -4px; width: 8px; height: 8px; background: var(--brand); border: 2px solid var(--surface); border-radius: 2px; cursor: ew-resize; z-index: 3; }
.fill-handle:hover { transform: scale(1.25); }
table.basis-grid th.mixed, table.basis-grid td.mixed { background: var(--mixed); }
table.annual-grid td.year-cell { padding: 7px 12px; font-variant-numeric: tabular-nums; }
table.annual-grid tr.basis-line.abs td.year-cell { color: var(--text); font-weight: 550; }
table.annual-grid tr.basis-line.yoy td.year-cell { color: var(--text-2); font-size: 12px; }
table.annual-grid thead th { white-space: nowrap; }

/* ---- collapsible cards ---- */
details.fold > summary { list-style: none; cursor: pointer; padding-bottom: 14px; user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold[open] > summary { padding-bottom: 0; }
details.fold > summary .fold-chevron { width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(-45deg); transition: transform 0.15s; align-self: center; margin-right: 2px; }
details.fold[open] > summary .fold-chevron { transform: rotate(45deg); }
details.fold > summary:hover h2 { color: var(--brand-ink); }

/* ---- the cell card ---- */
.cell-card { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.cell-card-empty { color: var(--text-3); font-size: 13px; }
.cell-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cell-card-title { font-weight: 560; font-size: 15px; }
.cell-card-meta { color: var(--text-3); font-size: 13px; }
.cell-card-basis { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--brand-wash); color: var(--brand-ink); }
.cell-card-unsaved { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--changed); color: var(--text); }
.calc-strip { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.calc-chip { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); min-width: 110px; }
.calc-chip-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.calc-chip-value { font-size: 17px; font-weight: 560; font-variant-numeric: tabular-nums; }
.calc-chip.input { border-color: var(--brand); background: var(--brand-wash); }
.calc-chip.input .calc-chip-label { color: var(--brand-ink); }
.calc-chip.result { background: var(--surface); }
.calc-op { align-self: center; color: var(--text-3); font-size: 15px; font-weight: 600; }
.cell-card-foot { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-3); }
.cell-card-note { color: var(--text-2); font-style: italic; }
.cell-card-note::before { content: "“"; }
.cell-card-note::after { content: "”"; }
.cell-card-hint { color: var(--text-2); }
@media (max-width: 700px) {
  .calc-chip { min-width: 0; flex: 1 1 40%; }
  .calc-op { display: none; }
}

/* ---- the assistant ---- */
.ai-fab { position: fixed; right: 22px; bottom: 22px; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; z-index: 40; color: #fff;
  background: var(--tomato); color: #fff8ec; border: var(--bw) solid var(--edge); box-shadow: var(--hard); display: grid; place-items: center; transition: transform 0.2s var(--ease-spring), box-shadow 0.2s; }
.ai-fab:hover { transform: translate(-2px, -2px) rotate(-10deg); box-shadow: 6px 6px 0 var(--drop); }
.ai-fab:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--drop); }
.ai-fab .ai-sparkle { width: 24px; height: 24px; }
.ai-fab.open { transform: rotate(0); }
.ai-fab.ping::after { content: ""; position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.ai-panel { position: fixed; right: 22px; bottom: 86px; width: 420px; height: min(680px, calc(100vh - 120px)); z-index: 45; display: flex; flex-direction: column;
  background: var(--surface); border: var(--bw) solid var(--edge); border-radius: 18px; box-shadow: var(--hard-lg); overflow: hidden; }
.ai-panel[hidden] { display: none; }
.ai-panel.wide { top: 0; right: 0; bottom: 0; height: auto; width: 520px; border-radius: 0; border-width: 0 0 0 1px; }
@media (min-width: 1100px) { body.ai-wide .shell { margin-right: 520px; } }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); }
.ai-avatar, .ai-welcome-mark { color: #fff8ec; border-radius: 50%; display: grid; place-items: center; background: var(--tomato); border: var(--bw) solid var(--edge); }
.ai-avatar { width: 30px; height: 30px; flex: none; }
.ai-avatar .ai-sparkle { width: 16px; height: 16px; }
.ai-title { min-width: 0; }
.ai-title-name { font-weight: 560; }
.ai-title-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.ai-icon { border: 0; background: none; color: var(--text-3); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.ai-icon:hover { background: var(--surface-2); color: var(--text); }
.ai-icon svg { width: 18px; height: 18px; }
.ai-icon.small { width: 26px; height: 26px; }
.ai-icon.confirm { color: var(--crit); background: color-mix(in srgb, var(--crit) 12%, transparent); }
.ai-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ai-welcome, .ai-setup { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 8px 4px; }
.ai-welcome-mark { width: 52px; height: 52px; }
.ai-welcome-mark .ai-sparkle { width: 26px; height: 26px; }
.ai-welcome-hi { font-family: var(--display); font-variation-settings: "SOFT" 100; font-size: 30px; font-weight: 640; letter-spacing: -0.02em; }
.ai-empty-sub { color: var(--text-2); font-size: 13.5px; max-width: 330px; }
.ai-suggest { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 8px; }
.ai-suggestion { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; cursor: pointer; color: var(--text); font: inherit; font-size: 13.5px; }
.ai-suggestion { border: var(--bw) solid var(--edge) !important; transition: transform 0.15s var(--ease-out), box-shadow 0.15s; }
.ai-suggestion:hover { background: var(--mustard); color: var(--on-accent); box-shadow: var(--hard-sm); transform: translate(-1px, -1px); }
.ai-setup { text-align: left; align-items: stretch; }
.ai-setup .ai-welcome-mark { align-self: center; }
.ai-setup strong { text-align: center; font-size: 15px; }
.ai-setup ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.ai-setup p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.ai-setup code, .ai-text code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.ai-msg.user { align-self: flex-end; max-width: 85%; }
.ai-bubble { background: var(--surface-3); color: var(--text); padding: 9px 14px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; font-size: 14px; }
.ai-msg.assistant { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; }
.ai-text p { margin: 0 0 8px; }
.ai-text p:last-child { margin-bottom: 0; }
.ai-text ul, .ai-text ol { margin: 0 0 8px; padding-left: 20px; }
.ai-text a { color: var(--brand-ink); }
.ai-text .md-table { overflow-x: auto; margin: 4px 0 8px; }
.ai-text table { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ai-text th, .ai-text td { border-bottom: 1px solid var(--grid); padding: 4px 8px; text-align: left; white-space: nowrap; }
.ai-text td.num { text-align: right; }
.ai-text th { color: var(--text-2); font-weight: 600; }
.ai-steps { font-size: 12px; color: var(--text-3); }
.ai-steps summary { cursor: pointer; list-style: none; }
.ai-steps summary::before { content: "▸ "; }
.ai-steps[open] summary::before { content: "▾ "; }
.ai-steps ul { margin: 4px 0 0; padding-left: 16px; }
.ai-typing { display: flex; gap: 4px; padding: 4px 0; }
.ai-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: ai-blink 1.2s infinite both; }
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ai-typing span { animation: none; opacity: 0.6; } .ai-fab { transition: none; } }
.ai-error { color: var(--crit); font-size: 13px; }
.ai-note { color: var(--text-3); font-size: 12.5px; }
.ai-proposal { border: 1px solid var(--brand); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.ai-proposal-head { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.ai-proposal-tag { font-weight: 560; color: var(--brand-ink); text-transform: uppercase; letter-spacing: 0.04em; }
.ai-proposal-ver { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-proposal-sum { font-weight: 600; }
.ai-proposal-meta, .ai-proposal-effect { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ai-proposal-warn { font-size: 12.5px; color: var(--warn, var(--text-2)); }
.ai-proposal-actions { display: flex; gap: 8px; margin-top: 4px; }
.ai-list-head { display: flex; justify-content: space-between; align-items: center; }
.ai-chats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-chats li { display: flex; align-items: center; gap: 4px; }
.ai-chat-open { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 10px; border: 0; background: none; padding: 9px 8px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--text); text-align: left; }
.ai-chat-open:hover { background: var(--surface-2); }
.ai-chat-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-chat-when { color: var(--text-3); font-size: 12px; flex: none; }
.ai-foot { padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.ai-box { border: 1px solid var(--line-strong); border-radius: 18px; padding: 8px 8px 6px 12px; background: var(--surface); }
.ai-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.ai-input { width: 100%; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 14px; line-height: 1.45; max-height: 160px; }
.ai-box-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-hint { font-size: 11.5px; color: var(--text-3); }
.ai-send { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.ai-send svg { width: 16px; height: 16px; }
.ai-send.stop { background: var(--text); color: var(--surface); }
@media (max-width: 700px) {
  .ai-panel, .ai-panel.wide { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; }
  .ai-fab { right: 16px; bottom: 16px; }
  .ai-panel:not([hidden]) + .ai-fab { display: none; }
  .ai-hint { display: none; }
}

/* ---- motion ---------------------------------------------------------- */

/* Arriving on a page: blocks drop in with a little spring, one after another. */
.content.enter > * { animation: drop-in 0.65s var(--ease-spring) both; }
.content.enter > :nth-child(1) { animation-delay: 0.04s; }
.content.enter > :nth-child(2) { animation-delay: 0.1s; }
.content.enter > :nth-child(3) { animation-delay: 0.16s; }
.content.enter > :nth-child(4) { animation-delay: 0.22s; }
.content.enter > :nth-child(5) { animation-delay: 0.28s; }
.content.enter > :nth-child(n + 6) { animation-delay: 0.34s; }
@keyframes drop-in { from { opacity: 0; transform: translateY(22px); } }
@keyframes pop { from { opacity: 0; transform: translate(6px, 10px); box-shadow: 0 0 0 var(--drop); } }
@keyframes fade { from { opacity: 0; } }

/* Charts draw themselves in: bars grow from the baseline left to right, lines trace. */
.content.enter .chart .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: grow 0.8s var(--ease-spring) both; animation-delay: calc(0.3s + var(--i, 0) * 0.7s); }
.content.enter .chart .bar.neg { transform-origin: 50% 0%; }
.content.enter .chart .series-line:not(.fc) { stroke-dasharray: 1; animation: draw 1.4s var(--ease-out) 0.3s both; }
.content.enter .chart .series-line.fc, .content.enter .chart .series-point, .content.enter .chart .series-area { animation: fade 0.6s ease 1.1s both; }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* Hovering a bar picks it out; the rest step back. */
.chart .bar { transition: opacity 0.2s; }
.chart svg:has(.bar.hover) .bar:not(.hover) { opacity: 0.32; }
.chart .bar.hover { opacity: 1; }

/* Surfaces that appear: the save tray, toasts, dialogs, the assistant. */
.tray:not([hidden]) { animation: tray-in 0.55s var(--ease-spring) both; }
@keyframes tray-in { from { opacity: 0; transform: translate(-50%, 40px); } }
.toast { animation: toast-in 0.5s var(--ease-spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) rotate(2deg); } }
dialog.modal[open] { animation: pop 0.45s var(--ease-spring) both; }
dialog.modal[open]::backdrop { animation: fade 0.25s ease both; }
.ai-panel:not([hidden]) { animation: pop 0.45s var(--ease-spring) both; transform-origin: bottom right; }

@media (max-width: 900px) {
  .hero .tiles, .hero-card .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hero .tile { padding: 12px; }
  .hero .tile .value { font-size: 24px; }
  .hero-card .card-body { padding: 22px 18px 36px; }
  .hero .hero-figure .value { font-size: 64px; }
  .hero-card .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-card .hero > .tiles { grid-column: 1; grid-row: 2; }
  .hero-card .hero::before { grid-column: 1; grid-row: 1; justify-self: end; align-self: start; width: 84px; margin: -6px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
  .ticker-track { animation: none !important; }
}

/* Bookings (a business page): the planning sheet's stays against the bank. */
.booking-figures { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.booking-figures .calc-chip { flex: 1 1 150px; }
.bookings td.nowrap { white-space: nowrap; }
.bookings .flag { color: var(--warn-text); font-weight: 700; cursor: help; }
.badge.paid { color: #fff8ec; background: var(--series-1); }
.badge.short { color: var(--on-accent); background: var(--mustard); }
.badge.missing { color: var(--on-accent); background: var(--orange); }
.badge.due { color: var(--text-3); }
.booking-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; padding: 6px 4px 10px 22px; white-space: normal; cursor: default; }
.booking-detail p { margin: 0 0 6px; }
.booking-detail .warn-text { color: var(--warn-text); }
.booking-detail .plain-list, .booking-extra .plain-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 3px; }
.booking-link summary { cursor: pointer; color: var(--text-2); margin: 4px 0; }
.booking-choices { display: grid; gap: 4px; margin: 6px 0 8px; max-height: 220px; overflow-y: auto; }
.booking-extra { margin-top: 14px; }
.booking-extra h3 { font-size: 13px; margin: 0 0 6px; }
@media (max-width: 700px) {
  .booking-detail { grid-template-columns: 1fr; padding-left: 4px; position: sticky; left: 0; width: calc(100vw - 120px); }
  .booking-figures .calc-chip { flex-basis: 120px; }
}
.bookings td { white-space: nowrap; }
.bookings tr.sub-row td { white-space: normal; }
.bookings th, .bookings td { padding-left: 10px; padding-right: 10px; }
.bookings thead th.text { text-align: left; }
.bookings td.wrap { white-space: normal; min-width: 90px; max-width: 170px; }
