/* ---------- Design system: one typeface, one type scale, four weights, six radii, one chart palette ----------
   Every size in styles.css / theme.css / magic.css points at these tokens; change a token to retune the whole app. */
@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --fs-1: 11px; --fs-2: 12px; --fs-3: 13px; --fs-4: 14px; --fs-5: 16px; --fs-6: 20px; --fs-7: 24px; --fs-8: 30px; --fs-9: 36px; --fs-10: 52px;
  --r-1: 6px; --r-2: 10px; --r-3: 14px; --r-4: 20px; --r-5: 26px; --r-pill: 999px;
  --chart-3: #5C7CE6; --chart-4: #3FA98F; --chart-5: #9B87E0; --chart-6: #D9A93F; --chart-7: #8E98B0; --chart-8: #DB7A86;
}
:root[data-theme="dark"] { --chart-3: #7D97F0; --chart-4: #4FC0A5; --chart-5: #B4A2EE; --chart-6: #E8BE5C; --chart-7: #9AA3B8; --chart-8: #E8909A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chart-3: #7D97F0; --chart-4: #4FC0A5; --chart-5: #B4A2EE; --chart-6: #E8BE5C; --chart-7: #9AA3B8; --chart-8: #E8909A; } }
html { font-optical-sizing: auto; font-feature-settings: "cv11", "ss03"; }

/* Theme: warm studio. Dark is espresso black with a soft amber glow, light is warm paper; both share one orange accent
   (from Harbourline peach), rounded cards and a floating sidebar dock that folds to icons. Loaded after styles.css and owns
   every colour token, light and dark. Built for speed: no pictures, no blur on repeated elements, no endless animation;
   the page glow is one static gradient on <body>. */

:root {
  /* Brand + base tokens (light: warm paper) */
  --navy: #15121F; --navy-2: #1B2627; --peach: #E8654A; --peach-soft: rgba(232, 101, 74, .1); --peach-ink: #1B7A84;
  --accent: #1AA6B6; --accent-2: #19C1DF; --accent-soft: rgba(232, 101, 74, .1); --accent-ink: #1B7A84; --on-accent: #FFFFFF;
  --bg: #F1EFF5; --card: #FFFFFF; --line: rgba(34, 26, 69, .1); --line-2: rgba(34, 26, 69, .06);
  --ink: #15121F; --ink-2: #5B4F47; --muted: #998C83;
  --good: #16A068; --good-bg: rgba(22, 160, 104, .1); --bad: #E0483C; --bad-bg: rgba(224, 72, 60, .1); --watch: #BE7812; --watch-bg: rgba(190, 120, 18, .1); --blue: #4C6FD8;
  --well: none; --hover: rgba(34, 26, 69, .045); --glass: rgba(255, 255, 255, .97); --bar-glass: rgba(237, 242, 243, .92);
  --shadow: 0 0 0 1px rgba(34, 26, 69, .05), 0 1px 2px rgba(34, 26, 69, .04), 0 10px 28px -18px rgba(34, 26, 69, .22);
  --shadow-hover: 0 0 0 1px rgba(34, 26, 69, .07), 0 14px 34px -16px rgba(34, 26, 69, .3);
  --shadow-lg: 0 0 0 1px rgba(34, 26, 69, .07), 0 30px 70px -24px rgba(34, 26, 69, .35);
  --chart-1: #1CA2B0; --chart-2: #B1CCD4; --chart-grid: rgba(34, 26, 69, .07); --tooltip: #15121F;
  --heat: 233, 112, 47;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;

  /* Layout + surface tokens */
  --t-page: #F1EFF5;
  --t-glow: radial-gradient(1100px 520px at 88% -12%, rgba(25, 193, 223, .2), transparent 62%), radial-gradient(700px 420px at 4% -8%, rgba(232, 101, 74, .07), transparent 60%);
  --t-side: #FFFFFF; --t-side-line: rgba(34, 26, 69, .07);
  --t-ink: #15121F;
  --t-card: #FFFFFF; --t-card-bg: #FFFFFF; --t-solid: #FFFFFF; --t-sub: rgba(74, 64, 110, .055); --t-edge: rgba(34, 26, 69, .05); --t-outline: rgba(34, 26, 69, .12);
  --t-ctrl: #FFFFFF; --t-ctrl-edge: rgba(34, 26, 69, .07);
  --t-shadow: var(--shadow); --t-shadow-up: var(--shadow-hover);
  --t-r: 24px; --t-r-sm: 20px;
  --t-act: var(--accent); --t-on-act: #FFFFFF;
  --t-sel: var(--accent); --t-sel-ink: #FFFFFF;
  --t-track: rgba(74, 64, 110, .08); --t-seg-on: #FFFFFF; --t-seg-on-ink: var(--ink);
  --t-hero: linear-gradient(150deg, #1AC5E5 0%, #1CA5B5 48%, #1C7D86 100%);
  --t-hero-shadow: 0 18px 40px -20px rgba(201, 80, 47, .65);
  --t-tip: #15121F; --t-tip-ink: #FFFFFF;
  --d-ease: cubic-bezier(.25, .1, .25, 1);
  --d-raise: var(--t-shadow); --d-raise-hover: var(--t-shadow-up);
  /* Older rules still read these: point them at the new look */
  --p-glass: var(--t-card); --p-glass-strong: var(--t-card); --p-edge: var(--t-edge); --p-shadow: var(--t-shadow); --p-shadow-hover: var(--t-shadow-up);
  --p-t1: var(--t-sub); --p-t2: var(--t-sub); --p-t3: var(--t-sub); --p-t4: var(--t-sub); --p-t5: var(--t-sub);
  --p-tile-edge: transparent; --p-tile-ink: var(--ink); --p-dark: var(--t-hero); --p-r: var(--t-r);
}

/* Dark: espresso black, warm brown cards, an amber glow at the top, orange accent, mint for "up". */
:root[data-theme="dark"] {
  --navy: #EFEDF4; --navy-2: #FFFFFF; --peach-soft: rgba(232, 101, 74, .14); --peach-ink: #F08A6E;
  --accent: #16AABF; --accent-2: #17C2DE; --accent-soft: rgba(232, 101, 74, .14); --accent-ink: #F08A6E;
  --bg: #08070D; --card: #0F0D18; --line: rgba(230, 222, 255, .09); --line-2: rgba(230, 222, 255, .05);
  --ink: #EFEDF4; --ink-2: #CBBDB3; --muted: #8E7F75;
  --good: #3DDC97; --good-bg: rgba(61, 220, 151, .12); --bad: #FF6B5E; --bad-bg: rgba(255, 107, 94, .12); --watch: #F2B04F; --watch-bg: rgba(242, 176, 79, .12); --blue: #8EA8F5;
  --hover: rgba(230, 222, 255, .05); --glass: rgba(12, 20, 20, .97); --bar-glass: rgba(8, 7, 13, .88);
  --shadow: 0 0 0 1px rgba(230, 222, 255, .06), 0 18px 40px -24px rgba(0, 0, 0, .9);
  --shadow-hover: 0 0 0 1px rgba(230, 222, 255, .1), 0 22px 44px -22px rgba(0, 0, 0, .95);
  --shadow-lg: 0 0 0 1px rgba(230, 222, 255, .1), 0 30px 70px -24px rgba(0, 0, 0, .95);
  --chart-1: #16AABF; --chart-2: #6B5649; --chart-grid: rgba(230, 222, 255, .06); --tooltip: #162324;
  --heat: 242, 122, 51;
  --t-page: #08070D;
  --t-glow: radial-gradient(1100px 560px at 78% -16%, rgba(201, 80, 47, .26), transparent 62%), radial-gradient(800px 520px at -4% -6%, rgba(27, 90, 97, .3), transparent 60%);
  --t-side: #0D1213; --t-side-line: rgba(230, 222, 255, .07); --t-ink: #EFEDF4;
  --t-card: #0F0D18; --t-card-bg: linear-gradient(180deg, #10191A 0%, #0C1313 100%); --t-solid: #0F1718; --t-sub: rgba(230, 222, 255, .045);
  --t-edge: rgba(230, 222, 255, .06); --t-outline: rgba(230, 222, 255, .12);
  --t-ctrl: rgba(230, 222, 255, .05); --t-ctrl-edge: rgba(230, 222, 255, .07);
  --t-act: var(--accent); --t-on-act: #FFFFFF; --t-sel: var(--accent); --t-sel-ink: #FFFFFF;
  --t-track: rgba(230, 222, 255, .06); --t-seg-on: rgba(230, 222, 255, .13); --t-seg-on-ink: #FFFFFF;
  --t-hero: linear-gradient(160deg, #1BB3CF 0%, #1E8790 46%, #0E3236 100%);
  --t-hero-shadow: 0 20px 44px -22px rgba(201, 80, 47, .55);
  --t-tip: #EFEDF4; --t-tip-ink: #0C1313;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #EFEDF4; --navy-2: #FFFFFF; --peach-soft: rgba(232, 101, 74, .14); --peach-ink: #F08A6E;
    --accent: #16AABF; --accent-2: #17C2DE; --accent-soft: rgba(232, 101, 74, .14); --accent-ink: #F08A6E;
    --bg: #08070D; --card: #0F0D18; --line: rgba(230, 222, 255, .09); --line-2: rgba(230, 222, 255, .05);
    --ink: #EFEDF4; --ink-2: #CBBDB3; --muted: #8E7F75;
    --good: #3DDC97; --good-bg: rgba(61, 220, 151, .12); --bad: #FF6B5E; --bad-bg: rgba(255, 107, 94, .12); --watch: #F2B04F; --watch-bg: rgba(242, 176, 79, .12); --blue: #8EA8F5;
    --hover: rgba(230, 222, 255, .05); --glass: rgba(12, 20, 20, .97); --bar-glass: rgba(8, 7, 13, .88);
    --shadow: 0 0 0 1px rgba(230, 222, 255, .06), 0 18px 40px -24px rgba(0, 0, 0, .9);
    --shadow-hover: 0 0 0 1px rgba(230, 222, 255, .1), 0 22px 44px -22px rgba(0, 0, 0, .95);
    --shadow-lg: 0 0 0 1px rgba(230, 222, 255, .1), 0 30px 70px -24px rgba(0, 0, 0, .95);
    --chart-1: #16AABF; --chart-2: #6B5649; --chart-grid: rgba(230, 222, 255, .06); --tooltip: #162324;
    --heat: 242, 122, 51;
    --t-page: #08070D;
    --t-glow: radial-gradient(1100px 560px at 78% -16%, rgba(201, 80, 47, .26), transparent 62%), radial-gradient(800px 520px at -4% -6%, rgba(27, 90, 97, .3), transparent 60%);
    --t-side: #0D1213; --t-side-line: rgba(230, 222, 255, .07); --t-ink: #EFEDF4;
    --t-card: #0F0D18; --t-card-bg: linear-gradient(180deg, #10191A 0%, #0C1313 100%); --t-solid: #0F1718; --t-sub: rgba(230, 222, 255, .045);
    --t-edge: rgba(230, 222, 255, .06); --t-outline: rgba(230, 222, 255, .12);
    --t-ctrl: rgba(230, 222, 255, .05); --t-ctrl-edge: rgba(230, 222, 255, .07);
    --t-act: var(--accent); --t-on-act: #FFFFFF; --t-sel: var(--accent); --t-sel-ink: #FFFFFF;
    --t-track: rgba(230, 222, 255, .06); --t-seg-on: rgba(230, 222, 255, .13); --t-seg-on-ink: #FFFFFF;
    --t-hero: linear-gradient(160deg, #1BB3CF 0%, #1E8790 46%, #0E3236 100%);
    --t-hero-shadow: 0 20px 44px -22px rgba(201, 80, 47, .55);
    --t-tip: #EFEDF4; --t-tip-ink: #0C1313;
    color-scheme: dark;
  }
}

/* ---------- Page: warm backdrop with one static glow at the top ---------- */
body { background: var(--t-glow), var(--t-page); background-repeat: no-repeat; background-color: var(--t-page);
  font-family: var(--font); font-size: var(--fs-4); letter-spacing: -.006em; color: var(--ink); -webkit-font-smoothing: antialiased; }
body::before { display: none; }
:root { --rail-open: 232px; --rail-min: 72px; --rail-w: var(--rail-open); --rail: var(--rail-w); --edge-gap: 14px; }
html[data-rail="min"] { --rail-w: var(--rail-min); }
main { margin: 0 0 0 calc(var(--rail-w) + var(--edge-gap)); padding: 14px 30px 64px 22px; min-height: 100vh; max-width: none;
  background: none; border: 0; border-radius: 0; box-shadow: none; transition: margin-left .3s var(--d-ease); }

/* ---------- Sidebar: a floating dock. Open shows names; folded shows icons, with a label sliding out on hover ---------- */
.edge { display: none; }
.rail { position: fixed; top: var(--edge-gap); bottom: var(--edge-gap); left: var(--edge-gap); width: var(--rail-w); padding: 16px 12px 12px; gap: 12px; transform: none;
  background: var(--t-side); border: 1px solid var(--t-side-line); border-radius: var(--r-5); box-shadow: var(--shadow); overflow: hidden;
  transition: width .3s var(--d-ease); z-index: 40; }
.rail.open { width: var(--rail-w); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 8px; min-height: 38px; }
.brand img { width: 30px; height: 30px; flex: none; }
.word { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; font-size: var(--fs-5); letter-spacing: -.02em; opacity: 1; transition: opacity .2s; }
.word b { font-weight: 700; color: var(--ink); } .word i { font-weight: 700; font-style: normal; color: var(--accent); }

#nav { min-height: 0; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 0 6px; gap: 2px; scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
.nav { position: relative; flex-shrink: 0; height: 38px; padding: 0 11px; gap: 11px; border-radius: var(--r-3); text-align: left; color: var(--ink-2); font-size: var(--fs-3); font-weight: 500;
  transition: background .15s, color .15s; }
.nav .i { width: 18px; height: 18px; color: var(--muted); flex: none; transition: color .15s; }
.nav span { opacity: 1; transition: opacity .2s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav kbd { display: none; }
.nav:hover { background: var(--hover); color: var(--ink); }
.nav:hover .i { color: var(--ink); }
.nav.active { background: var(--t-sel); color: var(--t-sel-ink); font-weight: 600; box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.nav.active .i { color: var(--t-sel-ink); }
.nav.active::after { display: none; }
.nav .badge { flex: none; margin-left: auto; }
.nav-group { height: auto; margin: 14px 0 4px; padding: 0 11px; }
.nav-group::before { display: none; }
.nav-group span { opacity: 1; white-space: nowrap; overflow: hidden; font-size: var(--fs-1); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); transition: opacity .2s; }
#nav > .nav-group:first-child { margin-top: 0; }
.rail-foot { gap: 2px; padding-top: 10px; border-top: 1px solid var(--t-side-line); }
.rail-toggle { display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 11px; border-radius: var(--r-3); color: var(--muted); font-size: var(--fs-3); font-weight: 500; white-space: nowrap; flex: none; }
.rail-toggle:hover { background: var(--hover); color: var(--ink); }
.rail-toggle .i { width: 17px; height: 17px; flex: none; }
.rail-toggle span { transition: opacity .2s; }

/* Folded: a slim column of icons */
html[data-rail="min"] .rail { padding-left: 12px; padding-right: 12px; }
html[data-rail="min"] .brand { justify-content: center; padding: 0; }
html[data-rail="min"] .rail :is(.word, .nav span, .nav-group span, .rail-toggle span) { opacity: 0; width: 0; flex: 0 0 0; }
html[data-rail="min"] :is(.nav, .rail-toggle) { justify-content: center; padding: 0; gap: 0; height: 44px; }
html[data-rail="min"] .rail-toggle { height: 36px; }
html[data-rail="min"] .nav .badge { position: absolute; top: 7px; right: 9px; min-width: 8px; height: 8px; padding: 0; font-size: 0; line-height: 8px; margin: 0; }
html[data-rail="min"] .nav-group { margin: 8px 10px; height: 1px; padding: 0; background: var(--t-side-line); }
html[data-rail="min"] #nav > .nav-group:first-child { display: none; }

/* The label that slides out beside a folded icon */
.tip { position: fixed; z-index: 80; display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 11px; border-radius: var(--r-2); pointer-events: none;
  background: var(--t-tip); color: var(--t-tip-ink); font-size: var(--fs-3); font-weight: 500; white-space: nowrap; transform: translateY(-50%);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .45); animation: tip-in .14s var(--d-ease); }
.tip[hidden] { display: none; }
.tip kbd { padding: 0 5px; border: 0; border-radius: var(--r-1); background: color-mix(in srgb, var(--t-tip-ink) 14%, transparent); color: inherit; opacity: .75; font-size: var(--fs-1); line-height: 16px; }
@keyframes tip-in { from { opacity: 0; transform: translate(-4px, -50%); } }

/* ---------- Top bar: search on the left; ask, present, light/dark and you on the right ---------- */
.top { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.top-r { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.menu-btn { display: none; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; color: var(--ink-2); background: var(--t-ctrl); border: 1px solid var(--t-ctrl-edge); }
.menu-btn .i { width: 18px; height: 18px; }
#search-btn { flex: 0 1 420px; height: 46px; justify-content: flex-start; padding: 0 6px 0 16px; gap: 10px; }
#search-btn .ph { flex: 1; text-align: left; color: var(--muted); font-weight: 400; }
#search-btn .ico .i { width: 17px; height: 17px; }
#search-btn kbd { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-pill); border: 0; background: var(--t-track); color: var(--ink-2); font-size: var(--fs-2); font-weight: 500; }
.round { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 50%; color: var(--ink-2);
  background: var(--t-ctrl); border: 1px solid var(--t-ctrl-edge); transition: color .15s, background .15s; }
.round:hover { color: var(--ink); background: var(--hover); }
.round .i { width: 18px; height: 18px; }
.top .pill.ask { height: 46px; padding: 0 8px 0 15px; gap: 9px; color: var(--accent-ink); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: none; font-size: var(--fs-4); font-weight: 600; }
.top .pill.ask:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: none; }
.pill.ask .ico { color: inherit; }
.pill.ask .ico .i { width: 17px; height: 17px; }
.pill.ask kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--accent) 16%, transparent); color: inherit; font-size: var(--fs-1); }
.top .me { display: flex; align-items: center; gap: 10px; height: 46px; margin: 0 0 0 4px; padding: 0 14px 0 5px; border-radius: var(--r-pill); text-align: left;
  background: var(--t-ctrl); border: 1px solid var(--t-ctrl-edge); }
.top .me:hover { background: var(--hover); }
.me-av { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; font: 600 var(--fs-3) var(--font); color: #FFF; background: var(--t-hero); box-shadow: none; }
.me-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-t b { font-size: var(--fs-3); font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.me-t small { font-size: var(--fs-1); color: var(--muted); }

/* ---------- Page header: a large title, then the page's controls ---------- */
.bar { position: static; margin: 26px 0 0; padding: 0 0 22px; background: transparent; border: 0; -webkit-mask-image: none; mask-image: none; align-items: flex-end; }
.titles { min-width: 0; }
h1 { font: 600 var(--fs-9)/1.1 var(--font-display); letter-spacing: -.03em; color: var(--ink); }
#subtitle { margin-top: 7px; font-size: var(--fs-3); color: var(--muted); }
.tools { gap: 8px; padding: 0; border-radius: 0; background: none; border: 0; box-shadow: none; }
.pill, .seg, .btn { height: 36px; background: var(--t-ctrl); border: 1px solid var(--t-ctrl-edge); box-shadow: none; border-radius: var(--r-pill); color: var(--ink); font-weight: 500; }
.pill:hover, .btn:hover { background: var(--t-ctrl); border-color: var(--t-outline); box-shadow: none; }
.btn { background: var(--t-ctrl); }
.tools .pill, .tools .seg { height: 36px; }
.pill .ico { display: inline-grid; place-items: center; width: auto; height: auto; margin: 0; background: none; color: var(--muted); border-radius: 0; }
.pill .ico .i { width: 15px; height: 15px; }
.pill b.count { background: var(--accent); color: #FFF; }
#period-btn { padding-right: 11px; }
/* Live Semble data that is behind (live-age.js): amber button, header line and date-picker option. */
#period-btn.live-behind { border-color: var(--watch); box-shadow: 0 0 0 3px var(--watch-bg); }
#period-btn.live-behind .ico { color: var(--watch); }
#subtitle.live-behind { color: var(--watch); font-weight: 500; }
/* The freshness line under the header (fresh.js): one short muted line on every page; hidden with the header in Present mode. */
#fresh { margin: 3px 0 0; font-size: var(--fs-2); color: var(--muted); }
#fresh.live-behind { color: var(--watch); font-weight: 500; }
.period-pop .opt.behind .muted { color: var(--watch); }
.period-pop .live-warn { margin: 0 0 10px; max-width: 360px; line-height: 1.4; }
.pill.dark, .btn.primary { background: var(--t-act); color: var(--t-on-act); border-color: transparent; box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--accent) 90%, transparent); }
.pill.dark .ico, .btn.primary .ico { color: inherit; }
.pill.dark:hover, .btn.primary:hover { background: var(--t-act); border-color: transparent; filter: brightness(1.06); }
/* Segmented controls: a quiet track with the chosen option lifted */
.seg { padding: 3px; background: var(--t-track); border-color: transparent; }
.seg button { height: 100%; padding: 0 13px; border-radius: var(--r-pill); color: var(--muted); font-weight: 500; }
.seg button:hover { color: var(--ink); }
.seg button.on, .tabs button.on { background: var(--t-seg-on); color: var(--t-seg-on-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 10px -4px rgba(0, 0, 0, .12); }
.tabs { display: inline-flex; padding: 3px; gap: 0; background: var(--t-track); border: 0; border-radius: var(--r-pill); box-shadow: none; }
.tabs button { color: var(--muted); font-weight: 500; border-radius: var(--r-pill); } .tabs button:hover { color: var(--ink); }
.btn.peach { color: #FFF; background: var(--accent); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.types { background: var(--t-track); box-shadow: none; border-radius: var(--r-pill); }
.types button { border-radius: var(--r-pill); } .types button.on { background: var(--t-seg-on); color: var(--t-seg-on-ink); box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .18); }
.ib { border-radius: var(--r-2); } .ib:hover { background: var(--hover); }
input[type=text], input[type=number], input[type=search], input[type=date], select, textarea { background: var(--t-solid); border: 1px solid var(--t-outline); border-radius: var(--r-3); color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); outline: 0; }
.search { background: var(--t-ctrl); border: 1px solid var(--t-ctrl-edge); box-shadow: none; }
.search input { background: none; border: 0; }
.checks { margin-top: 10px; }

/* ---------- Cards: rounded, soft edge; warm gradient in dark ---------- */
.card { background: var(--t-card-bg); border: 1px solid var(--t-edge); border-radius: var(--t-r); padding: 22px 24px; box-shadow: var(--shadow); }
.card:hover { box-shadow: var(--shadow); }
.card h3 { font-size: var(--fs-5); font-weight: 600; letter-spacing: -.015em; }
.grid { gap: 16px; }
.hint { color: var(--muted); }

/* Tiles: card surface; the lead tile on each row is the orange gradient */
.kpi, .stat { background: var(--t-card-bg) !important; border: 1px solid var(--t-edge); color: var(--ink); box-shadow: var(--shadow); }
.kpi { border-radius: var(--t-r-sm); padding: 18px 20px; }
.kpi .v, .kpi .v.proof-link { font: 600 var(--fs-8)/1.1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat { border-radius: var(--r-3); }
.stat .v { font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l, .stat .k, .kpi .sub, .stat .s { color: var(--muted); }
.kpi .l { font-weight: 500; color: var(--ink-2); }
.stats-row .stat, .card .stats-row .stat { background: var(--t-sub) !important; border-color: transparent; box-shadow: none; }
.kpis > .kpi.hero, .stats-row > .stat.main, .headline .main { background: var(--t-hero) !important; color: #FFF; border-color: transparent; box-shadow: var(--t-hero-shadow); }
.kpi.hero .l, .kpi.hero .sub, .stat.main .k, .stat.main .s, .headline .main .k { color: rgba(255, 255, 255, .78); }
.kpi.hero :is(.trend, .trend.up, .trend.down, .trend.flat) { background: rgba(255, 255, 255, .2) !important; color: #FFF !important; }
.kpi.hero .delta { color: #FFF !important; font-weight: 600; }
.kpi.hero .spark polyline, .kpi.hero .spark path { stroke: #FFF !important; }
.kpi.hero .ib { color: rgba(255, 255, 255, .8); }
.kpi.hero::after, .kpi.hero::before { display: none; }
.kpi.hero .spark { opacity: .95; }
/* "Of which £X is still unpaid" on the orange tile: white on a dark band, never grey on orange. */
.kpi .unpaid-note { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: var(--r-pill, 999px); font-weight: 600; background: var(--line); color: var(--ink); }
.kpi.hero .unpaid-note { background: rgba(0, 0, 0, .22); color: #FFF; }
.kpi .sub .was { opacity: .85; }
.stat.end-self { background: none !important; box-shadow: none; }
.headline > div, .lever, .ask-answer, .calc, .wd-bal, .pricebar, .pack-preview, .weeks-panel, p.ck-how, .mini-kpis div { background: var(--t-sub); box-shadow: none; border-color: transparent; }
.scen-result > div, .stack, .tblock, .note { border-color: var(--t-outline); }
.step > i { background: var(--t-act); color: var(--t-on-act); }
.sharebar i, .pbar i { background: var(--t-act); }
.progress-xl { box-shadow: none; } .progress-xl i { background: var(--t-act); }
.toast { background: var(--t-tip); color: var(--t-tip-ink); border-radius: var(--r-3); }
.sheet, .pop, .modal .box, .cmdk-box { background: var(--t-solid); color: var(--ink); }
.pop { border: 1px solid var(--t-edge); border-radius: var(--r-3); box-shadow: var(--shadow-lg); }
.sheet { border-radius: var(--r-5) 0 0 var(--r-5); box-shadow: var(--shadow-lg); }
.scrim { background: rgba(3, 8, 8, .28); }
.modal { background: rgba(3, 8, 8, .4); }
.upload-box { border-color: var(--t-outline); }
.chip { background: var(--accent-soft); color: var(--accent-ink); }
.trend.flat, .tag, .status-tag.on-track { background: var(--t-sub); }

/* No hover lift on tiles, KPI cards or rows (owner decision D44): a fully still look. A press still gives a tiny
   squeeze, which Settings → Still turns off with the other movement. */
html:not([data-depth="off"]) :is(.kpi, .stat, .tile, .pack-sec) { transition: transform .2s var(--d-ease); }
html:not([data-depth="off"]) :is(.kpi, .stat, .tile, .btn):active { transform: scale(.99); }
html.calm :is(.kpi, .stat, .tile, .btn, .drill-row, .pt-row) { transform: none !important; } html.calm :is(main, .rail) { transition: none !important; } html.calm .tip { animation: none; } /* html.calm: public/depth.js */

/* Tables: airy, hairline rows */
table.grid th { background: var(--t-solid); font-size: var(--fs-1); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); border-bottom-color: var(--line); }
/* The total row stays pinned to the bottom of a scrolling table: it needs a solid background and a soft edge, or rows show through it. */
table.grid tfoot td { background: var(--t-solid); z-index: 1; box-shadow: 0 -1px 0 var(--t-outline); }
table.grid td { padding: 11px 10px; border-bottom-color: var(--line-2); font-variant-numeric: tabular-nums; }
/* No row highlight on hover or while a row's drawer is open (user found it unprofessional).
   Overrides the older hover rules in styles.css. */
table.grid tbody tr:hover td, tr.link-row:hover td,
table.clickable > tbody > tr[data-svc]:hover td { background: transparent; }
table.grid tbody tr[data-row] { cursor: pointer; }
.tag.GP, .tag.HCA, .tag.Corporate { background: var(--t-sub); }
:root[data-theme="dark"] .tag.GP { color: #A9BBF5; } :root[data-theme="dark"] .tag.HCA { color: #7FD3BF; } :root[data-theme="dark"] .tag.Corporate { color: #C6B1EE; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.GP { color: #A9BBF5; } :root:not([data-theme="light"]) .tag.HCA { color: #7FD3BF; } :root:not([data-theme="light"]) .tag.Corporate { color: #C6B1EE; }
}

/* Chart tools stay out of the way until you point at the card, so titles get the full width */
@media (hover: hover) {
  .card.visual .vhead { position: relative; }
  .card.visual .vtools { position: absolute; top: -4px; right: -4px; padding: 3px; border-radius: var(--r-2); background: var(--t-solid); box-shadow: var(--shadow-hover);
    opacity: 0; pointer-events: none; transition: opacity .15s; }
  .card.visual:hover .vtools, .card.visual .vtools:focus-within { opacity: 1; pointer-events: auto; }
  .card.visual .vtools .ib.cm.has { opacity: 1; }
}

/* Narrow windows: tighter gutters; search keeps only its icon and shortcut */
@media (max-width: 1100px) {
  main { padding-right: 22px; }
  #search-btn { flex: 1 1 auto; }
  .top .me .me-t { display: none; } .top .me { padding: 0 4px; }
}
/* Phones: the dock becomes a sheet that slides in from the menu button */
@media (max-width: 720px) {
  :root, html[data-rail="min"] { --rail-w: 0px; --edge-gap: 0px; }
  main { margin: 0; padding: 12px 16px 64px; }
  .rail { top: 10px; bottom: 10px; left: 10px; width: 260px; transform: translateX(calc(-100% - 20px)); transition: transform .3s var(--d-ease); }
  .rail.open { width: 260px; transform: none; box-shadow: var(--shadow-lg); }
  html[data-rail="min"] .rail :is(.word, .nav span, .nav-group span) { opacity: 1; width: auto; flex: 1; }
  html[data-rail="min"] .nav { justify-content: flex-start; padding: 0 11px; gap: 11px; height: 40px; }
  html[data-rail="min"] .brand { justify-content: flex-start; padding: 0 4px 0 8px; }
  html[data-rail="min"] .nav-group { margin: 14px 0 4px; padding: 0 11px; height: auto; background: none; }
  .rail-toggle { display: none; }
  .menu-btn { display: grid; }
  .top { gap: 8px; }
  #search-btn { display: inline-flex; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; justify-content: center; }
  #search-btn :is(.ph, kbd) { display: none; }
  .top .pill.ask { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .top .pill.ask :is(.ask-l, kbd) { display: none; }
  .round, .top .me { width: 44px; height: 44px; } .top .me { padding: 0; justify-content: center; margin: 0; } .me-av { width: 34px; height: 34px; }
  .bar { margin-top: 18px; }
  h1 { font-size: var(--fs-8); }
}

/* ---------- Home: greeting and the big number on the page, tiles on the right ---------- */
:root .home-hero, :root .home-hero:hover { position: relative; overflow: visible; padding: 8px 4px 6px; background: none !important; border: 0; box-shadow: none !important; color: var(--ink); }
.home-hero::before, .home-hero::after { display: none; }
.hero-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: stretch; }
.hero-lead { display: flex; flex-direction: column; min-width: 0; }
.hero-head { display: flex; align-items: center; gap: 14px; margin: 0; }
.hello { margin: 0; font: 700 var(--fs-8)/1.15 var(--font-display); letter-spacing: -.035em; color: var(--ink); }
.hello-sub { margin: 2px 0 22px; font: 500 var(--fs-8)/1.15 var(--font-display); letter-spacing: -.035em; color: var(--muted); }
/* The answer sentence under the greeting (UI plan, Lane 1 uses it in place of .hello-sub). */
p.hero-answer { margin: 2px 0 18px; font-size: var(--fs-6); line-height: 1.4; color: var(--ink-2); max-width: 560px; text-wrap: pretty; }
p.hero-answer b { color: var(--ink); font-weight: 600; }
.hero-chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px 0 10px; border-radius: var(--r-pill); font-size: var(--fs-2); font-weight: 600;
  background: var(--t-ctrl); border: 1px solid var(--t-ctrl-edge); box-shadow: var(--shadow); white-space: nowrap; }
.hero-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hero-chip.good { color: var(--good); } .hero-chip.watch { color: var(--watch); } .hero-chip.bad { color: var(--bad); }
.hl-label { align-self: flex-start; font-size: var(--fs-3); font-weight: 600; color: var(--ink-2); padding: 5px 12px; border-radius: var(--r-pill); background: var(--t-sub); }
.hl-big { display: flex; align-items: flex-start; gap: 14px; margin: 14px 0 6px; flex-wrap: wrap; }
.hl-value { display: block; text-align: left; font: 600 var(--fs-10)/1 var(--font-display); letter-spacing: -.035em; color: var(--ink); font-variant-numeric: tabular-nums; }
button.hl-value:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 10px; text-decoration-color: var(--peach); }
.hl-delta { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; font-size: var(--fs-2); color: var(--muted); max-width: 170px; line-height: 1.35; }
.hl-delta b { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-4); font-weight: 600; }
.hl-delta b .i { width: 14px; height: 14px; }
.hl-delta.up b { color: var(--good); } .hl-delta.down b { color: var(--bad); }
.hl-spark { margin: 16px 0 4px; height: 70px; position: relative; }
.hl-spark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.hl-spark .ln { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hl-spark .ar { fill: url(#hl-grad); }
.hl-spark .g1 { stop-color: var(--accent); stop-opacity: .3; } .hl-spark .g2 { stop-color: var(--accent); stop-opacity: 0; }
.hl-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--t-card); border: 3px solid var(--accent); }
.hl-weeks { display: flex; justify-content: space-between; font-size: var(--fs-1); color: var(--muted); }
.hl-verdict { margin: 12px 0 0; padding-top: 16px; font-size: var(--fs-5); line-height: 1.5; color: var(--ink-2); max-width: 560px; text-wrap: pretty; }
.hl-verdict b { color: var(--ink); font-weight: 600; }

/* Tiles: icon top-left, arrow top-right, label, then the value with a small ring */
.home-hero .rings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-content: start; }
.tile { display: flex; flex-direction: column; align-items: stretch; gap: 0; min-height: 214px; padding: 16px 18px 18px; text-align: left; color: var(--ink);
  background: var(--t-card-bg); border: 1px solid var(--t-edge); border-radius: var(--t-r); box-shadow: var(--shadow); }
button.tile:focus-visible { outline: 2px solid var(--peach); outline-offset: 2px; }
.tile-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.tile-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-2); background: var(--t-sub); color: var(--ink-2); }
.tile-ic .i { width: 16px; height: 16px; }
.tile-go { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--muted); }
.tile-go .i { width: 15px; height: 15px; }
.tile .ring-l { font-size: var(--fs-4); font-weight: 500; color: var(--ink-2); letter-spacing: -.01em; }
.tile-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 14px; }
.tile-v { font: 600 var(--fs-9)/1 var(--font-display); letter-spacing: -.04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile-v.off { color: var(--muted); }
.tile svg.ring { width: 46px; height: 46px; flex: none; }
.tile .ring-bg { stroke: var(--line); stroke-width: 12; }
.tile .ring-fg { stroke-width: 12; filter: none; }
.tile .ring.navy .ring-fg { stroke: var(--accent); } .tile .ring.good .ring-fg { stroke: var(--good); } .tile .ring.peach .ring-fg { stroke: var(--peach); }
.tile .ring.bad .ring-fg { stroke: var(--bad); } .tile .ring.watch .ring-fg { stroke: var(--watch); }
.tile .ring.off .ring-bg { stroke: var(--line); stroke-dasharray: 3 9; stroke-width: 8; }
.tile .ring-tick { stroke: var(--peach); stroke-width: 5; }
.tile .ring-s { margin-top: 4px; font-size: var(--fs-2); line-height: 1.4; color: var(--muted); }
.tile .ring-s .link { color: var(--peach-ink); }
:root[data-theme="dark"] .tile .ring.navy .ring-fg { stroke: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile .ring.navy .ring-fg { stroke: var(--accent); } }

@media (max-width: 1180px) { .hero-body { grid-template-columns: 1fr; } }
/* Small phones: the answer, the figure and the two tiles fit on the first screen. */
@media (max-width: 640px) {
  .hello, .hello-sub { font-size: var(--fs-7); }
  p.hero-answer { font-size: var(--fs-5); }
  .hl-value { font-size: var(--fs-9); }
  .home-hero .rings { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { min-height: 0; padding: 12px 14px 14px; }
  .tile-top { display: none; }
  .tile-v { font-size: var(--fs-8); }
  .tile svg.ring { width: 36px; height: 36px; }
  .tile .ring-s { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  ul.tl-list li { flex-wrap: wrap; }
  ul.tl-list li .muted { margin-left: 0; flex-basis: 100%; }
}

/* ---------- Drill-down drawer ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 44px 6px 0; font-size: var(--fs-2); color: var(--muted); }
.crumbs button { padding: 3px 8px; border-radius: var(--r-pill); font-weight: 500; color: var(--ink-2); }
.crumbs button:hover { background: var(--hover); color: var(--ink); }
.crumbs b { padding: 3px 8px; font-weight: 600; color: var(--ink); }
.crumbs .i { width: 12px; height: 12px; opacity: .5; }
.dl-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.dl-kpis > div { padding: 12px 14px; border-radius: var(--r-3); font-size: var(--fs-2); color: var(--ink-2); border: 1px solid var(--p-tile-edge, var(--line)); box-shadow: var(--d-raise); }
.dl-kpis > div:nth-child(1) { background: var(--p-t1, var(--bg)); } .dl-kpis > div:nth-child(2) { background: var(--p-t2, var(--bg)); }
.dl-kpis > div:nth-child(3) { background: var(--p-t3, var(--bg)); } .dl-kpis > div:nth-child(4) { background: var(--p-t4, var(--bg)); }
.dl-kpis b { display: block; font: 700 var(--fs-6)/1.2 var(--font-display); letter-spacing: -.02em; color: var(--p-tile-ink, var(--ink)); margin-bottom: 2px; }
.dl-kpis .proof-link { text-align: left; }
.dl-sec { margin-top: 22px; }
.dl-sec > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dl-sec > header h4 { margin: 0; }
.dl-sec > header span { font-size: var(--fs-2); color: var(--muted); }
.drill-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; gap: 6px 12px; align-items: center; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: var(--r-3); margin-bottom: 6px; background: var(--t-sub); border: 1px solid transparent;
  box-shadow: none; }
.drill-row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.drill-row .sub { grid-column: 1 / 2; font-size: var(--fs-2); color: var(--muted); margin-top: -4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drill-row .amt { font-weight: 700; text-align: right; }
.drill-row .amt small { display: block; font-size: var(--fs-1); font-weight: 500; color: var(--muted); }
.drill-row > .i { color: var(--muted); grid-row: 1 / span 2; grid-column: 3; }
.drill-row .mix { grid-column: 1 / 3; display: flex; height: 6px; border-radius: var(--r-1); overflow: hidden; background: var(--line-2); }
.drill-row .mix i { display: block; height: 100%; }
.mix-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-2); color: var(--ink-2); margin: 0 0 10px; }
.mix-key span { display: inline-flex; align-items: center; gap: 6px; }
.mix-key i, .drill-row .mix i { --c: var(--muted); background: var(--c); }
.mix-key i { width: 8px; height: 8px; border-radius: var(--r-1); }
.mix-self { --c: #26AEB8 !important; } .mix-ins { --c: #5B7BE8 !important; } .mix-corp { --c: #14204A !important; }
:root[data-theme="dark"] .mix-corp { --c: #E6E3DD !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mix-corp { --c: #E6E3DD !important; } }
.pt-row { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 16px; gap: 2px 12px; align-items: center; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: var(--r-3); margin-bottom: 6px; background: var(--t-sub); border: 1px solid transparent;
  box-shadow: none; }
.pt-av { grid-row: 1 / span 2; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 700 var(--fs-2) var(--font); color: #14204A;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 6px 12px -6px rgba(60, 40, 50, .35); }
.pt-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-row .sub { grid-column: 2; font-size: var(--fs-2); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-row .amt { grid-row: 1 / span 2; grid-column: 3; text-align: right; font-weight: 700; }
.pt-row .amt small { display: block; font-size: var(--fs-1); font-weight: 500; }
.pt-row > .i { grid-row: 1 / span 2; grid-column: 4; color: var(--muted); }
.unpaid { color: var(--bad); } .paid { color: var(--good); }
.dl-note { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-3); font-size: var(--fs-2); color: var(--ink-2); background: var(--peach-soft); }
.dl-note b { color: var(--ink); }
.inv-list { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: var(--fs-3); }
.inv-list td { padding: 9px 10px; background: var(--t-sub); border-top: 1px solid transparent; border-bottom: 1px solid transparent; vertical-align: top; }
.inv-list td:first-child { border-left: 1px solid transparent; border-radius: var(--r-3) 0 0 var(--r-3); white-space: nowrap; }
.inv-list td:last-child { border-right: 1px solid transparent; border-radius: 0 var(--r-3) var(--r-3) 0; text-align: right; white-space: nowrap; }
.inv-list .svc { color: var(--ink); font-weight: 500; }
.inv-list .meta { color: var(--muted); font-size: var(--fs-2); }
.dl-more { display: block; width: 100%; margin-top: 4px; padding: 9px; border-radius: var(--r-3); font-weight: 600; color: var(--ink-2); }
.dl-more:hover { background: var(--hover); }
@media (max-width: 640px) { .dl-kpis { grid-template-columns: 1fr 1fr; } }

/* ---------- Board pack picker ---------- */
.pack-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.pack-group > header { display: flex; justify-content: space-between; align-items: center; margin: 6px 2px; font-size: var(--fs-1); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pack-group > header button { font-size: var(--fs-2); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--peach-ink); }
.pack-secs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pack-sec { display: flex; gap: 9px; align-items: flex-start; padding: 9px 10px; border-radius: var(--r-3); cursor: pointer; font-size: var(--fs-3); line-height: 1.3;
  background: var(--t-sub); border: 1px solid transparent; box-shadow: none; }
.pack-sec input { margin: 2px 0 0; accent-color: var(--accent); }
.pack-sec b { display: block; font-weight: 600; }
.pack-sec small { display: block; color: var(--muted); font-size: var(--fs-1); margin-top: 2px; }
.pack-sec:has(input:checked) { border-color: color-mix(in srgb, var(--peach) 70%, transparent); background: linear-gradient(160deg, var(--peach-soft), var(--t-sub)); }
.pack-count { font-size: var(--fs-2); color: var(--muted); margin: 4px 2px 0; }
@media (max-width: 640px) { .pack-secs { grid-template-columns: 1fr; } }

/* ---------- Settings toggle ---------- */
.depth-toggle { display: inline-flex; padding: 4px; border-radius: var(--r-pill); background: var(--t-sub); border: 1px solid transparent; box-shadow: var(--well); }
.depth-toggle button { padding: 6px 14px; border-radius: var(--r-pill); font-weight: 600; color: var(--ink-2); }
.depth-toggle button.on { background: var(--t-act); color: var(--t-on-act); box-shadow: none; }
.pt-c0 { background: #A1EDF3; } .pt-c1 { background: #D6E0FA; } .pt-c2 { background: #F0DCEC; } .pt-c3 { background: #D3EEE2; } .pt-c4 { background: #F2E6C8; }
:root[data-theme="dark"] .pt-av { color: var(--ink); box-shadow: none; }
:root[data-theme="dark"] :is(.pt-c0, .pt-c1, .pt-c2, .pt-c3, .pt-c4) { background: var(--t-sub); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pt-av { color: var(--ink); box-shadow: none; }
  :root:not([data-theme="light"]) :is(.pt-c0, .pt-c1, .pt-c2, .pt-c3, .pt-c4) { background: var(--t-sub); }
}
.dl-kpis .proof-link { display: block; }


/* ---------- Dropdowns: the select stays as the button; its list is drawn by controls.js ---------- */
select:not([multiple]):not([size]) { -webkit-appearance: none; appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23A08F83' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; text-overflow: ellipsis; }
select:not([multiple]):not([size]):hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--t-outline)); }
select.lb-open { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
select:disabled { opacity: .55; cursor: not-allowed; }
.msel { padding-right: 26px; background-position: right 8px center; }

.lb { position: fixed; z-index: 95; display: flex; flex-direction: column; overflow: hidden; padding: 6px;
  background: var(--t-solid); color: var(--ink); border: 1px solid var(--t-outline); border-radius: var(--r-3);
  box-shadow: 0 18px 40px -16px rgba(8, 7, 13, .35), 0 2px 6px rgba(8, 7, 13, .06); animation: lb-in .12s var(--d-ease, ease-out); transform-origin: top; }
.lb.up { transform-origin: bottom; }
.lb-q { padding: 2px 2px 6px; }
.lb-q input { width: 100%; height: 32px; padding: 0 10px; font-size: var(--fs-3); border-radius: var(--r-2); background: var(--t-sub); border-color: transparent; }
.lb-list { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.lb-group { padding: 8px 10px 4px; font-size: var(--fs-1); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.lb-opt { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 10px; border-radius: var(--r-2); font-size: var(--fs-3); cursor: pointer; white-space: nowrap; }
.lb-opt .lb-t { overflow: hidden; text-overflow: ellipsis; }
.lb-opt.on { background: var(--accent-soft, color-mix(in srgb, var(--accent) 12%, transparent)); }
.lb-opt.sel { font-weight: 600; color: var(--accent-ink, var(--accent)); }
.lb-opt.off { opacity: .45; cursor: default; }
.lb-opt svg { width: 14px; height: 14px; flex: none; color: var(--accent); }
.lb-opt[hidden], .lb-group[hidden] { display: none; }
@keyframes lb-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.lb.up { animation-name: lb-in-up; }
@keyframes lb-in-up { from { opacity: 0; transform: translateY(4px) scale(.98); } }

/* Hover labels (in place of the plain browser tooltip) */
.htip { position: fixed; z-index: 96; max-width: 280px; padding: 6px 10px; border-radius: var(--r-2); pointer-events: none;
  background: var(--t-tip); color: var(--t-tip-ink); font-size: var(--fs-2); font-weight: 500; line-height: 1.35;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .45); animation: htip-in .12s var(--d-ease, ease-out); }
.htip[hidden] { display: none; }
@keyframes htip-in { from { opacity: 0; transform: translateY(3px); } }
.htip.below { animation-name: htip-in-b; }
@keyframes htip-in-b { from { opacity: 0; transform: translateY(-3px); } }
html.calm :is(.lb, .htip) { animation: none; }

/* ---------- Pins ---------- */
.ib.pin.on { color: var(--accent); }
.ib.pin.on svg { fill: currentColor; fill-opacity: .2; }
.kpi .kpi-tools { display: inline-flex; align-items: center; gap: 2px; }
.kpi .ib.pin { opacity: 0; transition: opacity .15s; }
.kpi:hover .ib.pin, .kpi .ib.pin.on, .kpi .ib.pin:focus-visible { opacity: 1; }
.kpi.hero .ib.pin.on { color: #fff; }
.pin-head { display: flex; align-items: baseline; gap: 12px; margin: 10px 2px -4px; }
.pin-head h3 { margin: 0; font-size: var(--fs-5); font-weight: 600; letter-spacing: -.01em; }
.pin-head .i, .pin-empty p .i { width: 13px; height: 13px; vertical-align: -2px; }
.pin-empty { display: flex; align-items: center; gap: 16px; border: 1px dashed var(--t-outline); background: transparent; box-shadow: none; }
.pin-empty .pe-ic { width: 40px; height: 40px; flex: none; border-radius: var(--r-3); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.pin-empty b { font-weight: 600; } .pin-empty p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-3); }
.pin-missing b { font-weight: 600; } .pin-missing .toolbar { gap: 8px; }

/* ---------- Alerts ---------- */
.alerts-pill { display: inline-flex; align-items: center; gap: 5px; margin: 4px 0 0 6px; padding: 2px 10px 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-2); font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); }
.alerts-pill .i { width: 13px; height: 13px; }
.alerts-pill[hidden] { display: none; }
ul.attn li.good button::before { background: var(--good); box-shadow: 0 0 0 4px var(--good-bg); }
.attn-tag { display: inline-flex; align-items: center; gap: 3px; flex: none; padding: 1px 7px 1px 5px; border-radius: var(--r-pill); font-size: var(--fs-1); font-weight: 600; letter-spacing: .02em; color: var(--accent-ink); background: var(--accent-soft); }
.attn-tag .i { width: 11px !important; height: 11px !important; margin: 0 !important; color: inherit !important; transform: none !important; }
.attn-foot { margin: 10px 0 0; }
.attn-foot .link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-3); font-weight: 500; color: var(--muted); }
.attn-foot .link:hover { color: var(--accent-ink); }
.attn-foot .i { width: 14px; height: 14px; }
ul.alert-rules { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ul.alert-rules li { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: var(--r-3); background: var(--t-sub); font-weight: 500; }
ul.alert-rules li > span:nth-child(2) { flex: 1; }
.ar-ic { width: 30px; height: 30px; flex: none; border-radius: var(--r-2); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ar-ic .i { width: 15px; height: 15px; }
.alert-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px; border-radius: var(--r-3); border: 1px dashed var(--t-outline); }
.alert-form .af-w { color: var(--muted); font-weight: 500; }
.alert-form select { height: 36px; }
.af-v { display: inline-flex; align-items: center; gap: 6px; }
.af-v i { font-style: normal; color: var(--muted); font-weight: 600; }
.af-v input { width: 110px; height: 36px; }
.alert-form .btn { margin-left: auto; }

/* ---------- Compare ---------- */
.cmp-head { display: flex; flex-direction: column; gap: 14px; }
.cmp-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-presets button { height: 32px; padding: 0 13px; border-radius: var(--r-pill); font-size: var(--fs-3); font-weight: 500; color: var(--ink-2); background: var(--t-sub); border: 1px solid transparent; transition: background .15s, color .15s; }
.cmp-presets button:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.cmp-presets button.on { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.cmp-presets button:disabled { opacity: .45; cursor: not-allowed; }
.cmp-sides { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.cmp-range { display: flex; align-items: center; gap: 12px; min-width: 260px; padding: 10px 14px; border-radius: var(--r-3); background: var(--t-sub); border: 1px solid transparent; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.cmp-range:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.cmp-range .cmp-l { font-size: var(--fs-1); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.cmp-range .cmp-r { display: flex; flex-direction: column; flex: 1; line-height: 1.25; }
.cmp-range .cmp-r b { font-size: var(--fs-4); font-weight: 600; } .cmp-range .cmp-r em { font-style: normal; font-size: var(--fs-2); color: var(--muted); }
.cmp-range .i { width: 17px; height: 17px; color: var(--muted); flex: none; }
.cmp-range.a { box-shadow: inset 3px 0 0 var(--chart-1, var(--accent)); } .cmp-range.b { box-shadow: inset 3px 0 0 var(--chart-2, #A08F83); }
.cmp-swap { align-self: center; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--t-sub); color: var(--ink-2); cursor: pointer; border: 1px solid transparent; transition: transform .2s, border-color .15s; }
.cmp-swap:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--ink); transform: rotate(180deg); }
.cmp-swap .i { width: 17px; height: 17px; }
.cmp-save-wrap { margin-left: auto; align-self: center; }
.cmp-tag { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-1); font-size: var(--fs-3); font-weight: 700; vertical-align: 2px; color: #fff; }
.cmp-tag.a { background: var(--chart-1, var(--accent)); } .cmp-tag.b { background: var(--chart-2, #A08F83); }
.cmp-presets .hint, .cmp-saved .hint { margin-right: 2px; }
.wkpick { position: fixed; z-index: 95; width: min(440px, calc(100vw - 24px)); max-height: min(480px, calc(100vh - 40px)); display: flex; flex-direction: column; padding: 14px; border-radius: var(--r-4);
  background: var(--t-solid); color: var(--ink); border: 1px solid var(--t-outline); box-shadow: 0 24px 50px -18px rgba(8, 7, 13, .45), 0 2px 6px rgba(8, 7, 13, .08); animation: lb-in .12s ease-out; }
.wk-head { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 10px; }
.wk-months { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 2px; }
.wk-m { font-size: var(--fs-2); font-weight: 600; color: var(--ink-2); padding: 3px 8px; margin-left: -8px; border-radius: var(--r-2); cursor: pointer; }
.wk-m:hover { background: var(--hover); color: var(--ink); }
.wk-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 6px; }
.wk { display: flex; flex-direction: column; align-items: center; padding: 8px 0 7px; border-radius: var(--r-2); background: var(--t-sub); font-weight: 600; font-size: var(--fs-5); line-height: 1.1; cursor: pointer; border: 1px solid transparent; }
.wk em { font-style: normal; font-size: var(--fs-1); font-weight: 500; color: var(--muted); }
.wk:hover { border-color: var(--accent); }
.wk.in { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--ink); } .wk.in em { color: inherit; opacity: .75; }
.wk.wk-end { background: var(--accent); color: #fff; } .wk.wk-end em { color: #fff; opacity: .85; }
.wkpick.b .wk.in { background: color-mix(in srgb, var(--chart-2, #A08F83) 22%, transparent); color: var(--ink); }
.wkpick.b .wk.wk-end { background: var(--chart-2, #A08F83); color: #fff; }
.wk-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; margin-top: 10px; border-top: 1px solid var(--t-outline); }
.cmp-vs { color: var(--muted); font-weight: 600; font-size: var(--fs-2); text-transform: uppercase; letter-spacing: .06em; }
.cmp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 2px; vertical-align: 0; }
.cmp-dot.a { background: var(--chart-1, var(--accent)); } .cmp-dot.b { background: var(--chart-2, #E8654A); }
.cmp-head .big-line { margin: 0; font-size: var(--fs-5); line-height: 1.5; }
.cmp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.warn-inline { display: inline-flex; align-items: center; gap: 7px; color: var(--watch); font-size: var(--fs-3); font-weight: 500; }
.warn-inline .i { width: 15px; height: 15px; }
table.cmp-figs td, table.cmp-figs th { padding: 11px 10px; }
table.cmp-moves tbody tr { cursor: pointer; }
.cmp-bar-h { width: 22%; }
.cmp-bar { min-width: 90px; }
.cmp-bar .cb { display: block; height: 8px; border-radius: var(--r-pill); min-width: 2px; }
.cmp-bar .cb.up { background: linear-gradient(90deg, color-mix(in srgb, var(--good) 35%, transparent), var(--good)); }
.cmp-bar .cb.down { background: linear-gradient(90deg, color-mix(in srgb, var(--bad) 35%, transparent), var(--bad)); }

/* ---------- Smart answers ---------- */
.ask-modes { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 14px; }
.smart-thread { display: flex; flex-direction: column; gap: 18px; margin-top: 16px; }
.smart-q { align-self: flex-end; margin-left: auto; max-width: 85%; width: fit-content; padding: 9px 14px; border-radius: var(--r-3) var(--r-3) var(--r-1) var(--r-3); background: var(--accent); color: var(--on-accent, #fff); font-weight: 500; }
.smart-turn { display: flex; flex-direction: column; gap: 10px; }
.smart-a p { margin: 0 0 8px; line-height: 1.55; } .smart-a ul { margin: 0 0 8px; padding-left: 18px; } .smart-a li { margin: 3px 0; }
.smart-charts .card.visual { margin-top: 10px; box-shadow: none; border: 1px solid var(--t-outline); }
.smart-work { margin-top: 10px; font-size: var(--fs-3); color: var(--ink-2); }
.smart-work summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.smart-work ol { margin: 8px 0 6px; padding-left: 20px; } .smart-work li { margin: 3px 0; }
.smart-wait { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: var(--fs-3); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* ---------- Install ---------- */
.install-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-3); background: var(--t-sub); }
.install-row img { border-radius: var(--r-3); flex: none; }
.install-row > div { flex: 1; }
html.calm .dots i { animation: none; opacity: .7; }

/* ---------- Goals ---------- */
ul.goals { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
li.gitem { padding: 14px 16px; border-radius: var(--r-3); background: var(--t-sub); display: flex; flex-direction: column; gap: 9px; }
.goal-top { display: flex; align-items: center; gap: 10px; }
.goal-top b { flex: 1; font-weight: 600; }
.goal-bar { height: 8px; border-radius: var(--r-pill); background: var(--t-track); overflow: hidden; }
.goal-bar span { display: block; height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent)); transition: width .4s var(--d-ease); }
li.gitem.good .goal-bar span { background: linear-gradient(90deg, color-mix(in srgb, var(--good) 50%, transparent), var(--good)); }
li.gitem.bad .goal-bar span { background: linear-gradient(90deg, color-mix(in srgb, var(--bad) 50%, transparent), var(--bad)); }
.goal-nums { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: var(--fs-3); color: var(--muted); }
.goal-nums b { color: var(--ink); font-weight: 600; } .goal-nums em { font-style: normal; opacity: .8; }
.goal-form input[type=date] { height: 36px; }
.goal-now { flex-basis: 100%; margin: 0; }

/* ---------- Saved comparisons ---------- */
.cmp-saved { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cmp-chip { display: inline-flex; align-items: center; border-radius: var(--r-pill); background: var(--t-sub); border: 1px solid transparent; }
.cmp-chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent-ink); }
.cmp-chip button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 11px; font-size: var(--fs-3); font-weight: 600; color: inherit; }
.cmp-chip button .i { width: 13px; height: 13px; }
.cmp-chip .x { padding: 0 9px 0 4px; color: var(--muted); } .cmp-chip .x:hover { color: var(--bad); }
.cmp-save { display: flex; align-items: center; gap: 6px; min-width: 320px; }
.cmp-save input { flex: 1; height: 34px; min-width: 0; }

/* ---------- Year on year ---------- */
.kpi .sub.yoy { margin-top: 2px; font-size: var(--fs-2); }
.yoy-empty { display: flex; align-items: center; gap: 16px; border: 1px dashed var(--t-outline); background: transparent; box-shadow: none; }
.yoy-empty > div { flex: 1; } .yoy-empty b { font-weight: 600; } .yoy-empty p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-3); }
.yoy-empty .pe-ic { width: 40px; height: 40px; flex: none; border-radius: var(--r-3); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }

/* ---------- Rebook list ---------- */
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--fs-3); }
select.rb-status { height: 30px; width: 128px; font-size: var(--fs-3); font-weight: 600; padding: 0 24px 0 10px; line-height: 28px; background-position: right 8px center; }
select.rb-status.booked { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background-color: var(--good-bg); }
select.rb-status.declined { color: var(--muted); }
select.rb-status.called, select.rb-status.no-answer { color: var(--watch); border-color: color-mix(in srgb, var(--watch) 35%, transparent); }
.rb-by { display: block; font-size: var(--fs-1); margin-top: 2px !important; }

/* ---------- Alerts: notifications ---------- */
.notify-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; padding: 10px 12px; border-radius: var(--r-3); border: 1px solid var(--t-outline); }
.notify-row > span { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 300px; }
.notify-row .i { width: 15px; height: 15px; color: var(--accent); }

/* ---------- What if ---------- */
.kpi .ib.wi { opacity: 0; transition: opacity .15s; }
.kpi:hover .ib.wi, .kpi .ib.wi:focus-visible { opacity: 1; }
.wi-steps { margin: 4px 0 10px; }
.wi-custom { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-3); }
.wi-custom input { width: 80px; height: 32px; }
.wi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 6px; }
.wi-box { padding: 14px; border-radius: var(--r-3); background: var(--t-sub); display: flex; flex-direction: column; gap: 4px; }
.wi-box span { font-size: var(--fs-2); color: var(--muted); font-weight: 500; }
.wi-box b { font-size: var(--fs-5); font-weight: 600; letter-spacing: -.01em; }
.wi-box em { font-style: normal; font-size: var(--fs-3); color: var(--ink-2); }
.wi-work { margin: 6px 0 10px; padding-left: 20px; font-size: var(--fs-3); line-height: 1.55; color: var(--ink-2); } .wi-work li { margin: 5px 0; }
.ctx-menu { position: fixed; z-index: 97; min-width: 230px; padding: 6px; border-radius: var(--r-3); background: var(--t-solid); color: var(--ink); border: 1px solid var(--t-outline);
  box-shadow: 0 18px 40px -16px rgba(8, 7, 13, .35); animation: lb-in .12s var(--d-ease); }
.ctx-menu button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-2); font-size: var(--fs-3); text-align: left; }
.ctx-menu button:hover { background: var(--accent-soft); }
.ctx-menu .i { width: 15px; height: 15px; color: var(--muted); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--t-outline); margin: 5px 4px; }
@media (max-width: 600px) { .wi-grid { grid-template-columns: 1fr; } }
input[type=date] { padding: 0 10px; color-scheme: light dark; font: inherit; }
input[type=date]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.vhead { flex-wrap: wrap; }
.vhead > div:first-child { flex: 1 1 340px; min-width: 0; }
.rb-clin { display: block; font-size: var(--fs-2); color: var(--muted); margin-top: 2px; }

/* ---------- Present: one card per slide, sized to be read across a room ---------- */
.pslide { top: 84px; left: max(48px, 5vw); right: max(48px, 5vw); bottom: 64px; padding: clamp(24px, 3vw, 44px) !important; background: var(--t-solid) !important; color: var(--ink); font-size: var(--fs-5); }
.pslide .vhead h3, .pslide > h3, .pslide .head h3, .pslide h3:first-child { font-size: clamp(24px, 2.2vw, 34px); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.pslide .hint, .pslide .vhead .hint, .pslide p.hint { font-size: var(--fs-5); color: var(--ink-2); }
.pslide .big-line { font-size: clamp(22px, 2vw, 30px); line-height: 1.4; }
.pslide .trust, .pslide p { font-size: var(--fs-5); }
.pslide table.grid td, .pslide table.grid th { font-size: var(--fs-5); padding-top: 12px; padding-bottom: 12px; }
.pslide .stat .v, .pslide .stat b, .pslide .wd-total { font-size: clamp(30px, 3vw, 46px); }
.pslide .wd li, .pslide .steps p, .pslide .steps li { font-size: var(--fs-5); }
.pslide .steps h4 { font-size: var(--fs-6); }
/* Nothing to click on a slide: hide tools, pickers and form controls. */
.pslide .vtools, .pslide .toolbar, .pslide .btn, .pslide form, .pslide .cmp-presets, .pslide .cmp-saved, .pslide .cmp-swap, .pslide .cmp-save-wrap, .pslide .cmp-range .i, .pslide .seg, .pslide details.finetune, .pslide .assume { display: none !important; }
.pslide .cmp-range { cursor: default; }
.present .ptop { top: 10px; } .present .ptitle { font-size: var(--fs-5); } .present .meta { font-size: var(--fs-4); }
.present .pfoot { font-size: var(--fs-3); }
.pslide { max-height: none !important; align-self: auto !important; }
.pslide:not(.visual) > :first-child { margin-top: auto; } .pslide:not(.visual) > :last-child { margin-bottom: auto; }
.pslide .bal-none { font-size: clamp(20px, 1.8vw, 26px) !important; color: var(--muted); }
.pslide.cmp-head { justify-content: center; gap: 22px; }
.pslide .cmp-range { padding: 16px 22px; } .pslide .cmp-range .cmp-r b { font-size: var(--fs-6); } .pslide .cmp-range .cmp-r em, .pslide .cmp-range .cmp-l { font-size: var(--fs-4); }
.pslide .cmp-tag { min-width: 30px; height: 30px; font-size: var(--fs-5); border-radius: var(--r-2); }
.pslide .warn-inline { font-size: var(--fs-5); }
/* A drawer opened from a slide (click a row) goes above the slide, not behind it. */
/* Drawers always sit above present mode (slide z55, its header/footer z54), whatever state the page is in. */
.scrim { z-index: 58; } .sheet { z-index: 59; }
body.has-focus:not(:has(.sheet.open)) .scrim { z-index: 25; } /* an expanded chart (z30) sits above its own backdrop */

/* Compare: extra periods C and D, and the plain-English reasons */
.cmp-dot.c { background: #5B7BE8; } .cmp-dot.d { background: #4FB6A3; }
.cmp-range.c { box-shadow: inset 3px 0 0 #5B7BE8; } .cmp-range.d { box-shadow: inset 3px 0 0 #4FB6A3; }
.wkpick.c .wk.in, .wkpick.d .wk.in { background: color-mix(in srgb, #5B7BE8 18%, transparent); color: var(--ink); }
.wkpick.c .wk.wk-end { background: #5B7BE8; color: #fff; } .wkpick.d .wk.wk-end { background: #4FB6A3; color: #fff; }
.cmp-extra { position: relative; display: flex; }
.cmp-x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--t-solid); border: 1px solid var(--t-outline); color: var(--muted); cursor: pointer; }
.cmp-x:hover { color: var(--bad); } .cmp-x .i { width: 11px; height: 11px; }
.cmp-add { align-self: center; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: var(--r-3); border: 1px dashed var(--t-outline); color: var(--ink-2); font-size: var(--fs-3); font-weight: 600; cursor: pointer; background: transparent; }
.cmp-add:hover { border-color: var(--accent); color: var(--ink); } .cmp-add .i { width: 14px; height: 14px; }
.cmp-why .why-lead { font-size: var(--fs-5); line-height: 1.5; margin: 4px 0 12px; }
.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.why-list li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--t-outline); font-size: var(--fs-4); }
.why-list li span { display: flex; flex-direction: column; } .why-list li em { font-style: normal; font-size: var(--fs-2); color: var(--muted); }
.why-list li > b { white-space: nowrap; }
.why-h { font-size: var(--fs-1); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 2px; }
.pslide .why-list li { font-size: var(--fs-5); } .pslide .why-lead { font-size: var(--fs-6); }
.pslide .cmp-add, .pslide .cmp-x { display: none; }
.since-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin: 6px 0 10px; }
.since-row > div { display: flex; flex-direction: column; } .since-row span { font-size: var(--fs-2); color: var(--muted); }
.since-row b { font-size: var(--fs-7); font-weight: 600; } .since-row em { font-style: normal; font-size: var(--fs-2); color: var(--muted); }
.since-row .arrow .i { width: 18px; height: 18px; color: var(--muted); transform: rotate(45deg); }
/* Period menu: quick lengths + the shared week calendar */
.period-pop { width: min(420px, calc(100vw - 32px)); }
.period-pop h5 { margin: 10px 2px 6px; } .period-pop h5:first-child { margin-top: 2px; }
.pp-row { display: flex; flex-direction: column; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-chip { height: 30px; padding: 0 12px; border-radius: var(--r-pill); font-size: var(--fs-3); font-weight: 600; background: var(--t-sub); color: var(--ink-2); border: 1px solid transparent; cursor: pointer; }
.pp-chip:hover { color: var(--ink); } .pp-chip.on { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pp-cal .wk-head { padding: 0 2px 8px; } .pp-cal .wk-months { max-height: 260px; }
.pp-cal .wk-foot { margin-top: 8px; padding-top: 10px; }
/* Empty states: say what is missing, then one button that fixes it */
.empty-state { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.empty .empty-state, .card.empty .empty-state { align-items: center; text-align: center; }
.empty-state h3 { margin: 0; } .empty-state p { margin: 0; color: var(--ink-2); }
.es-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.btn.next-step { gap: 6px; background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 30%, transparent); white-space: nowrap; }
.btn.next-step:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.btn.next-step .i { width: 13px; height: 13px; }
p .btn.next-step, .s .btn.next-step, h5 .btn.next-step, .ring .btn.next-step, em .btn.next-step { margin-left: 6px; vertical-align: middle; height: 26px; padding: 0 10px; font-size: var(--fs-2); font-style: normal; text-transform: none; letter-spacing: 0; }
.pslide .btn.next-step { display: none !important; }

/* ---------- Keyboard hints (most-used actions show their key; hidden on touch screens) ---------- */
kbd.khint { margin-left: 8px; min-width: 20px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center; border: 0; border-radius: var(--r-1);
  background: var(--t-track, var(--line-2)); color: var(--muted); font-size: var(--fs-1); font-weight: 600; line-height: 1; }
.btn kbd.khint { background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; opacity: .7; }
.htip kbd { margin-left: 4px; padding: 0 5px; border: 0; border-radius: var(--r-1); background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; font-size: var(--fs-1); }
@media (hover: none), (max-width: 720px) { kbd.khint { display: none; } }
.pslide kbd.khint { display: none; }
.present .pfoot .pv-btn { pointer-events: auto; margin-left: 14px; }
.present .pfoot .pv-btn kbd { margin-left: 6px; }

/* ---------- Presenter view: the slide on the left, the console on the right ---------- */
body.presenter .pslide { right: calc(min(430px, 34vw) + 40px); }
body.presenter .present .ptop, body.presenter .present .pfoot { right: calc(min(430px, 34vw) + 40px); }
body.presenter .present .pfoot > span:last-child { display: none; }
.pconsole { position: fixed; z-index: 56; top: 18px; right: 18px; bottom: 18px; width: min(430px, 34vw); overflow: auto; display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border-radius: var(--r-4); background: var(--t-solid); box-shadow: var(--shadow-lg); color: var(--ink); }
.pconsole section { display: flex; flex-direction: column; gap: 8px; }
.pconsole h4 { margin: 0; font-size: var(--fs-2); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.pconsole h4 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.pc-row { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.pc-row > div { display: flex; flex-direction: column; }
.pc-k { font-size: var(--fs-1); color: var(--muted); font-weight: 600; }
.pc-row b { font: 700 var(--fs-8)/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.pc-row b.soft { font-size: var(--fs-6); font-weight: 600; color: var(--ink-2); }
.pc-row .pc-btns { flex-direction: row; gap: 6px; margin-left: auto; }
.pc-tv { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-3); background: var(--watch-bg); color: var(--ink-2); font-size: var(--fs-3); }
.pc-tv.ok { background: var(--good-bg); }
.pc-tv svg { width: 16px; height: 16px; flex: none; color: var(--good); }
.pc-tv .btn { margin-left: auto; }
.pc-pts { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-5); line-height: 1.4; }
.pc-notes textarea { width: 100%; min-height: 110px; resize: vertical; font: 15px/1.45 var(--font); padding: 12px; border-radius: var(--r-3); border: 1px solid var(--line); background: var(--t-sub); color: var(--ink); }
.pc-next { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border-radius: var(--r-3); border: 1px solid var(--line); background: var(--t-sub); color: var(--ink); cursor: pointer; font: inherit; }
.pc-next b { font-size: var(--fs-5); } .pc-next span:last-child { font-size: var(--fs-3); color: var(--ink-2); line-height: 1.4; }
.pc-kind { font-size: var(--fs-1); font-weight: 600; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .04em; }
.pc-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-strip button { min-width: 30px; height: 30px; border-radius: var(--r-2); border: 1px solid var(--line); background: transparent; color: var(--ink-2); font: 600 var(--fs-2) var(--font); cursor: pointer; }
.pc-strip button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* The audience (TV) window: nothing but the slide, or a calm waiting screen. */
body.audience .rail, body.audience .top, body.audience .bar, body.audience .chips, body.audience .tip { display: none !important; }
body.audience main { visibility: hidden; }
body.audience.presenting main { visibility: visible; }
.awaiting { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: var(--t-page); color: var(--ink); text-align: center; }
.awaiting[hidden] { display: none; }
.awaiting b { font: 700 var(--fs-7) var(--font-display); } .awaiting p { margin: 0; color: var(--ink-2); font-size: var(--fs-5); } .awaiting small { color: var(--muted); margin-top: 18px; }
body.presenter .pslide.kpis { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); align-content: center; }
body.presenter .pslide.kpis .kpi .v { font-size: clamp(28px, 3vw, 44px); }

/* Week calendar that stays short with years of data: year tabs, one compact row per month. */
.wk-years { display: flex; gap: 4px; padding: 3px; margin: 0 0 10px; border-radius: var(--r-3); background: var(--t-track); overflow-x: auto; }
.wk-years button { flex: 1; min-width: 58px; padding: 6px 10px; border-radius: var(--r-2); font: 600 var(--fs-3) var(--font); color: var(--ink-2); position: relative; }
.wk-years button.on { background: var(--t-seg-on); color: var(--t-seg-on-ink); box-shadow: var(--shadow); }
.wk-years button.has::after { content: ''; position: absolute; top: 5px; right: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.wk-months { gap: 6px; }
.wk-month { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 6px; }
.wk-month .wk-m { margin-left: 0; padding: 6px 4px; text-align: left; }
.wk-month .wk-row { margin-top: 0; }
.wk-month .wk { padding: 7px 0; font-size: var(--fs-4); }
.pp-chips.mt-s { margin-top: 6px; }

/* Backup (Settings) */
.bk-last { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; color: var(--ink-2); }
.bk-last svg { width: 16px; height: 16px; flex: none; }
.bk-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.bk-row .field { flex: 1 1 200px; margin: 0; }
.bk-restore { margin-top: 18px; } .bk-restore summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.bk-restore[open] summary { margin-bottom: 8px; }

/* Settings → Connections */
.conn .stack { gap: 8px; }
.conn-steps { margin: 4px 0 8px; padding-left: 18px; color: var(--muted); font-size: var(--fs-3); line-height: 1.55; }
.conn-form { display: flex; flex-wrap: wrap; gap: 8px; } /* a tool with several keys (Google Ads: 6) wraps onto more lines */
.conn-set { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.conn-lab { color: var(--muted); font-size: var(--fs-3); min-width: 150px; }
.conn-form input { flex: 1 1 180px; min-width: 0; }
@media (max-width: 760px) { .row2.conn { grid-template-columns: 1fr; } }

/* Week picker hint is one fixed line, so the weeks never move between the first and second click. */
.wk-head [data-wk-msg] { display: block; height: 1.4em; line-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ECharts (visual.js): the chart fills its body; tooltip rows are plain HTML with SVG dots. */
.vbody .ec { position: absolute; inset: 0; }
.ec-tip .tt-h { font-weight: 600; margin-bottom: 4px; }
.ec-tip .tt-r { display: flex; align-items: center; gap: 7px; line-height: 1.6; }
.ec-tip .tt-r span { opacity: .78; flex: 1; } .ec-tip .tt-r b { font-weight: 600; margin-left: auto; padding-left: 10px; font-variant-numeric: tabular-nums; }
.ec-tip .tt-dot { flex: none; } .ec-tip .tt-m { opacity: .7; margin-left: 4px; }
.ec-tip .tt-n { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .18); color: #E8654A; max-width: 260px; white-space: normal; }

/* ---------- Import review ("Check before using it" for weekly Semble exports; public/import-review.js) ---------- */
.ir-modal { overflow-y: auto; padding: 24px 0; }
.ir-modal .box.ir-box { width: min(820px, 94vw); max-height: calc(100vh - 48px); overflow-y: auto; }
.ir-box .why { margin-bottom: 4px; }
.ir-file { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--t-outline); border-radius: var(--r-3); background: var(--t-sub); }
.ir-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.ir-head h4 { margin: 0; font-size: var(--fs-5); font-weight: 600; overflow-wrap: anywhere; }
.ir-tag { flex: none; padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--fs-2); font-weight: 600; background: var(--t-sub); color: var(--ink-2); }
.ir-tag.ok { background: var(--good-bg); color: var(--good); }
.ir-tag.ask { background: var(--watch-bg); color: var(--watch); }
.ir-tag.bad { background: var(--bad-bg); color: var(--bad); }
.ir-week { margin: 2px 0; font-size: var(--fs-4); }
.ir-ask { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--peach); border-radius: var(--r-2); background: var(--peach-soft); }
.ir-opt { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; cursor: pointer; }
.ir-opt input { margin-top: 3px; accent-color: var(--accent); }
.ir-sub { margin: 12px 0 2px; font-size: var(--fs-1); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ir-sub.bad { color: var(--bad); }
.ir-table { margin-top: 8px; }
.ir-table td { vertical-align: top; }
.ir-yes { color: var(--good); }
.ir-no { color: var(--watch); }
.ir-alert { margin: 10px 0 0; padding: 8px 12px; border-radius: var(--r-2); background: var(--watch-bg); color: var(--ink); }
.ir-replace { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--t-outline); border-radius: var(--r-2); background: var(--t-card); }
.ir-box .lab.ck { margin: 8px 0 0; align-items: flex-start; }
.ir-box .lab.ck input { margin-top: 3px; accent-color: var(--accent); }
.ir-include { margin-top: 12px !important; }

/* Patients → Patient value by first visit: grey rows are too small to compare; the working folds away under the table. */
table.grid tr.fv-small td, table.grid tr.fv-small td b { color: var(--muted); font-weight: 500; }
details.fv-how { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
details.fv-how > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: var(--fs-4); }
details.fv-how[open] > summary { margin-bottom: 14px; }
details.fv-how .step ul.plain { margin: 0; }
.fv-check { margin-top: 16px; }
.pslide details.fv-how { display: none !important; }

/* =====================================================================================================================
   UI plan (docs/UI-PLAN.md), Lane 0b: every layout rule the page lanes need, so no other lane edits CSS.
   ===================================================================================================================== */

/* ---------- The answer card: period line, one lead sentence, a muted caveat, exactly 3 stats ---------- */
p.caveat { margin: -8px 0 14px; padding: 0; background: none; border-radius: 0; color: var(--muted); font-size: var(--fs-3); line-height: 1.5; max-width: 820px; }
.answer-card p.lead { margin-bottom: 12px; }
/* A side panel listing every column of one table row (a tap on a phone when the row has no drill-down). */
dl.row-panel { margin: 14px 0 0; display: grid; gap: 0; }
dl.row-panel > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line-2); }
dl.row-panel dt { color: var(--muted); font-size: var(--fs-3); }
dl.row-panel dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Tags and small text the page lanes use ---------- */
.tag.room { background: var(--t-sub); color: var(--muted); font-weight: 500; } /* "Room" beside a room booked as a clinician */
.tag.dup { background: var(--watch-bg); color: var(--watch); font-weight: 500; } /* "Also listed as …" */
.caption { margin: 6px 0 0; font-size: var(--fs-2); line-height: 1.45; color: var(--muted); } /* a line under a chart or bar */
.status-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; } /* Goals: "On track: N" tags in place of tiles */
/* "How we worked this out": a closed list of numbered steps with the real figures. */
details.workings { margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 10px; }
details.workings > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: var(--fs-3); }
details.workings[open] > summary { margin-bottom: 6px; }
ol.wi-work li b { color: var(--ink); font-weight: 600; }
/* Closed extra lists ("Checks that passed (n of m)", "More detail"). */
details.more { margin-top: 12px; } details.more > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: var(--fs-3); }
details.more[open] > summary { margin-bottom: 8px; }
/* Plain lists of rows (Money flows on a phone, "More as history grows"): no hover, hairline rows. */
ul.flow-list, ul.waiting { list-style: none; margin: 8px 0 0; padding: 0; }
ul.flow-list li, ul.waiting li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: var(--fs-3); color: var(--ink-2); }
ul.flow-list li > :first-child { flex: 1; min-width: 0; }
ul.flow-list li b { color: var(--ink); font-variant-numeric: tabular-nums; }
ul.flow-list li button { text-align: left; color: inherit; }
/* Settings: the two headings that group sections ("Clinic setup (saved for everyone)", "This computer only"). */
h2.set-group-h { margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: var(--fs-2); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* Explore: "Show [Sales] by [Specialty] · [No split] · [Top 10]" on one row. */
.ex-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.ex-controls .af-w { color: var(--muted); font-weight: 500; }
.ex-controls select { min-width: 0; }
/* Home: the Appointments tile shows a % in place of the ring. */
.tile .tile-pct { flex: none; font-size: var(--fs-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .tile-pct.up { color: var(--good); } .tile .tile-pct.down { color: var(--bad); }
/* Overview: the Patients and Refunds pair after the time chart. */
.ov-lead { display: flex; flex-direction: column; min-width: 0; }
.ov-lead p.lead { margin: 2px 0 14px; }
.ov-lead .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ov-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ov-pair.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Phone-only text (a second line in a cell, a note under a table): hidden on wider screens. */
.phone-only { display: none; }

/* ---------- Heat tables (When are we busy?, Busy hours, Coming back): every column, sticky first column ---------- */
table.heat :is(th, td):first-child { position: sticky; left: 0; background: var(--t-solid); z-index: 1; }

/* ---------- Settings and forms ---------- */
.set-section > * { min-width: 0; }

/* ---------- Explore lead: a fixed 2-line height on wider screens, so the controls under it don't jump ---------- */
@media (min-width: 721px) {
  .ex-lead p.lead { min-height: calc(2 * 1.55em); }
}

/* ---------- Phones (≤720px) ---------- */
@media (max-width: 720px) {
  /* Tables keep the name and 2 key columns; a tap shows the rest (docs/UI-PLAN.md 2.5). */
  table.grid.phone-cols :is(th, td):not(.col-keep) { display: none; }
  .phone-only { display: block; }
  td .phone-only { margin-top: 2px; font-size: var(--fs-2); color: var(--muted); font-weight: 400; }
  /* 3-tile rows: the main tile full width, the two others side by side below. 5- and 6-stat rows are unchanged. */
  .stats-row > .stat.main:first-child:nth-last-child(3) { grid-column: 1 / -1; }
  .dl-kpis { grid-template-columns: 1fr 1fr; }
  /* Overview */
  .ov-lead .kpis, .ov-pair, .ov-pair.three { grid-template-columns: 1fr 1fr; }
  .ov-lead .kpis > .kpi.hero { grid-column: 1 / -1; }
  .kpi svg.spark, .kpi .sub.yoy { display: none; }
  .ov-lead p.lead { font-size: var(--fs-4); }
  /* Compare and Data */
  .cmp-range { min-width: 0; width: 100%; }
  .data-bar { flex-direction: column; align-items: stretch; }
  .data-bar .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .data-bar .tabs button { flex: none; }
  .data-bar .tools { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .data-bar .tools > * { width: 100%; justify-content: center; }
  /* Settings: alert rules and the goal form wrap, selects full width */
  .alert-form { align-items: stretch; }
  .alert-form select, .alert-form .af-v, .alert-form .btn { width: 100%; margin-left: 0; }
  .alert-form .af-v input { flex: 1; min-width: 0; }
  /* Goal form: labelled rows (scoped to the form; .goal is the cash goal-seek and is left alone). */
  form.goal-form { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px 10px; }
  form.goal-form > .af-w { grid-column: 1; }
  form.goal-form > :not(.af-w) { grid-column: 2; width: 100%; }
  form.goal-form > .btn, form.goal-form > .seg, form.goal-form > .hint { grid-column: 1 / -1; }
  .ex-controls select { flex: 1 1 40%; }
}
/* Money missed and Prices: those tables are the detail, so a phone turned sideways shows every column again. */
@media (max-width: 720px) and (orientation: landscape) {
  table.grid.phone-cols.turn-wide :is(th, td):not(.col-keep) { display: table-cell; }
}

/* ui/lane1 */
/* Home: the greeting is a small line above the answer (D8). */
.home-hero .hello-line { margin: 0 0 4px; font-size: var(--fs-4); font-weight: 500; color: var(--muted); }
/* Timeline form: visible labels above each field. */
.tl-form label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: var(--fs-2); font-weight: 500; color: var(--muted); }
.tl-form label :is(input, select) { width: 100%; }
.tl-form > .btn { align-self: end; }
@media (max-width: 720px) { .tl-form label.tl-what { grid-column: 1 / -1; } }
/* ui/lane8 */
.set-section td > input[type="text"] { width: 100%; min-width: 0; }
.set-section td.num > input[type="number"] { width: 100%; max-width: 6ch; }
.set-section .row3 > .field { min-width: 0; }
.set-section .row3 .field input[type="text"] { width: 100%; min-width: 0; }
@media (max-width: 720px) { .set-section .row3 { grid-template-columns: 1fr; } }
/* ui/lane7 */
/* Board pack PDF and preview in the warm palette (owner decision D45: navy is not Harbourline's brand). print.css still
   holds the old cool values; these win because html raises the specificity. Same colours as boardpack.js. */
html #print-root, html .pack-preview {
  --bp-navy: #15121F; --bp-peach: #1AA6B6; --bp-bg: #EFF5F6; --bp-line: #DBE5E9;
  --bp-ink-2: #5B4F47; --bp-muted: #857870; --bp-good: #16A068; --bp-bad: #E0483C; --bp-cover-sub: #C2D4D8;
}
html .bp-product, html .bp-cover-foot { color: #A8998E; }
html .bp-ring-2 { border-top-color: rgba(232, 101, 74, .55); border-left-color: rgba(232, 101, 74, .55); }
html .bp-table th { border-bottom-color: #C8D8DC; }
html .bp-kpi-lead .bp-kpi-delta.bp-good { color: #3DDC97; } html .bp-kpi-lead .bp-kpi-delta.bp-bad { color: #FF6B5E; }
@media screen {
  html.printing:root body { background: #DCE5E9; }
  html.printing:root .bp-page, html .pack-preview .bp-page { box-shadow: 0 10px 30px -12px rgba(34, 26, 69, .3); }
}
html .cmp-figs-card { min-width: 0; }
html .vtools:has(> .seg[aria-label="Split by"]) { flex-wrap: wrap; } html .seg[aria-label="Split by"] { flex-wrap: wrap; max-width: 100%; }

/* ui/integration */
/* One clinician, one month: the three lists wrap instead of pushing the page sideways. */
.cm-lists { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cm-lists > * { min-width: 0; }
/* A next-step button inside a stat tile wraps rather than overflowing a phone screen. */
.stat .next-step { max-width: 100%; white-space: normal; text-align: left; }
/* Trend pills in KPI tiles may wrap on a phone instead of being cut off. */
@media (max-width: 720px) { .kpi .trend { white-space: normal; max-width: 100%; } }

/* Rooms, block by block (Operations, public/pages-rooms.js): one small square per block, filled from the bottom by the
   share of it that was booked. */
.rooms-grid th { position: static; }
.rooms-grid th.rg-day { text-align: center; padding: 6px 2px 2px; color: var(--ink-2); }
.rooms-grid th.rg-b { text-align: center; padding: 0 1px 6px; font-weight: 500; font-size: 10px; min-width: 18px; }
.rooms-grid td.rc { padding: 4px 1px; }
.rooms-grid .d0 { padding-left: 10px; }
.rooms-grid td.rg-name, .rooms-grid thead tr:first-child th:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); }
.rooms-grid tbody tr { cursor: pointer; }
.rcell { position: relative; display: block; width: 16px; height: 22px; margin: 0 auto; border-radius: 4px; overflow: hidden; }
.rcell > i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--accent); }
.rcell.rs-full { background: var(--accent); }
.rcell.rs-empty, .rcell.rs-part { background: var(--bad-bg); box-shadow: inset 0 0 0 1px var(--bad); }
.rcell.rs-none { box-shadow: inset 0 0 0 1px var(--line); }
.rooms-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 10px; font-size: var(--fs-2); color: var(--muted); }
.rooms-key span { display: inline-flex; align-items: center; gap: 6px; }
.rooms-key .rcell { width: 12px; height: 16px; margin: 0; }

/* Search box in the header of a table of more than 8 rows (public/finder.js, matrix() in pages.js): same look as the search in the
   Filters pop-up, a little smaller; "3 of 41" while it is filtering, and a × to clear it. */
.tbl-q { height: 30px; min-width: 0; width: 210px; padding: 0 4px 0 10px; gap: 6px; font-size: var(--fs-3); margin-right: 4px; }
.tbl-q .i { width: 15px; height: 15px; flex: none; }
.tbl-q input { min-width: 0; height: 100%; padding: 0; font-size: var(--fs-3); }
.tbl-q input:focus { box-shadow: none; }
.tbl-q:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.tbl-q input::-webkit-search-cancel-button, .tbl-q input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.tbl-n { flex: none; font-size: var(--fs-2); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-q .ib { width: 22px; height: 22px; flex: none; }
.tbl-q .ib .i { width: 13px; height: 13px; }
.tbl-q .ib[hidden] { display: none; }
tr.tbl-none td { color: var(--muted); padding: 18px 10px; white-space: normal; }
@media (max-width: 720px) { .tbl-q { width: 100%; margin-right: 0; } }

/* Filters pop-up: Service has the room of two lists; the long lists (Billed to, Service) say how many more there are. */
.pop .fcol.wide { grid-column: span 2; }
.pop .fcol .fmore { margin: 6px 6px 2px; }
.pop .fcol h5 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
@media (max-width: 720px) { .pop .fcol.wide { grid-column: auto; } }

/* The same search above a long table a page drew by hand (public/findbar.js). Not in slides or on paper. */
.tbl-bar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.tbl-bar .tbl-q { margin-right: 0; }
.pslide .tbl-bar { display: none !important; }
@media (max-width: 720px) { .tbl-bar { justify-content: stretch; } }


/* Phone (owner, 12 Nov 2026): the week, account invoices, Filters and Views sit on one row that slides sideways instead of taking three
   rows before the first figure; tables keep their kept columns inside the card, the name wrapping so the amount stays in sight. */
@media (max-width: 720px) {
  .bar .tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: calc(100% + 16px); margin-right: -16px; padding-right: 16px; }
  .bar .tools::-webkit-scrollbar { display: none; }
  .bar .tools > * { flex: none; }
  table.grid.phone-cols { width: 100%; }
  table.grid.phone-cols :is(th, td).col-keep:first-child { white-space: normal; overflow-wrap: anywhere; min-width: 0; max-width: none; }
  table.grid.phone-cols :is(th, td).col-keep:first-child :is(b, span, button) { white-space: normal; }
  table.grid.phone-cols :is(th, td) { padding-left: 6px; padding-right: 6px; }
}

/* Big money figures: the £ smaller and lighter than the digits, as banks set money (owner, 12 Nov 2026). app.js marks them .money. */
:is(.kpi, .stat) .v.money::first-letter { font-size: .64em; font-weight: 500; color: color-mix(in srgb, currentColor 62%, transparent); vertical-align: .3em; margin-right: .04em; }

/* Live and up to date: a small green line under the title (app.js paintLive). When behind, #fresh shows the amber warning instead. */
#live-pill { display: inline-flex; align-items: center; gap: 7px; margin: 8px 0 0; padding: 3px 10px 3px 8px; border-radius: var(--r-pill, 999px);
  background: var(--t-ctrl); box-shadow: 0 1px 2px rgba(34, 26, 69, .06); font-size: var(--fs-2); font-weight: 500; color: var(--ink-2); }
#live-pill[hidden] { display: none; }
#live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
html:not([data-depth="off"]):not(.calm) #live-pill i { animation: live-pulse 2.4s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@media print { #live-pill { display: none !important; } }
body.presenting #live-pill, body.audience #live-pill { display: none !important; }

/* Long notes fold to two lines with "More" (app.js foldLongNotes). Printed pages show them in full. */
.folded { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fold-btn { display: inline-block; margin: 0 0 8px; padding: 0; border: 0; background: none; color: var(--accent-ink); font: inherit; font-size: var(--fs-2); font-weight: 600; cursor: pointer; }
.fold-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
@media print { .folded { display: block; -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; } .fold-btn { display: none !important; } }
/* A run of short notes (app.js foldLongNotes): the first shows, the rest open with "More (n)". */
.note-run.shut > p:not(:first-child) { display: none; }
.note-run.shut > p:first-child { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media print { .note-run.shut > p { display: block !important; -webkit-line-clamp: unset; overflow: visible; } }
