/* EA Command Center — design system
   Brand: Deep Indigo #2E3A8C, Orchid Violet #7C5CFC, Teal #0F8B8D, Amber #D97706,
   Ivory #FAFAF8, Mist #F3F4F6, Charcoal #1F2937, Slate #6B7280. Manrope + Inter. */

@font-face { font-family: 'Manrope'; src: local('Manrope'); font-display: swap; }

:root {
  --indigo:  #2E3A8C;
  --violet:  #7C5CFC;
  --teal:    #0F8B8D;
  --amber:   #D97706;
  --ivory:   #FAFAF8;
  --mist:    #F3F4F6;
  --charcoal:#1F2937;
  --slate:   #6B7280;

  color-scheme: dark;              /* themes the native date and time pickers */

  /* Elevation, not decoration.
     The page is the deepest surface, cards sit above it, insets sit below the
     card they are in. Purple-tinted throughout to match the brand's violet
     family — neutral navy replaced with deep indigo-violet darks. */
  --bg:        #0B0A14;
  --bg-raised: #1A1828;
  --bg-inset:  #12101C;
  --line:      #2E2946;
  --line-soft: #231F38;

  /* A 1px highlight along the top of a raised surface. Light falls from above,
     so this is the cheapest way to make an edge read as lifted. */
  --lift: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,0) 96px);

  /* The scratchpad is a different KIND of thing to a screen — working
     material, not a record — so it gets the sidebar's violet family rather
     than the page's neutrals. */
  --pad-bg:   #1C1738;
  --pad-head: #28204E;
  --pad-line: #382E68;

  /* Glass, for the things that FLOAT over the page — the timer bar, the
     scratchpad, the bubble, the widget panels. Not used on cards: a card is
     part of the page, and blurring the page against itself looks smeared.

     The tint is a LIGHT wash, not a dark one. The first attempt tinted with the
     card colour at 72%, which over a near-black page resolved to within a few
     values of the solid colour it replaced — technically translucent, visually
     identical. Frosted glass reads as glass because it sits lighter than its
     backdrop and shifts as things pass behind it, so that is what this does.
     `brightness` in the blur lifts a dark backdrop the same way. */
  --glass:      rgba(255, 255, 255, .10);
  --glass-pad:  rgba(154, 132, 255, .16);
  --glass-head: rgba(154, 132, 255, .26);
  --glass-line: rgba(255, 255, 255, .16);
  --glass-blur: blur(24px) saturate(1.7) brightness(1.35);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .16);
  --text:      #ECEDF2;
  --text-dim:  #9AA0B0;
  --text-faint:#6A7183;
  --accent:      var(--violet);
  --accent-soft: rgba(124, 92, 252, 0.18);

  /* The sidebar reads as its own surface, not a slice of the page.
     Deepened to sit richer against the purple-tinted page. */
  --side-bg:     #110E28;
  --side-line:   #2A2252;
  --side-text:   #CFC7F5;
  --side-hover:  #201A42;
  --side-active: #362A72;
  --ok:    #34D399;
  --warn:  #FBBF24;
  --danger:#F87171;

  /* Text tones for a label sitting on a TINT OF ITSELF — pills, tags, chips.
     Separate from --ok/--warn/--danger because those are fills, dots and
     borders, where contrast is not a reading problem. Tinting the background
     lifts it toward the text, so the neat colour stops being legible: violet
     on its own tint is 3.4:1 and the old muted grey was 3.0:1. Each value
     below clears 4.5:1 against an 8% tint of itself on a card. Re-check with
     a contrast calculator before changing any of them. */
  --t-ok:     #34D399;   /* 7.2:1 */
  --t-warn:   #FBBF24;   /* 8.1:1 */
  --t-danger: #F87171;   /* 5.2:1 */
  --t-info:   #A78BFA;   /* 5.2:1 — lighter than --violet, which fails here */
  --t-muted:  #9AA0B0;   /* 5.4:1 */
  --t-brand:  #93A1FB;   /* 5.6:1 — the indigo family, for neutral metadata */

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --sidebar-w: 236px;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.22);
  --sans: 'Manrope', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* KPI tones. The brand four, plus two from the chip palette, assigned by
     MEANING rather than by position — money in is teal wherever it appears,
     money out is amber. Lifted here because the brand values are pitched for
     a white page: Deep Indigo against the #1C2130 card is two dark colours
     and reads as no border at all. Light mode uses the brand values as-is. */
  --k-income:  #2DD4BF;
  --k-expense: #F59E0B;
  --k-hours:   #7C8CF8;
  --k-clients: #34D399;
  --k-tasks:   #38BDF8;
  --k-reply:   #A78BFA;

  /* Portal surface aliases — these were used but never defined. Map them
     to the existing elevation tokens so the portal reads correctly. */
  --bg-card:    var(--bg-raised);
  --border:     var(--line);
  --accent-bg:  var(--accent-soft);
  --bg-hover:   rgba(180, 160, 255, .08);

  /* Glassmorphism — frosted translucent surfaces for cards and panels.
     Opaque enough that the top-to-bottom gradient reads as a real lifted
     surface, not a smudge of fog.  Still has backdrop-filter for blur
     behind any alpha-transparent edge, but the card body is near-solid. */
  --glass-card:        rgba(28, 24, 52, .88);
  --glass-card-border: rgba(180, 160, 255, .20);
  --glass-card-blur:   blur(28px) saturate(1.8) brightness(1.1);
  --glass-card-shadow: 0 10px 40px rgba(0, 0, 0, .45),
                       0 2px 0 rgba(0, 0, 0, .18),
                       0 1px 0 rgba(180, 160, 255, .08);

  /* Neomorphism — soft embossed surfaces for KPIs and stat cards. */
  --neo-shadow: 8px 8px 24px rgba(0, 0, 0, .45),
               -6px -6px 18px rgba(124, 92, 252, .04);
  --neo-inset:  inset 2px 2px 5px rgba(0, 0, 0, .28),
                inset -2px -2px 5px rgba(124, 92, 252, .03);

  /* Claymorphism — rounded, pillowy surfaces for buttons and interactive
     elements. Pairs large radius with inner highlights and outer shadows. */
  --clay-r:      20px;
  --clay-shadow:  0 10px 30px rgba(0, 0, 0, .28),
                  inset 0 -3px 8px rgba(0, 0, 0, .20),
                  inset 0 2px 4px rgba(180, 160, 255, .10);

  /* Portal hero gradient — the banner across the top of the client portal. */
  --hero-gradient: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 55%, #A78BFA 100%);
}

:root[data-theme='light'] {
  color-scheme: light;

  /* Lavender-tinted page so the light mode feels warm and alive, not flat
     grey. Cards stay pure white for contrast, insets pick up a whisper of
     lilac. The result sits between the Outreach and RaffleHub references:
     bright but with colour running through the ground. */
  --bg:        #DDDFF4;
  --bg-raised: #FFFFFF;
  --bg-inset:  #ECEAF8;
  --line:      #CDCBE2;
  --line-soft: #E0DEF2;
  --text:      var(--charcoal);
  --text-dim:  var(--slate);
  --text-faint:#8A92A2;
  --accent:      #6D4DF2;
  --accent-soft: rgba(109, 77, 242, 0.14);
  --ok:    #0F8B8D;
  --warn:  var(--amber);
  --danger:#DC2626;

  /* Same job as the dark set above, pulled darker instead of lighter. Amber is
     the one that moves most: #D97706 reads at 2.9:1 on its own tint. */
  --t-ok:     #0C7375;   /* 5.1:1 */
  --t-warn:   #A34A07;   /* 5.3:1 */
  --t-danger: #C81E1E;   /* 5.0:1 */
  --t-info:   #6D4DF2;   /* 4.7:1 */
  --t-muted:  #5B6371;   /* 5.5:1 */
  --t-brand:  #3B4CA8;   /* 6.5:1 */

  --k-income:  var(--teal);
  --k-expense: var(--amber);
  --k-hours:   var(--indigo);
  --k-clients: #059669;
  --k-tasks:   #0284C7;
  --k-reply:   var(--violet);

  /* Portal surface aliases — light-mode versions */
  --bg-card:    #FFFFFF;
  --border:     var(--line);
  --accent-bg:  rgba(109, 77, 242, 0.10);
  --bg-hover:   rgba(109, 77, 242, .05);

  /* Glassmorphism — light mode: white glass with violet shadow cast.
     More opaque so the gradient reads as a real surface. */
  --glass-card:        rgba(255, 255, 255, .90);
  --glass-card-border: rgba(255, 255, 255, .92);
  --glass-card-blur:   blur(24px) saturate(1.6);
  --glass-card-shadow: 0 10px 30px rgba(109, 77, 242, .10),
                       0 4px 8px rgba(0, 0, 0, .06);

  /* Neomorphism — light: violet-tinted cast on the shadow side */
  --neo-shadow: 6px 6px 20px rgba(109, 77, 242, .14),
               -4px -4px 14px rgba(255, 255, 255, .92);
  --neo-inset:  inset 2px 2px 5px rgba(109, 77, 242, .06),
                inset -2px -2px 5px rgba(255, 255, 255, .85);

  /* Claymorphism — light: warm violet shadow cast */
  --clay-shadow: 0 10px 30px rgba(109, 77, 242, .08),
                 inset 0 -3px 8px rgba(0, 0, 0, .03),
                 inset 0 2px 4px rgba(255, 255, 255, .92);

  /* Card shadow carries violet, connecting white cards to the lavender ground. */
  --shadow: 0 1px 2px rgba(109,77,242,.05), 0 10px 28px rgba(109,77,242,.09);
  --lift: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,0) 96px);

  /* The scratchpad follows the sidebar's violet family, so it deepened with
     it — a pale lilac pad beside a full-strength violet sidebar read as a
     leftover from the old palette rather than a relative of it. */
  --pad-bg:   #EDE7FE;
  --pad-head: #D9CCFD;
  --pad-line: #B9A2FA;

  /* Light mode goes the other way: the page is already bright, so the wash is
     white at a high alpha and the blur does the separating. No brightness lift
     here — it would blow the backdrop out. */
  --glass:      rgba(255, 255, 255, .62);
  --glass-pad:  rgba(233, 225, 255, .72);
  --glass-head: rgba(210, 195, 253, .78);
  --glass-line: rgba(255, 255, 255, .85);
  --glass-blur: blur(24px) saturate(1.8);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .9);

  /* The brand violet at full strength, not a tint of it, so the sidebar reads
     as the brand rather than as a pale wash of it.

     #6D4DF2 rather than the brand's #7C5CFC, and the difference matters more
     than it looks. White on #7C5CFC is 4.38:1 — and white is the best there
     is against it, so no text choice reaches AA on that background at all.
     #6D4DF2 is the same violet a shade deeper and measures 5.26:1, which puts
     every nav item, tab and the brand name over the line. The brand hex still
     rules everywhere it sits on a light ground; this is the one surface where
     it is the ground.

     The hover and active steps are WHITE AT AN ALPHA rather than three more
     violets. These same variables also paint the tab strip, which sits on the
     page instead of in the sidebar, and a translucent step composites
     correctly on both; three hard-coded violets would only have suited one. */
  --side-bg:     #6D4DF2;
  --side-line:   rgba(255, 255, 255, .26);
  --side-text:   #FFFFFF;
  --side-hover:  rgba(255, 255, 255, .15);
  --side-active: rgba(255, 255, 255, .26);
}

/* On a violet sidebar the mark cannot be indigo — that is the colour rule's
   own case, indigo disappearing on a saturated ground. Scoped to the sidebar
   so the portal header and the sign-in card, which are still light surfaces
   in this theme, keep their indigo. */
:root[data-theme='light'] .sidebar .brand-mark { color: #FFFFFF; }

/* The active row's edge is --violet, which is now the sidebar itself. */
:root[data-theme='light'] .nav-item.is-active { box-shadow: inset 2px 0 0 #FFFFFF; }

/* The group labels and the brand sub-line run at .55 and .65, which was
   legible as dark violet on a pale ground and is not as white on a saturated
   one — they measured 3.5:1. .90 puts them at 4.58:1, over the line with a
   little left over, and keeps them quieter than the nav items at 5.26:1.
   Full opacity would clear AA too and is what an earlier pass used, but it
   flattens the two into the same weight for no gain. */
:root[data-theme='light'] .nav-group { opacity: .90; }
:root[data-theme='light'] .brand-sub { opacity: .90; }

/* Indigo on light grounds, violet on dark. Not a preference — indigo against
   the dark sidebar is close to invisible, and violet washes out on the light one. */
:root[data-theme='light'] .brand-mark { color: var(--indigo); }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Ambient gradient on the main content area — gives glass cards something
   to blur against and adds depth that a flat bg can never provide.
   Dark mode is richer and more violet to match Neuro/Opentree feel. */
.main,
.portal-main {
  background:
    /* Noise grain */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E"),
    /* Ambient glow orbs */
    radial-gradient(ellipse 80% 60% at 15% 0%, rgba(124, 92, 252, .25), transparent 55%),
    radial-gradient(ellipse 60% 50% at 85% 80%, rgba(15, 139, 141, .15), transparent 50%),
    radial-gradient(ellipse 70% 55% at 55% 35%, rgba(46, 58, 140, .18), transparent 50%),
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(80, 50, 180, .15), transparent 65%),
    var(--bg);
  position: relative;
}
/* Decorative rings on main content area */
.main::before,
.portal-main::before {
  content: '';
  position: fixed;
  width: 300px; height: 300px;
  right: -80px; top: 15%;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 92, 252, .15);
  box-shadow: 0 0 0 40px rgba(124, 92, 252, .04),
              0 0 0 80px rgba(124, 92, 252, .02);
  pointer-events: none;
  z-index: 0;
}
.main::after,
.portal-main::after {
  content: '';
  position: fixed;
  width: 200px; height: 200px;
  left: 10%; bottom: 5%;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 92, 252, .12);
  box-shadow: 0 0 0 30px rgba(124, 92, 252, .03);
  pointer-events: none;
  z-index: 0;
}
:root[data-theme='light'] .main,
:root[data-theme='light'] .portal-main {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 80% 60% at 15% 0%, rgba(109, 77, 242, .22), transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(15, 139, 141, .14), transparent 50%),
    radial-gradient(ellipse 70% 55% at 55% 35%, rgba(46, 58, 140, .16), transparent 50%),
    radial-gradient(ellipse 90% 65% at 50% 0%, rgba(109, 77, 242, .18), transparent 60%),
    var(--bg);
}
:root[data-theme='light'] .main::before,
:root[data-theme='light'] .portal-main::before {
  border-color: rgba(109, 77, 242, .18);
  box-shadow: 0 0 0 40px rgba(109, 77, 242, .05),
              0 0 0 80px rgba(109, 77, 242, .025);
}
:root[data-theme='light'] .main::after,
:root[data-theme='light'] .portal-main::after {
  border-color: rgba(109, 77, 242, .14);
  box-shadow: 0 0 0 30px rgba(109, 77, 242, .04);
}
.main > *,
.portal-main > * { position: relative; z-index: 1; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ---------- boot + sign-in ---------- */

.boot {
  min-height: 100vh; display: grid; place-items: center;
  color: var(--text-faint); font-size: 13px;
}

.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 420px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.gate-card {
  width: 100%; max-width: 400px; text-align: center;
  background:
    linear-gradient(180deg,
      rgba(50, 42, 85, .95) 0%,
      rgba(30, 26, 58, .92) 45%,
      rgba(16, 14, 34, .94) 100%);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  border: 1px solid var(--glass-card-border);
  border-top: 1px solid rgba(180, 160, 255, .28);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  border-radius: var(--clay-r); padding: 36px 32px;
  box-shadow: var(--glass-card-shadow);
}
:root[data-theme='light'] .gate-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F3FC 40%, #E8E2F2 100%);
  border: 1px solid rgba(109,77,242,.10);
  border-top: 1px solid rgba(255,255,255,.98);
  border-bottom: 1px solid rgba(109,77,242,.12);
  box-shadow: 0 1px 0 rgba(255,255,255,.95) inset,
              0 -2px 0 rgba(109,77,242,.03) inset,
              0 12px 36px rgba(109,77,242,.12),
              0 4px 8px rgba(0,0,0,.06);
}
.gate-brand { display: flex; justify-content: center; margin-bottom: 15px; }
.gate-card h1 { font-size: 24px; }
.gate-sub { margin: 6px 0 22px; color: var(--text-dim); font-size: 14px; }
.gate-form { text-align: left; }
.gate-or {
  display: flex; align-items: center; gap: 11px;
  margin: 17px 0; color: var(--text-faint); font-size: 11px;
}
.gate-or::before, .gate-or::after {
  content: ''; flex: 1; height: 1px; background: var(--line-soft);
}
.gate-note {
  margin: 17px 0 0; font-size: 12px; color: var(--text-faint); line-height: 1.5;
}
.gate-note.is-good { color: var(--ok); }
.gate-note.is-bad  { color: var(--danger); }

/* ---------- sidebar ---------- */

.sidebar {
  background:
    /* Noise grain */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"),
    /* Ambient glow orbs */
    radial-gradient(ellipse 120% 40% at 80% 8%, rgba(124, 92, 252, .18), transparent 60%),
    radial-gradient(ellipse 100% 35% at 20% 92%, rgba(46, 58, 140, .14), transparent 55%),
    radial-gradient(circle at 50% 55%, rgba(124, 92, 252, .05), transparent 50%),
    /* 3D gradient */
    linear-gradient(180deg,
      rgba(26, 20, 55, 1) 0%,
      var(--side-bg) 40%,
      rgba(8, 6, 18, 1) 100%);
  border-right: 1px solid var(--side-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
/* Decorative rings — faint geometric circles */
.sidebar::before {
  content: '';
  position: absolute;
  width: 180px; height: 180px;
  right: -60px; top: 60px;
  border-radius: 50%;
  border: 1px solid rgba(124, 92, 252, .10);
  box-shadow: 0 0 0 30px rgba(124, 92, 252, .03),
              0 0 0 60px rgba(124, 92, 252, .015);
  pointer-events: none;
  z-index: 0;
}
.sidebar::after {
  content: '';
  position: absolute;
  width: 120px; height: 120px;
  left: -40px; bottom: 80px;
  border-radius: 50%;
  border: 1px solid rgba(124, 92, 252, .08);
  box-shadow: 0 0 0 20px rgba(124, 92, 252, .025);
  pointer-events: none;
  z-index: 0;
}
.sidebar > * { position: relative; z-index: 1; }
:root[data-theme='light'] .sidebar {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 120% 40% at 80% 8%, rgba(255, 255, 255, .25), transparent 60%),
    radial-gradient(ellipse 100% 35% at 20% 92%, rgba(255, 255, 255, .15), transparent 55%),
    linear-gradient(180deg,
      #8B6CF7 0%,
      var(--side-bg) 40%,
      #4A2DC7 100%);
}
:root[data-theme='light'] .sidebar::before {
  border-color: rgba(255, 255, 255, .18);
  box-shadow: 0 0 0 30px rgba(255, 255, 255, .06),
              0 0 0 60px rgba(255, 255, 255, .025);
}
:root[data-theme='light'] .sidebar::after {
  border-color: rgba(255, 255, 255, .14);
  box-shadow: 0 0 0 20px rgba(255, 255, 255, .04);
}

/* Collapsed: icons only. Width is driven by --sidebar-w so the grid follows. */
.app.is-collapsed { --sidebar-w: 62px; }
.app.is-collapsed .brand > div:not(.brand-mark),
.app.is-collapsed .nav-item .label,
.app.is-collapsed .nav-group,
.app.is-collapsed .soon-dot,
.app.is-collapsed .user-chip > div:not(.avatar) { display: none; }
.app.is-collapsed .brand { justify-content: center; padding-inline: 0; }
.app.is-collapsed .nav-item { justify-content: center; padding-inline: 0; }
.app.is-collapsed .user-chip { flex-direction: column; gap: 7px; padding: 9px 4px; }
.app.is-collapsed .nav { padding-inline: 6px; }

.side-toggle {
  margin: 0 10px 8px; padding: 7px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: none; border: 1px solid var(--side-line); border-radius: var(--r-sm);
  color: var(--side-text); cursor: pointer; font-size: 12px;
}
.side-toggle:hover { background: var(--side-hover); }
.app.is-collapsed .side-toggle-label { display: none; }

.brand { padding: 20px 18px 16px; display: flex; gap: 11px; align-items: center; }
/* The brand mark. A flat shape rather than a filled tile, so it carries its own
   colour instead of sitting on one: violet against the dark sidebar, indigo
   against the light one. The height drives it and the width follows the
   artwork's 409:367, which is why nothing here is square. */
.brand-mark {
  height: 30px; flex: none;
  display: flex; align-items: center;
  color: var(--violet);
}
.brand-mark svg { height: 100%; width: auto; display: block; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-name { color: var(--side-text); }
.brand-sub {
  font-size: 11px; color: var(--side-text); opacity: .65;
  text-transform: uppercase; letter-spacing: .09em; margin-top: 2px;
}

.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 16px; }
/* .68, not .55 and not 1. At .55 these were 4.15:1 on the dark sidebar, under
   AA for 10px text whose strokes are thin to begin with. Full white would fix
   the number and overcorrect: small bright type on a near-black ground blooms,
   and these are section headers nobody needs to read twice. .68 is 5.65:1 —
   over the line, still plainly quieter than a nav item at 10.8:1. */
.nav-group {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--side-text); opacity: .68; padding: 16px 10px 6px; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px; margin-bottom: 2px;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--side-text); cursor: pointer; text-align: left; white-space: nowrap;
  font-size: 14px;
}
.nav-item:hover { background: var(--side-hover); }
.nav-item.is-active {
  background: var(--side-active); font-weight: 700;
  box-shadow: inset 2px 0 0 var(--violet);
}
.nav-item .ico { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav-item.is-active .ico { opacity: 1; }
.nav-item .label { flex: 1; }

/* Count of what is late or due today. Only ever rendered when non-zero, so it
   reads as an alarm rather than a statistic. */
.nav-badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  background: var(--danger); color: #fff;
  border-radius: 9px; font-size: 10.5px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
/* Collapsed to icons only, the number will not fit — it becomes a dot on the
   icon's shoulder, which still tells you something is waiting. */
.app.is-collapsed .nav-item { position: relative; }
.app.is-collapsed .nav-badge {
  position: absolute; top: 3px; right: 11px;
  min-width: 8px; width: 8px; height: 8px; padding: 0;
  font-size: 0; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--side-bg);
}
.soon-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .4; flex: none; }

.user-chip {
  margin: 10px; padding: 9px 11px; display: flex; gap: 10px; align-items: center;
  background: var(--side-hover); border: 1px solid var(--side-line);
  border-radius: var(--r); color: var(--side-text);
}
.user-chip .icon-btn { background: none; border-color: var(--side-line); color: inherit; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; overflow: hidden;
  background: linear-gradient(140deg, var(--teal), var(--indigo));
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Photo plus its controls, in a client record or Settings. */
.photo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.photo-row .avatar { box-shadow: 0 0 0 3px var(--bg-raised), 0 0 0 4px var(--line-soft); }

/* Intake form: a long questionnaire, so sections have to be findable. */
.intake-section { margin-bottom: 26px; }
.intake-section > h3 {
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700;
  margin: 0 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft);
}
.intake-hint { font-size: 11.5px; color: var(--text-faint); margin: 4px 0 0; }
.intake-now {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 9.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  vertical-align: middle;
}
.intake-bar {
  position: sticky; bottom: 0; z-index: 2; margin: 0 -19px -17px;
  padding: 13px 19px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--bg-raised); border-top: 1px solid var(--line);
}
/* Read-back of stored answers on the detail tab. */
.intake-read dt {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-top: 12px;
}
.intake-read dd { margin: 3px 0 0; font-size: 13.5px; white-space: pre-wrap; }

/* ---------- top bar ---------- */

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

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 32px; border-bottom: 1px solid var(--glass-card-border);
  position: sticky; top: 0;
  background: var(--glass-card);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  z-index: 5;
}
:root[data-theme='light'] .topbar {
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid rgba(109,77,242,.06);
}
.crumb { font-size: 13px; color: var(--text-faint); }
.crumb b { color: var(--text-dim); font-weight: 600; }

.search {
  flex: 1; max-width: 420px; margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; background: var(--bg-inset);
  border: 1px solid var(--line); border-radius: 9px; color: var(--text-faint);
}
.search input { flex: 1; background: none; border: 0; outline: none; font-size: 14px; }
.search input::placeholder { color: var(--text-faint); }
.kbd {
  font-size: 10px; padding: 2px 5px; border-radius: 4px;
  background: var(--line-soft); border: 1px solid var(--line); color: var(--text-faint);
}

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

.page { padding: 36px 40px; max-width: 1600px; width: 100%; }
.page-head { margin-bottom: 30px; }
.eyebrow {
  font-size: 12px; letter-spacing: .10em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 8px;
}
.page-head h1 { font-size: 34px; }
.page-head p { margin: 8px 0 0; color: var(--text-dim); max-width: 68ch; font-size: 16px; }

.split { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 1080px) { .split { grid-template-columns: 1fr; } }

/* Cards read as 3D objects: brighter at the top where light hits, fading
   slightly darker toward the bottom. The gradient + shadow + top highlight
   combine to make them feel lifted and tactile, not flat. */
.card {
  position: relative;
  background:
    linear-gradient(180deg,
      rgba(50, 42, 85, .95) 0%,
      rgba(30, 26, 58, .92) 45%,
      rgba(16, 14, 34, .94) 100%);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  border: 1px solid var(--glass-card-border);
  border-top: 1px solid rgba(180, 160, 255, .28);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  border-radius: var(--clay-r);
  box-shadow: var(--glass-card-shadow);
  transition: transform .22s ease, box-shadow .22s ease;
}
:root[data-theme='light'] .card {
  background:
    linear-gradient(180deg,
      #FFFFFF 0%,
      #F6F3FC 40%,
      #E8E2F2 100%);
  border: 1px solid rgba(109,77,242,.10);
  border-top: 1px solid rgba(255,255,255,.98);
  border-bottom: 1px solid rgba(109,77,242,.12);
  box-shadow: 0 1px 0 rgba(255,255,255,.95) inset,
              0 -2px 0 rgba(109,77,242,.03) inset,
              0 10px 30px rgba(109,77,242,.10),
              0 4px 8px rgba(0,0,0,.06);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 48px rgba(0, 0, 0, .50),
              0 4px 0 rgba(0, 0, 0, .20),
              0 1px 0 rgba(180, 160, 255, .12);
}
:root[data-theme='light'] .card:hover {
  box-shadow: 0 1px 0 rgba(255,255,255,.95) inset,
              0 -2px 0 rgba(109,77,242,.03) inset,
              0 16px 40px rgba(109,77,242,.14),
              0 6px 10px rgba(0,0,0,.07);
}
.card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(180,160,255,.18) 0%, transparent 35%);
}
:root[data-theme='light'] .card::before {
  background: linear-gradient(180deg, rgba(255,255,255,.7) 0%, transparent 40%);
}
.card > * { position: relative; }
.card-head {
  padding: 20px 24px; border-bottom: 1px solid var(--glass-card-border);
  display: flex; align-items: flex-start; gap: 12px;
}
.card-head h2 { font-size: 19px; }
.card-head p { margin: 3px 0 0; font-size: 14px; color: var(--text-dim); }
.card-body { padding: 20px 24px; }

/* ---------- forms ---------- */

.field { margin-bottom: 13px; }
.field label {
  display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 700; margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px;
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: var(--r-sm); outline: none;
}
.field textarea { min-height: 74px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: var(--r); border: 1px solid var(--glass-card-border);
  background: var(--glass-card);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  cursor: pointer; font-weight: 600; font-size: 14px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--violet), var(--indigo));
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px rgba(124, 92, 252, .3),
              inset 0 1px 2px rgba(255, 255, 255, .15);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: none; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--line-soft); color: var(--text); }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg-inset); display: grid; place-items: center; cursor: pointer;
  color: var(--text-dim);
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------- table ---------- */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700;
  padding: 0 14px 10px; border-bottom: 1px solid var(--line-soft);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--line-soft); }
/* Rate table — opted out of wireTables so it gets its own 5-row cap */
#rtTable th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 700; padding: 0 14px 10px;
}
#rtTable td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
#rtTable tbody tr:last-child td { border-bottom: 0; }
#rtTable tbody tr:hover td { background: var(--line-soft); }
.cell-main { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cell-sub { font-size: 13px; color: var(--text-dim); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600;
  background: var(--line-soft); color: var(--text-dim);
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* The status colour fills the pill now instead of only tinting six characters
   of text. Both the wash and the ring are derived from currentColor, so every
   variant below is one `color` declaration and there is no second place to
   keep in sync — and a status added later is coloured the moment it has a tone.

   Mixed with `transparent`, not with a surface colour: pills sit on cards, on
   inset fields and on hovered table rows, and a wash composited over whatever
   is actually behind stays right on all three. The ring is what stops a pale
   wash from dissolving into a light card.

   Kept as a separate declaration from the `background` above, on purpose.
   Where color-mix is unsupported the whole thing drops and the plain grey
   pill still stands — same defensive shape as the .kpi border. */
.pill {
  background: color-mix(in srgb, currentColor 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 20%, transparent);
}
.pill-active   { color: var(--t-ok); }
.pill-prospect { color: var(--t-info); }
.pill-hold     { color: var(--t-warn); }
.pill-past     { color: var(--t-muted); }

.empty { padding: 46px 24px; text-align: center; color: var(--text-dim); }
.empty-mark {
  width: 42px; height: 42px; margin: 0 auto 12px; border-radius: var(--r);
  background: var(--accent-soft); display: grid; place-items: center; color: var(--accent);
}
.empty h3 { font-size: 14px; margin-bottom: 4px; }
.empty p { margin: 0; font-size: 13px; max-width: 34ch; margin-inline: auto; }

.count { font-size: 12px; color: var(--text-faint); }

.soon-banner {
  margin-top: 14px; padding: 13px 15px; display: flex; gap: 10px; align-items: flex-start;
  background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: var(--r); font-size: 13px; color: var(--text-dim);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.stack { display: grid; gap: 18px; }
.split-wide { grid-template-columns: minmax(360px, 1fr) minmax(380px, 1fr); }
.pill-danger { color: var(--t-danger); }

/* ---------- invoice builder ---------- */

.items-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 0 9px; font-weight: 700; font-size: 13px;
}
.item-labels, .item-row {
  display: grid; grid-template-columns: 1fr 62px 84px 90px 32px;
  gap: 7px; align-items: center;
}
.item-labels {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-bottom: 5px;
}
.item-labels span:nth-child(4) { text-align: right; }
.item-row { margin-bottom: 7px; }
.item-row input {
  width: 100%; padding: 8px 10px; background: var(--bg-inset);
  border: 1px solid var(--line); border-radius: var(--r-sm); outline: none;
}
.item-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.item-amt { text-align: right; font-weight: 600; font-size: 13px; }

.totals { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.totals > div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--text-dim); }
.totals .grand {
  margin-top: 7px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  color: var(--text); font-weight: 800; font-size: 16px;
}

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 17px; }

/* A checkbox and its label as one clickable row inside a form. */
.check-row {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 9px 11px; margin-bottom: 11px; font-size: 13px;
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}
.check-row:hover { border-color: var(--accent); }
.check-row input { flex: none; }

/* the rendered invoice — always light, it is a document */
.paper-wrap { background: var(--bg-inset); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.paper {
  background: #fff; color: #1F2937; border-radius: var(--r);
  padding: 26px; font-size: 12px; box-shadow: 0 6px 22px rgba(0,0,0,.18);
}
.paper-top { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.paper-brand { display: flex; align-items: center; gap: 8px; font-size: 14px; }
/* Paper is always white, whatever the app theme is doing, so this one is indigo
   and stays indigo — it prints. */
.paper-mark {
  height: 22px; flex: none;
  display: flex; align-items: center;
  color: #2E3A8C;
}
.paper-mark svg { height: 100%; width: auto; display: block; }
.paper-muted { color: #6B7280; font-size: 11px; }
.paper-label {
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  color: #9AA1AE; font-weight: 700; margin-bottom: 2px;
}
.paper-number { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.paper-meta {
  display: flex; justify-content: space-between; gap: 18px;
  padding: 13px 0; border-top: 1px solid #EDEFF3; border-bottom: 1px solid #EDEFF3;
  margin-bottom: 15px;
}
.paper-table { width: 100%; border-collapse: collapse; }
.paper-table th {
  text-align: left; font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
  color: #9AA1AE; padding-bottom: 7px; border-bottom: 1px solid #EDEFF3;
}
.paper-table td { padding: 8px 0; border-bottom: 1px solid #F5F6F8; }
.paper-totals { margin-top: 14px; margin-left: auto; width: min(240px, 100%); }
.paper-totals > div { display: flex; justify-content: space-between; padding: 3px 0; color: #6B7280; }
.paper-totals .grand {
  margin-top: 6px; padding-top: 8px; border-top: 1px solid #E3E5EC;
  color: #1F2937; font-weight: 800; font-size: 15px;
}
.paper-notes { margin-top: 20px; padding-top: 13px; border-top: 1px solid #EDEFF3; color: #6B7280; }

/* ---------- dashboard ---------- */

/* Always one line. Columns share the width equally and shrink together
   rather than wrapping — min-width:0 is what lets them go narrow. */
.kpi-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: clamp(6px, 0.8vw, 13px);
  margin-bottom: 18px;
}
.kpi {
  --kpi: var(--accent);            /* tiles with no tone stay on the accent */
  position: relative; overflow: hidden; min-width: 0;
  background:
    linear-gradient(180deg,
      rgba(50, 42, 85, .95) 0%,
      rgba(30, 26, 58, .92) 45%,
      rgba(16, 14, 34, .94) 100%);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  border: 1px solid var(--glass-card-border);
  border-top: 1px solid rgba(180, 160, 255, .28);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  border-radius: var(--clay-r); padding: clamp(14px, 1.4vw, 22px) clamp(14px, 1.3vw, 22px);
  box-shadow: var(--neo-shadow);
  transition: transform .18s;
}
.kpi:hover { transform: translateY(-2px); }
/* The tile's colour runs all the way round, EVENLY. The first version kept a
   2px gradient bar along the top on top of a 1px border, which made the edge
   read as thick and saturated at the top-left, fading right, and hairline
   everywhere else — four different weights on one box. One border, one width,
   one colour is what "outlined in its colour" actually looks like.

   Mixed toward --line rather than used neat: six full-strength outlines at
   once is a row of warning boxes.

   Still NOT the glow that was taken off these tiles in August — that was a
   halo BEHIND the box, bleeding over the number and making it harder to read.
   A border is an edge: it sits outside the content and touches nothing.

   The border-color declaration is deliberately separate. Where color-mix is
   unsupported the whole declaration is dropped and the plain --line border
   above still stands. */
/* Superseded by the filled tiles further down, which set border-color to
   transparent. This is what a browser without color-mix still gets, and it is
   why the 2px width stays here rather than moving too — the box is the same
   size either way, so nothing shifts. */
.kpi {
  border-width: 2px;
  border-color: color-mix(in srgb, var(--kpi) 60%, var(--line));
  /* Colored ambient glow behind the tile — visible on dark backgrounds,
     subtle on light ones. Uses the tile's own --kpi tone. */
  box-shadow: var(--neo-shadow),
              0 6px 28px color-mix(in srgb, var(--kpi) 20%, transparent);
}

.kpi-income   { --kpi: var(--k-income); }
.kpi-cash     { --kpi: var(--k-hours); }
.kpi-owed     { --kpi: var(--k-expense); }
.kpi-expenses { --kpi: var(--k-expense); }
.kpi-hours    { --kpi: var(--k-hours); }
.kpi-clients  { --kpi: var(--k-clients); }
.kpi-tasks    { --kpi: var(--k-tasks); }
.kpi-reply    { --kpi: var(--k-reply); }

/* The same six tones under hue names, for tiles whose metric has no natural
   one — "leads", "drafts", "entries this month". Naming those after a meaning
   they do not have (kpi-owed on a row of work-log counts) reads as a bug in
   the markup. What is actually being chosen is a colour, so the class says so.

   Reach for the semantic names above where the metric really is income, hours
   or tasks; use these to fill out a row. A row of six should spend all six —
   an untoned .kpi falls back to --accent, and six of those is the flat violet
   block these screens used to be. */
.kpi-teal   { --kpi: var(--k-income); }
.kpi-amber  { --kpi: var(--k-expense); }
.kpi-indigo { --kpi: var(--k-hours); }
.kpi-green  { --kpi: var(--k-clients); }
.kpi-blue   { --kpi: var(--k-tasks); }
.kpi-violet { --kpi: var(--k-reply); }

/* No top bar. It was the thing making the edge uneven — see above. */
.kpi-value { font-variant-numeric: tabular-nums; }
.kpi-label {
  font-size: clamp(10px, .8vw, 13px); letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-value {
  font-size: clamp(20px, 1.9vw, 30px); font-weight: 800; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- finance: tiered layout ----------

   Four lead tiles carry more weight than a KPI in a row of six — bigger
   number, room for a comparison line underneath. The comparison is the point:
   a figure with nothing to measure it against is decoration. */
.kpi-row-lead { grid-auto-columns: minmax(0, 1fr); margin-bottom: 20px; }
.kpi-row-lead .kpi { padding: 18px 20px; }
.kpi-row-lead .kpi-value { font-size: clamp(26px, 2.4vw, 36px); }

.kpi-delta {
  display: block; margin-top: 6px; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-delta.is-up   { color: var(--ok); }
.kpi-delta.is-down { color: var(--danger); }
.kpi-delta.is-flat { color: var(--text-faint); font-weight: 500; }

.fin-charts {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; margin-bottom: 18px;
  align-items: stretch;
}
@media (max-width: 1080px) { .fin-charts { grid-template-columns: 1fr; } }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-tick { fill: var(--text-faint); font-size: 11px; font-weight: 600; }
.chart-legend {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  margin-top: 10px; font-size: 12px; color: var(--text-dim);
}
.chart-legend i {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px;
}
.chart-scale { margin-left: auto; color: var(--text-faint); }

/* A labelled list with a magnitude, which is what a category breakdown is. */
.cat-row {
  display: grid; grid-template-columns: minmax(70px, 1fr) 2fr auto;
  gap: 11px; align-items: center; padding: 6px 0;
}
.cat-label {
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.cat-track { background: var(--bg-inset); border-radius: 999px; height: 9px; overflow: hidden; }
/* Solid, not a gradient. A gradient along the bar means a long bar ends up a
   different colour from a short one, which reads as the colour encoding
   something — and it encodes nothing. Every bar here is the same kind of
   thing: money spent. */
.cat-fill {
  height: 100%; border-radius: 999px; min-width: 3px;
  background: var(--k-expense);
}
.cat-value { font-size: 12.5px; font-weight: 700; text-align: right; white-space: nowrap; }
.cat-value .cell-sub { margin-left: 5px; font-weight: 500; }

.fin-strip-card { margin-bottom: 18px; }
/* Equal columns across the full width rather than a flex row bunched at the
   left. auto-fit with a minimum keeps them from being squeezed unreadably on a
   narrow window — they drop to a second line instead. */
.fin-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px 24px;
  font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.fin-strip-l {
  display: block; font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-bottom: 2px;
}

.dash-grid .card, .lib-side { position: relative; overflow: hidden; }

/* Colour-coded count chips. Only chips carrying a chip-* class get a dot —
   the invoice-status chips already contain a pill with its own dot. */
.inv-chip[class*="chip-"] { position: relative; padding-left: 25px; }
/* The chip already knew its colour and spent it on a 7px dot. Same wash as the
   pills, from --chip rather than currentColor because the chip's text stays
   readable body text — these carry a count, not a status word. */
.inv-chip[class*="chip-"] {
  background: color-mix(in srgb, var(--chip) 10%, var(--bg-inset));
  border-color: color-mix(in srgb, var(--chip) 34%, var(--line-soft));
}
.inv-chip[class*="chip-"]::before {
  content: ''; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: var(--chip, var(--text-faint));
}
.chip-found      { --chip: #6A7183; }
.chip-applied    { --chip: #7C5CFC; }
.chip-replied    { --chip: #0F8B8D; }
.chip-interview  { --chip: #38BDF8; }
.chip-discovery  { --chip: #FBBF24; }
.chip-proposal   { --chip: #D97706; }
.chip-confirm    { --chip: #34D399; }
.chip-clients    { --chip: #7C5CFC; }
.chip-projects   { --chip: #0F8B8D; }
.chip-tasks      { --chip: #FBBF24; }
.kpi-value.is-good { color: var(--ok); }
.kpi-value.is-bad  { color: var(--danger); }
.kpi-value.is-warn { color: var(--warn); }

/* ---------- filled KPI tiles ----------

   The tile's colour became the tile rather than its edge. Third treatment
   these have had, so the two that were removed are worth restating: a halo
   glow BEHIND the box (bled over the number) and a 2px gradient bar along the
   top (made one box read at four different edge weights). A flat fill is
   neither — it sits behind the content evenly and adds no new edge.

   Wrapped in @supports rather than relying on an unsupported declaration
   being dropped, because this changes the TEXT colour too. Drop just the
   background and you get white text on a white card — so the fill and the
   white it requires have to stand or fall together.

   The two percentages are not interchangeable and were measured, not chosen:

   - Light mixes the tone 72% toward black. Neat brand tones are too light to
     carry white text — amber is 3.2:1 — and 72% is the point where the worst
     of the six clears 4.5:1 with the label still legible at 88% white.
   - Dark mixes 30% into the CARD, not toward black. A dark page needs the
     tile lighter than its surroundings, not darker, and full-strength tones
     are far too bright to sit under white. This also sidesteps the problem
     that gave the brand its colour rule: deep indigo on the navy card is
     1.2:1, near enough invisible, while the mix lands at 1.6–2.0:1.

   Re-measure both if the --k-* tones ever move. */
@supports (background: color-mix(in srgb, red 50%, blue)) {

  /* DARK — the tone at full strength, with near-black ink on top.
     Mixing the tone INTO the card was the first attempt and it went muddy:
     the card is a desaturated navy, so 30% of amber over it lands on brown
     and teal lands on slate. Nothing was wrong with the contrast, the colour
     had just been washed out of it. Neat tones keep the hue, and the text
     inverts to compensate — dark ink on a bright fill rather than white on a
     dark one. Worst pairing of the six is 6.4:1 on the number, 4.7:1 on the
     label at 78%. */
  .kpi {
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--kpi) 85%, #fff) 0%,
      var(--kpi) 55%,
      color-mix(in srgb, var(--kpi) 80%, #000) 100%);
    border-color: transparent;
    border-top-color: color-mix(in srgb, var(--kpi) 55%, #fff);
    border-bottom-color: color-mix(in srgb, var(--kpi) 55%, #000);
  }
  .kpi-label, .kpi-delta,
  .kpi-delta.is-up, .kpi-delta.is-down, .kpi-delta.is-flat {
    color: rgba(11, 14, 22, .78);
  }
  .kpi-value,
  .kpi-value.is-good, .kpi-value.is-bad, .kpi-value.is-warn { color: #0B0E16; }
  .kpi-delta.is-flat { font-weight: 500; }

  /* LIGHT — softer, more pastel fills so the tiles sit comfortably on the
     lavender ground without looking heavy. Mix toward white instead of black
     so they read as tinted surfaces, not dark blocks. Text goes dark to
     maintain contrast against the light fill. */
  :root[data-theme='light'] .kpi {
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--kpi) 30%, #fff) 0%,
      color-mix(in srgb, var(--kpi) 38%, #fff) 55%,
      color-mix(in srgb, var(--kpi) 50%, #fff) 100%);
    border-top-color: color-mix(in srgb, var(--kpi) 18%, #fff);
    border-bottom-color: color-mix(in srgb, var(--kpi) 55%, #fff);
  }
  :root[data-theme='light'] .kpi-label,
  :root[data-theme='light'] .kpi-delta,
  :root[data-theme='light'] .kpi-delta.is-up,
  :root[data-theme='light'] .kpi-delta.is-down,
  :root[data-theme='light'] .kpi-delta.is-flat {
    color: color-mix(in srgb, var(--kpi) 85%, #000);
  }
  :root[data-theme='light'] .kpi-value,
  :root[data-theme='light'] .kpi-value.is-good,
  :root[data-theme='light'] .kpi-value.is-bad,
  :root[data-theme='light'] .kpi-value.is-warn {
    color: color-mix(in srgb, var(--kpi) 75%, #000);
  }
}

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 1080px) { .dash-grid { grid-template-columns: 1fr; } }

/* Two columns that pack independently. A plain grid aligned every row to its
   tallest card, so a short card beside a tall one left a block of dead space
   below it — which is what made the dashboard look badly spaced. Each column
   is its own flex stack now, so cards sit directly under one another.
   The columns then STRETCH to the taller of the two, and the last card in
   each takes up the difference, so the two sides end level. Note what is
   deliberately not happening: the slack goes inside one card, at the bottom
   of the column, and never between cards — putting it between them is the
   row-aligned grid this replaced. */
.dash-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: stretch;
}
.dash-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.dash-col > :last-child { flex: 1 1 auto; }
@media (max-width: 1080px) {
  .dash-cols { grid-template-columns: 1fr; }
  /* Stacked, there is no second column to match, so a growing last card would
     just be a tall empty box. */
  .dash-col > :last-child { flex: 0 0 auto; }
}

.need-list {
  padding: 8px; display: grid; gap: 4px;
  max-height: 280px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.need-list::-webkit-scrollbar { width: 7px; }
.need-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.need {
  display: flex; gap: 11px; align-items: center; width: 100%; text-align: left;
  padding: 10px 11px; background: none; border: 0; border-radius: var(--r-sm);
  cursor: pointer; color: var(--text);
}
.need:hover { background: var(--line-soft); }
.need-ico {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.need-ico.is-late { background: rgba(248,113,113,.14); color: var(--danger); }
.need-label { display: block; font-weight: 600; font-size: 14px; }
.need-sub { display: block; font-size: 12px; color: var(--text-faint); margin-top: 1px; }

.bars {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px;
  align-items: end; height: 120px; margin-bottom: 6px;
}
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 4px; }
.bar {
  min-height: 2px; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--violet), var(--indigo));
}
.bar-label { text-align: center; font-size: 9px; color: var(--text-faint); }

.inv-status { display: flex; gap: 9px; flex-wrap: wrap; padding-top: 12px; }
.inv-chip {
  display: flex; align-items: center; gap: 8px;
  padding-block: 6px; padding-inline: 11px;
  border: 1px solid var(--line-soft); border-radius: 9px;
  background: var(--bg-inset); font-size: 13px;
}

/* ---------- calendar ---------- */

/* Calendar sits beside its event list rather than filling the width. Both
   sides stretch to the taller of the two so the pair ends level — same
   treatment as .dash-cols, and for the same reason. */
.cal-layout {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, 1fr);
  gap: 18px; align-items: stretch;
}
@media (max-width: 1000px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side > :last-child { flex: 0 0 auto; }
}

/* The right-hand column. Events on top, key dates under it, each keeping its
   own height rather than one pushing the other down the page — except the
   last, which absorbs whatever the month card is taller by. */
.cal-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.cal-side > :last-child { flex: 1 1 auto; }

.day-list { display: grid; gap: 7px; }

/* A list that scrolls inside its card instead of growing without limit. A busy
   month should make ONE card scroll, not push everything below it off screen. */
.day-list.is-scroll { max-height: 275px; overflow-y: auto; padding-right: 4px; }
.day-list.is-scroll::-webkit-scrollbar { width: 8px; }
.day-list.is-scroll::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 99px;
}
.day-list.is-scroll { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.day-item {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--bg-inset); border-left: 3px solid var(--text-faint);
}
.day-item.is-deadline { border-left-color: var(--danger); }
.day-item.is-meeting  { border-left-color: var(--violet); }
.day-item.is-reminder { border-left-color: var(--warn); }
.day-item.is-derived  { border-left-color: var(--teal); }

.cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px;
}
.cal-head div {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; padding-left: 3px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 92px; padding: 7px 8px; cursor: pointer;
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); overflow: hidden;
}
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.is-outside { opacity: .38; }
.cal-cell.is-today { border-color: var(--accent); background: var(--accent-soft); }
.cal-day { font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.cal-cell.is-today .cal-day { color: var(--accent); }

.mark {
  font-size: 10px; line-height: 1.35; padding: 2px 5px; margin-bottom: 3px;
  border-radius: 4px; border-left: 2px solid var(--text-faint);
  background: var(--line-soft); color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mark b { font-weight: 700; color: var(--text); }
.mark.is-deadline { border-left-color: var(--danger); }
.mark.is-meeting  { border-left-color: var(--violet); }
.mark.is-reminder { border-left-color: var(--warn); }
.mark.is-derived  { border-left-color: var(--teal); opacity: .85; }
.mark-more { font-size: 9px; color: var(--text-faint); padding-left: 5px; }

@media (max-width: 760px) {
  .cal-cell { min-height: 64px; }
  .mark { display: none; }
}

/* ---------- time tracker ---------- */

.clock-wrap {
  text-align: center; padding: 22px 14px;
  background: var(--bg-inset); border: 1px solid var(--line-soft); border-radius: var(--r);
}
.clock {
  font-size: 42px; font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.clock-state {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-top: 4px;
}

.timer-row {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 11px 13px; border-radius: var(--r);
  background: var(--bg-inset); border: 1px solid var(--line-soft);
}
.timer-row.is-live { border-color: var(--ok); }
.timer-clock {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 19px;
  letter-spacing: -.02em; min-width: 92px;
}
.timer-row.is-live .timer-clock { color: var(--ok); }

/* One line, always. Five concurrent timers used to wrap into a block three
   rows deep that ate the bottom of the screen. The pills now scroll sideways
   inside the bar instead: about three are visible and the rest are a swipe
   away, so the bar's height never changes no matter how many are running. */
.timer-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 45; display: flex; align-items: center; gap: 9px; flex-wrap: nowrap;
  max-width: min(94vw, 880px);
  padding: 9px 13px; border-radius: 99px;
  background: var(--glass); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), 0 8px 30px rgba(0,0,0,.38);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .timer-bar { -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
}
/* Without backdrop-filter a 10%-white wash over the page is unreadable, so
   fall back to the solid surface rather than shipping a ghost. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .timer-bar, .notepad, .chip-panel { background: var(--bg-raised); }
  .notepad-head, .notepad-list { background: var(--bg-inset); }
}
.timer-bar-label, .timer-bar > .btn { flex: none; }

/* The scrolling middle. The mask fades the pills out at the right edge so it
   is obvious there is more, without spending room on a scrollbar. */
.timer-scroll {
  display: flex; align-items: center; gap: 9px; flex-wrap: nowrap;
  min-width: 0; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; scroll-snap-type: x proximity;
  padding-bottom: 1px;
}
.timer-scroll::-webkit-scrollbar { display: none; }
.timer-scroll.is-overflowing {
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.timer-scroll .timer-pill { flex: none; scroll-snap-align: start; }

/* How many are off-screen, so a hidden timer is never a surprise. */
.timer-more {
  flex: none; font-size: 11px; font-weight: 700; color: var(--text-faint);
  white-space: nowrap;
}
.timer-bar-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint);
}
.timer-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 5px 4px 11px; border-radius: 99px;
  background: var(--bg-inset); border: 1px solid var(--line-soft); font-size: 12px;
}
.timer-pill.is-live { border-color: var(--ok); }
.timer-pill b { font-variant-numeric: tabular-nums; }
.timer-pill.is-live b { color: var(--ok); }
/* Narrower than it was, so three pills fit the bar rather than two. The name
   is the least load-bearing part of a pill — the clock and the two controls
   are what you came for — so it is the part that gives. */
.timer-pill-name {
  max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-dim);
}
@media print { .timer-bar { display: none !important; } }

/* ---------- library ---------- */

.lib { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .lib { grid-template-columns: 1fr; } }

.lib-side {
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 12px 8px; box-shadow: var(--shadow);
  position: sticky; top: 76px;
}
/* A foldable section header. .nav-group carries the type; this adds the button
   behaviour and the chevron, and re-colours it — .nav-group is written for the
   dark sidebar, and this one sits on a card. */
.nav-group-btn {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  color: var(--text-faint); opacity: 1; font: inherit;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: 12px 8px 6px; border-radius: var(--r-sm);
}
.nav-group-btn:hover { color: var(--text-dim); }
.nav-group-btn .ico { transition: transform .15s ease; flex: none; }
.nav-group-btn[aria-expanded='false'] .ico { transform: rotate(-90deg); }
.lib-group[hidden] { display: none; }
.shelf {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; margin-bottom: 1px; text-align: left;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--text-dim); cursor: pointer; font-size: 13px;
}
.shelf:hover { background: var(--line-soft); color: var(--text); }
.shelf.is-active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.shelf-count { font-size: 11px; color: var(--text-faint); }

.lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px;
}
.bk {
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 12px 13px;
}
.bk:hover { border-color: var(--accent); }
.bk-top { display: flex; gap: 9px; align-items: flex-start; }
.bk-mark {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, var(--teal), var(--indigo));
}
.bk-title {
  font-size: 13px; font-weight: 600; line-height: 1.35; text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bk-title:hover { color: var(--accent); }
.bk-domain { font-size: 11px; color: var(--text-faint); margin: 7px 0 10px 33px; }
.bk-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 9px; border-top: 1px solid var(--line-soft);
}
.bk-foot .icon-btn { width: 26px; height: 26px; }

/* ---------- pipeline board ---------- */

.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(196px, 1fr);
  gap: 13px; overflow-x: auto; padding-bottom: 6px; align-items: start;
}
.col {
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r); min-height: 130px;
}
.col.is-over { border-color: var(--accent); background: var(--accent-soft); }
.col-head {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 13px; border-bottom: 1px solid var(--line-soft);
  font-size: 12px; font-weight: 700;
}
.col-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Quiet by default — the column heading is the thing to read, not its sort
   control. It only gains a border once you go near it. */
.col-sort {
  flex: none; max-width: 82px; padding: 2px 4px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--text-faint);
  font: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer;
}
.col-sort:hover { color: var(--text-dim); border-color: var(--line-soft); background: var(--bg-raised); }
.col-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.col-body { padding: 10px; display: grid; gap: 9px; }
/* max-height is set per column in pipeline.js, measured off the real cards. */
.col-body.is-capped { overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.col-body.is-capped::-webkit-scrollbar { width: 7px; }
.col-body.is-capped::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 99px;
}
.col-empty { margin: 0; padding: 12px 3px; font-size: 12px; color: var(--text-faint); }

.lead {
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 11px 12px; cursor: grab;
}
.lead:hover { border-color: var(--accent); }
.lead.is-dragging { opacity: .45; cursor: grabbing; }
.lead-top { display: flex; gap: 7px; align-items: flex-start; font-size: 13px; line-height: 1.35; }
.lead-top b { flex: 1; }
.lead-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.lead-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
/* Metadata, not status — a source, a tool, a category. Given the indigo family
   rather than a status tone precisely so it cannot be mistaken for one: a tag
   never means anything is good, late or waiting. */
.tag {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 5px;
  background: var(--line-soft); color: var(--text-dim);
}
.tag {
  color: var(--t-brand);
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.lead-follow {
  display: flex; align-items: center; gap: 4px;
  margin-top: 8px; font-size: 11px; color: var(--text-faint);
}
.lead-follow.is-late { color: var(--danger); font-weight: 600; }
/* A table row that opens its record. */
.table tbody tr.row-open { cursor: pointer; }
.table tbody tr.row-open:hover { background: var(--bg-inset); }

/* ---------- table caps and filters (wireTables in ui.js) ---------- */

.table-wrap.is-capped { overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.table-wrap.is-capped::-webkit-scrollbar { width: 7px; }
.table-wrap.is-capped::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
/* The header has to survive the scroll, or a capped table loses its labels. */
.table-wrap.is-capped thead th {
  position: sticky; top: 0; z-index: 1; background: var(--bg-raised);
}

.table-filter {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 15px 0;
}
.table-filter input {
  flex: 1; max-width: 260px; padding: 6px 10px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--bg-inset); color: var(--text);
  font: inherit; font-size: 12px;
}
.table-filter input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.table-filter .count { font-size: 11px; color: var(--text-faint); }

.lead-doc {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 7px;
  font-size: 11px; font-weight: 600; color: var(--accent); text-decoration: none;
}
.lead-doc:hover { text-decoration: underline; }

.vet {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 10px; font-weight: 800;
}
.vet-ok   { background: rgba(52, 211, 153, .16); color: var(--ok); }
.vet-bad  { background: rgba(248, 113, 113, .16); color: var(--danger); }
.vet-none { background: var(--line-soft); color: var(--text-faint); }

.vet-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px; }
@media (max-width: 1180px) { .vet-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .vet-grid { grid-template-columns: 1fr; } }
.vet-head {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 700; margin-bottom: 9px;
}
.vet-head-red { color: var(--danger); }
.vet-head-yellow { color: var(--warn); }
.vet-head-green { color: var(--ok); }
.vet-item {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 6px 0; font-size: 13px; color: var(--text-dim); cursor: pointer;
}
.vet-item input { margin-top: 2px; flex: none; }

/* ---------- modal ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 10, 16, .55); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 22px;
}
.modal {
  width: 100%; max-width: 540px; max-height: 86vh; overflow-y: auto;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--bg-raised);
}
.modal-head h2 { font-size: 16px; flex: 1; }
.modal-body { padding: 18px 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 18px; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-item .dl {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-bottom: 3px;
}
.detail-item .dv { font-size: 13px; word-break: break-word; }
.detail-item .dv a { color: var(--accent); }
.mini-select {
  padding: 4px 8px; background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 6px; font-size: 12px; outline: none; cursor: pointer;
}
.mini-select:focus { border-color: var(--accent); }

/* ---------- tabs + document pages ---------- */

/* Tabs wear the sidebar's palette, not the page's. They are navigation, the
   same as the module list on the left, and using the same violet family for
   both means "where am I" reads the same wherever it is asked. The --side-*
   variables already carry a light and a dark value, so this follows the theme
   without a second set of colours. */
.tabs {
  display: flex; gap: 5px; margin-bottom: 18px; padding: 4px;
  background: var(--side-bg); border: 1px solid var(--side-line);
  border-radius: var(--r); width: fit-content; max-width: 100%; overflow-x: auto;
}
.tab {
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 8px 14px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--side-text); cursor: pointer; font-weight: 600; font-size: 13px;
}
.tab:hover { background: var(--side-hover); }
/* Matches .nav-item.is-active exactly — same background, same weight. */
.tab.is-active { background: var(--side-active); color: var(--side-text); font-weight: 700; }

/* Three or more tabs fill the width and share it equally, so the strip reads
   as a bar across the screen rather than stopping short somewhere arbitrary.
   Two stay compact on purpose: a pair stretched the whole width is two
   enormous buttons, not a tab bar — which is the Tasks Board/Archive pair.

   min-width: max-content is what stops a long label being squashed by an
   equal share it cannot fit; past that the strip scrolls, which it already
   did. */
.tabs:has(> .tab:nth-child(3)) { width: 100%; }
.tabs:has(> .tab:nth-child(3)) > .tab {
  flex: 1 1 0; justify-content: center; min-width: max-content;
}

.doc-h {
  font-size: 17px; margin: 4px 0 14px; padding-bottom: 9px;
  border-bottom: 1px solid #EDEFF3;
}
.doc-block { margin-bottom: 15px; }
.doc-p { margin: 3px 0 0; line-height: 1.6; }
.doc-list { margin: 5px 0 0; padding-left: 17px; line-height: 1.7; }
.doc-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin: 15px 0; padding: 12px 0; border-block: 1px solid #EDEFF3;
}
.sign-row { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 34px; }
.sign-line { border-top: 1px solid #C9CDD6; margin-bottom: 6px; }

/* ---------- client portal ---------- */

.portal { min-height: 100vh; background: var(--bg); }
.portal-top {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 26px; border-bottom: 1px solid var(--line-soft);
  background: var(--bg-inset); position: sticky; top: 0; z-index: 5;
}
.portal-top .brand-mark { height: 32px; }
@media (max-width: 620px) {
  .portal-top { flex-wrap: wrap; }
  .portal-top .user-chip { width: 100%; }
}

.preview-bar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 20px; font-size: 12px;
  background: var(--accent-soft); border-bottom: 1px solid var(--line);
  color: var(--text-dim);
}
.preview-bar b { color: var(--text); }

.feed { display: grid; gap: 3px; }
.feed-item { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.feed-item:last-child { border-bottom: 0; }
.feed-date {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-bottom: 5px;
}
.feed-body { white-space: pre-wrap; line-height: 1.6; }

.portal-scroll.is-capped {
  overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain;
}
.portal-scroll.is-capped::-webkit-scrollbar { width: 7px; }
.portal-scroll.is-capped::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.progress {
  height: 5px; border-radius: 99px; background: var(--line-soft); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--violet));
}

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

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  max-width: min(460px, calc(100vw - 40px));
  padding: 12px 17px; border-radius: var(--r);
  background: var(--bg-raised); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 13px; color: var(--text-dim);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 50;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-good { border-color: var(--ok); color: var(--text); }
.toast.is-bad  { border-color: var(--danger); color: var(--text); }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- Playbook: Notion prose ----------
   Read-only text, so it is set for reading: a measure that stops around 74
   characters and headings that step down from the page title. */

.nk-prose { max-width: 74ch; font-size: 14.5px; line-height: 1.68; color: var(--text); }
.nk-prose > :first-child { margin-top: 0; }
.nk-prose > :last-child  { margin-bottom: 0; }

.nk-prose p { margin: 0 0 13px; }
.nk-prose h2 { font-size: 19px; margin: 30px 0 10px; letter-spacing: -.01em; }
.nk-prose h3 { font-size: 16px; margin: 24px 0 8px; }
.nk-prose h4 { font-size: 14px; margin: 20px 0 6px; color: var(--text-dim);
               text-transform: uppercase; letter-spacing: .06em; }
.nk-prose ul, .nk-prose ol { margin: 0 0 13px; padding-left: 22px; }
.nk-prose li { margin-bottom: 5px; }
.nk-prose li > ul, .nk-prose li > ol { margin: 5px 0 0; }
.nk-prose a { color: var(--accent); }
.nk-prose strong { font-weight: 700; }
.nk-prose hr { border: 0; border-top: 1px solid var(--line-soft); margin: 24px 0; }

.nk-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: 5px; padding: 1px 5px;
}
.nk-prose pre {
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 13px 15px; overflow-x: auto; margin: 0 0 15px;
}
.nk-prose pre code { background: none; border: 0; padding: 0; font-size: 12.5px; }

.nk-prose blockquote {
  margin: 0 0 15px; padding: 2px 0 2px 15px;
  border-left: 3px solid var(--accent); color: var(--text-dim);
}

.nk-callout {
  display: flex; gap: 11px; margin: 0 0 15px;
  background: var(--accent-soft); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 12px 15px; font-size: 13.5px;
}
.nk-callout-icon { flex: 0 0 auto; }
.nk-callout > div > :last-child { margin-bottom: 0; }

.nk-todo { list-style: none; padding-left: 0; }
.nk-todo li { display: flex; gap: 9px; align-items: flex-start; }
.nk-todo li.is-done { color: var(--text-faint); text-decoration: line-through; }
.nk-box {
  flex: 0 0 auto; width: 15px; height: 15px; margin-top: 3px;
  border: 1.5px solid var(--line); border-radius: 4px;
  font-size: 10px; line-height: 12px; text-align: center; color: var(--ok);
}

.nk-toggle { margin: 0 0 13px; }
.nk-toggle > summary { cursor: pointer; color: var(--text); }
.nk-toggle > summary > h2, .nk-toggle > summary > h3, .nk-toggle > summary > h4 {
  display: inline; margin: 0;
}
.nk-toggle[open] > summary { margin-bottom: 9px; }

.nk-figure { margin: 0 0 15px; }
.nk-figure img { max-width: 100%; border-radius: var(--r); display: block; }
.nk-figure figcaption { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

.nk-link { word-break: break-word; }
.nk-note { font-size: 12.5px; color: var(--text-dim); }
.nk-table-wrap { overflow-x: auto; margin: 0 0 15px; }

.nk-subpage {
  display: block; width: 100%; text-align: left; margin: 0 0 7px;
  padding: 9px 13px; font-size: 13.5px; font-weight: 600;
  background: var(--bg-inset); color: var(--text);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); cursor: pointer;
}
.nk-subpage:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- scratchpad ----------
   Fixed to the viewport and outside #page, so it survives every screen change.
   Bottom-right keeps it clear of the timer bar, which is bottom-centre. */

/* Sits ABOVE the bubble rather than on top of it, so the bubble stays
   clickable while the pad is open and can toggle it shut. 18 + 48 + 12. */
.notepad {
  position: fixed; right: 18px; bottom: 78px; z-index: 46;
  width: min(440px, calc(100vw - 36px));
  height: min(420px, calc(100vh - 180px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--glass-pad); border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-edge), 0 16px 48px rgba(0,0,0,.45);
  resize: both;                       /* drag the corner to make it bigger */
  min-width: 300px; min-height: 220px;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .notepad { -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
}

.notepad-head {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--glass-line);
  background: var(--glass-head); flex: none;
}
.notepad-head strong { font-size: 13px; }
.notepad-head .icon-btn { width: 26px; height: 26px; }

.note-status { flex: 1; font-size: 11px; color: var(--text-faint); }
.note-status.is-ok  { color: var(--ok); }
.note-status.is-bad { color: var(--danger); }

.notepad-body { flex: 1; display: grid; grid-template-columns: 132px 1fr; min-height: 0; }

.notepad-list {
  overflow-y: auto; border-right: 1px solid var(--glass-line);
  padding: 6px; background: var(--glass-head);
}
.note-row {
  display: block; width: 100%; text-align: left; margin-bottom: 2px;
  padding: 6px 8px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-dim); cursor: pointer;
}
.note-row:hover { background: var(--line-soft); color: var(--text); }
.note-row.is-active { background: var(--accent-soft); color: var(--text); }
.note-row-title {
  display: block; font-size: 12px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-row-date { display: block; font-size: 10px; color: var(--text-faint); margin-top: 1px; }
.note-empty { font-size: 11px; color: var(--text-faint); padding: 8px; margin: 0; }

/* A collection shelf plus its settings button. The cog only appears on hover
   or focus, so the sidebar stays a list of shelves rather than a list of
   controls — but it is always reachable by keyboard. */
.shelf-row { position: relative; display: flex; align-items: center; }
.shelf-row .shelf { flex: 1; min-width: 0; }
.shelf-edit {
  position: absolute; right: 4px; width: 22px; height: 22px;
  opacity: 0; transition: opacity .12s ease;
}
.shelf-row:hover .shelf-edit, .shelf-edit:focus-visible { opacity: 1; }

/* ---------- confirm dialog ----------
   Above everything, including the palette, because it is always the most
   recent question on screen and nothing behind it should take a click. */

.confirm-wrap {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: 20px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
}
/* Same surface language as a card — the lift highlight, the same radius and
   border — so it reads as part of the app rather than a browser dialog. The
   accent bar along the top is the card treatment from the KPI tiles. */
.confirm {
  position: relative; overflow: hidden;
  width: 100%; max-width: 400px; text-align: center;
  padding: 28px 24px 20px; border-radius: var(--r-lg);
  background: var(--bg-raised); background-image: var(--lift);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
/* Even on all sides, same as the KPI tiles. The danger variant gains from it:
   a destructive confirm outlined in red the whole way round is harder to
   dismiss without reading than one with a red line along the top. */
.confirm { border-width: 2px; border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.confirm.is-danger { border-color: color-mix(in srgb, var(--danger) 65%, var(--line)); }
.confirm-mark {
  width: 46px; height: 46px; margin: 0 auto 14px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
}
.confirm-mark.is-danger {
  background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger);
}
.confirm h2 {
  font-size: 18px; margin-bottom: 8px; letter-spacing: -.02em; font-family: var(--sans);
}
.confirm p { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.confirm-row { display: flex; gap: 9px; margin-top: 22px; }
.confirm-row .btn { flex: 1; justify-content: center; padding: 10px 14px; font-weight: 600; }

/* Brand red, and it looks like a button rather than a link. */
.btn-danger {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.btn-danger:hover { filter: brightness(1.08); border-color: var(--danger); }
:root[data-theme='light'] .btn-danger { color: #fff; }

/* ---------- header widget chips ---------- */

.chip-widget {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; cursor: pointer;
  padding: 6px 11px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg-inset);
  font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.chip-widget:hover { border-color: var(--accent); color: var(--text); }
.chip-widget b { color: var(--text); font-weight: 700; }
.chip-widget[aria-expanded="true"] { border-color: var(--accent); color: var(--text); }
@media (max-width: 1000px) { .chip-widget { display: none; } }

/* The panel each chip drops. Anchored to the top bar, not the chip, so two
   open panels can never overlap each other. */
.chip-panel {
  position: fixed; z-index: 60; width: 268px; max-height: 60vh; overflow-y: auto;
  padding: 8px; border-radius: var(--r);
  background: var(--glass); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), 0 18px 48px rgba(0,0,0,.45);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .chip-panel { -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
}

/* The swap control in the rate panel. */
.chip-panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 9px 9px; border-bottom: 1px solid var(--glass-line); margin-bottom: 4px;
}
.chip-panel-head span {
  flex: 1; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700;
}
.chip-swap {
  flex: none; display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 4px 9px; border-radius: 99px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--line); background: var(--bg-inset); color: var(--text-dim);
}
.chip-swap:hover { border-color: var(--accent); color: var(--text); }
.chip-row {
  display: flex; align-items: baseline; gap: 9px;
  padding: 7px 9px; border-radius: var(--r-sm); font-size: 13px;
}
.chip-row + .chip-row { border-top: 1px solid var(--line-soft); }
.chip-row.is-home { background: var(--accent-soft); }

/* The sun/moon leads the row rather than crowding the number. Fixed width so
   the place names line up in a column whichever icon each row has. */
.chip-row-ico {
  flex: none; width: 16px; font-size: 12px; line-height: 1.4; text-align: center;
}
.chip-row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip-row-sub { display: block; font-size: 10.5px; color: var(--text-faint); }
.chip-row-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-row-value.is-night { opacity: .55; }
.chip-panel-note {
  font-size: 10.5px; color: var(--text-faint); padding: 8px 9px 4px;
  border-top: 1px solid var(--line-soft); margin-top: 4px; line-height: 1.5;
}

/* ---------- the today card ----------
   The first thing on the dashboard and the only one that answers "does today
   need me". Tinted rather than white so it reads as the answer to a question
   rather than another panel of figures. */

/* Even on all sides, same as the KPI tiles — the verdict colour outlines the
   whole card rather than running along one edge and fading. */
.today {
  position: relative; overflow: hidden;
  border: 2px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-raised); background-image: var(--lift);
  box-shadow: var(--shadow); margin-bottom: 18px; padding: 16px 19px;
}
.today { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }
/* Amber when something is actually waiting, so the card itself carries the
   verdict before a word of it is read. */
.today.is-live { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }

.today-label {
  font-size: 10px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-bottom: 10px;
}
.today-body { display: flex; flex-direction: column; gap: 2px; }

.today-line {
  display: flex; align-items: baseline; gap: 9px; width: 100%; text-align: left;
  padding: 7px 8px; margin-left: -8px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text); cursor: pointer;
}
.today-line:hover { background: var(--accent-soft); }
.today-dot {
  flex: none; width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn); transform: translateY(-1px);
}
.today-dot.is-late { background: var(--danger); }
.today-what { font-weight: 600; font-size: 13.5px; }
.today-why { color: var(--text-faint); font-size: 12px; min-width: 0; }

.today-clear {
  display: flex; align-items: center; gap: 8px; margin: 0;
  color: var(--text-dim); font-size: 13.5px;
}
.today-clear .ico { color: var(--ok); flex: none; }

.today-go {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-soft);
}
.today-go-label {
  font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-right: 2px;
}
.today-go .btn { padding: 4px 11px; font-size: 12px; }

@media (max-width: 640px) {
  .today-line { flex-direction: column; gap: 2px; }
}

/* ---------- roster donut ----------
   One conic-gradient and a hole. No chart library, no canvas, and it themes
   with everything else because the slice colours are CSS variables. */

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut {
  flex: none; width: 132px; height: 132px; border-radius: 50%;
  display: grid; place-items: center;
}
.donut-hole {
  width: 88px; height: 88px; border-radius: 50%; background: var(--bg-raised);
  display: grid; place-items: center; align-content: center; text-align: center;
}
.donut-hole b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.donut-hole span { font-size: 10.5px; color: var(--text-faint); }

.donut-key { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 2px; }
.donut-key-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 6px 8px; margin-left: -8px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text); font-size: 13px; cursor: pointer;
}
.donut-key-row:hover { background: var(--accent-soft); }
.donut-key-row b { font-variant-numeric: tabular-nums; }
.donut-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }

/* Key dates — the ones the app works out rather than the ones you typed. */
.day-item.is-key { border-left-color: var(--accent); }
button.day-item {
  width: 100%; text-align: left; border-width: 0 0 0 3px; border-style: solid;
  background: none; cursor: pointer; font: inherit; color: inherit;
}
button.day-item:hover { background: var(--accent-soft); }
.key-ico { flex: none; font-size: 15px; line-height: 1; }

/* ---------- command palette ---------- */

.pal-wrap {
  position: fixed; inset: 0; z-index: 70;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
}
.pal {
  width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: 0 20px 60px rgba(0,0,0,.45); overflow: hidden;
}
.pal-head {
  display: flex; align-items: center; gap: 9px; flex: none;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft); color: var(--text-faint);
}
.pal-head input {
  flex: 1; border: 0; background: none; padding: 0;
  font-size: 15px; color: var(--text);
}
.pal-head input:focus { outline: none; box-shadow: none; }

.pal-list { overflow-y: auto; padding: 6px; }
.pal-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text); cursor: pointer;
}
.pal-row:hover, .pal-row.is-on { background: var(--accent-soft); }
.pal-ico { display: flex; color: var(--text-faint); flex: none; }
.pal-label {
  display: block; font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pal-sub {
  display: block; font-size: 11px; color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pal-kind {
  flex: none; font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 700;
}
.pal-foot {
  flex: none; padding: 8px 14px; border-top: 1px solid var(--line-soft);
  font-size: 11px; color: var(--text-faint); background: var(--bg-inset);
}

/* The header box opens the palette rather than filtering anything itself. */
#globalSearch { cursor: pointer; }

/* ---------- the client record ---------- */

.rec-head {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin-bottom: 16px;
}
.rec-name { font-size: 24px; letter-spacing: -.02em; }
.rec-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-dim); }

/* The phase strip. Ten segments across the top, the way a pipeline reads in
   any CRM — a map of where this client is, not a control that changes it. */
.pstrip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  gap: 5px; margin-bottom: 18px;
}
.pstrip-seg {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
}
.pstrip-bar {
  height: 5px; border-radius: 99px; background: var(--line);
  transition: background .15s ease;
}
.pstrip-seg.is-done .pstrip-bar { background: var(--ok); }
.pstrip-seg.is-now  .pstrip-bar { background: var(--accent); }
.pstrip-label {
  font-size: 10px; color: var(--text-faint); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pstrip-seg.is-now .pstrip-label { color: var(--accent); font-weight: 700; }
.pstrip-seg:hover .pstrip-label { color: var(--text); }
@media (max-width: 900px) { .pstrip-label { display: none; } }

/* Health. A dot, because the colour is the message and the words are backup. */
.health-dot {
  flex: none; width: 11px; height: 11px; border-radius: 50%; display: inline-block;
  background: var(--text-faint);
}
.health-dot.is-ok     { background: var(--ok); }
.health-dot.is-warn   { background: var(--warn); }
.health-dot.is-danger { background: var(--danger); }
.health-dot.is-faint  { background: var(--text-faint); opacity: .5; }

.health-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--r);
  background: var(--bg-inset); border: 1px solid var(--line-soft);
}
.health-row b { display: block; font-size: 13.5px; }

/* A phase's suggested actions. Each row creates a REAL record in a real
   module — a task, an event, a copied script — rather than storing a copy. */
.pact {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 8px 10px; margin-top: 6px; border-radius: var(--r-sm);
  background: var(--bg-inset); border: 1px solid var(--line-soft); font-size: 12.5px;
}
.pact-kind {
  flex: none; width: 74px; font-size: 9.5px; letter-spacing: .07em;
  text-transform: uppercase; font-weight: 700; color: var(--text-faint);
}
.pact .btn { padding: 3px 10px; font-size: 11.5px; }

/* ---------- client journey ---------- */

.journey-bar {
  flex: 1; min-width: 140px; height: 7px; border-radius: 99px;
  background: var(--bg-inset); border: 1px solid var(--line-soft); overflow: hidden;
}
.journey-bar span {
  display: block; height: 100%; background: var(--accent);
  transition: width .2s ease;
}
/* One collapsible block per phase. Ten phases open at once is a wall; the one
   they are actually in opens itself and the rest stay a summary line. */
.phase {
  border: 1px solid var(--line-soft); border-radius: var(--r);
  margin-bottom: 8px; background: var(--bg-inset); overflow: hidden;
}
.phase.is-current { border-color: var(--accent); background: var(--accent-soft); }
.phase.is-done .phase-n { background: var(--ok); color: #fff; border-color: var(--ok); }

.phase > summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 12px; list-style: none;
}
.phase > summary::-webkit-details-marker { display: none; }
.phase > summary:hover { background: var(--line-soft); }
.phase[open] > summary { border-bottom: 1px solid var(--line-soft); }
.phase-n {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  border: 1px solid var(--line); color: var(--text-dim); background: var(--bg-raised);
}
.phase > summary b { display: block; font-size: 13px; }
.phase-timing {
  display: block; font-size: 10.5px; color: var(--text-faint);
}
.phase-count {
  flex: none; font-size: 11px; font-weight: 700; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.phase-body { padding: 4px 12px 12px; background: var(--bg-raised); }
.phase-obj {
  margin: 10px 0; font-size: 12px; color: var(--text-dim); line-height: 1.55;
}
.phase-gate {
  margin-top: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--bg-inset); font-size: 11.5px; color: var(--text-dim);
}
.phase-gate span {
  font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase;
  font-weight: 700; color: var(--text-faint); margin-right: 6px;
}

.journey-step {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 2px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}
.journey-step:last-child { border-bottom: 0; }
.journey-step.is-done { color: var(--text-dim); }
.journey-step.is-done span:not(.cell-sub) { text-decoration: line-through; opacity: .7; }

/* ---------- document templates and reports ---------- */

/* Monospace, because these are documents with tables and indentation in them —
   proportional type makes a Markdown table look broken when it is not. */
.tpl-out {
  min-height: 340px; width: 100%; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.65; white-space: pre; overflow-wrap: normal;
  overflow-x: auto; tab-size: 2;
}
.tpl-vars {
  display: grid; gap: 7px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  padding: 12px; border-radius: var(--r); background: var(--bg-inset);
  border: 1px solid var(--line-soft);
}
.tpl-vars .snip-var span { width: 96px; }

/* ---------- snippets ---------- */

.snip-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.snip {
  display: flex; flex-direction: column; gap: 9px;
  padding: 13px; border: 1px solid var(--line-soft);
  border-radius: var(--r-md); background: var(--bg-inset);
}
.snip-head { display: flex; align-items: center; gap: 7px; }
.snip-head b { flex: 1; font-size: 13px; min-width: 0; }

/* Clamped rather than scrolled: the card is a reminder of which snippet this
   is, not a place to read the whole thing. Editing shows the full body. */
.snip-body {
  margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-dim);
  white-space: pre-wrap; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4;
}
.snip-vars { display: flex; flex-direction: column; gap: 6px; }
.snip-var { display: flex; align-items: center; gap: 8px; }
.snip-var span {
  flex: none; width: 78px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snip-var input { flex: 1; min-width: 0; padding: 5px 8px; font-size: 12px; }
.snip-foot { display: flex; align-items: center; gap: 9px; margin-top: auto; }
.snip-foot .btn { padding: 5px 14px; }

/* A client's local clock. Dimmed with a moon outside 8am–8pm their time, so
   "do not ring them now" is readable without working it out. */
.tz { font-variant-numeric: tabular-nums; }
.tz.is-night { opacity: .6; }
.tz.is-night::after { content: ' \263D'; }

/* Contact cadence, on the client record. Sits above the detail grid because
   "when did I last speak to this person" is the thing you open the record to
   answer more often than their phone number. */
.touch-strip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 13px; margin-bottom: 16px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--bg-inset);
}
.touch-strip.is-due { border-color: var(--warn); }
.touch-strip .dl {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; margin-bottom: 3px;
}
.touch-strip .dv { font-size: 13px; }

/* The minimized scratchpad.
   Sits where the pad itself sits, so expanding does not move under the cursor.
   Bottom-RIGHT keeps it clear of the timer bar, which is bottom-centre. It
   carries an icon and nothing else — no note title, by design. */
.note-bubble {
  position: fixed; right: 18px; bottom: 18px; z-index: 47;   /* above the pad */
  width: 48px; height: 48px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--pad-line); border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
  box-shadow: 0 6px 22px rgba(0,0,0,.32);
  transition: transform .12s ease, filter .12s ease;
}
.note-bubble:hover { transform: translateY(-2px); filter: brightness(1.1); }
.note-bubble:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* While the pad is open the bubble is the way to shut it, so it says so: the
   icon swaps to a chevron and the whole thing goes glass, matching the pad it
   is attached to instead of staying a solid accent dot beside it. */
.note-bubble.is-open {
  background: var(--glass-head); color: var(--accent); border-color: var(--glass-line);
}
.note-bubble.is-open:hover { transform: none; filter: none; }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .note-bubble.is-open {
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  }
}

/* A save that did not land is the one thing the bubble reports, because that
   is about the pad rather than about what is written in it. */
.note-bubble.is-bad { border-color: var(--danger); color: var(--danger); }
.note-bubble.is-bad::after {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg-raised);
}

@media print { .note-bubble { display: none !important; } }

.notepad-body textarea {
  border: 0; border-radius: 0; resize: none; height: 100%;
  padding: 13px 14px; font-size: 13.5px; line-height: 1.6;
  /* Transparent, so the pad's glass shows through as one surface rather than
     a solid panel dropped into a translucent frame. */
  background: transparent; color: var(--text); font-family: var(--sans);
}
.notepad-body textarea:focus { outline: none; box-shadow: none; }
.notepad .note-row.is-active,
.notepad .note-row:hover { background: var(--glass-pad); }

@media (max-width: 560px) {
  /* Clear the bubble on a narrow screen too, where the pad is full-width. */
  .notepad { right: 10px; left: 10px; width: auto; bottom: 78px; }
  .notepad-body { grid-template-columns: 96px 1fr; }
}

/* ---------- print: the invoice only ---------- */

@media print {
  .sidebar, .topbar, .btn-row, .items-head, .item-labels, #itemRows,
  #totalsBlock, .page-head, .toast, .card-head { display: none !important; }
  body, .app, .main, .page { display: block; background: #fff; }
  .split, .split-wide { display: block; }
  .tabs, .split > .card:not(:has(.paper)) { display: none !important; }
  .card:not(:has(.paper)) { display: none !important; }
  .card, .card-body, .paper-wrap {
    border: 0 !important; box-shadow: none !important; padding: 0 !important; background: #fff !important;
  }
  .paper { box-shadow: none; padding: 16mm; border-radius: 0; }
  /* margin: 0 eliminates the area where the browser draws its default
     headers and footers (date, URL, page title). The padding on .paper
     and #print-area replaces it so the content does not bleed to the edge. */
  @page { margin: 0; }
}

/* ---------- print: a records table ---------- */

/* export.js builds #print-area, prints, and removes it. Everything here is
   scoped by body:has(#print-area) so it only applies while that node exists —
   the invoice rules above are untouched the rest of the time. */
#print-area { display: none; }

@media print {
  body:has(#print-area) > *:not(#print-area) { display: none !important; }
  body:has(#print-area) #print-area { display: block; }

  #print-area { color: #111; font-family: var(--sans); padding: 16mm; }
  #print-area h1 { font-size: 18pt; margin: 0 0 2pt; }
  #print-area .print-sub,
  #print-area .print-foot { font-size: 9pt; color: #555; margin: 0 0 12pt; }
  #print-area .print-foot { margin: 10pt 0 0; }
  #print-area table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  #print-area th, #print-area td {
    text-align: left; padding: 5pt 6pt; border-bottom: 0.5pt solid #bbb;
    vertical-align: top;
  }
  #print-area th {
    font-size: 8pt; text-transform: uppercase; letter-spacing: .06em;
    border-bottom: 1pt solid #444;
  }
  /* Repeat the header on every sheet, and never split a row across two —
     the reason this goes through print rather than a PDF library. */
  #print-area thead { display: table-header-group; }
  #print-area tr { break-inside: avoid; page-break-inside: avoid; }
}

/* ---------- view toggle tabs ---------- */

.view-tabs {
  display: inline-flex; gap: 2px;
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 2px; margin-right: 8px;
}
.view-tab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border: 0; border-radius: 6px;
  background: none; color: var(--text-dim); cursor: pointer;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.view-tab:hover { color: var(--text); background: var(--line-soft); }
.view-tab.is-active { background: var(--accent); color: #fff; }

/* ---------- status-grouped list (projects) ---------- */

.status-group { margin-bottom: 4px; }
.status-group-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px; margin-bottom: 2px;
  background: none; border: 0; cursor: pointer;
  color: var(--text); font-size: 13px; font-weight: 700; text-align: left;
}
.status-group-head:hover { background: var(--bg-inset); border-radius: var(--r-sm); }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
}
.status-chevron { transition: transform .15s; display: inline-flex; }
.status-chevron.is-collapsed { transform: rotate(-90deg); }
.status-group-body.is-hidden { display: none; }

/* ---------- inline pill dropdown ---------- */

.pill-inline {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap; border: 0;
  color: var(--pill-c, var(--text-dim));
  background: color-mix(in srgb, var(--pill-c, var(--text-dim)) 10%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pill-c, var(--text-dim)) 22%, transparent);
  transition: background .12s;
}
.pill-inline:hover {
  background: color-mix(in srgb, var(--pill-c, var(--text-dim)) 18%, transparent);
}
.pill-inline .pill-dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.pill-inline svg { opacity: .5; }

.pill-dropdown {
  position: fixed; z-index: 1000; min-width: 140px;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow);
  padding: 4px; overflow: hidden;
}
.pill-dd-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: 5px;
  background: none; color: var(--text); cursor: pointer;
  font-size: 12px; text-align: left;
}
.pill-dd-item:hover { background: var(--bg-inset); }

/* ---------- tag chips ---------- */

.tag-chip {
  display: inline-block;
  padding: 1px 7px; border-radius: 4px; font-size: 10px; font-weight: 600;
  color: var(--tag-c, var(--text-dim));
  background: color-mix(in srgb, var(--tag-c, var(--text-dim)) 12%, transparent);
  margin-right: 3px; white-space: nowrap;
}

/* Tag picker in forms */
.tag-picker {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.tag-pick {
  padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--line); color: var(--text-dim);
  background: var(--bg-inset); transition: all .12s;
}
.tag-pick.is-on {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent);
}

/* ---------- kanban board (projects) ---------- */

.board-columns {
  display: flex; gap: 12px; overflow-x: auto; padding: 8px 0 12px;
  min-height: 200px;
}
.board-column {
  flex: 1 0 200px; min-width: 200px; max-width: 300px;
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r); display: flex; flex-direction: column;
}
.board-column.is-over {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.board-col-head {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 12px; font-size: 12px; font-weight: 700;
  border-bottom: 1px solid var(--line-soft);
}
.board-col-body {
  flex: 1; padding: 8px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.board-card {
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 10px 12px;
  cursor: grab; transition: opacity .12s, box-shadow .12s;
}
.board-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.board-card.is-dragging { opacity: .45; }
.board-card-title { font-size: 13px; font-weight: 600; }
.board-card-meta {
  display: flex; gap: 8px; margin-top: 5px; font-size: 11px;
}

/* ---------- rate builder ---------- */

.rate-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px;
}
@media (max-width: 860px) {
  .rate-layout { grid-template-columns: 1fr; }
}

.rate-inputs { display: flex; flex-direction: column; gap: 16px; }

.rate-group { display: flex; flex-direction: column; gap: 4px; }

.rate-label {
  font-size: 12px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

.rate-hint {
  font-size: 11px; color: var(--text-dim); line-height: 1.4;
}

.rate-margin-val {
  font-weight: 600; color: var(--accent); font-size: 12px;
}

.rate-checks {
  display: flex; flex-direction: column; gap: 6px; margin-top: 2px;
}

.rate-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-dim); cursor: pointer;
}
.rate-check input { accent-color: var(--accent); }
.rate-check:has(input:checked) span { color: var(--text); }

.rate-slider {
  width: 100%; accent-color: var(--accent); cursor: pointer;
}

/* results panel */

.rate-results {
  display: flex; flex-direction: column; gap: 16px;
}

.rate-hero {
  text-align: center; padding: 20px;
  background: var(--bg-inset); border-radius: var(--r);
  border: 1px solid var(--line-soft);
}
.rate-hero-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-dim); margin-bottom: 4px;
}
.rate-hero-value {
  font-size: 36px; font-weight: 800; color: var(--text); line-height: 1.1;
}
.rate-hero-value .rate-unit {
  font-size: 16px; font-weight: 500; color: var(--text-dim);
}
.rate-hero-pos {
  font-size: 13px; font-weight: 600; margin-top: 6px;
}
.rate-good { color: #22C55E; }
.rate-great { color: #8B5CF6; }
.rate-warn { color: #F59E0B; }

.rate-floor-warn {
  font-size: 11px; color: #F59E0B; margin-top: 6px;
  background: rgba(245,158,11,.1); padding: 4px 8px;
  border-radius: var(--r-sm); display: inline-block;
}

.rate-projections {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.rate-proj {
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.rate-proj-label { font-size: 11px; color: var(--text-dim); }
.rate-proj-value { font-size: 18px; font-weight: 700; color: var(--text); }

.rate-section-head {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-dim); margin-bottom: 6px;
}

/* market range bar */
.rate-market {
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 12px;
}
.rate-bar-track {
  position: relative; height: 8px; border-radius: 4px;
  background: var(--line-soft); margin: 8px 0 6px; overflow: visible;
}
.rate-bar-low, .rate-bar-mid, .rate-bar-high {
  position: absolute; top: 0; left: 0; height: 100%; border-radius: 4px;
}
.rate-bar-high { background: rgba(139,92,246,.15); }
.rate-bar-mid  { background: rgba(34,197,94,.25); z-index: 1; }
.rate-bar-low  { background: rgba(245,158,11,.25); z-index: 2; }
.rate-bar-marker {
  position: absolute; top: -4px; width: 4px; height: 16px;
  background: var(--accent); border-radius: 2px; z-index: 3;
  transform: translateX(-2px); box-shadow: 0 0 6px rgba(124,92,252,.5);
}
.rate-bar-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-dim);
}

/* breakdown table */
.rate-breakdown {
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 12px;
}
.rate-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.rate-table td {
  padding: 5px 0; border-bottom: 1px solid var(--line-soft);
}
.rate-table td.num {
  text-align: right; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text);
}
.rate-table tr:last-child td { border-bottom: none; }
.rate-table tr.rate-total td {
  border-top: 2px solid var(--line); padding-top: 8px; font-size: 13px;
}
.rate-table tr.scope-row td {
  padding: 3px 0; border-bottom-color: transparent; font-size: 11px;
  color: var(--text-dim);
}
.rate-table td.indent { padding-left: 14px; }

/* scope of work */
.scope-group { gap: 8px !important; }
.scope-counter {
  font-weight: 500; font-size: 11px; color: var(--accent);
  margin-left: auto;
}
.scope-included {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 10px 12px;
}
.scope-included-item {
  font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px;
}
.scope-check-icon {
  color: #22C55E; font-weight: 700; font-size: 11px; flex-shrink: 0;
}
.scope-cat-items { display: flex; flex-direction: column; gap: 4px; }
.scope-pct {
  margin-left: auto; font-size: 10px; font-weight: 600;
  color: var(--text-dim); font-variant-numeric: tabular-nums;
  min-width: 32px; text-align: right;
}

/* ---------- client onboarding portal ---------- */

.ob-container {
  max-width: 780px; margin-inline: auto; padding: 32px 28px 60px;
}

/* Progress bar */
.ob-progress { margin-bottom: 28px; }
.ob-progress-bar {
  height: 4px; border-radius: 99px; background: var(--line-soft); overflow: hidden;
}
.ob-progress-fill {
  height: 100%; border-radius: 99px; transition: width .4s ease;
  background: linear-gradient(90deg, var(--teal), var(--violet));
}
.ob-progress-text {
  margin-top: 8px; font-size: 12px; color: var(--text-dim);
  font-weight: 600; letter-spacing: .02em;
}

/* Stepper dots */
.ob-stepper {
  display: flex; gap: 2px; margin-bottom: 32px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.ob-stepper::-webkit-scrollbar { display: none; }
.ob-step-dot {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex: 1; min-width: 60px; padding: 10px 6px; border-radius: var(--r);
  border: none; background: transparent; cursor: pointer; transition: background .18s;
}
.ob-step-dot:hover:not(:disabled) { background: var(--accent-soft); }
.ob-dot-num {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  background: var(--glass-card); border: 1px solid var(--glass-card-border);
  color: var(--text-faint);
  box-shadow: var(--neo-shadow);
  transition: background .2s, color .2s, box-shadow .2s;
}
.ob-step-dot.current .ob-dot-num {
  background: var(--accent); color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(124, 92, 252, .35);
}
.ob-step-dot.complete .ob-dot-num {
  background: var(--ok); color: #fff; font-size: 15px; border-color: transparent;
  box-shadow: 0 4px 12px rgba(52, 211, 153, .3);
}
.ob-step-dot.locked { opacity: .45; cursor: not-allowed; }
.ob-dot-label {
  font-size: 11px; color: var(--text-faint); font-weight: 500;
  white-space: nowrap; letter-spacing: .01em;
}
.ob-step-dot.current .ob-dot-label { color: var(--accent); font-weight: 600; }
.ob-step-dot.complete .ob-dot-label { color: var(--ok); }

@media (max-width: 520px) {
  .ob-dot-label { display: none; }
  .ob-step-dot { min-width: 36px; }
}

/* Step content area */
.ob-step-content { animation: obFadeIn .3s ease; }
@keyframes obFadeIn { from { opacity: 0; transform: translateY(8px); } }

.ob-step-content h2 {
  font-size: 28px; font-weight: 700; margin: 0 0 10px; color: var(--text);
}
.ob-step-content > p {
  font-size: 16px; color: var(--text-dim); margin: 0 0 26px; line-height: 1.65;
}

/* Cards — 3D gradient glassmorphism */
.ob-card {
  background:
    linear-gradient(180deg,
      rgba(50, 42, 85, .95) 0%,
      rgba(30, 26, 58, .92) 45%,
      rgba(16, 14, 34, .94) 100%);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  border: 1px solid var(--glass-card-border);
  border-top: 1px solid rgba(180, 160, 255, .28);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  border-radius: var(--clay-r); padding: 22px 24px; margin-bottom: 18px;
  box-shadow: var(--glass-card-shadow);
}
:root[data-theme='light'] .ob-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F3FC 40%, #E8E2F2 100%);
  border: 1px solid rgba(109,77,242,.10);
  border-top: 1px solid rgba(255,255,255,.98);
  border-bottom: 1px solid rgba(109,77,242,.12);
  box-shadow: 0 1px 0 rgba(255,255,255,.95) inset,
              0 -2px 0 rgba(109,77,242,.03) inset,
              0 10px 30px rgba(109,77,242,.10),
              0 4px 8px rgba(0,0,0,.06);
}
.ob-card h3 {
  font-size: 18px; font-weight: 700; margin: 0 0 12px; color: var(--text);
}
.ob-card p { font-size: 15px; color: var(--text-dim); line-height: 1.6; margin: 0; }

.ob-card-success {
  border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--bg-raised));
}
.ob-card-pending {
  border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--bg-raised));
}
.ob-card-info {
  display: flex; gap: 12px; align-items: flex-start;
  border-left: 3px solid var(--accent); padding-left: 16px;
}
.ob-info-icon { flex-shrink: 0; color: var(--accent); margin-top: 2px; }

.ob-muted { font-size: 12px !important; color: var(--text-faint) !important; }

/* Action button — claymorphism */
.ob-action {
  display: block; width: 100%; margin-top: 24px; padding: 15px 24px;
  font-size: 15px; font-weight: 600; border-radius: var(--clay-r);
  box-shadow: var(--clay-shadow);
  transition: transform .18s, box-shadow .18s;
}
.ob-action:hover:not(:disabled) { transform: translateY(-1px); }
.ob-action:disabled { opacity: .5; cursor: not-allowed; }
.ob-final {
  background: linear-gradient(135deg, var(--teal), var(--violet));
  border: none; color: #fff; font-size: 16px; padding: 18px 24px;
  box-shadow: var(--clay-shadow), 0 4px 16px rgba(124, 92, 252, .3);
}
.ob-final:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-2px); }

/* Welcome step */
.ob-greeting {
  text-align: center; padding: 28px 0 32px;
}
.ob-greeting-emoji { font-size: 48px; margin-bottom: 16px; }
.ob-greeting h2 { font-size: 28px; margin-bottom: 10px; }
.ob-greeting p { max-width: 480px; margin-inline: auto; font-size: 15px; }

/* Checklist */
.ob-checklist { display: grid; gap: 10px; }
.ob-check-item {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; color: var(--text-dim); padding: 8px 0;
}
.ob-check-icon { width: 24px; text-align: center; flex-shrink: 0; font-size: 16px; }

/* Contract */
.ob-terms-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.ob-term {
  background: var(--bg-inset); border-radius: var(--r-sm); padding: 12px;
}
.ob-term-label {
  display: block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); margin-bottom: 4px;
}
.ob-term span:last-child { font-size: 14px; font-weight: 600; color: var(--text); }
.ob-scroll-box { max-height: 320px; overflow-y: auto; }
.ob-contract-text {
  font-size: 12px; line-height: 1.7; color: var(--text-dim); white-space: pre-wrap;
}
.ob-agree {
  display: flex; gap: 10px; align-items: center; padding: 14px;
  background: var(--bg-inset); border-radius: var(--r-sm); margin-top: 12px;
  cursor: pointer; font-size: 13px; color: var(--text-dim);
}
.ob-agree input { accent-color: var(--accent); width: 18px; height: 18px; }

/* Deposit */
.ob-methods { display: grid; gap: 8px; }
.ob-method {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  cursor: pointer; transition: border-color .15s;
}
.ob-method.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.ob-method input { margin-top: 3px; accent-color: var(--accent); }
.ob-method-name { font-size: 14px; font-weight: 600; color: var(--text); }
.ob-method-details {
  font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.5;
  white-space: pre-wrap;
}

.ob-upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 32px 16px; border: 2px dashed var(--line);
  border-radius: var(--r); cursor: pointer; transition: border-color .15s, background .15s;
  color: var(--text-faint); font-size: 13px;
}
.ob-upload:hover, .ob-upload.is-drag {
  border-color: var(--accent); background: var(--accent-soft);
}
.ob-upload-icon { color: var(--text-faint); }
.ob-file-preview {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--bg-inset); border-radius: var(--r-sm); margin-top: 10px;
  font-size: 13px; color: var(--text-dim);
}

/* Intake form */
.ob-intake-form { display: grid; gap: 20px; }
.ob-intake-section h3 {
  font-size: 13px; font-weight: 700; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line-soft);
}
.ob-field { margin-bottom: 12px; }
.ob-field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 4px;
}
.ob-hint { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 4px; }
.ob-req { color: var(--accent); font-size: 8px; margin-right: 3px; vertical-align: middle; }
.ob-field input, .ob-field textarea, .ob-field select, .ob-input {
  width: 100%; padding: 9px 12px; font-size: 13px; font-family: var(--sans);
  background: var(--bg-inset); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); color: var(--text); transition: border-color .15s;
  box-sizing: border-box;
}
.ob-field input:focus, .ob-field textarea:focus, .ob-field select:focus, .ob-input:focus {
  outline: none; border-color: var(--accent);
}
.ob-field textarea { resize: vertical; min-height: 48px; }
.ob-field select { appearance: auto; cursor: pointer; }
.ob-field-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 6px;
}

.ob-autosave {
  font-size: 11px; color: var(--ok); font-weight: 600; text-align: right;
  margin-bottom: 8px; transition: color .2s;
}
.ob-autosave.is-saving { color: var(--text-faint); }

/* Access */
.ob-access-row {
  display: grid; grid-template-columns: 1fr auto auto auto auto;
  gap: 8px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
@media (max-width: 600px) {
  .ob-access-row { grid-template-columns: 1fr 1fr; }
  .ob-access-row select, .ob-access-row .ob-input { font-size: 12px; }
}
.ob-access-status { font-size: 11px; text-transform: capitalize; }
.ob-add-tool {
  display: flex; align-items: center; gap: 6px; margin: 12px 0;
  font-size: 13px; font-weight: 500; color: var(--accent);
}
.ob-skip-note {
  font-size: 12px; color: var(--text-faint); margin: 16px 0;
}
.ob-skip-note input { accent-color: var(--accent); margin-right: 6px; }

/* Welcome kit */
.ob-kit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ob-kit-card {
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 18px 20px;
}
.ob-kit-card h3 { font-size: 14px; font-weight: 700; margin: 0 0 8px; }
.ob-kit-card p { font-size: 13px; color: var(--text-dim); line-height: 1.55; margin: 0; }
.ob-kit-icon { font-size: 28px; margin-bottom: 8px; }
.ob-kit-tools { display: grid; gap: 6px; }
.ob-kit-tool {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-dim); padding: 4px 0;
}
.ob-timeline { display: grid; gap: 8px; }
.ob-timeline-item {
  display: flex; gap: 12px; font-size: 13px; color: var(--text-dim);
  padding: 6px 0; border-bottom: 1px solid var(--line-soft);
}
.ob-timeline-item:last-child { border-bottom: 0; }
.ob-timeline-day {
  font-weight: 700; color: var(--accent); min-width: 52px; flex-shrink: 0; font-size: 12px;
}

/* Calendly embed */
.ob-calendly-wrap {
  border-radius: var(--r-sm); overflow: hidden; margin-top: 8px;
}
.ob-calendly-wrap iframe { display: block; min-height: 600px; border: none; }

/* Admin onboarding tracker */
.ob-admin-steps { display: grid; gap: 2px; }
.ob-admin-step {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px;
  color: var(--text-dim); transition: background .12s;
}
.ob-admin-step.is-current {
  background: var(--accent-soft); color: var(--text);
}
.ob-admin-step.is-done { color: var(--text-faint); }
.ob-admin-dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  background: var(--line-soft); color: var(--text-faint);
}
.ob-admin-step.is-current .ob-admin-dot {
  background: var(--accent); color: #fff;
}
.ob-admin-step.is-done .ob-admin-dot {
  background: var(--ok); color: #fff; font-size: 12px;
}

/* ==========================================================================
   PORTAL — Phase 2 Active Dashboard + Phase 3 Messages/Files
   ========================================================================== */

/* Shell layout */
.portal-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar — frosted glass panel with 3D gradient, texture + decorative elements ── */
.portal-sidebar {
  width: 260px;
  flex-shrink: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 120% 40% at 80% 8%, rgba(124, 92, 252, .18), transparent 60%),
    radial-gradient(ellipse 100% 35% at 20% 92%, rgba(46, 58, 140, .14), transparent 55%),
    radial-gradient(circle at 50% 55%, rgba(124, 92, 252, .05), transparent 50%),
    linear-gradient(180deg,
      rgba(26, 20, 55, 1) 0%,
      var(--side-bg) 40%,
      rgba(8, 6, 18, 1) 100%);
  border-right: 1px solid var(--side-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 2;
  transition: width .22s ease;
}
/* Decorative rings — matching HQ sidebar */
.portal-sidebar::before {
  content: '';
  position: absolute;
  width: 180px; height: 180px;
  right: -60px; top: 60px;
  border-radius: 50%;
  border: 1px solid rgba(124, 92, 252, .10);
  box-shadow: 0 0 0 30px rgba(124, 92, 252, .03),
              0 0 0 60px rgba(124, 92, 252, .015);
  pointer-events: none;
  z-index: 0;
}
.portal-sidebar::after {
  content: '';
  position: absolute;
  width: 120px; height: 120px;
  left: -40px; bottom: 80px;
  border-radius: 50%;
  border: 1px solid rgba(124, 92, 252, .08);
  box-shadow: 0 0 0 20px rgba(124, 92, 252, .025);
  pointer-events: none;
  z-index: 0;
}
.portal-sidebar > * { position: relative; z-index: 1; }
:root[data-theme='light'] .portal-sidebar {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 120% 40% at 80% 8%, rgba(255, 255, 255, .25), transparent 60%),
    radial-gradient(ellipse 100% 35% at 20% 92%, rgba(255, 255, 255, .15), transparent 55%),
    linear-gradient(180deg,
      #8B6CF7 0%,
      var(--side-bg) 40%,
      #4A2DC7 100%);
  border-right: 1px solid var(--side-line);
}
:root[data-theme='light'] .portal-sidebar::before {
  border-color: rgba(255, 255, 255, .18);
  box-shadow: 0 0 0 25px rgba(255, 255, 255, .06),
              0 0 0 50px rgba(255, 255, 255, .025);
}
:root[data-theme='light'] .portal-sidebar::after {
  border-color: rgba(255, 255, 255, .14);
  box-shadow: 0 0 0 18px rgba(255, 255, 255, .04);
}
/* Light-mode portal sidebar — white text on vibrant violet, matching HQ */
:root[data-theme='light'] .portal-sidebar-top {
  border-bottom-color: rgba(255, 255, 255, .20);
}
:root[data-theme='light'] .portal-sidebar-top .portal-brand-text {
  color: #FFFFFF;
}
:root[data-theme='light'] .portal-nav-item {
  color: rgba(255, 255, 255, .85);
}
:root[data-theme='light'] .portal-nav-item:hover {
  background: rgba(255, 255, 255, .15);
  color: #FFFFFF;
}
:root[data-theme='light'] .portal-nav-item.is-active {
  background: rgba(255, 255, 255, .26);
  color: #FFFFFF;
  box-shadow: inset 3px 0 0 #FFFFFF;
}
:root[data-theme='light'] .portal-badge {
  background: #FFFFFF;
  color: var(--side-bg);
}
:root[data-theme='light'] .portal-sidebar-foot {
  border-top-color: rgba(255, 255, 255, .20);
}
:root[data-theme='light'] .portal-sidebar-foot,
:root[data-theme='light'] .portal-user-text,
:root[data-theme='light'] .portal-user-chip {
  color: #FFFFFF;
}
:root[data-theme='light'] .portal-sidebar-foot .icon-btn {
  color: rgba(255, 255, 255, .85);
}
:root[data-theme='light'] .portal-sidebar-foot .icon-btn:hover {
  background: rgba(255, 255, 255, .15);
  color: #FFFFFF;
}
:root[data-theme='light'] .portal-sidebar .side-toggle {
  color: rgba(255, 255, 255, .85);
  border-color: rgba(255, 255, 255, .15);
}
:root[data-theme='light'] .portal-sidebar .side-toggle:hover {
  background: rgba(255, 255, 255, .15);
  color: #FFFFFF;
}
:root[data-theme='light'] .portal-sidebar .portal-zoom-row {
  color: rgba(255, 255, 255, .85);
}
:root[data-theme='light'] .portal-sidebar .zoom-btn {
  color: rgba(255, 255, 255, .85);
  border-color: rgba(255, 255, 255, .18);
}
:root[data-theme='light'] .portal-sidebar .zoom-btn:hover {
  background: rgba(255, 255, 255, .15);
  color: #FFFFFF;
}
:root[data-theme='light'] .portal-sidebar .zoom-label {
  color: rgba(255, 255, 255, .75);
}
:root[data-theme='light'] .portal-sidebar .zoom-control {
  background: rgba(255, 255, 255, .15);
  border-color: rgba(255, 255, 255, .20);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.portal-sidebar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(124, 92, 252, .12);
}
.portal-nav {
  flex: 1;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  min-height: 0;
}
.portal-nav::-webkit-scrollbar { width: 4px; }
.portal-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
.portal-nav::-webkit-scrollbar-track { background: transparent; }
.portal-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, .72);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .18s, color .18s, box-shadow .18s;
}
.portal-nav-item:hover {
  background: rgba(255, 255, 255, .08);
  color: #FFFFFF;
}
.portal-nav-item.is-active {
  background: rgba(255, 255, 255, .14);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, .85);
}
.portal-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.portal-sidebar-foot {
  padding: 10px 14px;
  border-top: 1px solid rgba(124, 92, 252, .12);
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, .85);
}
.portal-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
/* Sidebar toggle — white text on violet */
.portal-sidebar .side-toggle {
  color: rgba(255, 255, 255, .72);
  border-color: rgba(124, 92, 252, .15);
}
.portal-sidebar .side-toggle:hover {
  background: rgba(255, 255, 255, .08);
  color: #FFFFFF;
}
/* Zoom controls */
.portal-sidebar .portal-zoom-row {
  color: rgba(255, 255, 255, .72);
}
.portal-sidebar .zoom-btn {
  color: rgba(255, 255, 255, .72);
  border-color: rgba(255, 255, 255, .15);
}
.portal-sidebar .zoom-btn:hover {
  background: rgba(255, 255, 255, .10);
  color: #FFFFFF;
}
.portal-sidebar .icon-btn {
  color: rgba(255, 255, 255, .72);
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .18);
}
.portal-sidebar .icon-btn:hover {
  background: rgba(255, 255, 255, .18);
  border-color: rgba(255, 255, 255, .30);
  color: #FFFFFF;
}

/* ── Portal sidebar — collapsed state ── */
.portal-shell.is-collapsed .portal-sidebar { width: 62px; }
.portal-shell.is-collapsed .portal-brand-text,
.portal-shell.is-collapsed .portal-nav-item span,
.portal-shell.is-collapsed .portal-badge,
.portal-shell.is-collapsed .portal-user-text,
.portal-shell.is-collapsed .portal-zoom-row,
.portal-shell.is-collapsed .side-toggle-label { display: none; }
.portal-shell.is-collapsed .portal-sidebar-top { justify-content: center; padding-inline: 0; }
.portal-shell.is-collapsed .portal-nav-item { justify-content: center; padding-inline: 0; }
.portal-shell.is-collapsed .portal-nav { padding-inline: 6px; }
.portal-shell.is-collapsed .portal-sidebar-foot {
  flex-direction: column; gap: 7px; padding: 12px 6px; align-items: center;
}
.portal-shell.is-collapsed .portal-foot-row {
  flex-direction: column; gap: 7px; align-items: center;
}

/* ── Main content — full width ── */
.portal-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  height: 100vh;
}
.portal-content {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 36px;
}

/* ── Page sections — bigger typography ── */
.p-page { padding: 36px 0 60px; }
.p-page-head { margin-bottom: 28px; }
.p-page-head h1 {
  font-family: var(--sans);
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 6px;
}
.p-page-sub {
  font-size: 16px;
  color: var(--text-faint);
  margin: 0;
}

/* ── Cards — 3D gradient glassmorphism ── */
.p-card {
  background:
    linear-gradient(180deg,
      rgba(50, 42, 85, .95) 0%,
      rgba(30, 26, 58, .92) 45%,
      rgba(16, 14, 34, .94) 100%);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  border: 1px solid var(--glass-card-border);
  border-top: 1px solid rgba(180, 160, 255, .28);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  border-radius: var(--clay-r);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--glass-card-shadow);
  transition: transform .18s, box-shadow .18s;
}
:root[data-theme='light'] .p-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F3FC 40%, #E8E2F2 100%);
  border: 1px solid rgba(109,77,242,.10);
  border-top: 1px solid rgba(255,255,255,.98);
  border-bottom: 1px solid rgba(109,77,242,.12);
  box-shadow: 0 1px 0 rgba(255,255,255,.95) inset,
              0 -2px 0 rgba(109,77,242,.03) inset,
              0 10px 30px rgba(109,77,242,.10),
              0 4px 8px rgba(0,0,0,.06);
}
.p-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 48px rgba(0, 0, 0, .50),
              0 4px 0 rgba(0, 0, 0, .20),
              0 1px 0 rgba(180, 160, 255, .12);
}
:root[data-theme='light'] .p-card:hover {
  box-shadow: 0 1px 0 rgba(255,255,255,.95) inset,
              0 16px 40px rgba(109,77,242,.14),
              0 6px 10px rgba(0,0,0,.07);
}
.p-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid var(--glass-card-border);
  color: var(--text);
}
.p-card-body { padding: 18px 22px; }
/* Auto-cap card bodies that contain scrollable row lists */
.p-card-body:has(.p-doc-row),
.p-card-body:has(.p-project-row),
.p-card-body:has(.p-update-row) {
  max-height: 275px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.p-card-body:has(.p-doc-row)::-webkit-scrollbar,
.p-card-body:has(.p-project-row)::-webkit-scrollbar,
.p-card-body:has(.p-update-row)::-webkit-scrollbar { width: 7px; }
.p-card-body:has(.p-doc-row)::-webkit-scrollbar-thumb,
.p-card-body:has(.p-project-row)::-webkit-scrollbar-thumb,
.p-card-body:has(.p-update-row)::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.p-empty {
  padding: 24px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-faint);
}

/* ── KPI row — 3D neomorphism ── */
.p-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.p-kpi {
  --kpi: var(--accent);
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg,
      rgba(50, 42, 85, .95) 0%,
      rgba(30, 26, 58, .92) 45%,
      rgba(16, 14, 34, .94) 100%);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  border: 2px solid color-mix(in srgb, var(--kpi) 60%, var(--line));
  border-radius: var(--clay-r);
  padding: 20px 22px;
  text-align: center;
  box-shadow: var(--neo-shadow),
              0 6px 28px color-mix(in srgb, var(--kpi) 20%, transparent);
  transition: transform .18s, box-shadow .18s;
}
:root[data-theme='light'] .p-kpi {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--kpi) 30%, #fff) 0%,
    color-mix(in srgb, var(--kpi) 38%, #fff) 55%,
    color-mix(in srgb, var(--kpi) 50%, #fff) 100%);
  border-color: color-mix(in srgb, var(--kpi) 60%, var(--line));
  border-top-color: color-mix(in srgb, var(--kpi) 18%, #fff);
  border-bottom-color: color-mix(in srgb, var(--kpi) 55%, #fff);
}
:root[data-theme='light'] .p-kpi .p-kpi-label {
  color: color-mix(in srgb, var(--kpi) 85%, #000);
}
:root[data-theme='light'] .p-kpi .p-kpi-value {
  color: color-mix(in srgb, var(--kpi) 75%, #000);
}
.p-kpi:hover {
  transform: translateY(-2px);
}
.p-kpi-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.p-kpi-value {
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.p-kpi.kpi-indigo { --kpi: var(--k-hours); }
.p-kpi.kpi-teal   { --kpi: var(--k-income); }
.p-kpi.kpi-blue   { --kpi: var(--k-tasks); }
.p-kpi.kpi-amber  { --kpi: var(--k-expense); }

/* Alert banner — glass */
.p-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(217, 119, 6, .08);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid rgba(217, 119, 6, .3);
  border-radius: var(--clay-r);
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text);
}
.p-alert svg { flex-shrink: 0; color: var(--amber); margin-top: 2px; }

/* Grid layouts */
.p-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* Project rows */
.p-project-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-card-border);
}
.p-project-row:last-child { border-bottom: none; }
.p-project-name { font-size: 15px; font-weight: 600; }
.p-project-meta { font-size: 14px; color: var(--text-faint); }
.p-progress-mini { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.p-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.p-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--accent));
  border-radius: 3px;
  transition: width .3s;
}
.p-progress-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* Update rows */
.p-update-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-card-border);
}
.p-update-row:last-child { border-bottom: none; }
.p-update-date { font-size: 13px; color: var(--text-faint); margin-bottom: 3px; }
.p-update-body { font-size: 15px; }

/* ── Quick actions — claymorphism ── */
.p-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.p-quick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  background:
    linear-gradient(180deg,
      rgba(50, 42, 85, .95) 0%,
      rgba(30, 26, 58, .92) 45%,
      rgba(16, 14, 34, .94) 100%);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  border: 1px solid var(--glass-card-border);
  border-top: 1px solid rgba(180, 160, 255, .28);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  border-radius: var(--clay-r);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--clay-shadow);
  transition: transform .18s, border-color .18s, box-shadow .18s, color .18s;
}
:root[data-theme='light'] .p-quick-btn {
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F3FC 40%, #E8E2F2 100%);
  border: 1px solid rgba(109,77,242,.10);
  border-top: 1px solid rgba(255,255,255,.98);
  border-bottom: 1px solid rgba(109,77,242,.12);
}
.p-quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--clay-shadow), 0 0 0 1px rgba(124, 92, 252, .25);
}

/* Task groups */
.p-task-group { margin-bottom: 24px; }
.p-task-group-head {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-card-border);
}
.p-task-list {
  max-height: 275px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.p-task-list::-webkit-scrollbar { width: 7px; }
.p-task-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.p-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--glass-card-border);
}
.p-task-row:last-child { border-bottom: none; }
.p-task-status { font-size: 16px; flex-shrink: 0; }

/* Document rows */
.p-doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-card-border);
}
.p-doc-row:last-child { border-bottom: none; }
.p-doc-icon { color: var(--text-faint); flex-shrink: 0; }
.p-doc-title { font-size: 15px; font-weight: 500; }

/* Links */
.p-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
}
.p-link:hover { text-decoration: underline; }
button.p-link { background: none; border: none; font: inherit; padding: 0; }

/* Meta text */
.p-meta { font-size: 14px; color: var(--text-faint); }

/* Settings rows */
.p-settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--glass-card-border);
}
.p-settings-row:last-child { border-bottom: none; }
.p-settings-label {
  font-weight: 600;
  min-width: 110px;
  color: var(--text-faint);
}

/* ── Messages — glass bubbles ── */
.p-messages-card { display: flex; flex-direction: column; }
.p-messages-thread {
  flex: 1;
  max-height: 520px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.p-msg { display: flex; }
.p-msg-mine { justify-content: flex-end; }
.p-msg-theirs { justify-content: flex-start; }
.p-msg-bubble {
  max-width: 70%;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.55;
}
.p-msg-mine .p-msg-bubble {
  background: linear-gradient(135deg, var(--violet), var(--indigo));
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(124, 92, 252, .25);
}
.p-msg-theirs .p-msg-bubble {
  background: var(--glass-card);
  backdrop-filter: var(--glass-card-blur);
  -webkit-backdrop-filter: var(--glass-card-blur);
  border: 1px solid var(--glass-card-border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.p-msg-time {
  font-size: 11px;
  margin-top: 5px;
  opacity: .6;
}
.p-msg-compose {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--glass-card-border);
}
.p-msg-compose textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  border-radius: var(--r);
}

/* ── Portal hero — RaffleHub-style profile banner ── */
.p-hero {
  background: var(--hero-gradient);
  border-radius: var(--clay-r);
  padding: 36px 32px 28px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(46, 58, 140, .3), 0 2px 8px rgba(124, 92, 252, .2);
}
/* Liquid-glass sheen over the gradient */
.p-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 20% 10%, rgba(255,255,255,.18), transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 90%, rgba(124, 92, 252, .15), transparent 50%);
  pointer-events: none;
}
.p-hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  z-index: 1;
}
.p-hero-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  background: rgba(255, 255, 255, .15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.p-hero-info {
  flex: 1;
  min-width: 0;
}
.p-hero-name {
  font-size: 30px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.p-hero-email {
  font-size: 14px;
  color: rgba(255, 255, 255, .80);
  margin: 0 0 10px;
}
.p-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .03em;
}
.p-hero-stat-row {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.p-hero-stat {
  flex: 1;
  min-width: 120px;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--r);
  padding: 14px 16px;
  text-align: center;
}
.p-hero-stat-value {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.p-hero-stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(255, 255, 255, .70);
  margin-top: 3px;
}

/* ---------- calendar grid ---------- */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
  text-align: center;
  padding: 6px 0 10px;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 4px 4px;
  border-radius: var(--r-sm);
  min-height: 48px;
  transition: background .15s;
}
.cal-cell:not(.cal-empty):hover { background: var(--bg-hover); }
.cal-cell.is-today {
  background: var(--accent-bg);
  border: 1px solid var(--accent);
}
.cal-cell.is-today .cal-day { color: var(--accent); font-weight: 700; }
.cal-day {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.cal-dots {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.cal-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-dot-more {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-faint);
  line-height: 6px;
}

/* ---------- calendar side-by-side ---------- */
.cal-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
}
.cal-cell { aspect-ratio: 1; min-height: 36px; }
.cal-day { font-size: 12px; }

/* ---------- project cards ---------- */
.p-project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--neo-shadow);
}

/* ---------- kanban board ---------- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 860px) {
  .kanban-board { grid-template-columns: 1fr; }
}
.kanban-col {
  background: var(--bg-inset);
  border-radius: var(--clay-r);
  border: 1px solid var(--line-soft);
  min-height: 120px;
}
.kanban-col-head {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-col-head .count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--line-soft);
  color: var(--text-faint);
}
.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-card {
  background: var(--glass-card);
  border: 1px solid var(--glass-card-border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}
.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
}
.kanban-card-meta {
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-card.is-requested {
  border-left: 3px solid var(--amber);
}

/* ---------- activity timeline ---------- */

.activity-timeline {
  position: relative;
  padding-left: 28px;
}
.activity-timeline::before {
  content: '';
  position: absolute;
  left: 11px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--line-soft);
  border-radius: 1px;
}
.activity-item {
  position: relative;
  padding-bottom: 22px;
}
.activity-item:last-child { padding-bottom: 0; }
.activity-dot {
  position: absolute;
  left: -28px; top: 2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  z-index: 1;
}
.activity-item.is-latest .activity-dot {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent);
}
.activity-content {
  padding: 2px 0;
}

/* ---------- approval cards ---------- */

.approval-card.is-urgent {
  border-left: 3px solid #EF4444;
}
.approval-card.is-overdue .p-card-body {
  background: rgba(239, 68, 68, .04);
}
:root[data-theme='light'] .approval-card.is-overdue .p-card-body {
  background: rgba(239, 68, 68, .06);
}
.p-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* ── Notifications ── */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-inset); }
.notif-item.is-actionable { background: rgba(124, 92, 252, .04); }
.notif-item.is-actionable:hover { background: rgba(124, 92, 252, .08); }
.notif-item.is-urgent { border-left: 3px solid #EF4444; }
.notif-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #FFF;
}

/* Collapsible sections — shared chevron rotation */
.notif-activity-group summary::-webkit-details-marker,
.activity-group summary::-webkit-details-marker,
.p-doc-row-details summary::-webkit-details-marker { display: none; }
.notif-activity-group[open] .notif-chevron,
.activity-group[open] .notif-chevron { transform: rotate(0deg); }
.notif-activity-group:not([open]) .notif-chevron,
.activity-group:not([open]) .notif-chevron { transform: rotate(-90deg); }
.p-doc-row-details:last-child { border-bottom: none; }

/* Mobile responsive */
@media (max-width: 720px) {
  .portal-shell { flex-direction: column; }
  .portal-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--glass-card-border);
  }
  .portal-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 10px;
    gap: 4px;
  }
  .portal-nav-item {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 13px;
  }
  .portal-nav-item span { display: none; }
  .portal-nav-item.is-active { box-shadow: none; }
  :root[data-theme='light'] .portal-nav-item.is-active { background: rgba(255,255,255,.26); }
  .portal-sidebar-top { display: none; }
  .portal-sidebar-foot { display: none; }
  .portal-sidebar .side-toggle { display: none; }
  .portal-main { height: auto; }
  .portal-content { padding: 0 20px; }
  .p-grid-2 { grid-template-columns: 1fr; }
  .p-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .p-msg-bubble { max-width: 85%; }
  .p-hero { border-radius: var(--r) !important; margin: 0 -4px; }
}

/* =========================================================================
   Onboarding Overview (Phase 4 — admin side)
   ========================================================================= */

.ob-overview { margin-bottom: 24px; }

/* KPI row */
.ob-kpi-row {
  display: flex; gap: 16px; padding: 16px 20px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.ob-kpi { text-align: center; flex: 1; min-width: 80px; }
.ob-kpi-value { font-size: 28px; font-weight: 800; color: var(--text); }
.ob-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); margin-top: 2px; }
.ob-kpi-active .ob-kpi-value { color: var(--accent); }
.ob-kpi-done   .ob-kpi-value { color: var(--ok); }

/* Stall alert */
.ob-stall-alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 20px; margin: 0;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text);
}
.ob-stall-alert svg { color: var(--warn); flex-shrink: 0; margin-top: 2px; }
.ob-stall-name {
  background: none; border: none; padding: 0; cursor: pointer;
  font-weight: 600; color: var(--accent); font-size: 13px;
}
.ob-stall-name:hover { text-decoration: underline; }

/* Dashboard stall banner (smaller) */
.ob-stall-banner {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 12px; border-radius: 6px; font-size: 12px;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  color: var(--text);
}
.ob-stall-banner svg { color: var(--warn); flex-shrink: 0; }
.ob-stall-banner b { color: var(--accent); cursor: pointer; }
.ob-stall-banner b:hover { text-decoration: underline; }

/* Step grid (funnel view) */
.ob-step-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 2px; padding: 16px 20px 8px;
}
.ob-step-col {
  text-align: center; padding: 8px 4px;
  border-radius: 6px; transition: background .15s;
}
.ob-step-col.has-clients { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.ob-step-num { font-size: 18px; }
.ob-step-label { font-size: 10px; color: var(--text-faint); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-step-count { font-size: 16px; font-weight: 700; color: var(--text); margin-top: 2px; }
.ob-step-col.has-clients .ob-step-count { color: var(--accent); }

/* Client list */
.ob-client-list { padding: 8px 20px 16px; }
.ob-client-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.ob-client-row:last-child { border-bottom: none; }
.ob-client-row:hover { background: var(--hover); border-radius: 6px; padding-left: 6px; margin-left: -6px; }

/* Mini progress bar */
.ob-mini-bar {
  width: 60px; height: 4px; border-radius: 2px;
  background: var(--border); overflow: hidden;
}
.ob-mini-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--indigo), var(--accent));
  transition: width .3s;
}

@media (max-width: 720px) {
  .ob-step-grid { grid-template-columns: repeat(4, 1fr); }
  .ob-kpi-row { gap: 10px; }
  .ob-kpi { min-width: 60px; }
}

/* ---------- text-size zoom control ----------
   A floating control in the topbar and portal that lets the user
   scale text up/down. Stored in localStorage so it persists. */
.zoom-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  background: var(--glass-card);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--glass-card-border);
  border-radius: 999px;
  padding: 3px 4px;
}
.zoom-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  transition: background .15s, color .15s;
}
.zoom-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.zoom-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* Portal collapsible sections — arrow rotation */
.ob-node[open] > summary .ob-arrow,
.offer-group[open] > summary .offer-group-arrow,
.bible-section[open] > summary .bible-section-arrow { transform: rotate(90deg); }

.ob-node > summary::-webkit-details-marker,
.offer-group > summary::-webkit-details-marker,
.offer-item > summary::-webkit-details-marker,
.bible-section > summary::-webkit-details-marker { display: none; }

.offer-item[open] > summary .offer-item-arrow { transform: rotate(180deg); }
.offer-item { scroll-margin-top: 20px; }
.bible-section { scroll-margin-top: 20px; }

/* Onboarding task table */
.ob-table { width:100%; border-collapse:collapse; font-size:13px; table-layout:fixed; }
.ob-table thead th {
  text-align:left; font-size:10px; font-weight:700; letter-spacing:.06em;
  text-transform:uppercase; color:var(--text-faint); padding:8px 10px;
  border-bottom:2px solid var(--line-soft); white-space:nowrap;
}
.ob-table tbody tr.ob-task { border-bottom:1px solid var(--line-soft); }
.ob-table td { padding:10px; vertical-align:top; color:var(--text-dim); line-height:1.5; }
.ob-col-check { width:36px; text-align:center; }
.ob-col-title { width:160px; }
.ob-col-desc  { /* flex — takes remaining space */ }
.ob-col-status { width:110px; }
.ob-col-notes  { width:80px; text-align:center; }
.ob-table .ob-task-name { font-weight:700; font-size:13px; color:var(--text); display:block; line-height:1.35; }
.ob-table .ob-status {
  font-size:11px; font-weight:700; padding:4px 8px; border-radius:6px;
  border:1px solid transparent; cursor:pointer; font-family:inherit;
  width:100%; transition:background .15s, color .15s;
}
.ob-task[style*="opacity: 0.5"] .ob-task-name { text-decoration:line-through; color:var(--text-faint); }
.ob-task[style*="opacity: 0.5"] .ob-col-desc { opacity:0.6; }

/* Notes toggle button */
.ob-note-btn {
  display:inline-flex; align-items:center; gap:4px;
  font-size:11px; font-weight:600; color:var(--text-faint);
  background:none; border:1px solid var(--line-soft); border-radius:6px;
  padding:4px 10px; cursor:pointer; font-family:inherit;
  transition:background .15s, color .15s, border-color .15s;
}
.ob-note-btn:hover { background:var(--accent-soft, rgba(124,92,252,.1)); color:var(--accent); border-color:var(--accent); }
.ob-note-btn-active { background:var(--accent-soft, rgba(124,92,252,.1)); color:var(--accent); border-color:var(--accent); }

/* Expandable notes row */
.ob-note-row { background:var(--bg-inset, var(--bg)); }
.ob-note-cell { padding:0 10px 12px !important; }
.ob-note-panel {
  background:var(--surface-raised, var(--bg-card)); border:1px solid var(--line-soft);
  border-radius:8px; padding:12px 14px; margin-top:6px;
}
.ob-note-panel .ob-note {
  width:100%; font-size:12px; line-height:1.5; padding:8px 10px;
  border:1px solid var(--line-soft); border-radius:6px; background:var(--bg);
  color:var(--text); resize:vertical; font-family:inherit; box-sizing:border-box;
}

/* Deliverables grid — 2 columns */
.ob-del-grid {
  display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px;
}
.ob-del-item {
  background:var(--surface-raised, var(--bg-card)); border:1px solid var(--line-soft);
  border-radius:8px; overflow:hidden; transition:border-color .15s;
}
.ob-del-item:hover { border-color:var(--accent); }
.ob-del-done { opacity:0.55; }
.ob-del-done .ob-del-name { text-decoration:line-through; }
.ob-del-header {
  display:flex; align-items:center; gap:10px; padding:10px 12px;
}
.ob-del-name {
  flex:1; font-size:13px; font-weight:600; color:var(--text); line-height:1.35;
}
.ob-del-check-label { display:flex; align-items:center; flex-shrink:0; cursor:pointer; }
.ob-del-expand {
  flex-shrink:0; background:none; border:none; cursor:pointer;
  color:var(--text-faint); padding:2px; transition:transform .2s;
}
.ob-del-expand-open { transform:rotate(180deg); }
.ob-del-body { padding:0 12px 12px; }
.ob-del-fields { display:flex; flex-direction:column; gap:10px; }
.ob-del-field label {
  display:block; font-size:10px; font-weight:700; letter-spacing:.04em;
  text-transform:uppercase; color:var(--text-faint); margin-bottom:4px;
}
.ob-del-field textarea {
  width:100%; font-size:12px; line-height:1.5; padding:6px 10px;
  border:1px solid var(--line-soft); border-radius:6px; background:var(--bg);
  color:var(--text); resize:vertical; font-family:inherit; box-sizing:border-box;
}

/* Responsive: stack table on narrow screens */
@media (max-width: 720px) {
  .ob-table, .ob-table thead, .ob-table tbody, .ob-table tr, .ob-table th, .ob-table td {
    display:block; width:100%;
  }
  .ob-table thead { display:none; }
  .ob-table tr.ob-task { padding:10px 0; border-bottom:1px solid var(--line-soft); }
  .ob-note-row td { display:block; }
  .ob-col-check { width:auto; text-align:left; padding:0 10px 4px; }
  .ob-col-title { width:auto; padding:0 10px 2px; }
  .ob-col-desc  { width:auto; padding:2px 10px 6px; }
  .ob-col-status { width:auto; padding:2px 10px; }
  .ob-col-notes  { width:auto; padding:2px 10px; text-align:left; }
  .ob-table .ob-status { width:auto; }
  .ob-del-grid { grid-template-columns:1fr; }
}

.offer-item[style*="opacity: 0.5"] .offer-q { text-decoration: line-through; }
