/* Adviq HQ. Ported from the Command Centre artifact (v26); the design is unchanged. */
:root{color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0;padding:0;font:14px -apple-system,BlinkMacSystemFont,sans-serif;background:#fff;color:#000}
img{max-width:100%}
[hidden]:not([hidden=until-found i]){display:none!important}

  /* Modern-clean SaaS structure on Ahmed's gradient-mesh-3 canvas. The gradient is his
     Figma fill at full strength, painted as a single viewport-fixed layer behind the
     CONTENT COLUMN ONLY; the sidebar keeps its own opaque --side surface. Cards stay
     opaque white and now carry real shadow instead of v19's near-flush hairline, because
     a saturated canvas has to be sat on rather than blended into. Every piece of text on
     the page lives on an opaque surface; the one exception is the 32px page title, and
     near-black ink clears 4.5:1 against the sweep's darkest point. The accent is a deep
     bronze-olive that belongs with the gold and green (and with Adviq's warm identity)
     rather than the indigo it replaces; it carries the active nav item, primary buttons,
     focus rings, today's calendar circle and the selected-cell ring. Semantic colour stays
     but tinted. Inter Tight for titles and figures, Inter for text. Dark mode is the same
     gradient dimmed to a night canvas, same five hues, same 143.38deg. */
  :root {
    --canvas: #FBFBFC;
    /* Ahmed's Figma "gradient-mesh-3" fill, verbatim, as its own token so --canvas stays
       a flat COLOUR: .kan-col, .cal-cell.out and .tip all consume --canvas as a colour and
       would break outright if the gradient were put in it. */
    --canvas-art: linear-gradient(143.38deg, #C6AA69 32.46%, #CFBF8E 46.09%, #FECECA 59.7%, #4A912B 87.9%, #E0C86D 101.92%);
    --card: #FFFFFF;
    --card-2: #F4F4F6;
    --hair: #E9E9ED;
    --hair-card: #E4E4E9;
    /* Interactive borders carry 3:1, so a field or quiet button is never a guess. */
    --ctrl: #90909B;
    --ink: #16161A;
    --ink-soft: #45454E;
    --muted: #6B6B76;
    --good: #0F7355;
    --good-bg: #EAF5F0;
    --bad: #B42318;
    --bad-bg: #FDF0EE;
    --warn: #8A5A00;
    --warn-bg: #FDF3E3;
    /* Deep bronze-olive: sits inside the gradient's own gold-to-green family, carries
       --card (white) text at 8.6:1, and holds 4.6:1 as a focus ring against the sweep's
       darkest stop. --accent-soft is the brighter hover value, --accent-tint the warm
       cream wash behind nav and calendar hover. */
    --accent: #5B4A1F;
    --accent-soft: #75601F;
    --accent-tint: #F6F1E2;
    --grid: #EDEDF1;
    --c1: #5B5BD6; --c2: #C23A55; --c3: #0E7C6B; --c4: #7C4DD1; --c5: #A0680A;
    /* v19 leaned on a 1px hairline against a near-white canvas. Over a saturated canvas a
       hairline reads as nothing where the gradient is light, so cards get genuine lift
       instead. Shadow only: no layout, no density, no geometry. */
    --shadow: 0 1px 2px rgba(18, 18, 26, 0.06), 0 6px 16px -4px rgba(18, 18, 26, 0.16);
    --shadow-sm: 0 1px 2px rgba(18, 18, 26, 0.05), 0 3px 8px -3px rgba(18, 18, 26, 0.11);
    --shadow-in: inset 0 0 0 1px var(--hair-card);
    --radius: 14px;
    --radius-sm: 11px;
    --radius-xs: 9px;
    --font-display: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --canvas: #0B0B0D;
      /* The same five hues and the same 143.38deg, dimmed to a night canvas. The whole
         sweep is held at L<=0.131 so near-white --ink clears 4.5:1 anywhere on it
         (5.25:1 at the lightest point, 7.30:1 at the darkest). The green is lifted
         slightly rather than scaled flat, so the dark cards still separate from it. */
      --canvas-art: linear-gradient(143.38deg, #5C4F31 32.46%, #605942 46.09%, #76605E 59.7%, #2E5A1B 87.9%, #685D33 101.92%);
      --card: #141417;
      --card-2: #1D1D21;
      --hair: #27272C;
      --hair-card: #242429;
      --ctrl: #696973;
      --ink: #F3F3F4;
      --ink-soft: #BEBEC6;
      --muted: #95959F;
      --good: #4ECCA3;
      --good-bg: #11251E;
      --bad: #FF8B80;
      --bad-bg: #2B1715;
      --warn: #E6BE6E;
      --warn-bg: #2A2113;
      --accent: #D9BE72;
      --accent-soft: #E6CE8C;
      --accent-tint: #2A2415;
      --grid: #232329;
      --c1: #9E99FF; --c2: #FF8B9F; --c3: #4ECCA3; --c4: #C9A7FF; --c5: #E6BE6E;
      --shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 6px 16px -4px rgba(0, 0, 0, 0.6);
      --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45), 0 3px 8px -3px rgba(0, 0, 0, 0.5);
      --shadow-in: inset 0 0 0 1px var(--hair-card);
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --canvas: #0B0B0D;
    /* The same five hues and the same 143.38deg, dimmed to a night canvas. The whole
       sweep is held at L<=0.131 so near-white --ink clears 4.5:1 anywhere on it
       (5.25:1 at the lightest point, 7.30:1 at the darkest). The green is lifted
       slightly rather than scaled flat, so the dark cards still separate from it. */
    --canvas-art: linear-gradient(143.38deg, #5C4F31 32.46%, #605942 46.09%, #76605E 59.7%, #2E5A1B 87.9%, #685D33 101.92%);
    --card: #141417;
    --card-2: #1D1D21;
    --hair: #27272C;
    --hair-card: #242429;
    --ctrl: #696973;
    --ink: #F3F3F4;
    --ink-soft: #BEBEC6;
    --muted: #95959F;
    --good: #4ECCA3;
    --good-bg: #11251E;
    --bad: #FF8B80;
    --bad-bg: #2B1715;
    --warn: #E6BE6E;
    --warn-bg: #2A2113;
    --accent: #D9BE72;
    --accent-soft: #E6CE8C;
    --accent-tint: #2A2415;
    --grid: #232329;
    --c1: #9E99FF; --c2: #FF8B9F; --c3: #4ECCA3; --c4: #C9A7FF; --c5: #E6BE6E;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 6px 16px -4px rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45), 0 3px 8px -3px rgba(0, 0, 0, 0.5);
    --shadow-in: inset 0 0 0 1px var(--hair-card);
    color-scheme: dark;
  }

  * { box-sizing: border-box; }
  /* html keeps the flat --canvas so the overscroll gutter, any paint failure and dark
     mode all land on a known colour. body must be transparent or it would paint over
     the negative-z-index gradient layer below. */
  html { background-color: var(--canvas); }
  body {
    background: transparent;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.45;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
  }
  .app {
    max-width: 1280px;
    margin: 0 auto;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-block: 18px 60px;
  }

  /* Top bar */
  .topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; }
  .logo { height: 24px; width: auto; max-width: 132px; display: block; }
  .logo-for-dark { display: none; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-for-light { display: none; }
    :root:not([data-theme="light"]) .logo-for-dark { display: block; }
  }
  :root[data-theme="dark"] .logo-for-light { display: none; }
  :root[data-theme="dark"] .logo-for-dark { display: block; }

  .tabs {
    display: flex; gap: 2px; background: var(--card); border: 1px solid var(--hair-card);
    border-radius: 999px; padding: 4px; box-shadow: var(--shadow-sm); flex-wrap: wrap; min-width: 0;
  }
  .tab {
    appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13.5px;
    padding: 7px 15px; border-radius: 999px; cursor: pointer; white-space: nowrap; font-weight: 500;
  }
  .tab:hover { color: var(--ink); }
  .tab[aria-selected="true"] { background: var(--card-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair); }
  .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
  .status-pill {
    display: inline-flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--hair);
    border-radius: 999px; padding: 6px 12px; font-size: 11.5px; color: var(--muted); box-shadow: none;
    min-width: 0;
  }
  .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
  .dot.live { background: var(--good); }
  .dot.part { background: var(--warn); }
  .dot.off { background: var(--bad); }

  /* Title row */
  .titlerow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 2px 0 20px; }
  .pagetitle { font-family: var(--font-display); font-weight: 600; font-size: 32px; line-height: 1.15; margin: 0; letter-spacing: -0.028em; }
  .titlerow-right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
  .chip {
    display: inline-flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--hair-card);
    border-radius: 999px; padding: 7px 14px; font-size: 12.5px; color: var(--ink-soft); box-shadow: none;
  }

  /* KPI strip */
  .kpis {
    background: var(--card); border: 1px solid var(--hair-card); border-radius: var(--radius); box-shadow: var(--shadow);
    display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden;
  }
  .kpi { padding: 18px 20px 20px; min-width: 0; border-left: 1px solid var(--hair); }
  .kpi:first-child { border-left: 0; }
  /* Two lines' worth of room so a wrapping label doesn't drop its card's number
     out of line with the rest of the row. */
  .kpi-label { font-size: 15px; font-weight: 500; color: var(--ink-soft); opacity: 1; min-height: 2.7em; letter-spacing: -0.012em; }
  .kpi-num {
    font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.15; margin-top: 10px;
    font-variant-numeric: tabular-nums; letter-spacing: -0.026em; overflow-wrap: anywhere;
  }
  .kpi-num[data-state="pending"] { color: var(--muted); }
  .kpi-foot {
    display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 13px;
    border-top: 1px solid var(--hair); flex-wrap: wrap; min-height: 1px;
  }
  .badge {
    font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted);
    font-variant-numeric: tabular-nums; white-space: nowrap;
  }
  .badge.good { background: var(--good-bg); color: var(--good); }
  .badge.bad { background: var(--bad-bg); color: var(--bad); }
  .badge.warn { background: var(--warn-bg); color: var(--warn); }
  .kpi-sub { font-size: 12.5px; color: var(--muted); min-width: 0; }

  /* Views + cards */
  .view { padding-top: 18px; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
  .col { display: grid; gap: 20px; min-width: 0; }
  .panel {
    background: var(--card); border: 1px solid var(--hair-card); border-radius: var(--radius);
    box-shadow: var(--shadow); min-width: 0; overflow: hidden;
  }
  .panel-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 12px; flex-wrap: wrap; }
  .panel-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 0; letter-spacing: -0.022em; }
  .panel-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .panel-src {
    margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap;
    border: 1px solid var(--hair); border-radius: var(--radius-xs); padding: 5px 10px; background: var(--card);
  }
  .panel-body { padding: 0 22px 20px; }

  /* Rows */
  .row { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--hair); align-items: flex-start; }
  .row:last-child { border-bottom: 0; }
  .row-main { flex: 1; min-width: 0; }
  .row-title { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; letter-spacing: -0.011em; }
  .row-title.done { text-decoration: line-through; color: var(--muted); }
  .row-meta { font-size: 11.5px; font-weight: 400; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 5px 10px; align-items: center; }
  .row-amount { font-family: var(--font-display); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; flex: none; letter-spacing: -0.018em; }
  .num { font-variant-numeric: tabular-nums; }
  .daygroup { font-size: 11px; color: var(--muted); padding: 13px 0 3px; border-bottom: 1px solid var(--hair); }
  .daygroup:first-child { padding-top: 4px; }
  .time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); flex: 0 0 52px; padding-top: 1px; }

  .pill { font-size: 11px; font-weight: 600; padding: 4px 11px; border-radius: 999px; white-space: nowrap; flex: none; background: var(--card-2); color: var(--muted); }
  .pill.active, .pill.ok, .pill.paid { background: var(--good-bg); color: var(--good); }
  .pill.prospect, .pill.warn, .pill.due { background: var(--warn-bg); color: var(--warn); }
  .pill.closed, .pill.idle { background: var(--card-2); color: var(--muted); }
  .pill.bad, .pill.overdue { background: var(--bad-bg); color: var(--bad); }
  .stripe { width: 3px; border-radius: 3px; flex: none; align-self: stretch; background: var(--hair); }
  .stripe.over { background: var(--bad); }
  .stripe.soon { background: var(--warn); }
  .stripe.good { background: var(--good); }

  /* Controls */
  button, input, select { font: inherit; color: inherit; }
  .btn {
    background: var(--accent); color: var(--card); border: 0; padding: 10px 18px; border-radius: var(--radius-xs);
    cursor: pointer; font-size: 13.5px; font-weight: 600; box-shadow: none; letter-spacing: -0.011em;
  }
  .btn:hover { background: var(--accent-soft); }
  .btn-quiet {
    background: var(--card); color: var(--ink-soft); border: 1px solid var(--ctrl); padding: 6px 12px;
    border-radius: var(--radius-xs); cursor: pointer; font-size: 11.5px; font-weight: 600; white-space: nowrap; box-shadow: none;
  }
  .btn-quiet:hover { color: var(--ink); background: var(--card-2); border-color: var(--ink-soft); }
  .btn-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
  .btn-link:hover { color: var(--ink); }
  .step {
    background: var(--card); border: 1px solid var(--ctrl); color: var(--ink-soft); width: 26px; height: 26px;
    border-radius: var(--radius-xs); cursor: pointer; font-size: 14px; line-height: 1; flex: none; box-shadow: none;
  }
  .step:hover { color: var(--ink); background: var(--card-2); border-color: var(--ink-soft); }
  .step:disabled { opacity: 0.4; cursor: default; }
  input[type="text"], input[type="date"], input[type="number"], select {
    background: var(--card); border: 1px solid var(--ctrl); border-radius: var(--radius-xs); padding: 10px 13px;
    font-size: 13.5px; min-width: 0; width: 100%; box-shadow: none;
  }
  input[type="number"] { font-variant-numeric: tabular-nums; }
  input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, .check:focus-visible, .tab:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
  }
  .form { display: grid; gap: 9px; padding: 4px 0 14px; border-bottom: 1px solid var(--hair); }
  .form-line { display: flex; gap: 9px; flex-wrap: wrap; }
  .form-line > * { flex: 1 1 110px; min-width: 0; }
  .form-line > .btn { flex: 0 0 auto; }
  .mini { flex: 0 0 94px; width: 94px; padding: 5px 8px; font-size: 12.5px; border-radius: var(--radius-xs); }
  .check {
    appearance: none; -webkit-appearance: none; width: 17px; height: 17px; flex: none;
    border: 1.5px solid var(--ctrl); border-radius: 5px; background: var(--card); cursor: pointer; position: relative;
  }
  .check:checked { background: var(--good); border-color: var(--good); }
  .check:checked::after {
    content: ""; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px;
    border: solid var(--card); border-width: 0 2px 2px 0; transform: rotate(45deg);
  }
  .check-wrap { display: inline-flex; align-items: center; gap: 6px; }

  /* Charts */
  .charts { display: grid; grid-template-columns: 1.1fr 1fr; gap: 26px; }
  .chart { margin: 0; min-width: 0; }
  .chart-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 4px 0 2px; letter-spacing: -0.014em; }
  .chart-sub { font-family: var(--font-body); font-size: 11.5px; font-weight: 400; color: var(--muted); letter-spacing: -0.006em; }
  .chart-box { position: relative; min-width: 0; }
  .chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
  .legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 2px 0 8px; }
  .legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); }
  .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
  .tip {
    position: absolute; pointer-events: none; z-index: 5; background: var(--ink); color: var(--canvas);
    padding: 8px 11px; border-radius: var(--radius-xs); font-size: 11.5px; line-height: 1.35; white-space: nowrap;
    opacity: 0; transition: opacity 0.1s ease;
  }
  .tip[data-on="1"] { opacity: 1; }
  .tip b { font-variant-numeric: tabular-nums; font-weight: 600; }
  @media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
  .bar-hit { fill: transparent; }
  .pnl-row { border-bottom: 1px solid var(--hair); padding: 2px 0 16px; margin-bottom: 16px; }
  .pnl-when { font-size: 12px; font-weight: 600; color: var(--muted); padding-bottom: 10px; }
  .pnl-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .pnl-cell { min-width: 0; }
  .pnl-k { font-size: 12px; color: var(--muted); }
  .pnl-v { font-family: var(--font-display); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -0.024em; }
  .pnl-cell.pos .pnl-v { color: var(--good); }
  .pnl-cell.neg .pnl-v { color: var(--bad); }
  .errcode { color: var(--muted); font-size: 10.5px; }

  .renew-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; border-top: 1px solid var(--hair); margin-top: 22px; padding-top: 16px; }

  /* Agents */
  .agent-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(248px, 320px));
    justify-content: start; gap: 16px; padding-top: 6px;
  }
  .agent {
    background: var(--card); border: 1px solid var(--hair-card); border-left-width: 3px;
    border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px 22px 22px;
    min-width: 0; display: grid; gap: 4px; justify-items: start;
  }
  .agent-fig {
    display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px;
    background: color-mix(in srgb, currentColor 12%, transparent); box-shadow: none; margin-bottom: 14px;
  }
  .agent-fig svg { width: 32px; height: 32px; display: block; }
  .agent-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.022em; overflow-wrap: anywhere; }
  .agent-ws { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
  .agent-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
  /* A lone agent reads as a wide badge rather than one small card stranded in the panel. */
  .agent-grid:has(> .agent:only-child) { grid-template-columns: minmax(0, min(100%, 440px)); }
  .agent:only-child { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 24px; padding: 26px 26px 24px; }
  .agent:only-child .agent-fig { grid-row: 1 / span 3; width: 72px; height: 72px; border-radius: 22px; margin-bottom: 0; }
  .agent:only-child .agent-fig svg { width: 38px; height: 38px; }
  .agent:only-child .agent-foot { margin-top: 10px; }
  @media (max-width: 560px) {
    .agent-grid { grid-template-columns: minmax(0, 1fr); }
  }

  /* States */
  .note { font-size: 12.5px; color: var(--muted); padding: 13px 0; }
  .note a { color: var(--accent); }
  .skel { height: 11px; background: var(--card-2); border-radius: 999px; margin: 14px 0; }
  .skel.s2 { width: 72%; }
  .skel.s3 { width: 48%; }
  @media (prefers-reduced-motion: no-preference) {
    .skel { animation: pulse 1.6s ease-in-out infinite; }
    @keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.45 } }
  }

  /* Business card */
  .biz { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 24px; }
  .biz-item { min-width: 0; }
  .biz-k { font-size: 12px; color: var(--muted); }
  .biz-v { font-size: 14px; font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; letter-spacing: -0.011em; }
  .biz-v.empty { color: var(--muted); font-style: italic; font-weight: 400; }
  .biz-edit { grid-column: 1 / -1; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
  .biz-edit label { font-size: 12px; color: var(--muted); flex: none; }
  .biz-edit input { flex: 1 1 180px; }

  /* Invoice */
  .inv { margin-bottom: 20px; }
  .inv-doc { border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: none; padding: 28px 26px; display: grid; gap: 22px; margin-top: 4px; background: var(--card); }
  .inv-top { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; }
  .inv-from { min-width: 0; }
  .inv-wordmark { font-family: var(--font-display); font-weight: 700; font-size: 23px; letter-spacing: -0.03em; }
  .inv-line { font-size: 12.5px; color: var(--muted); }
  .inv-right { text-align: right; min-width: 0; }
  .inv-kind { font-size: 15px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); }
  .inv-no { font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 3px; }
  .inv-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
  .inv-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
  .inv-v { font-size: 13.5px; margin-top: 4px; overflow-wrap: anywhere; }
  .inv-v.gap { color: var(--bad); font-style: italic; }
  .inv-table { width: 100%; border-collapse: separate; border-spacing: 0; }
  .inv-table th {
    text-align: left; font-size: 13px; color: var(--ink-soft); font-weight: 600; background: var(--card-2);
    border-bottom: 0; padding: 11px 14px;
  }
  .inv-table th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
  .inv-table th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
  .inv-table th:last-child, .inv-table td:last-child { text-align: right; }
  .inv-table td { padding: 14px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--hair); }
  .inv-table td.num { font-variant-numeric: tabular-nums; }
  .inv-sum { display: flex; justify-content: flex-end; gap: 22px; align-items: baseline; }
  .inv-sum-k { font-size: 11.5px; color: var(--muted); }
  .inv-sum-v { font-family: var(--font-display); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.026em; }
  .inv-foot { font-size: 12px; color: var(--muted); display: grid; gap: 5px; }
  .inv-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 14px; }
  .inv-form { display: grid; gap: 9px; padding: 14px 0 0; }
  .inv-warn { font-size: 12.5px; color: var(--bad); padding-top: 12px; }

  /* Mail */
  .mbox-head { display: flex; gap: 8px; align-items: baseline; padding: 2px 0 1px; }
  .mbox-addr { font-size: 11.5px; color: var(--muted); }
  .mbox-n { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

  /* The only body copy on the page that is not already inside a card. 11.5px --muted
     over the gradient's #4A912B stop measures 1.4:1, and no single ink clears 4.5:1
     across a sweep this wide at this size, so it gets a surface of its own rather than a
     recoloured one. The padding here is the single geometry change the gradient forced. */
  .foot {
    margin-top: 26px; font-size: 11.5px; color: var(--muted);
    background: var(--card); border: 1px solid var(--hair-card); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 13px 16px;
  }

  @media (max-width: 1000px) { .charts { grid-template-columns: 1fr; } }
  @media (max-width: 880px) {
    .grid2 { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .kpi:nth-child(3) { border-left: 0; }
    .kpi:nth-child(n+3) { border-top: 1px solid var(--hair); }
  }
  @media (max-width: 560px) {
    .pagetitle { font-size: 26px; }
    .kpi-num { font-size: 26px; }
    .topbar-right { margin-left: 0; width: 100%; }
    .tabs { width: 100%; justify-content: flex-start; overflow-x: auto; }
  }

  /* Display-only sources: where to edit them, and the refresh control */
  .src-link { color: var(--muted); text-decoration: none; }
  .src-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
  .chip-btn { cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; border-color: var(--ctrl); }
  .chip-btn:hover { color: var(--ink); background: var(--card-2); border-color: var(--ink-soft); }
  .chip-btn:disabled { opacity: 0.55; cursor: default; }
  /* Refresh and the clock are the only components that sit on the gradient rather than
     inside a card. A white pill on the #FECECA stop is 1.45:1 and an --ctrl hairline is
     1.22:1, so neither the fill nor a grey border can identify the control there. An --ink
     border holds 4.6:1 against the darkest stop and 12.8:1 against the lightest, i.e.
     3:1 everywhere on the sweep, in both themes. Focus rings sit 2px outside the box and
     would land on the gradient too, so a --card halo backs the ring to its full width. */
  .topbar .chip { border-color: var(--ink); }
  .topbar .chip-btn:hover { border-color: var(--ink); }
  .topbar .chip-btn:focus-visible { box-shadow: 0 0 0 4px var(--card); }
  .topbar-right { gap: 8px; }
  .view > .kpis + .grid2 { margin-top: 20px; }
  .view .col > .grid2 { gap: 20px; }
  .view > .kpis { margin-top: 0; }
  /* v22: Business details at the foot of Overview */
  .view > .grid2 + .biz-panel { margin-top: 20px; }

  /* Needs you */
  .attention {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 20px; padding: 14px 18px;
    background: var(--card); border: 1px solid var(--hair-card); border-radius: var(--radius); box-shadow: var(--shadow);
  }
  .attention[hidden] { display: none; }
  .attn-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 4px; text-transform: uppercase; letter-spacing: 0.06em; }
  .attn-chip {
    font: inherit; font-size: 12.5px; font-weight: 600; border: 0; border-radius: 999px; padding: 6px 13px; cursor: pointer;
    background: var(--card-2); color: var(--ink-soft); text-align: left;
  }
  .attn-chip:hover { filter: brightness(0.97); }
  .attn-chip.bad { background: var(--bad-bg); color: var(--bad); }
  .attn-chip.warn { background: var(--warn-bg); color: var(--warn); }

  /* Content pipeline */
  .kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 12px; align-items: start; }
  .kan-col { background: var(--canvas); border: 1px solid var(--hair); border-radius: var(--radius-sm); box-shadow: none; padding: 12px; min-width: 0; display: grid; gap: 8px; align-content: start; }
  .kan-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 2px 2px 4px; }
  .kan-card { background: var(--card); border: 1px solid var(--hair-card); border-radius: var(--radius-xs); box-shadow: var(--shadow-sm); padding: 11px 12px; min-width: 0; }
  .kan-card .row-title { font-size: 13.5px; }
  .kan-empty { font-size: 12px; color: var(--muted); padding: 2px 4px 6px; }

  /* Calendar: one colour per kind of thing, red only when it's late. Tones come after kinds so they win. */
  .k-event { --k: var(--c1); }
  .k-payment { --k: var(--c2); }
  .k-post { --k: var(--c3); }
  .k-task { --k: var(--muted); }
  .t-good { --k: var(--good); }
  .t-warn { --k: var(--warn); }
  .t-bad { --k: var(--bad); }
  .t-muted { --k: var(--muted); }
  .stripe.k-event, .stripe.k-payment, .stripe.k-post, .stripe.k-task { background: var(--k); }

  .cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding-bottom: 14px; }
  .cal-nav { display: flex; align-items: center; gap: 6px; }
  .cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
  .cal-key { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); }
  .cal-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--k); flex: none; }
  .cal-grid {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--hair);
    border: 1px solid var(--hair); border-radius: var(--radius-sm); overflow: hidden;
  }
  .cal-dow { background: var(--card-2); font-size: 12px; font-weight: 600; color: var(--ink-soft); text-align: center; padding: 10px 0; }
  .cal-cell {
    appearance: none; border: 0; background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
    min-height: 98px; padding: 6px 6px 7px; display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden;
  }
  .cal-cell:hover:not(:disabled) { background: var(--accent-tint); }
  .cal-cell.out { background: var(--canvas); cursor: default; }
  .cal-cell.out .cal-num { opacity: 0.35; }
  .cal-cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
  .cal-num { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; flex: none; }
  .cal-cell.today .cal-num { background: var(--accent); color: var(--card); }
  .cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .cal-chip {
    display: block; font-size: 10.5px; font-weight: 600; line-height: 1.3; padding: 2px 6px; border-radius: 5px; border-left: 3px solid var(--k);
    background: color-mix(in srgb, var(--k) 13%, transparent); color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cal-more { font-size: 10.5px; color: var(--muted); padding-left: 2px; }
  .cal-dots { display: none; gap: 3px; flex-wrap: wrap; padding-left: 2px; }
  .cal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--k); }
  .cal-detail { padding-top: 18px; }
  .cal-detail-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; padding-bottom: 4px; letter-spacing: -0.016em; }
  @media (max-width: 640px) {
    .cal-cell { min-height: 54px; padding: 4px 3px 5px; align-items: center; }
    .cal-chips, .cal-more { display: none; }
    .cal-dots { display: flex; justify-content: center; }
  }

  .row-title a { text-decoration: none; }
  .row-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
  .row-title.settled { color: var(--muted); font-weight: 400; }
  .tab { flex: none; }
  @media (max-width: 560px) {
    .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
  }

  /* ---- sidebar shell, icon squares, tiles ---- */
  :root { --side: #F7F7F9; --side-ink: #16161A; --side-muted: #4A4A55; --side-hi: var(--accent); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --side: #101013; --side-ink: #F3F3F4; --side-muted: #9C9CA6; --side-hi: var(--accent); } }
  :root[data-theme="dark"] { --side: #101013; --side-ink: #F3F3F4; --side-muted: #9C9CA6; --side-hi: var(--accent); }
  .shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
  .side {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 30px;
    padding: 26px 14px 20px; background: var(--side); color: var(--side-ink);
    border-right: 1px solid var(--hair);
  }
  .side .logo { height: 26px; max-width: 140px; margin: 0 0 0 10px; }
  .side .tabs { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 4px; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .side .tab, .theme-btn {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: var(--radius-xs); border: 0;
    background: none; color: var(--side-muted); font: inherit; font-size: 14px; font-weight: 500; letter-spacing: -0.008em;
    text-align: left; cursor: pointer; box-shadow: none;
  }
  .side .tab:hover, .theme-btn:hover { color: var(--side-ink); background: var(--accent-tint); }
  .side .tab[aria-selected="true"] { background: var(--side-hi); color: var(--card); box-shadow: none; font-weight: 600; }
  .side .tab[aria-selected="true"]:hover { background: var(--side-hi); color: var(--card); }
  .side .tab .ico, .theme-btn svg { width: 20px; height: 20px; background: none; border: 0; border-radius: 0; box-shadow: none; color: inherit; }
  .side .tab .ico svg { width: 20px; height: 20px; }
  .theme-btn { margin-top: auto; border-top: 1px solid var(--hair); border-radius: 0; padding-top: 18px; }
  .theme-btn svg { flex: none; }
  .theme-btn .i-sun { display: none; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; } :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; } }
  :root[data-theme="dark"] .theme-btn .i-sun { display: block; }
  :root[data-theme="dark"] .theme-btn .i-moon { display: none; }
  .app { max-width: 1160px; margin: 0; padding-top: 22px; }
  /* The gradient canvas. One fixed layer, inset past the 240px sidebar so the sweep
     belongs to the content column and never runs behind the nav.
       - position: fixed + cover. The asset was authored 1080x1920, so it is sized to the
         VIEWPORT and pinned there. Sized to the document instead it would stretch to the
         full scroll height of a long tab (Money runs past 3500px) and smear the 143.38deg
         sweep into vertical bands; pinned, the slice is identical on every tab however far
         it scrolls, and content moves across a static field.
       - no-repeat. cover never leaves a gap, but this makes a tile impossible.
       - z-index -1 puts it above html's flat background and below every box on the page.
         .app and .shell create no stacking context and carry no transform, so the layer
         is viewport-relative and the whole page paints on top of it.
       - it is a ::before on .app, not on .shell: .shell is the grid, and a pseudo-element
         there would become a seventh grid item and break the two-column layout. */
  .app::before {
    content: "";
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 240px;
    z-index: -1;
    pointer-events: none;
    background-image: var(--canvas-art);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
  }
  .topbar { justify-content: flex-end; padding-bottom: 6px; }
  .topbar-right { margin-left: 0; }

  .ico { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; color: var(--ink-soft); background: var(--card-2); border: 1px solid var(--hair); box-shadow: none; }
  .ico svg { width: 18px; height: 18px; }
  .ico.tone-teal { --k: var(--ink-soft); } .ico.tone-bronze { --k: var(--ink-soft); } .ico.tone-indigo { --k: var(--ink-soft); }
  .ico[class*="tone-"] { color: var(--k); background: var(--card-2); }
  .panel-title { display: inline-flex; align-items: center; gap: 10px; }
  .panel-title .ico { width: 30px; height: 30px; border-radius: 9px; }
  .panel-title .ico svg { width: 16px; height: 16px; }

  .kpis { background: none; border: 0; box-shadow: none; overflow: visible; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
  .kpis .kpi { background: var(--card); border: 1px solid var(--hair-card) !important; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px 18px; }
  .kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
  .kpi-top .ico { width: 48px; height: 48px; border-radius: 14px; }
  .kpi-top .ico svg { width: 24px; height: 24px; }

  @media (max-width: 760px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side {
      position: fixed; top: auto; left: 0; right: 0; bottom: 0; height: auto; flex-direction: row; align-items: stretch; gap: 2px;
      padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 30;
      border-right: 0; border-top: 1px solid var(--hair); box-shadow: 0 -1px 2px rgba(18, 18, 26, 0.04);
    }
    /* The sidebar is now an opaque bar overlaying the bottom of the viewport, so the
       gradient layer spans the full width instead of being inset past a 240px column. */
    .app::before { left: 0; }
    .side .logo { display: none !important; }
    .side .tabs { flex-direction: row; flex: 1; justify-content: space-between; gap: 0; overflow: visible; }
    .side .tab, .theme-btn { flex-direction: column; gap: 3px; width: auto; flex: 1 1 0; min-width: 0; padding: 7px 2px; font-size: 10px; letter-spacing: 0; align-items: center; justify-content: center; text-align: center; }
    .theme-btn { margin-top: 0; flex: 0 0 48px; border-top: 0; padding-top: 7px; }
    .app { padding-bottom: 96px; }
    .topbar { padding-top: 4px; }
  }
  /* ---- v21: Ready to post + Ads. Existing tokens only: inputs and the inline forms sit on
     --card (a --ctrl border on --card-2 would drop under 3:1), interactive borders are --ctrl,
     the single accent marks a pressed toggle and nothing else. ---- */
  .ready-row .check { margin-top: 2px; }
  .post-form {
    margin: 0 0 14px 28px; padding: 16px 16px 16px; display: grid; gap: 16px;
    background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius-sm);
  }
  .post-form.ad-new { margin: 2px 0 16px; }
  .pf-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
  .pf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; }
  .pf-field { min-width: 0; }
  .pf-wide { grid-column: 1 / -1; }
  .pf-pair { display: flex; gap: 8px; }
  .pf-pair > input { flex: 1 1 auto; }
  .pf-pair > select { flex: 0 0 auto; width: auto; }
  .toggles { display: flex; flex-wrap: wrap; gap: 6px; }
  .toggle {
    appearance: none; font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.2;
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
    border: 1px solid var(--ctrl); background: var(--card); color: var(--ink-soft); cursor: pointer;
  }
  .toggle:hover { color: var(--ink); border-color: var(--ink-soft); }
  .toggle[aria-pressed="true"] { background: var(--accent-tint); border-color: var(--accent); color: var(--ink); }
  /* State is never colour alone: a pressed toggle also carries a tick. */
  .toggle[aria-pressed="true"]::before {
    content: ""; width: 4px; height: 8px; margin: -2px 1px 0 1px; flex: none;
    border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
  }
  .toggle:disabled { opacity: 0.55; cursor: default; }
  .ad-block { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--hair); }
  .pf-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .pf-err { margin: 0; font-size: 12.5px; color: var(--bad); }
  .pf-hint { margin: 0; font-size: 12px; color: var(--muted); }
  .btn:disabled { opacity: 0.6; cursor: default; }
  .btn-quiet:disabled { opacity: 0.55; cursor: default; }
  .done-note {
    display: flex; gap: 9px; align-items: flex-start; margin: 2px 0 10px; padding: 10px 12px;
    border-radius: var(--radius-xs); background: var(--good-bg); color: var(--ink-soft); font-size: 12.5px;
  }
  .done-note svg { width: 16px; height: 16px; flex: none; color: var(--good); margin-top: 1px; }
  .done-note b { color: var(--ink); font-weight: 600; }

  .panel-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .panel-actions .panel-src { margin-left: 0; }
  .ad-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px 12px; margin-top: 12px; }
  .ad-fig { min-width: 0; }
  .ad-fig input[type="number"], .ad-fig select { padding: 8px 10px; font-size: 13px; }
  .ad-read { font-family: var(--font-display); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.018em; padding-top: 6px; }
  .fstat { display: block; font-size: 11px; color: var(--muted); min-height: 1.35em; margin-top: 3px; }
  .fstat.bad { color: var(--bad); }
  .fstat.good { color: var(--good); }
  .spend-foot { font-size: 12px; color: var(--muted); padding-top: 12px; margin: 0; }
  @media (max-width: 560px) {
    .post-form { margin-left: 0; }
  }
  /* Seven sections plus Theme in the phone bar: below 430px the labels tighten a little and
     clip with an ellipsis rather than run into each other. */
  @media (max-width: 760px) {
    .side .tab .tab-label, .theme-btn .tab-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  }
  @media (max-width: 430px) {
    .side .tab, .theme-btn { font-size: 9.5px; letter-spacing: -0.01em; padding-left: 1px; padding-right: 1px; }
    /* share the width by label length, so "Workspace" gets what "Ads" doesn't need */
    .side .tab { flex: 1 1 auto; }
    /* Theme keeps its icon and aria-label; its word is the one label that can go. */
    .theme-btn { flex-basis: 34px; }
    .theme-btn .tab-label { display: none; }
  }
  /* ---- v23: one home per item. Money split is the hero of Money: one bar for the
     period's money in, split Client costs | Business costs | Profit. Segment colours reuse
     validated tokens (--c5 amber, --c4 violet, --good): each is >= 4.6:1 on --card, and the
     three stay >= 12.3 CIEDE2000 apart under deutan/protan simulation in both themes. The
     over-run is hatched AND labelled, so it never relies on red against amber. ---- */
  .flow-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .flow-month { font-size: 13px; font-weight: 600; min-width: 116px; text-align: center; font-variant-numeric: tabular-nums; }
  .split-panel .panel-body { padding-top: 6px; }
  .sp-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; }
  .sp-fig { min-width: 0; }
  .sp-end { text-align: right; }
  .sp-k { font-size: 12px; font-weight: 500; color: var(--muted); }
  .sp-big { font-family: var(--font-display); font-size: 40px; font-weight: 600; line-height: 1.1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 4px; }
  .sp-big.good { color: var(--good); }
  .sp-big.bad, .sp-lm.bad { color: var(--bad); }
  .sp-lm.good { color: var(--good); }
  .sp-bar { position: relative; display: flex; gap: 3px; height: 20px; margin: 18px 0 14px; border-radius: 999px; overflow: hidden; background: var(--card-2); }
  .sp-seg { flex: 1 1 0; min-width: 4px; height: 100%; }
  .sp-over {
    position: absolute; top: 0; bottom: 0; right: 0; border-left: 2px solid var(--card);
    background: repeating-linear-gradient(-45deg, var(--bad) 0 4px, transparent 4px 8px);
  }
  .sp-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; }
  .sp-li { min-width: 0; }
  .sp-ln { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
  .sp-sw { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
  .sp-sw-over { background: repeating-linear-gradient(-45deg, var(--bad) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--bad); }
  .sp-lv { display: flex; align-items: baseline; gap: 8px; margin: 3px 0 0 18px; }
  .sp-lm { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .sp-lp { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
  #split-break { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 36px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--hair); }
  .sp-col { min-width: 0; }
  .sp-gh { display: flex; align-items: center; gap: 8px; padding: 2px 0 8px; font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: -0.014em; border-bottom: 1px solid var(--hair); }
  .sp-ght { flex: 1; min-width: 0; }
  .sp-line { display: flex; align-items: baseline; gap: 12px; padding: 5px 0; font-size: 13px; }
  .sp-grp { font-weight: 600; padding-top: 10px; }
  .sp-item { padding-left: 18px; color: var(--ink-soft); }
  .sp-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .sp-note { color: var(--muted); font-size: 11.5px; margin-left: 8px; white-space: nowrap; }
  .sp-amt { flex: none; font-variant-numeric: tabular-nums; text-align: right; }
  .sp-empty { margin: 0; padding: 10px 0; font-size: 12.5px; color: var(--muted); }
  .sub-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: -0.014em; margin: 4px 0 0; }
  .sub-h + div { margin-bottom: 14px; }
  .cl-mg { flex: none; text-align: right; }
  .cl-mg .row-amount { display: block; }
  .cl-mg-k { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .cl-mg .row-amount.bad { color: var(--bad); }
  @media (max-width: 560px) {
    .flow-nav { margin-left: 0; width: 100%; }
    .sp-big { font-size: 32px; }
    .sp-end { text-align: left; }
    .sp-note { display: block; margin-left: 0; white-space: normal; }
  }
  /* ---- v24: Money tab rebuilt around a reference layout (component ideas only; Adviq's
     own tokens). One period control in the title row drives the tab. Charts reuse the
     validated pair --c1 (money in) / --c2 (money out) plus --good for net. Map tokens:
     the island silhouette clears 3:1 against --card (light: side 3.50:1, dark: land
     3.03:1); client pins (indigo, "money in") clear 3.6-3.9:1 on the land; lead dots use
     ink. ---- */
  :root { --map-land: #E7DCC2; --map-side: #9A875E; --map-pin: #5B5BD6; --map-lead: #45454E; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --map-land: #6E6147; --map-side: #4E4430; --map-pin: #C9C6FF; --map-lead: #CFCFD6; } }
  :root[data-theme="dark"] { --map-land: #6E6147; --map-side: #4E4430; --map-pin: #C9C6FF; --map-lead: #CFCFD6; }

  /* period control: sits on the gradient, so it gets its own opaque pill and an --ink edge
     (same treatment as the Refresh chip) */
  .period { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px; background: var(--card); border: 1px solid var(--ink); border-radius: 999px; }
  .period .step { border-radius: 999px; }
  .period .toggle { padding: 5px 12px; }
  .period .flow-month { min-width: 120px; }

  .money-top { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 20px; align-items: stretch; }
  .mk-stack { display: grid; gap: 14px; min-width: 0; }
  .mk { background: var(--card); border: 1px solid var(--hair-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 15px; min-width: 0; }
  .mk-head { display: flex; align-items: center; gap: 9px; }
  .mk-ico { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--card-2); border: 1px solid var(--hair); color: var(--ink-soft); flex: none; }
  .mk-ico svg { width: 16px; height: 16px; }
  .mk-k { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); flex: 1; min-width: 0; }
  .mk-link {
    display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
    background: var(--card); border: 1px solid var(--ctrl); border-radius: var(--radius-xs); padding: 4px 9px; text-decoration: none; cursor: pointer; white-space: nowrap;
  }
  .mk-link:hover { color: var(--ink); background: var(--card-2); border-color: var(--ink-soft); }
  .mk-link svg { width: 12px; height: 12px; }
  .mk-v { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.028em; font-variant-numeric: tabular-nums; margin-top: 10px; line-height: 1.1; }
  .mk-v.good { color: var(--good); }
  .mk-v.bad { color: var(--bad); }
  .mk-v[data-state="pending"] { color: var(--muted); }
  .mk-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
  .mk-s { font-size: 12px; color: var(--muted); }

  .cash-panel, .pnl-panel, .map-panel { display: flex; flex-direction: column; }
  .seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
  .seg .toggle { padding: 5px 11px; font-size: 12px; }
  .chart-legend { display: flex; gap: 6px 16px; flex-wrap: wrap; padding: 0 0 8px; font-size: 11.5px; color: var(--ink-soft); }
  .chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
  .lg-sq { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
  .lg-net { width: 8px; height: 8px; border-radius: 2px; background: var(--ink); display: inline-block; }
  .lg-dash { width: 16px; height: 0; border-top: 2px dashed var(--ink-soft); display: inline-block; }
  .lg-line { width: 16px; height: 0; border-top: 2.5px solid currentColor; display: inline-block; }
  .money-mid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .money-mid .sp-gh { margin-top: 2px; }
  #split-break { margin-top: 16px; }

  .map-box { position: relative; height: 340px; border-radius: var(--radius-sm); overflow: hidden;
    background: radial-gradient(120% 90% at 50% 40%, var(--card) 0%, var(--card-2) 100%); border: 1px solid var(--hair); touch-action: pan-y; }
  .map-box .map-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
  .map-box .map-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
  .map-box[data-mode="loading"]::after { content: "Loading map\2026"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; color: var(--muted); }
  .map-box .map-flat { width: 100%; height: 100%; display: block; }
  .map-box .tip { white-space: normal; max-width: 260px; }
  .map-legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-soft); padding: 10px 0 2px; }
  .map-legend span { display: inline-flex; align-items: center; gap: 6px; }
  .lg-pin { width: 10px; height: 10px; border-radius: 50%; background: var(--map-pin); display: inline-block; box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--map-pin); }
  .lg-lead { width: 9px; height: 9px; border-radius: 50%; background: var(--map-lead); opacity: 0.72; display: inline-block; }
  .map-sum { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 8px 0 4px; border-top: 1px solid var(--hair); margin-top: 8px; }
  .map-row { display: grid; grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 34px; gap: 10px; align-items: center; padding: 3px 0; font-size: 12.5px; }
  .map-town { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
  .map-bar { height: 6px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
  .map-bar > span { display: block; height: 100%; background: var(--map-lead); opacity: 0.6; border-radius: 999px; }
  .map-n { text-align: right; color: var(--ink-soft); }

  @media (max-width: 1100px) { .money-mid { grid-template-columns: minmax(0, 1fr); } }
  @media (max-width: 900px) {
    .money-top { grid-template-columns: minmax(0, 1fr); }
    .mk-stack { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  }
  @media (max-width: 560px) {
    .period { margin-left: 0; width: 100%; justify-content: space-between; }
    .period .flow-month { min-width: 0; flex: 1; }
    .mk-v { font-size: 26px; }
    .map-box { height: 280px; }
  }
  /* ---- Tools tab (v25, re-laid in v26 when Claude usage was dropped): the same shape as
     the Money tab's top row, a narrow figure card beside a wide list. Higgsfield is the
     figure, Subscriptions the list; they stack below 900px. ---- */
  .tools-top { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 20px; align-items: start; }
  .higgs-panel .panel-body { display: flex; flex-direction: column; min-height: 196px; }
  .credit { padding: 8px 0 4px; }
  .credit-v { font-family: var(--font-display); font-size: 44px; font-weight: 600; line-height: 1.05; letter-spacing: -0.032em; font-variant-numeric: tabular-nums; }
  .credit-k { font-size: 13px; color: var(--muted); margin-top: 4px; }
  .credit-meta { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--hair); font-size: 12px; color: var(--muted); }
  .credit-gap { flex: 1; min-height: 16px; }
  .sub-right { flex: none; text-align: right; }
  .sub-right .row-amount { display: block; }
  .sub-days { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .sub-days.soon { color: var(--warn); font-weight: 600; }
  .sub-first { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-tint); color: var(--ink-soft); }
  @media (max-width: 900px) { .tools-top { grid-template-columns: minmax(0, 1fr); } }
  @media (max-width: 560px) { .credit-v { font-size: 38px; } .higgs-panel .panel-body { min-height: 0; } }

  /* ---- HQ: roles and the account chip ---- */
  body:not(.is-admin) [data-admin] { display: none !important; }
  .me-chip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .chip-signout { font-weight: 600; display: inline-flex; align-items: center; gap: 7px; }
  .topbar .chip { white-space: nowrap; }
  @media (max-width: 560px) {
    /* phone: the account name goes (it is on the sign-in screen and in Google), Sign out becomes its icon */
    .me-chip { display: none; }
    .topbar .chip-signout { padding: 7px 10px; }
    .topbar .chip-signout .so-label { display: none; }
  }
