/* =========================================================================
   System Optimization Dashboard  ·  Mixcodev studio window-shelf piece
   Central stylesheet: tokens, shell, and every widget.

   Theme model: each color token is one light-dark(light, dark) pair on :root.
   Themes switch through color-scheme only: system by default, [data-theme] from the toggle.
   Colors are logo-true (blue #2563EB, charcoal #231F20, warm energy accents).
   The one addition beyond the logo palette is a muted status green, used only
   for good/on-schedule/healthy semaphores where blue would blur the signal.
   ========================================================================= */

/* ----- Fonts: self-hosted, latin subset (no CDN dependency) -----
   Instrument Sans (OFL) and JetBrains ship as one variable font each (weight range);
   Spectral is two static instances (italic 400, roman 600).
   JetBrains Mono is kept only for raw file values on the import screen. */
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../assets/fonts/instrument-sans-var.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../assets/fonts/jbmono-var.woff2') format('woff2'); }
@font-face { font-family: 'Spectral'; font-style: italic; font-weight: 400; font-display: swap; src: url('../assets/fonts/spectral-400i.woff2') format('woff2'); }
@font-face { font-family: 'Spectral'; font-style: normal; font-weight: 600; font-display: swap; src: url('../assets/fonts/spectral-600.woff2') format('woff2'); }

/* ----- Tokens: light (default) ----- */
:root {
  color-scheme: light dark;

  /* Surfaces */
  --bg: light-dark(#C8D9E6, #142230);   /* main section: blue-grey ground (the left nav stays --surface) */
  --surface: light-dark(#FFFFFF, #151A21);   /* cards, panels */
  --surface-2: light-dark(#F1F4F7, #1C222B);   /* inset / hover ground */
  --surface-sink: light-dark(#E9EDF2, #0A0D11);   /* deep inset (tracks, wells) */

  /* Ink (charcoal family, never pure black) */
  --ink: light-dark(#18202B, #E7EBF0);   /* primary text */
  --ink-2: light-dark(#475262, #AEB7C3);   /* secondary text */
  --ink-3: var(--ink-3-card);
  --ink-3-card: light-dark(#627083, #8892A0);   /* muted text on a card */
  --ink-3-page: light-dark(#4A5668, #9AA6B5);   /* muted text directly on the blue page (4.5:1 on #C8D9E6) */

  /* Lines */
  --line: light-dark(#E4E8EE, #232A33);   /* hairline borders */
  --line-strong: light-dark(#CDD4DD, #333B47);

  /* Brand */
  --primary: light-dark(#2B396D, #8C9EE0);
  --primary-strong: light-dark(#212C56, #9AA8E6);
  --primary-ink: light-dark(#FFFFFF, #0D1226);
  --primary-tint: light-dark(#E8EBF5, #1A2140);   /* active nav ground, chip selected */
  --primary-tint-2: light-dark(#D5DAEE, #222B52);

  /* Energy accents (from the cube mark) */
  --amber: light-dark(#F19D30, #F6B450);
  --orange: var(--serious);
  --gold: light-dark(#F6C646, #F8D46A);
  --red: var(--critical);

  /* Status (functional semaphore, icon+label always, never color alone) */
  --good: light-dark(#0F7F73, #3CC0A8);   --good-tint: light-dark(#E0F1EE, #0F2E2B);   --good-text: light-dark(#0B6E63, #3CC0A8);
  --warning: light-dark(#B5830F, #D9AE45);   --warning-tint: light-dark(#F6EED8, #2E2712);   --warning-text: light-dark(#8F6406, #D9AE45);
  --serious: light-dark(#FE3702, #FF6A3D);   --serious-tint: light-dark(#FFE7DE, #3A1F14);   --serious-text: light-dark(#D42E00, #FF6A3D);   /* #FE3702 is 3.6:1 on white: bars and dots only, text uses --serious-text */
  --critical: light-dark(#750608, #E07A82);   --critical-tint: light-dark(#F5E3E3, #3A181B);

  /* Avatar gradient: the light-theme blues in both themes, so white initials stay 5.2:1 or better. */
  --avatar-from: #3A4A85;   --avatar-to: #2B396D;

  /* Service categories (validated for CVD) */
  --cat-onboarding: var(--primary);
  --cat-buildouts: light-dark(#ED6027, #E8631C);
  --cat-integrations: var(--good);
  --cat-custom: light-dark(#B4820E, #A8790C);

  /* Meter zones */
  --zone-healthy: var(--good);
  --zone-watch: light-dark(#F19D30, #F6B450);
  --zone-risk: var(--serious);

  /* Elevation (offset + soft blur, warm-tinted) */
  --shadow-sm: 0 1px 2px rgba(35,31,32,0.05), 0 1px 3px rgba(35,31,32,0.04);
  --shadow-md: 0 2px 4px rgba(35,31,32,0.05), 0 6px 16px rgba(35,31,32,0.07);
  --shadow-lg: 0 8px 24px rgba(35,31,32,0.10), 0 2px 6px rgba(35,31,32,0.06);
  --shadow-foot: 0 0 transparent;   /* sidebar footer: no drop shadow in light, shadow-sm in dark */

  /* Type */
  --font-sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-num:  var(--font-sans);   /* numbers: same face, tabular digits */
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --font-serif: "Spectral", Georgia, serif;

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:    120ms;
  --dur-draw:    900ms;

  /* Geometry */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --sidebar-w: 250px;

  /* Soft cards (GEO-253): solid --surface, no edge highlight, no page glow. */
  --edge:      transparent;
  --edge-hero: transparent;
  --card-bg: var(--surface);
}

/* The in-page toggle sets data-theme; with none set, color-scheme "light dark" follows the system. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* Dark shadows differ in geometry as well as color, which light-dark() cannot express,
   so they stay in one small block (system dark, then the explicit toggle). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.30), 0 1px 3px rgba(0,0,0,0.24);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.30), 0 8px 20px rgba(0,0,0,0.36);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.46), 0 2px 8px rgba(0,0,0,0.34);
    --shadow-foot: var(--shadow-sm);
  }
}
:root[data-theme="dark"] {
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.30), 0 1px 3px rgba(0,0,0,0.24);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.30), 0 8px 20px rgba(0,0,0,0.36);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.46), 0 2px 8px rgba(0,0,0,0.34);
  --shadow-foot: var(--shadow-sm);
}

/* =========================================================================
   Base
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;   /* digits line up in every column */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Numerals in data: tabular digits so columns line up. */
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ----- Browser surfaces carry the theme too ----- */
::selection { background: var(--primary-tint-2); color: var(--ink); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
::-webkit-scrollbar-track { background: transparent; }

/* ----- Service category identity (dots) -----
   Emitted as classes, never as concatenated inline style, so a category key
   can never break out of a style attribute. */
.cat-onboarding   { background: var(--cat-onboarding); }
.cat-buildouts    { background: var(--cat-buildouts); }
.cat-integrations { background: var(--cat-integrations); }
.cat-custom       { background: var(--cat-custom); }

/* =========================================================================
   App shell
   ========================================================================= */
.app {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh;
  /* Sidebar ground and edge run the full page height; the sticky .side only holds the content. */
  background: linear-gradient(to right, var(--surface) calc(var(--sidebar-w) - 1px), var(--line) 0 var(--sidebar-w), transparent 0);
}

/* ----- Sidebar ----- */
.side {
  border-right: 1px solid transparent;   /* the visible edge is drawn on .app; this keeps the content box as before */
  display: flex; flex-direction: column;
  padding: 22px 16px 16px;
  gap: 4px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 6px; margin-bottom: 33px; } /* the extra room is where the old subtitle sat */
.side__brand .logo { height: 40px; width: auto; } /* the stacked logo needs the height for COMMAND to read */
.mobile-brand .logo { height: 32px; width: auto; }
/* Light/dark logo swap, applied wherever a .logo pair appears. Size only above;
   display is owned here at single-class specificity so the dark overrides win. */
.logo-light { display: block; }
.logo-dark  { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark  { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark  { display: block; }
}

/* Mobile brand bar (shown only when the sidebar is hidden on phones). */
.mobile-brand { display: none; align-items: center; padding: 18px 20px 10px; }
/* Mobile nav row (rendered by shell.js): hidden on desktop, a scroll strip on phones. */
.mobile-nav { display: none; }
.side__group-label {
  font-size: 12.5px; font-weight: 550; color: var(--ink-3);   /* sentence case, no tracking */
  padding: 0 12px; margin: 22px 0 6px;
}
.side__group-label:first-of-type { margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 12px; border-radius: var(--radius-xs);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.5; }
@media (hover: hover) and (pointer: fine) { .nav-item:hover { background: var(--surface-2); color: var(--ink); } }
.nav-item.is-active { background: var(--primary-tint); color: var(--primary-strong); font-weight: 600; }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.nav-item__count { margin-left: auto; font-family: var(--font-num); font-size: 11px; color: var(--ink-3); }
.nav-item.is-active .nav-item__count { color: var(--primary-strong); }
.side__spacer { flex: 1; }
.side__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px; margin-top: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); box-shadow: var(--shadow-foot), inset 0 1px 0 var(--edge);
}
.side__foot-env { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }

/* ----- Theme switch: Match device / Light / Dark ----- */
.theme-seg {
  display: inline-flex; gap: 2px; padding: 2px; flex: none;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface);
}
.theme-seg__btn {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 28px; block-size: 28px; padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.theme-seg__btn svg { inline-size: 16px; block-size: 16px; }
.theme-seg__btn[aria-pressed="true"] { background: var(--primary-tint); color: var(--primary-strong); }
@media (hover: hover) and (pointer: fine) { .theme-seg__btn:hover:not([aria-pressed="true"]) { background: var(--surface-2); color: var(--ink); } }
.side__foot { flex-wrap: wrap; row-gap: 10px; }
.mobile-brand .theme-seg { margin-inline-start: auto; }

/* ----- Main ----- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 26px 32px 20px;
}
.topbar__head { min-width: 0; }
.topbar h1 { font-size: 26px; line-height: 1.15; font-weight: 450; letter-spacing: -0.04em; }
/* #viewTitle takes programmatic focus on navigation (a11y); show the ring only for keyboard users. */
#viewTitle:focus:not(:focus-visible) { outline: none; }
#viewTitle[data-pointer="1"]:focus { outline: none; }
.topbar__sub {
  margin-top: 5px; font-family: var(--font-sans); font-weight: 400;
  font-size: 13px; color: var(--ink-3);
}
.topbar__sub b { font-weight: inherit; color: inherit; }
.topbar__right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.asof { font-family: var(--font-num); font-size: 11px; color: var(--ink-2); white-space: nowrap; }

/* Demo pill: a live dot + the word Demo, per brief. No disclaimer text. */
.demo-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px 0 10px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em;
}
.demo-pill .live {
  width: 8px; height: 8px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 0 rgba(30,158,99,0.5); animation: livepulse 2.4s ease-out infinite;
}
@keyframes livepulse {
  0%   { box-shadow: 0 0 0 0 rgba(30,158,99,0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(30,158,99,0); }
  100% { box-shadow: 0 0 0 0 rgba(30,158,99,0); }
}
@media (prefers-reduced-motion: reduce) { .demo-pill .live { animation: none; } }
/* Live state: reading real tenant data from the data layer, not the synthetic demo. */
.demo-pill.is-live { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-strong); }

/* Account menu: the avatar is a button that opens a small panel (data-source status for now). */
.usermenu { position: relative; flex: 0 0 auto; }
button.avatar { border: 0; padding: 0; cursor: pointer; font-family: inherit; }
button.avatar:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.usermenu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 200px;
  padding: 6px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.usermenu__panel[hidden] { display: none; }
.usermenu__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; }
.usermenu__label { font-size: 12px; color: var(--ink-3); }
.usermenu__by { display: block; margin-block-start: 4px; padding: 8px 8px 2px; border-block-start: 1px solid var(--line); font-size: 11px; color: var(--ink-3); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: linear-gradient(135deg, var(--avatar-from), var(--avatar-to));
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center;
}

/* =========================================================================
   Content grid: the layout is a Gridstack grid (see css/gridstack-theme.css
   and app-shell/src/features/dashboard/Grid.ts). The card styling below is shared by every widget.
   ========================================================================= */
.card {
  background: var(--card-bg);
  border: 1px solid transparent;   /* soft card: no border, no shadow; the white sits on the blue page */
  border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; min-width: 0;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__title { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; }
.card__link {
  font-size: 12.5px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 3px;
}
@media (hover: hover) and (pointer: fine) { .card__link:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 2px; } }

/* ----- Status stat tiles (schedule + SOW) ----- */
/* Equal min-height keeps the four-up KPI strip flush, so the backlog and team
   row below it starts on one line. Foot is bottom-anchored (margin-top:auto). */
.tile { position: relative; overflow: hidden; min-height: 168px; }
.tile__top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.tile__icn {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
}
.tile__icn svg { width: 16px; height: 16px; stroke-width: 1.5; }
.tile__label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tile__value { display: flex; align-items: baseline; gap: 8px; }
.tile__num { font-family: var(--font-num); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.tile__unit { font-size: 12.5px; color: var(--ink-3); }
.tile__money { font-family: var(--font-num); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.tile__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.tile__foot .strong { font-weight: 600; color: var(--ink); }

.icn-good    { background: var(--good-tint);    color: var(--good); }
.icn-warning { background: var(--warning-tint); color: var(--warning-text); }
.icn-serious { background: var(--serious-tint); color: var(--serious); }
.icn-info    { background: var(--primary-tint); color: var(--primary-strong); }

.chip-tag {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px;
  border-radius: 6px; font-size: 11px; font-weight: 600;
}
.chip-tag.good    { background: var(--good-tint);    color: var(--good-text); }

/* ----- Capacity meter ----- */
.meter__bar {
  position: relative; height: 14px; border-radius: 999px; overflow: hidden;
  background: var(--surface-sink); border: 1px solid var(--line);
}
.meter__zones { position: absolute; inset: 0; display: flex; }
.meter__zone { height: 100%; opacity: 0.16; }
.meter__zone.z-healthy { background: var(--zone-healthy); }
.meter__zone.z-watch   { background: var(--zone-watch); }
.meter__zone.z-risk    { background: var(--zone-risk); }
.meter__fill {
  position: absolute; top: 0; left: 0; bottom: 0; border-radius: 999px;
  background: var(--zone-healthy);
  transform: scaleX(0); transform-origin: left center;
  transition: transform var(--dur-draw) var(--ease-out);
}
.meter__fill.is-shown { transform: scaleX(1); }
.meter__fill.is-watch { background: var(--zone-watch); }
.meter__fill.is-risk  { background: var(--zone-risk); }
@media (prefers-reduced-motion: reduce) {
  .meter__fill { transition: none; transform: scaleX(1); }
}
.meter__marker { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; opacity: 0.55; }
.meter__scale { position: relative; display: flex; justify-content: space-between; margin-top: 7px; font-family: var(--font-num); font-size: 10px; color: var(--ink-3); }
.meter__floor { position: absolute; transform: translateX(-50%); white-space: nowrap; color: var(--ink-2); }

/* ----- Team roster ----- */
.roster { display: flex; flex-direction: column; }
.roster__row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.roster__row:last-child { border-bottom: 0; }
.roster__ava {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
}
.roster__id { min-width: 0; flex: 1; }
.roster__name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster__role { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avail { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.avail .sdot { width: 7px; height: 7px; border-radius: 50%; }
.avail.available { color: var(--good); }      .avail.available .sdot { background: var(--good); }
.avail.limited   { color: var(--warning); }    .avail.limited .sdot   { background: var(--warning); }
.avail.booked    { color: var(--ink-3); }      .avail.booked .sdot    { background: var(--ink-3); }
.roster__hrs { font-family: var(--font-num); font-size: 11px; color: var(--ink-3); width: 42px; text-align: right; }

/* ----- Backlog + filter chips ----- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--ink-3); color: var(--ink); } }
.chip .cdot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.chip__count {
  font-family: var(--font-num); font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); border-radius: 999px; padding: 1px 7px; min-width: 22px; text-align: center;
}
.chip.is-active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
/* Inverted pill: the number keeps AA (6.5:1) on the blue chip in both themes; white on a 22% veil was 3.5:1 light, 2.7:1 dark. */
.chip.is-active .chip__count { background: var(--primary-ink); color: var(--primary-strong); }
.chip.is-active .cdot { box-shadow: 0 0 0 2px rgba(255,255,255,0.4); }
.chip--all .cdot { background: var(--ink-3); }

.backlog {
  margin-top: 12px; display: flex; flex-direction: column;
  max-height: 372px; overflow-y: auto; overscroll-behavior: contain;
  /* pull the scroll gutter to the card edge so rows keep full measure */
  margin-right: -6px; padding-right: 6px;
}
.backlog__row {
  display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 13px;
  padding: 9px 8px; border-bottom: 1px solid var(--line);
  border-radius: var(--radius-xs); scroll-margin: 6px;
  transition: background var(--dur-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .backlog__row:hover { background: var(--surface-2); } }
.backlog__row:last-child { border-bottom: 0; }
.backlog__cdot { width: 9px; height: 9px; border-radius: 50%; }
.backlog__main { min-width: 0; }
.backlog__title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backlog__meta { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; margin-top: 2px; }
.backlog__cat { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.prio .pdot { width: 6px; height: 6px; border-radius: 50%; }
.prio.high   { color: var(--serious); }  .prio.high .pdot   { background: var(--serious); }
.prio.medium { color: var(--warning); }  .prio.medium .pdot { background: var(--warning); }
.prio.low    { color: var(--ink-3); }    .prio.low .pdot    { background: var(--ink-3); }
.backlog__age { font-family: var(--font-num); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; width: 46px; text-align: right; }
.backlog__empty { padding: 28px 6px; text-align: center; color: var(--ink-3); font-size: 13px; }


/* =========================================================================
   Capacity hero  ·  the full-width lead instrument
   Three panels reading left to right: the reading (committed vs floor), the
   zoned gauge (where committed sits), and the six-week trend (whether load is
   climbing toward the floor). It leads the page, so it sits one step above the
   resting cards on the elevation ladder.
   ========================================================================= */
.card--hero {
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--edge-hero);
  /* No horizontal padding: the hero content runs edge to edge so its slot grid
     matches the KPI-tile row below exactly. Each panel supplies its own inset. */
  padding: 22px 0;
  overflow: hidden;
}
/* The hero shares the tile row's structure: four equal slots with the same 18px
   gap. Reading takes one slot (over tile 1), gauge takes two (over tiles 2-3),
   trend takes one (directly over tile 4), so the trend reads as wide as a KPI
   tile and lines up beneath it. */
.hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 18px; align-items: center;
}

/* Reading panel */
.hero__lede { min-width: 0; grid-column: span 1; padding-left: 24px; }
.hero__title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.hero__sub { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); line-height: 1.45; max-width: 30ch; }
.hero__read { display: flex; align-items: baseline; gap: 10px; margin-top: 16px; }
.hero__hours { font-family: var(--font-num); font-size: 42px; font-weight: 500; letter-spacing: -0.03em; line-height: 0.9; color: var(--ink); }
.hero__u { font-size: 19px; color: var(--ink-3); margin-left: 1px; letter-spacing: 0; }
.hero__of { font-size: 12.5px; color: var(--ink-2); max-width: 12ch; line-height: 1.35; }
.hero__of b { font-weight: 600; color: var(--ink); }
.hero__state {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 15px;
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
}
.hero__state .sdot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }

/* Gauge panel: bordered as the center of the instrument */
.hero__gauge { min-width: 0; grid-column: span 2; padding: 0 24px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.hero__gauge .meter__bar { height: 16px; }
.hero__legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 15px; }
.hero__leg { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-2); }
.hero__leg b { font-weight: 600; color: var(--ink); }
.hero__leg .swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.swatch.is-open { background: var(--surface-sink); border: 1px solid var(--line-strong); }
.swatch.is-over { background: var(--zone-risk); opacity: 0.45; }

/* Trend panel: last three columns, so it reads as wide as one KPI tile */
.hero__trend { min-width: 0; grid-column: span 1; padding-right: 24px; }
.hero__trend-head { font-size: 12.5px; font-weight: 550; color: var(--ink-3); }
.spark-wrap { position: relative; width: 100%; margin: 9px 0 7px; }
.spark { width: 100%; height: 46px; display: block; overflow: visible; }
/* Strokes keep a uniform width despite the horizontal stretch. */
.spark__floor { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.spark__area { fill: color-mix(in srgb, var(--primary) 13%, transparent); stroke: none; }
.spark__line {
  /* No non-scaling-stroke here: the draw-on-load animation sets the dash length
     from getTotalLength() in SVG units, and non-scaling-stroke would render the
     dash in screen pixels, breaking the line into a gap. The slight stroke
     scaling from the stretch is not noticeable at this size. */
  fill: none; stroke: var(--primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke-dashoffset 1150ms var(--ease-out);
}
.spark__line.is-drawn { stroke-dashoffset: 0 !important; }
/* End marker: a true round dot, overlaid in HTML so the SVG stretch can't
   distort it. Positioned on the last data point (this-week's reading). */
.spark-dot {
  position: absolute; left: var(--x); top: var(--y); width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 0 2px var(--surface);
  transform: translate(-50%, -50%); pointer-events: none;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.hero__trend-cap { font-size: 11.5px; color: var(--ink-2); line-height: 1.35; }
@media (prefers-reduced-motion: reduce) { .spark__line { transition: none; stroke-dashoffset: 0 !important; } }

/* Hero adapts before the phone breakpoint: trend drops under the reading+gauge,
   then everything stacks. Driven by the hero card width, which Gridstack sets. */
@media (max-width: 1180px) {
  /* Below the wide desktop, tile alignment no longer matters, so restore the
     card's own horizontal padding and drop to a two-panel hero. */
  .card--hero { padding: 22px 26px; }
  .hero { grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); }
  .hero__lede { grid-column: 1; padding: 0 26px 0 0; }
  .hero__gauge { grid-column: 2; padding: 0 0 0 24px; border-right: 0; }
  .hero__trend { grid-column: 1 / -1; padding: 15px 0 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 16px; }
  .hero__trend-head { flex: 0 0 auto; }
  .spark-wrap { width: 150px; margin: 0; flex: 0 0 150px; }
  .hero__trend-cap { flex: 1; }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 720px) {
  /* Phones: drop the sidebar, brand from a top bar, single-column content.
     Gridstack collapses the grid to one column at this width (app-shell/src/features/dashboard/Grid.ts). */
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { display: none; }
  .mobile-brand { display: flex; }
  .mobile-nav { display: flex; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; padding: 0 20px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px 20px; }
  .topbar h1 { font-size: 21px; }
  .usermenu__panel { right: auto; left: 0; }
  .grid-stack { padding: 4px 16px 32px; }
  .card--hero { padding: 20px; }
  .hero { grid-template-columns: 1fr; gap: 18px; }
  .hero__lede, .hero__gauge, .hero__trend { grid-column: 1 / -1; padding: 0; }
  .hero__gauge { border-left: 0; border-right: 0; }
  .hero__trend { padding-top: 15px; }
  .hero__trend { display: block; border-top: 1px solid var(--line); padding-top: 15px; }
  .spark { width: 100%; margin: 9px 0 7px; }
  /* the 187h ceiling label crowds the floor label on a phone; the floor is the
     meaningful mark, so drop the ceiling label here. */
  .meter__scale > span:last-child { display: none; }
  .tile { min-height: 0; }
  .backlog { max-height: none; }
  .backlog__row { grid-template-columns: 12px 1fr auto; }
  .backlog__age { display: none; }
}


/* =========================================================================
   SPA shell: the router mounts each view into #viewRoot. The dashboard view
   injects its own .grid-stack (which carries its own padding); other views
   render into the padded content area below.
   ========================================================================= */
#viewRoot { min-width: 0; }

/* Shown in #viewRoot until the first view renders (the router replaces it). */
.view-loading { padding: 48px 32px; text-align: center; color: var(--ink-3); font-size: 13px; }


/* =========================================================================
   Backlog view  ·  table + service-line board
   Shares the dashboard's chips, category dots, and priority pills. The table
   is a plain sortable table; the board is a Sortable Kanban, one column per
   service line, with cards that swap between columns.
   ========================================================================= */
.bl-view { padding: 4px 32px 64px; max-width: 1280px; }

/* ----- Sub-view toggle ----- */
.seg {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 18px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px;
}
.seg__btn {
  height: 28px; padding: 0 16px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 600;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .seg__btn:hover { color: var(--ink); } }
.seg__btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ----- Table ----- */
.bl-panel { min-width: 0; }
.bl-wrap {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm), inset 0 1px 0 var(--edge); overflow: hidden;
}
.bl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bl-table thead th {
  padding: 10px 16px; text-align: left; white-space: nowrap;
  font-size: 12.5px; font-weight: 550;
  color: var(--ink-3); border-bottom: 1px solid var(--line);
}
.bl-sort {
  display: inline-flex; align-items: center; gap: 6px; padding: 0;
  border: 0; background: none; cursor: pointer;
  font: inherit; letter-spacing: inherit; color: inherit;
}
@media (hover: hover) and (pointer: fine) { .bl-sort:hover { color: var(--ink); } }
.bl-sort.is-active { color: var(--ink); }
.bl-sort__arrow { font-family: var(--font-num); font-size: 11px; color: var(--primary-strong); }
.bl-table tbody tr { border-bottom: 1px solid var(--line); }
.bl-table tbody tr:last-child { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) { .bl-table tbody tr:hover { background: var(--surface-2); } }
.bl-cell { padding: 12px 16px; vertical-align: middle; }
.bl-title { font-weight: 600; min-width: 230px; }
/* Auto-layout (backlog) table: long titles and client names ellipsize so they
   cannot stretch the table past the viewport. The fixed-layout tables keep
   their measured columns. */
.bl-view:not(.team-view):not(.schedule-view) .bl-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-view:not(.team-view):not(.schedule-view) .bl-client { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.bl-client, .bl-service { color: var(--ink-2); white-space: nowrap; }
.bl-service { display: flex; align-items: center; gap: 8px; }
.bl-prio { white-space: nowrap; }
.bl-age { text-align: right; color: var(--ink-2); }
/* Column alignment rule (backlog): first column left, numeric column right with
   its header aligned to the values, middle text columns center. The header th
   carries data-key, so match the header to its column. */
.bl-view:not(.team-view) thead th[data-key="client"],   .bl-view:not(.team-view) .bl-client,
.bl-view:not(.team-view) thead th[data-key="priority"], .bl-view:not(.team-view) .bl-prio,
.bl-view:not(.team-view) thead th[data-key="service"] { text-align: center; }
.bl-service { justify-content: center; }
.bl-view:not(.team-view) thead th[data-key="age"] { text-align: right; }

/* ----- Board ----- */
.bk-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
.bk-col {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm), inset 0 1px 0 var(--edge);
  display: flex; flex-direction: column; min-height: 320px;
}
.bk-col__head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 700;
}
.bk-col__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-col__count {
  font-family: var(--font-num); font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2);
  border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.bk-col__body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.bk-card {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 11px 13px; cursor: grab;
}
@media (hover: hover) and (pointer: fine) { .bk-card:hover { border-color: var(--ink-3); } }
.bk-card:active { cursor: grabbing; }
.bk-card.sortable-ghost { opacity: 0.45; }
.bk-card.sortable-drag { box-shadow: var(--shadow-md); }
.bk-card__title { font-size: 13px; font-weight: 600; line-height: 1.35; margin-bottom: 3px; }
.bk-card__client { font-size: 11.5px; color: var(--ink-3); margin-bottom: 9px; }
.bk-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bk-card__age { font-family: var(--font-num); font-size: 11px; color: var(--ink-3); }


/* ----- Responsive: board scrolls on phones, table sheds the Client column ----- */
@media (max-width: 720px) {
  .bl-view { padding: 4px 20px 48px; }
  .bk-board { display: flex; overflow-x: auto; padding-bottom: 8px; }
  .bk-col { flex: 0 0 280px; min-height: 260px; }
}
@media (max-width: 560px) {
  .bl-view:not(.schedule-view):not(.clients-view) :is(.bl-client, thead th[data-key="client"]) { display: none; }
}

/* =========================================================================
   Team view  ·  sortable table + card grid
   Reuses the seg toggle, the bl-table sort, the roster avatar, the avail
   pill, and the .num measurement style. Only the grid layout and the two
   team column cell layouts are new here.
   ========================================================================= */
.team-view .bl-table thead th,
.team-view .bl-cell { white-space: nowrap; }
.bl-team-member { display: flex; align-items: center; gap: 11px; min-width: 0; }
.bl-team-member .roster__ava { font-size: 11px; }
.bl-team-role { color: var(--ink-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.bl-team-status { color: var(--ink-2); }
.bl-team-hours { text-align: right; color: var(--ink-2); }
/* Column alignment rule: first column left, a numeric column right (its header
   too), middle text columns center. The header th carries data-key, so align
   the header to match its values. */
.team-view thead th[data-key="role"],   .bl-team-role,
.team-view thead th[data-key="status"], .bl-team-status { text-align: center; }
.team-view thead th[data-key="hours"] { text-align: right; }
/* Four even columns: auto layout gave the Member column extra width and pushed
   the rest off an even grid. Fixed layout distributes the four columns equally. */
.team-view .bl-table { table-layout: fixed; }

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.grid-card { padding: 16px; }
.grid-card__top { display: flex; align-items: center; gap: 12px; min-width: 0; margin-bottom: 14px; }
.grid-card__top .roster__ava { width: 40px; height: 40px; flex: 0 0 40px; font-size: 13px; }
.grid-card__id { min-width: 0; }
.grid-card__name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-card__role { margin-top: 2px; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-card__foot {
  margin-top: auto; padding-top: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line);
}
.grid-card__hrs { font-size: 12px; color: var(--ink-2); }

/* Narrow screens: auto-fill already drops the grid to one or two columns; the
   table keeps all four columns and scrolls horizontally instead of clipping. */
@media (max-width: 720px) {
  .team-view .bl-wrap { overflow-x: auto; }
  /* On a phone let the table size to content and scroll, rather than squeezing
     four fixed columns into the viewport. */
  .team-view .bl-table { table-layout: auto; min-width: 560px; }
}

/* =========================================================================
   SOWs view  ·  one unified table over the money pipeline
   Reuses the card surface for the two summary figures, the filter chips, and
   the bl-table sort from the backlog. New here are the two summary cards and
   the status pill. The alignment rule matches the house convention: Client
   left, Status a middle text column centered, Amount and Age numeric and
   right with their headers aligned, fixed even columns with the phone
   auto+scroll fallback.
   ========================================================================= */
.sow-view { padding: 4px 32px 64px; max-width: 1280px; }

.sow-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.sow-card { padding: 16px 18px; }
.sow-card__label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.sow-card__value { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.sow-card__foot { margin-top: auto; padding-top: 12px; font-size: 12px; color: var(--ink-3); }
.sow-card__foot .num { color: var(--ink-2); }

.sow-status { text-align: center; white-space: nowrap; }
.sow-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.sow-pill .sdot { width: 6px; height: 6px; border-radius: 50%; }
.sow-pill.is-warn { background: var(--warning-tint); color: var(--warning-text); }
.sow-pill.is-warn .sdot { background: var(--warning); }
.sow-pill.is-info { background: var(--primary-tint); color: var(--primary-strong); }
.sow-pill.is-info .sdot { background: var(--primary-strong); }

.sow-client { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sow-type { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sow-card__hours { margin-top: 0; padding-top: 4px; }
.sow-amount, .sow-hours, .sow-age { text-align: right; color: var(--ink-2); white-space: nowrap; }
.sow-age.is-serious { color: var(--serious); font-weight: 600; }

/* Column alignment rule: first column left, middle text column center, numeric
   columns right with their headers aligned to the values. */
.sow-view thead th[data-key="status"] { text-align: center; }
.sow-view thead th[data-key="amount"],
.sow-view thead th[data-key="hours"],
.sow-view thead th[data-key="age"] { text-align: right; }

/* Six columns on a fixed layout: Client and Status get the room, the numbers stay
   narrow. On a phone the table sizes to content and the wrap scrolls. */
.sow-view .bl-table { table-layout: fixed; }
.sow-table thead th[data-key="client"] { width: 24%; }
.sow-table thead th[data-key="type"] { width: 16%; }
.sow-table thead th[data-key="status"] { width: 20%; }
.sow-table thead th[data-key="amount"] { width: 14%; }
.sow-table thead th[data-key="hours"] { width: 14%; }
.sow-table thead th[data-key="age"] { width: 12%; }

@media (max-width: 720px) {
  .sow-view { padding: 4px 20px 48px; }
  .sow-view .bl-wrap { overflow-x: auto; }
  .sow-view .bl-table { table-layout: auto; min-width: 560px; }
  .sow-view .sow-table { min-width: 760px; }
}

/* =========================================================================
   Clients view  ·  one derived sortable table
   One row per unique client, built from the backlog and both SOW pipelines.
   Reuses the card surface (bl-wrap), the bl-table sort, and the backlog
   service dots. No sub-view toggle or chips, so it is a bare table. The
   alignment rule matches the house convention: Client left, Top service a
   middle text column centered, and the three numeric columns right with
   their headers aligned to the values, evenly spread by table-layout.
   ========================================================================= */
.clients-view { padding: 4px 32px 64px; max-width: 1280px; }

.clients-view .bl-service { justify-content: center; }
.clients-view .bl-items,
.clients-view .bl-pipeline,
.clients-view .bl-oldest { text-align: right; color: var(--ink-2); white-space: nowrap; }
.clients-view .bl-oldest.is-serious { color: var(--serious); font-weight: 600; }

/* Column alignment rule: first column left, middle text column center, numeric
   columns right with their headers aligned to the values. */
.clients-view thead th[data-key="service"] { text-align: center; }
.clients-view thead th[data-key="items"],
.clients-view thead th[data-key="pipeline"],
.clients-view thead th[data-key="oldest"] { text-align: right; }

/* Five even columns: fixed layout distributes Client, Top service, Open items,
   Pipeline, and Oldest equally. On a phone the table sizes to content and the
   wrap scrolls, the way Team and SOWs do. */
.clients-view .bl-table { table-layout: fixed; }

@media (max-width: 720px) {
  .clients-view { padding: 4px 20px 48px; }
  .clients-view .bl-wrap { overflow-x: auto; }
  .clients-view .bl-table { table-layout: auto; min-width: 560px; }
}

/* =========================================================================
   Schedule view  ·  sortable table of build-out windows + a read-only
   calendar (month, week, day) built on plain CSS grid, no library
   Reuses the seg toggle, the bl-table sort, the backlog client/service
   alignment rule, and the sow-pill status pill. Only the calendar and its
   chrome are new here. All colors come from the tokens; service identity
   comes from the shared cat-<key> dots.
   ========================================================================= */

/* ----- Table: five even columns, window and status centered -----
   Client and Service already center through the backlog rule; Window and
   Status are the middle text columns this view owns. */
.schedule-view .bl-table { table-layout: fixed; }
.schedule-view .sch-window { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-view thead th[data-key="window"], .schedule-view .sch-window,
.schedule-view thead th[data-key="status"], .schedule-view .sch-status { text-align: center; }

/* Status pill (mirrors the SOW pill, on track vs behind). */
.sch-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px;
  padding: 0 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.sch-pill .sdot { width: 6px; height: 6px; border-radius: 50%; }
.sch-pill.is-good    { background: var(--good-tint);    color: var(--good-text); }
.sch-pill.is-good .sdot    { background: var(--good); }
.sch-pill.is-serious { background: var(--serious-tint); color: var(--serious-text); }
.sch-pill.is-serious .sdot { background: var(--serious); }

/* ----- Calendar chrome ----- */
.cal {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm), inset 0 1px 0 var(--edge);
  padding: 18px; min-width: 0;
}
.cal__chrome {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.cal__period { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.cal__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal__nav { display: inline-flex; gap: 6px; }
.cal__btn {
  height: 28px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .cal__btn:hover { color: var(--ink); border-color: var(--ink-3); } }
.cal__btn--today { background: var(--primary-tint); border-color: transparent; color: var(--primary-strong); }
@media (hover: hover) and (pointer: fine) { .cal__btn--today:hover { color: var(--primary-strong); } }
.cal__viewseg { margin-bottom: 0; }

.cal__body { min-width: 0; }

/* ----- Month grid ----- */
.cal__gridhead, .cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal__gridhead span {
  padding: 6px 4px; text-align: center;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--line);
}
.cal__grid { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cal__day {
  min-height: 88px; min-width: 0; padding: 5px 5px 7px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cal__day:nth-child(7n) { border-right: 0; }
.cal__day:nth-last-child(-n+7) { border-bottom: 0; }
.cal__day.is-dim { background: var(--surface-2); }
.cal__day.is-dim .cal__dnum { color: var(--ink-3); }
.cal__dnum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-family: var(--font-num); font-size: 11px; color: var(--ink-2);
}
.cal__day.is-today .cal__dnum { background: var(--primary-tint); color: var(--primary-strong); font-weight: 600; }
.cal__more { font-size: 10.5px; color: var(--ink-3); padding: 1px 4px; font-family: var(--font-num); border: 0; background: none; cursor: pointer; }

/* ----- Event chips (shared by month, week, day) ----- */
.cal__chips { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.sch-chip {
  display: flex; align-items: center; gap: 5px; min-width: 0;
  padding: 3px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.sch-chip__body { min-width: 0; }
.sch-chip__title {
  font-size: 11px; font-weight: 500; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sch-chip__meta { font-size: 10.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sch-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.sch-chip__flag { width: 6px; height: 6px; border-radius: 50%; background: var(--serious); flex: 0 0 6px; }
.sch-chip.is-behind { border-color: var(--serious); }

/* Tasks and epics due (L3b): links to their project, with a colored edge like the
   project page outline (epics blue, tasks teal). Overdue shows the same red dot as behind. */
a.sch-work { color: inherit; text-decoration: none; border-inline-start-width: 3px; }
a.sch-work.is-task { border-inline-start-color: var(--cat-integrations); }
a.sch-work.is-epic { border-inline-start-color: var(--primary); background: color-mix(in oklab, var(--primary) 8%, var(--surface-2)); }
a.sch-work.is-epic .sch-chip__title { font-weight: 600; }
a.sch-work.is-late { border-color: var(--serious); border-inline-start-color: var(--serious); }
@media (hover: hover) and (pointer: fine) { a.sch-work:hover { border-color: var(--ink-3); } }
a.sch-work:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.sch-kind { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.sch-key { width: 12px; height: 10px; border-radius: 3px; border: 1px solid var(--line); border-inline-start-width: 3px; background: var(--surface-2); }
.sch-key.is-task { border-inline-start-color: var(--cat-integrations); }
.sch-key.is-epic { border-inline-start-color: var(--primary); }
.cal__leg-check { cursor: pointer; margin-inline-start: auto; }

/* ----- Week view ----- */
.cal__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.cal__wday { min-width: 0; min-height: 130px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cal__whead { padding: 8px 6px; text-align: center; background: var(--surface); border-bottom: 1px solid var(--line); }
.cal__wdow { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.cal__wdate { font-size: 13px; font-weight: 600; margin-top: 1px; }
.cal__wday.is-today { border-color: var(--primary); }
.cal__wday.is-today .cal__wdate { color: var(--primary-strong); }
.cal__wday .cal__chips { padding: 6px; }

/* ----- Day view ----- */
.cal__dayview { max-width: 560px; }
.cal__dhead { padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; }
.cal__ddow { font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.cal__ddate { font-size: 16px; font-weight: 700; margin-top: 2px; }
.cal__dayview.is-today .cal__dhead { border-color: var(--primary); }
.cal__dayview.is-today .cal__ddate { color: var(--primary-strong); }
.cal__dayview .cal__chips { margin-top: 0; gap: 6px; }
.cal__dayview .sch-chip { padding: 7px 9px; border-radius: var(--radius-xs); }
.cal__dayview .sch-chip__title { font-size: 12.5px; }
.cal__dayview .sch-dot, .cal__dayview .sch-chip__flag { width: 8px; height: 8px; }

.cal__none { font-size: 11.5px; color: var(--ink-3); padding: 10px; text-align: center; }

/* ----- Legend ----- */
.cal__legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.cal__leg-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }


/* ----- Responsive: table scrolls, month grid tightens, week scrolls ----- */
@media (max-width: 720px) {
  .schedule-view .bl-wrap { overflow-x: auto; }
  .schedule-view .bl-table { table-layout: auto; min-width: 560px; }
  .cal { padding: 14px; }
  .cal__day { min-height: 72px; padding: 4px; }
  .cal__dnum { width: 20px; height: 20px; font-size: 10px; }
  .sch-chip { padding: 2px 4px; gap: 4px; }
  .sch-chip__title { font-size: 9.5px; }
  .cal__week { min-width: 560px; }
  .cal__body { overflow-x: auto; }
  .cal__wday { min-height: 0; }
  .cal__whead { padding: 6px 4px; }
}

/* =========================================================================
   Adoption watch  ·  complete accounts colored by adoption, never by status
   The Complete badge is neutral; only the dot beside it carries color. Reuses
   the SOW summary cards, the filter chips, and the bl-table. First column left,
   the rest centered.
   ========================================================================= */
.tile__pair { display: block; margin-bottom: 2px; color: var(--ink-2); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .tile__pair:hover { color: var(--ink); } }
.tile__pair .strong { font-weight: 600; color: var(--ink); }

.adopt-unit { font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.adopt-note { min-height: 18px; margin: 8px 0; font-size: 12.5px; color: var(--ink-2); }
/* The watch list fills the page width instead of the 1280px cap other list views use. */
.adopt-view { max-width: none; }
.adopt-view .bl-table { table-layout: auto; width: 100%; }
.adopt-view .bl-wrap { overflow-x: auto; }
.adopt-view .bl-table thead th { text-align: center; }
.adopt-view .bl-table thead th:first-child { text-align: left; }
.adopt-name { font-weight: 600; white-space: nowrap; }
.adopt-c { text-align: center; white-space: nowrap; color: var(--ink-2); }

.adopt-badge {
  display: inline-flex; align-items: center; gap: 7px; height: 22px; padding: 0 10px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 11.5px; font-weight: 600;
}
.adopt-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.adopt-level { font-size: 12px; font-weight: 600; }
.adopt-level.is-none, .adopt-muted { color: var(--ink-3); }
.adopt-badge, .adopt-flag { white-space: nowrap; }
.adopt-overdue { color: var(--serious); font-weight: 600; }
.adopt-flag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px;
  background: var(--critical-tint); color: var(--critical); font-size: 11.5px; font-weight: 600;
}
.adopt-log select {
  font: inherit; font-size: 12px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs); padding: 4px 8px;
}

.chip .cdot.adopt-q-thriving        { background: var(--good); }
.chip .cdot.adopt-q-quietly_leaving { background: var(--critical); }
.chip .cdot.adopt-q-awaiting_checkin { background: var(--ink-3); }
.chip .cdot.adopt-q-power_users     { background: var(--primary); }
.chip .cdot.adopt-q-stalled         { background: var(--warning); }
.chip .cdot.adopt-q-flagged         { background: var(--serious); }

/* Three cards stay on one row down to tablet width. */
.adopt-view .sow-summary { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Below desktop width the three day columns fold into one cell of colored pips,
   and long cells wrap, so the table fits without sideways scrolling. */
.adopt-trail { display: none; }
.adopt-pip {
  display: inline-block; width: 10px; height: 10px; margin: 0 3px; border-radius: 50%;
  border: 1px solid var(--line-strong); vertical-align: middle;
}
@media (max-width: 1280px) {
  .adopt-view .adopt-day { display: none; }
  .adopt-view .adopt-trail { display: table-cell; }
  .adopt-view .adopt-c,
  .adopt-view .adopt-name,
  .adopt-view .bl-table thead th { white-space: normal; }
  .adopt-view .bl-cell,
  .adopt-view .bl-table thead th { padding-left: 10px; padding-right: 10px; }
  .adopt-view .adopt-flag { white-space: normal; height: auto; padding: 3px 10px; text-align: center; }
}
@media (max-width: 720px) {
  .adopt-view .bl-table { min-width: 640px; }
}

/* =========================================================================
   Onboarding profitability  ·  setup fee / (hours x loaded cost per hour)
   Reuses the SOW summary cards, the filter chips, the bl-table and the neutral
   status badge from the adoption watch. New here: the what-if settings card, the
   ratio meter (break-even and target ticks), and the per-account detail row.
   Account left, status centered, money and hours right.
   ========================================================================= */
.pf-view { max-width: none; }
.pf-policy {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: 14px 18px; margin-bottom: 16px;
}
.pf-policy__fields { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.pf-policy__help { flex: 1 1 260px; margin: 0; font-size: 12.5px; color: var(--ink-3); }
.pf-policy__actions { display: flex; gap: 8px; }

.pf-field { display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pf-input {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-xs);
}
.pf-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.pf-input em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.pf-input input {
  width: 72px; border: 0; outline: 0; background: transparent; padding: 0;
  font-family: var(--font-num); font-size: 13px; color: var(--ink);
}
.pf-btn {
  height: 32px; padding: 0 14px; border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--ink);
}
@media (hover: hover) and (pointer: fine) { .pf-btn:hover { border-color: var(--ink-3); } }
.pf-btn.is-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
@media (hover: hover) and (pointer: fine) { .pf-btn.is-primary:hover { background: var(--primary-strong); } }
.pf-btn.is-armed:not(.is-danger) { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.pf-btn:disabled { opacity: 0.6; cursor: wait; }

/* Projects by ratio: donut plus legend, Count / % toggle. */
.pf-bands__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pf-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); overflow: hidden; }
.pf-seg button {
  height: 24px; padding: 0 9px; border: 0; background: var(--surface);
  font-size: 11.5px; font-weight: 600; color: var(--ink-3); cursor: pointer;
}
.pf-seg button + button { border-left: 1px solid var(--line-strong); }
.pf-seg button.is-on { background: var(--surface-2); color: var(--ink); }
.pf-bands__body { display: flex; align-items: center; gap: 16px; margin: 2px 0 10px; }
.pf-pie { position: relative; flex: 0 0 112px; height: 112px; }
.pf-pie svg { display: block; overflow: visible; }
.pf-pie__seg { fill: none; stroke-width: 14; cursor: pointer; transition: stroke-width var(--dur-fast) var(--ease-out); }
.pf-pie__seg:focus-visible, .pf-pie__seg.is-on { stroke-width: 18; outline: 0; }
@media (hover: hover) and (pointer: fine) { .pf-pie__seg:hover { stroke-width: 18; outline: 0; } }
.pf-pie__center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center;
}
.pf-pie__big { font-size: 22px; font-weight: 500; color: var(--ink); line-height: 1.1; }
.pf-pie__cap { font-size: 10.5px; color: var(--ink-3); }
.pf-pie__legend { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-width: 0; }
.pf-pie__key {
  display: flex; align-items: center; gap: 7px; width: 100%; padding: 3px 6px; margin: 0 -6px;
  border: 0; border-radius: 6px; background: none; font-size: 12.5px; color: var(--ink-2); cursor: pointer; text-align: left;
}
@media (hover: hover) and (pointer: fine) { .pf-pie__key:hover { background: var(--surface-2); } }
.pf-pie__key.is-on { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.pf-pie__val { margin-left: auto; padding-left: 8px; color: var(--ink); font-size: 12.5px; }
.pf-bands { container-type: inline-size; }
@container (max-width: 300px) {
  .pf-bands__body { flex-direction: column; align-items: stretch; }
  .pf-pie { align-self: center; }
  .pf-pie__legend { margin: 0 6px; }
}

/* Source of the projects, with the Sync button. */
.pf-source {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 24px; padding: 12px 18px; margin-bottom: 12px;
}
.pf-source__text { flex: 1 1 320px; min-width: 0; }
.pf-source__label { font-size: 12.5px; font-weight: 550; color: var(--ink-3); }
.pf-source__name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 15px; font-weight: 600; color: var(--ink); }
.pf-source__meta { font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.pf-source__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.pf-source__dot.is-error { background: var(--critical); }
.pf-source__help, .pf-source__error { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.pf-source__error { color: var(--critical); }
.pf-source__actions, .pf-source__connect { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pf-source__connect .pf-select { height: 32px; }
.pf-link {
  border: 0; background: none; padding: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .pf-link:hover { color: var(--ink); } }
.pf-synced {
  display: inline-block; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-size: 10.5px; font-weight: 600; line-height: 16px; color: var(--ink-3);
}
.pf-input:has(input:disabled) { background: var(--surface-2); }
.pf-input input:disabled, .pf-select:disabled { color: var(--ink-3); cursor: not-allowed; }

/* Danger zone: closed by default, at the foot of the page. */
.pf-danger { margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pf-danger > summary {
  padding: 10px 16px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer;
}
.pf-danger[open] { border-color: var(--critical); }
.pf-danger[open] > summary { color: var(--critical); }
.pf-danger__body {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 4px 16px 14px;
}
.pf-danger__text { flex: 1 1 320px; }
.pf-danger__title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.pf-danger__text p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.pf-btn.is-danger { color: var(--critical); border-color: var(--critical); }
@media (hover: hover) and (pointer: fine) { .pf-btn.is-danger:hover { background: var(--critical-tint); } }
.pf-btn.is-danger.is-armed { background: color-mix(in oklab, var(--critical) 70%, black); border-color: transparent; color: #fff; } /* white text needs 4.5:1 in both themes */
.pf-btn.is-danger:disabled { opacity: 0.45; cursor: not-allowed; }

.pf-view .sow-summary { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.pf-view .pf-table { table-layout: auto; }
.pf-view .bl-wrap { overflow-x: auto; position: relative; }
.pf-status-inline { display: none; }
.pf-table thead th.pf-r { text-align: right; }
.pf-table thead th.pf-c { text-align: center; }
.pf-r { text-align: right; white-space: nowrap; color: var(--ink-2); }
.pf-c { text-align: center; white-space: nowrap; }
.pf-name { font-weight: 600; white-space: nowrap; }
.pf-sub { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.pf-muted { color: var(--ink-3); }
.pf-over { color: var(--serious); font-weight: 600; }
.pf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.pf-ratio { min-width: 180px; }
.pf-ratio__top { display: flex; align-items: center; gap: 10px; }
.pf-ratio__val { font-weight: 600; font-size: 14px; min-width: 48px; }
.pf-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.pf-pill .sdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pf-pill.is-good { background: var(--good-tint); color: var(--good-text); }
.pf-pill.is-warning { background: var(--warning-tint); color: var(--warning-text); }
.pf-pill.is-critical { background: var(--critical-tint); color: var(--critical); }
.pf-pill.is-neutral { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }

/* Bar runs 0 to 1.6x the target. Thin tick = break-even (1x), dark tick = target. */
.pf-meter {
  position: relative; display: block; height: 6px; margin-top: 7px; max-width: 200px;
  background: var(--surface-sink); border-radius: 999px;
}
.pf-meter__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.pf-meter__even, .pf-meter__tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; }
.pf-meter__even { background: var(--line-strong); }
.pf-meter__tick { background: var(--ink); }

.pf-toggle {
  height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 12px; font-weight: 600; color: var(--ink-2);
}
@media (hover: hover) and (pointer: fine) { .pf-toggle:hover { border-color: var(--ink-3); color: var(--ink); } }
.pf-row.is-open { background: var(--surface-2); }
.pf-row.is-open .pf-toggle { background: var(--primary-tint); border-color: var(--primary-tint-2); color: var(--primary-strong); }
@media (hover: hover) and (pointer: fine) { .bl-table tbody tr.pf-detail:hover { background: transparent; } }
.pf-detail > td { padding: 0; background: var(--surface-2); }
.pf-detail__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 28px;
  padding: 16px 18px 18px;
  /* The detail cell spans every column of an auto-layout table, so its content width would be shared out among them and move
     the headings whenever a section opens or closes. A zero preferred width, stretched back to the cell's width, keeps it out. */
  inline-size: 0; min-inline-size: 100%; box-sizing: border-box;
}
.pf-detail__block { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; }
.pf-detail__label { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.pf-detail__help { margin: 0; font-size: 12.5px; color: var(--ink-2); white-space: normal; }
.pf-detail .pf-field { justify-content: space-between; width: 100%; max-width: 260px; }
.pf-dl { display: grid; grid-template-columns: auto auto; gap: 4px 24px; margin: 0; font-size: 13px; }
.pf-dl dt { color: var(--ink-2); }
.pf-dl dd { margin: 0; text-align: right; color: var(--ink); }
.pf-log { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-log .pf-input input { width: 56px; }
.pf-log select {
  height: 32px; font: inherit; font-size: 12.5px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs); padding: 0 8px;
}

/* Service line tabs, the add-project form, and the per-line fee list. */
.pf-services { margin-bottom: 12px; }
.pf-sdot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 0; }
.pf-suggest { grid-template-columns: 1fr auto; gap: 6px 16px; margin-top: 2px; }
.pf-suggest dt { display: flex; align-items: center; color: var(--ink-2); }
.pf-suggest dd { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; }
.pf-suggest__fee { font-size: 15px; font-weight: 600; color: var(--ink); }
.pf-suggest__avg { font-size: 11.5px; color: var(--ink-3); min-width: 72px; text-align: right; }
.pf-add { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; margin-bottom: 16px; }
.pf-add[hidden] { display: none; }
.pf-add__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 16px; }
.pf-add__actions { display: flex; gap: 8px; }
.pf-field--stack { flex-direction: column; align-items: stretch; gap: 6px; }
.pf-field--stack .pf-input { width: 100%; box-sizing: border-box; }
.pf-field--stack .pf-input input { width: 100%; }
.pf-text, .pf-select {
  height: 32px; box-sizing: border-box; padding: 0 10px; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-xs);
}
.pf-text:focus, .pf-select:focus { outline: 2px solid transparent; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }

/* Narrower screens drop the derived money columns (the open detail row has them), then let the table scroll on a phone. */
@media (max-width: 1500px) {
  .pf-view .pf-wide, .pf-view .pf-status { display: none; }
  .pf-view .pf-status-inline { display: inline; }
  .pf-view .bl-cell, .pf-view .bl-table thead th { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 720px) {
  .pf-view { padding: 4px 16px 48px; }
  .pf-view .pf-table { min-width: 560px; }
  /* The table scrolls sideways on a phone; the first column stays pinned (header cell and names),
     capped so the figures beside it stay visible. The card turns solid so the pinned cells match it. */
  .pf-view .bl-wrap { background: var(--surface); }
  .pf-table > thead > tr > th:first-child, .pf-table > tbody > tr > td.pf-name {
    position: sticky; inset-inline-start: 0; background: var(--surface);
    inline-size: 38vw; min-inline-size: 120px; max-inline-size: 40vw; white-space: normal; overflow-wrap: break-word;
  }
  .pf-table > tbody > tr > td.pf-name { z-index: 1; }
  .pf-table > tbody > tr > td.pf-name .pf-sub { white-space: normal; }
  .pf-table > thead > tr > th:first-child { z-index: 2; }
  .pf-policy, .pf-source { padding: 12px 14px; }
  .pf-ratio { min-width: 150px; }
  /* The table scrolls sideways on a phone; the open detail stays in view. */
  .pf-detail__grid { position: sticky; left: 0; inline-size: calc(100vw - 34px); min-inline-size: 0; padding: 14px; }
}

/* Health score (#/health): the profitability page's parts plus a settings card with two
   groups, a band bar for the portfolio support average, and the month-by-month table. */
.hl-policy { flex-direction: column; align-items: stretch; }
.hl-policy__groups { display: flex; flex-wrap: wrap; gap: 16px 40px; }
.hl-policy__group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hl-policy .pf-policy__help { flex: 1 1 100%; }
.hl-policy .pf-policy__actions { align-self: flex-start; }
.hl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 16px; }
.hl-grid .pf-input em { white-space: nowrap; }
.hl-meta { display: inline-flex; align-items: center; gap: 6px; }
.wf-main .hl-name { background: var(--surface); border: 1px solid var(--line-strong); }
.hl-wrows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hl-wrows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; border-top: 1px solid var(--line); color: var(--ink-2); }
.hl-wrows li:first-child { border-top: 0; }
.hl-plans { display: flex; flex-direction: column; gap: 12px; margin-block-start: 24px; }
.hl-plans .pf-policy__help { flex: none; }
.hl-band { position: relative; display: block; height: 8px; margin: 8px 0 4px; background: var(--surface-sink); border-radius: 999px; }
.hl-band__target { position: absolute; top: 0; bottom: 0; background: var(--good-tint); border: 1px solid var(--good); border-radius: 999px; box-sizing: border-box; }
.hl-band__avg { position: absolute; top: -3px; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; }
.hl-flags { color: var(--ink-2); white-space: normal; max-width: 210px; }
.hl-view .pf-detail__grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
/* The month-by-month tables need the full width, so the sections stack until the screen is wide. */
@media (max-width: 1439px) { .hl-view .pf-detail__grid { grid-template-columns: 1fr; } }
.pf-detail__col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.hl-view .pf-log .pf-input { flex: 1 1 96px; }
.hl-view .pf-log .pf-input input { width: 100%; min-width: 0; }
.hl-hist { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.hl-hist th { padding: 4px 10px 4px 0; font-size: 11px; font-weight: 600; text-align: left; color: var(--ink-3); }
.hl-hist th.pf-r { text-align: right; }
.hl-hist td { padding: 5px 10px 5px 0; border-top: 1px solid var(--line); white-space: nowrap; color: var(--ink-2); }
.hl-hist td.pf-r { text-align: right; }
.hl-table td.pf-ratio { min-width: 140px; }
/* Flag text wraps (it is not readable elsewhere in the row) so the Health column stays narrow. */
.hl-table .hl-flags, .hl-table .hl-health .pf-sub { white-space: normal; max-width: 240px; }

.hl-gap { margin-top: 14px; }

/* Account detail: collapsible sections, each with an accent colour. The accent shows as a left
   edge and tints the section's heading and table headers; the values stay in the ink colours. */
.hl-detail__main, .hl-detail__side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hl-sec { --acc: var(--cat-onboarding); min-width: 0; background: var(--card-bg); border: 1px solid var(--line); border-inline-start: 4px solid var(--acc); border-radius: var(--radius-sm, 10px); }
/* Accents are neutral, not status colours. Orange-red is only for Hypercare when the account needs it. */
.hl-sec--blue { --acc: var(--cat-onboarding); }
.hl-sec--teal { --acc: var(--cat-integrations); }
.hl-sec--gray { --acc: var(--ink-3); }
.hl-sec--red { --acc: var(--serious); }
.hl-sec > summary {
  display: flex; align-items: baseline; gap: 10px; min-height: 40px; padding: 8px 14px; box-sizing: border-box; cursor: pointer; list-style: none;
  color: color-mix(in srgb, var(--acc) 60%, var(--ink));
}
.hl-sec > summary::-webkit-details-marker { display: none; }
.hl-sec > summary::before { content: ""; flex: none; align-self: center; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
.hl-sec[open] > summary::before { transform: rotate(45deg); }
.hl-sec__title { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.hl-sec__hint { font-size: 12.5px; color: var(--ink-2); }
.hl-sec[open] > summary { border-bottom: 1px solid color-mix(in srgb, var(--acc) 30%, var(--line)); }
.hl-sec > summary:focus-visible { outline: 2px solid var(--primary-strong); outline-offset: -2px; border-radius: 6px; }
@media (hover: hover) and (pointer: fine) { .hl-sec > summary:hover { background: color-mix(in srgb, var(--acc) 8%, transparent); } }
@media (prefers-reduced-motion: no-preference) { .hl-sec > summary::before { transition: transform var(--dur-fast) var(--ease-out); } }
@media (pointer: coarse) { .hl-sec > summary { min-height: 44px; } .hl-sec select, #hlTemplate { min-height: 44px; } }
.hl-sec__body { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 12px 14px 14px; min-width: 0; overflow-x: auto; }
.hl-sec__body > * { max-width: 100%; }
.hl-sec__body > table { align-self: stretch; width: 100%; }
.hl-sec .hl-hist th { padding-bottom: 6px; border-bottom: 2px solid color-mix(in srgb, var(--acc) 35%, var(--line)); color: color-mix(in srgb, var(--acc) 60%, var(--ink)); }
.hl-sec .hl-hist td { color: var(--ink); }
.hl-sec .hl-hist tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--acc) 5%, transparent); }
.hl-sec .hl-hist tbody tr.pf-muted td, .hl-sec .pf-muted { color: var(--ink-2); }
.hl-sec .hl-hist td:first-child, .hl-sec .hl-hist th:first-child { padding-inline-start: 6px; }
.hl-sec .hl-hist td.hl-lost { color: var(--serious-text); font-weight: 600; }
.hl-signals td:first-child { color: var(--ink); }
.hl-weights { margin: 4px 0 0; }
.hl-weights summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 6px 0; }
.hl-weights__sum { font-weight: 400; color: var(--ink-3); }
.hl-weights[open] summary { margin-bottom: 6px; }
@media (max-width: 1720px) { .hl-view .hl-wide { display: none; } }
/* Between a phone and a wide laptop the sidebar leaves the table about 400 to 960px. The Adoption column loses its second line,
   and under 1125px the meters go and Details stays pinned at the edge. */
@media (min-width: 721px) and (max-width: 1279px) {
  /* Adoption keeps its column (dot and level); the "Graduated <month>" line under it goes. */
  .hl-view .hl-adopt .pf-sub { display: none; }
  .hl-view .hl-table td.pf-name .pf-sub { white-space: normal; max-inline-size: 150px; }
  .hl-view .hl-table .pf-ratio__top { flex-wrap: wrap; gap: 4px 10px; }
  .hl-view .hl-table td.pf-ratio { min-inline-size: 0; }
}
@media (min-width: 721px) and (max-width: 1124px) {
  .hl-view .hl-table .pf-meter { display: none; }
  /* The card is translucent; solid here so the pinned cells match it, as on a phone. Only the table's own rows, not the open detail's. */
  .hl-view .bl-wrap { background: var(--surface); }
  .hl-table > thead > tr > th:last-child, .hl-table > tbody > tr.pf-row > td:last-child {
    position: sticky; inset-inline-end: 0; background: var(--surface); box-shadow: -1px 0 0 var(--line);
  }
  .hl-table > tbody > tr.pf-row > td:last-child { z-index: 1; }
  .hl-table > tbody > tr.pf-row.is-open > td:last-child { background: var(--surface-2); }
}
@media (min-width: 721px) and (max-width: 1124px) and (hover: hover) and (pointer: fine) {
  .hl-table > tbody > tr.pf-row:hover > td:last-child { background: var(--surface-2); }
}
@media (max-width: 720px) {
  .hl-hist .hl-cost { display: none; }
  .hl-view .hl-table { min-width: 720px; }
  .hl-view .pf-detail__grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   Understanding triage (#/triage) and onboarding capacity (#/capacity)
   The capacity stack's Metabase views, rebuilt on the adoption watch's parts:
   summary cards, filter chips, the bl-table, neutral badges with a colored dot.
   ========================================================================= */
.tri-q-graduate           { background: var(--good); }
.tri-q-enable_and_unblock { background: var(--warning); }
.tri-q-at_risk            { background: var(--ink-3); }
.tri-q-dangerous_quadrant { background: var(--critical); }
.sow-card__label .cdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
/* The 2x2: understanding up, completion right. Cells are the table's filter. */
.tri-matrix {
  display: grid; grid-template-columns: 18px 64px minmax(0, 1fr); grid-template-rows: auto auto auto auto;
  padding: 18px 20px 14px 12px; margin-bottom: 16px; max-width: 980px;
}
.tri-grid { grid-column: 3; grid-row: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tri-axis { display: flex; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.tri-axis--y { grid-column: 2; grid-row: 1; flex-direction: column; justify-content: space-around; padding-right: 10px; text-align: right; }
.tri-axis--x { grid-column: 3; grid-row: 2; justify-content: space-around; padding-top: 8px; }
.tri-axis-title { font-size: 12.5px; font-weight: 550; color: var(--ink-3); }
.tri-axis-title--y { grid-column: 1; grid-row: 1; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; }
.tri-axis-title--x { grid-column: 3; grid-row: 3; text-align: center; padding-top: 4px; }
/* One hue per axis: understanding in blue, completion in green, each with a light
   rule along its edge. The High/Low and Building/Built labels stay in text ink. */
.tri-axis span { color: var(--ink); }
.tri-axis-title--y { color: var(--primary); }
.tri-axis-title--x { color: var(--good); }
.tri-axis--y { border-right: 3px solid var(--primary-tint-2); margin-right: 8px; }
.tri-axis--x { border-top: 3px solid var(--good-tint); margin-top: 8px; }
.tri-grid { position: relative; }
.tri-cell {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; min-height: 170px; padding: 14px 16px;
  overflow: hidden; background: var(--surface-2); border-radius: var(--radius-sm);
}
.tri-cell--dangerous_quadrant { background: var(--critical-tint); }
/* Danger zones (GEO-113): red built-not-understood, yellow understood-not-built, gray where most start; graduate stays neutral. */
.tri-cell--enable_and_unblock { background: color-mix(in srgb, var(--warning) 8%, var(--surface)); }
.tri-cell--at_risk { background: color-mix(in srgb, var(--ink-3) 16%, var(--surface)); }
.tri-cell__head { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tri-cell__head .cdot { width: 9px; height: 9px; border-radius: 50%; }
/* The count sits behind the dots as a light background figure. */
.tri-cell__n {
  position: absolute; right: 18px; bottom: 6px; font-size: 92px; font-weight: 600; line-height: 1;
  letter-spacing: -0.04em; color: var(--ink-3); opacity: 0.18; pointer-events: none;
}

/* Dots, tails and the hover card sit over the four cells. */
.tri-plot { position: absolute; inset: 0; pointer-events: none; }
.tri-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tri-tail { stroke: var(--ink-3); stroke-width: 1.5; stroke-linecap: round; stroke-dasharray: 1 5; vector-effect: non-scaling-stroke; opacity: 0.4; }
.tri-start { opacity: 0.6; position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; border: 1.5px solid var(--ink-3); background: var(--surface); box-sizing: border-box; }
.tri-dot {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; padding: 0; border-radius: 50%;
  border: 2px solid var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.18); cursor: pointer; pointer-events: auto;
}
/* A bigger invisible hit area than the mark. */
.tri-dot::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.tri-dot:focus-visible { transform: scale(1.25); }
@media (hover: hover) and (pointer: fine) { .tri-dot:hover { transform: scale(1.25); } }
.tri-dot.has-danger { box-shadow: 0 0 0 2px var(--critical); }
.tri-dot.is-active { box-shadow: 0 0 0 3px var(--primary); }
.tri-dot.has-danger.is-active { box-shadow: 0 0 0 2px var(--critical), 0 0 0 5px var(--primary); }
.tri-tip {
  position: absolute; z-index: 3; transform: translate(14px, -50%); width: max-content; max-width: 260px;
  padding: 10px 12px; border-radius: var(--radius-xs); background: var(--ink); color: var(--surface);
  font-size: 12px; line-height: 1.45; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.tri-tip.is-left { transform: translate(calc(-100% - 14px), -50%); }
.tri-tip__name { font-weight: 600; font-size: 12.5px; margin-bottom: 2px; }
.tri-tip__past { opacity: 0.75; }
.tri-tip__mods { list-style: none; margin: 6px 0 0; padding: 6px 0 0; border-top: 1px solid rgba(255,255,255,0.18); }
.tri-tip__mods li { display: flex; align-items: center; gap: 6px; }
.tri-tip__mods .adopt-dot { width: 7px; height: 7px; flex: 0 0 7px; }
.tri-legend {
  grid-column: 3; grid-row: 4; display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 10px;
  font-size: 11.5px; color: var(--ink-3);
}
.tri-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.tri-key { display: inline-block; }
.tri-key--dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.tri-key--tail { width: 18px; height: 2px; background: radial-gradient(circle, var(--ink-3) 0.75px, transparent 1px) left center / 6px 2px repeat-x; position: relative; }
.tri-legend__toggle { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; border-radius: 4px; }
.tri-legend__toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tri-legend__act { color: var(--primary); font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .tri-legend__toggle:hover .tri-legend__act { text-decoration: underline; } }
.tri-matrix.is-trails-off .tri-tail, .tri-matrix.is-trails-off .tri-start { display: none; }
.tri-matrix.is-trails-off .tri-legend__toggle .tri-key { opacity: 0.35; }
.tri-key--tail::before { content: ""; position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--ink-3); background: var(--surface); box-sizing: border-box; }
.tri-key--ring { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); box-shadow: 0 0 0 2px var(--critical); }
.tri-chip-account .chip__x { margin-left: 2px; font-size: 14px; line-height: 1; }
.tri-chip-account[hidden], .tri-tip[hidden] { display: none; }
.tri-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tri-verifier { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.tri-verifier input, .tri-select, .cap-field input {
  font: inherit; font-size: 12px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs); padding: 4px 8px;
}
.tri-verifier input { width: 160px; }

.cap-panel { padding: 18px 20px; margin-bottom: 16px; }
.cap-h { font-size: 15px; font-weight: 600; margin: 0; }
.cap-sub { margin: 4px 0 12px; font-size: 12.5px; color: var(--ink-3); max-width: 80ch; }
.cap-chart { position: relative; max-width: 760px; }
.cap-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.cap-grid { stroke: var(--line); stroke-width: 1; }
.cap-tick { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 10px; fill: var(--ink-3); }
.cap-bar-train { fill: var(--primary); }
.cap-bar-task { fill: color-mix(in oklab, var(--primary) 35%, var(--surface)); }
.cap-floor { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 5 4; }
.cap-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 10px 0 18px; font-size: 12px; color: var(--ink-2); }
.cap-leg { display: inline-flex; align-items: center; gap: 7px; }
.cap-key { display: inline-block; flex: 0 0 auto; width: 12px; height: 10px; border-radius: 3px; }
.cap-key.is-train { background: var(--primary); }
.cap-key.is-task { background: color-mix(in oklab, var(--primary) 35%, var(--surface)); }
.cap-key.is-floor { height: 0; width: 16px; border-radius: 0; border-block-start: 2px dashed var(--ink-2); }
.cap-over { color: var(--serious-text); font-weight: 600; }
.cap-over__tag { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.cap-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cap-pt { fill: var(--primary); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.cap-hit { fill: transparent; cursor: default; }
.cap-now { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.cap-now-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.cap-now-label { font-size: 11px; font-weight: 600; fill: var(--ink-2); }
.cap-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none; white-space: nowrap;
  background: var(--ink); color: var(--surface); font-size: 11.5px; padding: 4px 8px; border-radius: 6px;
}
.cap-table { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.cap-table summary { cursor: pointer; }
.cap-table table { max-width: 360px; margin-top: 6px; }
.cap-inputs { margin: 12px 0 4px; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.cap-origin {
  display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line);
}
.cap-origin.is-measured { color: var(--good-text); background: var(--good-tint); border-color: transparent; }
.cap-origin.is-entered  { color: var(--primary); background: var(--primary-tint); border-color: transparent; }
.cap-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 10px; }
.cap-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.cap-field input { width: 120px; }
.cap-form .adopt-note { margin: 0; align-self: center; }
.cap-honest { margin: 12px 0 0; font-size: 12px; color: var(--ink-3); font-style: italic; }
.cap-view .sow-summary { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (max-width: 720px) {
  .cap-panel { padding: 14px; }
  .cap-view .bl-table { min-width: 560px; }
  .tri-view .bl-table { min-width: 560px; }
  .tri-matrix { grid-template-columns: 0 64px minmax(0, 1fr); padding: 14px 12px 12px 4px; }
  .tri-axis-title--y { display: none; }
  .tri-axis--y { font-size: 10.5px; padding-right: 6px; margin-right: 6px; }
  .tri-cell { min-height: 130px; padding: 10px; }
  .tri-cell__n { font-size: 64px; right: 10px; }
  .tri-legend { grid-column: 2 / 4; }
  /* The chart scales down with its viewBox, so its text and line are drawn larger. */
  .cap-tick { font-size: 19px; }
  .cap-now-label { font-size: 20px; }
  .cap-line { stroke-width: 3.5; }
  .cap-pt { r: 5; }
}

/* =========================================================================
   Today inbox (#/today). Tabs show one group at a time; rows stay one line of
   title and one line of facts. The severity bar carries color, the tab label
   says it in words, so color is never the only signal.
   ========================================================================= */
.td-view { max-width: 1100px; }

.td-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.td-tab {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 12px 14px; text-align: left; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card-bg); box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .td-tab:hover { border-color: var(--ink-3); } }
.td-tab__n { font-size: 22px; font-weight: 400; line-height: 1; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.td-tab__label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.td-tab.is-critical .td-tab__n { color: var(--critical); }
.td-tab.is-warning .td-tab__n { color: var(--warning); }
.td-tab.is-info .td-tab__n { color: var(--primary); }
.td-tab.is-empty .td-tab__n { color: var(--ink-3); }
.td-tab.is-active { border-color: var(--primary); background: var(--primary-tint); }
.td-tab.is-active .td-tab__label { color: var(--ink); }
.td-tab.is-active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--primary);
}

.td-chips { margin: 0 0 4px; }
.td-chips .chip { height: 30px; padding: 0 11px; font-size: 12.5px; }
.chip .cdot.td-dot-adoption      { background: var(--primary); }
.chip .cdot.td-dot-triage        { background: var(--cat-integrations); }
.chip .cdot.td-dot-profitability { background: var(--cat-custom); }
.chip .cdot.td-dot-schedule      { background: var(--cat-buildouts); }
.chip .cdot.td-dot-capacity      { background: var(--ink-3); }
/* Health, Task and Epic dots follow their tags in the list: Health is neutral (green would read as "healthy" next
   to red and amber items); Task and Epic are the outlined tags, so their dots are rings (teal, blue). */
.chip .cdot.td-dot-health        { background: var(--ink-2); }
.chip .cdot.td-dot-task          { box-sizing: border-box; border: 2px solid var(--cat-integrations); }
.chip .cdot.td-dot-epic          { box-sizing: border-box; border: 2px solid var(--primary); }
.td-note:empty { min-height: 4px; margin: 4px 0; }

.td-group + .td-group { margin-top: 14px; }
.td-group__head {
  display: flex; align-items: center; gap: 7px; margin: 0 0 6px;
  font-size: 12.5px; font-weight: 700; color: var(--ink);
}
.td-group__head::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.td-group__head.is-critical::before { background: var(--critical); }
.td-group__head.is-warning::before { background: var(--warning); }
.td-group__head .num { font-weight: 400; color: var(--ink-3); }

.td-list { list-style: none; margin: 0; padding: 0; gap: 0; overflow: hidden; }
.td-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px 9px 18px; border-bottom: 1px solid var(--line);
}
.td-item:last-child { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) { .td-item:hover { background: var(--surface-2); } }
.td-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.td-item.is-critical .td-bar { background: var(--critical); }
.td-item.is-warning .td-bar { background: var(--warning); }
.td-item.is-parked .td-bar { background: var(--line-strong); }
.td-item.is-parked .td-title { color: var(--ink-2); }

.td-main { flex: 1; min-width: 0; }
.td-line1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.td-title { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) and (pointer: fine) { .td-title:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; } }
.td-kind {
  flex: 0 0 auto; display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2);
}
/* Tag text mixes 60% category colour into --ink: AA 4.5:1 on its tint in both themes (dark failed on main too). */
.td-k-adoption      { background: var(--primary-tint); color: var(--primary-strong); }
.td-k-triage        { background: color-mix(in srgb, var(--cat-integrations) 14%, transparent); color: color-mix(in srgb, var(--cat-integrations) 60%, var(--ink)); }
.td-k-profitability { background: color-mix(in srgb, var(--cat-custom) 16%, transparent); color: color-mix(in srgb, var(--cat-custom) 60%, var(--ink)); }
.td-k-schedule      { background: color-mix(in srgb, var(--cat-buildouts) 14%, transparent); color: color-mix(in srgb, var(--cat-buildouts) 60%, var(--ink)); }
.td-k-health        { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.td-k-task          { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-integrations) 55%, transparent); }
.td-k-epic          { background: transparent; color: var(--primary-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 55%, transparent); }
.td-due { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-due.is-late { color: var(--serious); }
.td-due.is-today { color: var(--warning); }
.td-sub {
  margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}
.td-sep { color: var(--ink-3); }
.td-detail { font-weight: 400; color: var(--ink-3); }

.td-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.td-btn { height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.td-btn svg { width: 14px; height: 14px; stroke-width: 1.7; flex: 0 0 14px; }
.td-snooze { color: var(--ink-2); }
.td-snooze[aria-expanded="true"] { border-color: var(--primary); color: var(--primary-strong); }
/* The snooze choices, on their own line under the item. */
.td-item { flex-wrap: wrap; }
.td-snoozer { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.td-snoozer[hidden] { display: none; }
.td-snoozer__lbl { font-size: 12px; color: var(--ink-3); margin-right: 2px; }
.td-snoozer__x { color: var(--ink-3); }
.td-when { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

.td-empty { font-size: 13.5px; color: var(--ink-2); }

/* Phone: the tabs become one scrolling strip, a row keeps its buttons beside it as
   icons, and the facts may take two lines. */
@media (max-width: 720px) {
  .td-tabs {
    display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none;
    margin: 0 -16px 10px; padding: 0 16px;
  }
  .td-tabs::-webkit-scrollbar { display: none; }
  .td-tab { flex: 0 0 auto; flex-direction: row; align-items: baseline; gap: 6px; padding: 8px 11px; box-shadow: none; }
  .td-tab__n { font-size: 16px; }
  .td-tab.is-active::after { display: none; }
  /* Side-scroll strips: lock the vertical axis. Without overflow-y: hidden, the chips' 44px touch
     halo (::before, -8px above and below) overflows the strip and it wobbles up and down under a finger.
     The 8px block padding keeps that halo inside the strip; the negative margin keeps the spacing. */
  .td-chips { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; margin: -8px -16px -6px; padding: 8px 16px; }
  .td-chips::-webkit-scrollbar { display: none; }
  .td-chips .chip { flex: 0 0 auto; }
  .td-item { align-items: flex-start; gap: 8px; padding: 9px 10px 9px 14px; }
  .td-line1 { flex-wrap: wrap; row-gap: 2px; }
  .td-title { white-space: normal; flex: 1 1 100%; }
  .td-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .td-btn { width: 34px; height: 34px; padding: 0; justify-content: center; }
  .td-btn svg { width: 16px; height: 16px; }
  .td-btn__txt { display: none; }
  .td-btn[data-act="reopen"] { width: auto; padding: 0 10px; }
  .td-snoozer { justify-content: flex-start; }
  .td-snoozer__lbl { display: none; } /* the lit clock button says it; the group is labelled */
  .td-snoozer .td-btn { width: auto; padding: 0 10px; }
  .td-item.is-parked .td-when { display: none; }
}

/* ----- Project page: epics and tasks (#/project) ----- */
.pf-open-project { display: inline-flex; align-items: center; text-decoration: none; }
.pj { display: flex; flex-direction: column; gap: 14px; }
/* Page inset for Projects, a project and the states editor: same as the older pages (.sow-view, .clients-view). */
.pj-page { padding-block: 4px 64px; padding-inline: 32px; }
@media (max-width: 720px) { .pj-page { padding-block-end: 48px; padding-inline: 20px; } }
.pj-back { font-size: 12.5px; font-weight: 600; color: var(--primary); align-self: flex-start; }
@media (hover: hover) and (pointer: fine) { .pj-back:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 2px; } }
.pj-head { gap: 16px; }
.pj-head__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.pj-name { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.pj-meta { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.pj-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pj-head__side { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
/* Phones: the Alerts switch sits top right beside the name; the status pills get their own row */
@media (max-width: 720px) {
  .pj-head__top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .pj-head__side { display: contents; }
  .pj-head__id { grid-column: 1; grid-row: 1; min-width: 0; }
  .pj-head__top .pj-alerts { grid-column: 2; grid-row: 1; align-self: start; padding-inline: 0; }
  .pj-head__top .pj-chips { grid-column: 1 / -1; grid-row: 2; }
}
.pj-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.pj-stat {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.pj-stat__v { font-size: 18px; font-weight: 500; }
.pj-stat__l { font-size: 11.5px; color: var(--ink-3); }
.pj-stat.is-critical .pj-stat__v { color: var(--critical); }
.pj-stat.is-warning .pj-stat__v { color: var(--warning); }
.pj-note { font-size: 12.5px; color: var(--ink-3); min-height: 1em; margin: 0; }
.pj-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.pj-alerts { padding-inline: 4px; }
.pj-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pj-addms { display: inline-flex; gap: 8px; }
.pj-addms input, .pj-add__in {
  height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; min-width: 0;
}
.pj-addms input:focus, .pj-add__in:focus { outline: 2px solid transparent; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
/* Project page tabs and the Numbers tab (GEO-149) */
.pj-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.pj-tab {
  padding: 9px 16px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--ink-3); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.pj-tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
@media (hover: hover) and (pointer: fine) { .pj-tab:hover { color: var(--ink); } .pj-tab[aria-selected="true"]:hover { color: var(--primary); } }
@media (pointer: coarse) { .pj-tab { min-height: 44px; } }
.pj-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pn { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pn-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pn-log { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pn-log .pj-select { width: auto; min-width: 150px; flex: 1 1 150px; max-width: 280px; }
.pn-log .pj-hours { width: 90px; }
.pn-split { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
@media (max-width: 960px) { .pn-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .pn .pn-table { min-width: 0; font-size: 12px; } .pn-sm-hide { display: none; } .pn .pn-table .pn-task { min-width: 0; padding-inline-start: 10px; } .pn-table th, .pn-table td { white-space: normal; padding-inline: 4px; } .pn .pn-table thead th { letter-spacing: 0.02em; } }
.pn-scroll { overflow-x: auto; position: relative; }
.pn-table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 13px; }
.pn-table th, .pn-table td { padding: 8px; text-align: end; border-top: 1px solid var(--line); white-space: nowrap; }
.pn-table thead th { border-top: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.pn-table th:first-child, .pn-table td:first-child { text-align: start; }
.pn-table .pn-task { padding-inline-start: 24px; white-space: normal; min-width: 180px; }
.pn .pn-table .pn-task.pn-sub { padding-inline-start: 44px; color: var(--ink-2); }
@media (max-width: 720px) { .pn .pn-table .pn-task.pn-sub { padding-inline-start: 22px; } }
.pn-total th, .pn-total td { font-weight: 700; border-top: 2px solid var(--line-strong); }
.pn-epic th, .pn-epic td { background: var(--surface-2); font-weight: 600; }
.pn-bad { color: var(--critical); }
.pn-good { color: var(--good); }
.pn-dim { color: var(--ink-3); font-size: 12px; }
.pn-bar { display: inline-block; inline-size: 70px; block-size: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; vertical-align: middle; }
.pn-bar i { display: block; block-size: 100%; inline-size: var(--w); border-radius: 99px; background: var(--primary); }
.pn-bar i.is-over { background: var(--critical); }
.pn-sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
.pn-h { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.pn-team { display: flex; flex-direction: column; gap: 10px; }
.pn-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pn-people li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 13px; }
.pn-people .pn-bar { grid-column: 1 / -1; inline-size: 100%; }
.pn-people .pn-dim { grid-column: 1 / -1; }
.pn-allot { display: flex; flex-direction: column; gap: 6px; }
.pn-allot__row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-weight: 600; }
.pn-meter { position: relative; display: block; block-size: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pn-meter i { position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: var(--w); border-radius: 99px; background: var(--primary); }
.pn-meter i.is-over { background: var(--critical); }
.pn-meter b { position: absolute; inset-block: 0; inset-inline-start: var(--at); inline-size: 2px; background: var(--ink); }
.pn-price { inline-size: 84px; padding-inline: 8px; text-align: end; }
.pn-price.is-custom { border-color: var(--primary); }
.pn-untied { margin-block-start: 10px; border-top: 1px solid var(--line); padding-block-start: 8px; }
.pn-untied summary { cursor: pointer; font-size: 13px; font-weight: 600; padding-block: 6px; }
.pn-untied ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pn-untied li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto minmax(140px, 200px); gap: 4px 12px; align-items: center; padding-block: 6px; border-top: 1px solid var(--line); font-size: 13px; }
@media (max-width: 720px) { .pn-untied li { grid-template-columns: minmax(0, 1fr) auto auto; } .pn-untied li .pj-select { grid-column: 1 / -1; } }
.pn-sug { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pn-sug li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.pn-sug li:first-child { border-top: 0; }
.pn-sug .num { font-weight: 600; white-space: nowrap; }
/* Team page (GEO-152): utilization trend and workload balance */
.tm-head { flex-wrap: wrap; margin-bottom: 0; }
.tm-thr { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.tm-thr .pj-select { inline-size: auto; }
.tm-spark { display: inline-flex; align-items: flex-end; gap: 3px; block-size: 22px; }
.tm-spark i { inline-size: 6px; block-size: max(var(--h), 2px); border-radius: 2px 2px 0 0; background: var(--primary); opacity: 0.45; }
.tm-spark i:last-child { opacity: 1; }
.tm-bal { position: relative; display: flex; block-size: 32px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.tm-bal > div { inline-size: var(--w); min-inline-size: 0; background: color-mix(in srgb, var(--primary) var(--mix), var(--surface)); }
.tm-bal > .is-flagged { background: var(--critical); }
.tm-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); }
.tm-legend li { display: inline-flex; align-items: center; gap: 6px; }
.tm-legend i { inline-size: 10px; block-size: 10px; border-radius: 3px; background: color-mix(in srgb, var(--primary) var(--mix), var(--surface)); }
.tm-legend .is-flagged i { background: var(--critical); }
.tm-legend .is-flagged { font-weight: 600; }
.tm-bad { color: color-mix(in srgb, var(--critical) 75%, var(--ink)); }
.tm-good { color: color-mix(in srgb, var(--good) 75%, var(--ink)); }
.tm-fair { position: absolute; inset-block: 0; inset-inline-start: var(--at); inline-size: 2px; background: var(--ink); }
.tm-flag { position: absolute; inset-block: 0; inset-inline-start: var(--at); inline-size: 3px; background: repeating-linear-gradient(to bottom, var(--surface) 0 4px, var(--ink) 4px 8px); }
.tm-flagnote { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; }
.tm-fairkey, .tm-flagkey { flex: none; inline-size: 3px; block-size: 14px; }
.tm-fairkey { inline-size: 2px; background: var(--ink); }
.tm-flagkey { background: repeating-linear-gradient(to bottom, var(--surface) 0 3px, var(--ink) 3px 6px); margin-inline-start: 12px; }
.tm-over { display: flex; flex-direction: column; gap: 10px; }
.tm-over__line { margin: 0; font-weight: 600; color: color-mix(in srgb, var(--critical) 75%, var(--ink)); }
.tm-ok { margin: 0; font-weight: 600; color: color-mix(in srgb, var(--good) 75%, var(--ink)); }
.tm-move { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding-block-start: 10px; border-top: 1px solid var(--line); }
.tm-move > div { flex: 1 1 260px; min-inline-size: 0; }
.team-view .tm-table { table-layout: auto; min-inline-size: 0; }
.team-view .tm-table thead th { white-space: normal; padding-inline: 12px; text-align: start; vertical-align: bottom; }
.team-view .tm-table .bl-cell { padding-inline: 12px; }
.tm-stack { margin-block-end: 14px; }
@media (max-width: 720px) { .tm-table .pn-sm-hide, .tm-table .roster__ava { display: none; } .team-view .tm-table thead th, .team-view .tm-table .bl-cell { padding-inline: 6px; } .tm-table thead th { letter-spacing: 0; font-size: 10.5px; } .team-view .tm-table .bl-team-member { display: table-cell; } }
.pj-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
/* Subtasks (GEO-167): drawn under their parent on the same columns, so nothing gets wider */
.pj-ask { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 14px; margin-block-end: 12px; }
.pj-ask span { flex: 1 1 260px; font-size: 13.5px; }
.pj-addsub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pj-addsub input[name="title"] { inline-size: 220px; max-inline-size: 100%; }
.pj-addsub .pj-hours { inline-size: 64px; }
/* Desktop: every control sits on one 30px line; the "late" label and the time bar hang below it instead of re-centering the row */
.pj-done { flex: 0 0 auto; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.pj-start__dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--good); }
@media (prefers-reduced-motion: no-preference) { .pj-start__dot { animation: pj-pulse 1.6s ease-in-out infinite; } }
@keyframes pj-pulse { 50% { opacity: 0.35; } }
.pj-select, .pj-title, .pj-date, .pj-hours, .pj-notes {
  height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-xs);
  background: transparent; color: var(--ink); font: inherit; font-size: 13px; min-width: 0; width: 100%;
}
.pj-select, .pj-date, .pj-hours { background: var(--surface-2); border-color: var(--line); }
.pj-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); background: var(--surface); }  /* ring comes from the global :focus-visible */
.pj-title:focus, .pj-date:focus, .pj-hours:focus, .pj-notes:focus {
  outline: 2px solid transparent; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); background: var(--surface);
}
.pj-select:disabled, .pj-date:disabled, .pj-hours:disabled, .pj-title:disabled, .pj-notes:disabled, .pj-ms__name:disabled { color: var(--ink-2); cursor: default; opacity: 1; }
.pj-hours { text-align: right; }
.pj-late, .pj-wait { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pj-late { color: var(--critical); }
.pj-wait { color: var(--warning); }
.pj-grip {
  position: relative; inline-size: 28px; block-size: 28px; padding: 0; border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center;
  cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
}
.pj-grip--off { cursor: default; visibility: hidden; }
.pj-grip:active { cursor: grabbing; background: var(--surface-2); color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .pj-grip:hover { background: var(--surface-2); color: var(--ink); } }
/* 44px target on touch: 28px wide + 8px each side (the column gap); 30px tall + 8px above and 6px below (the phone row gap) */
@media (pointer: coarse) { .pj-grip { block-size: 30px; } .pj-grip::after { content: ""; position: absolute; inset-block: -8px -6px; inset-inline: -8px; } }
.pj-list { min-block-size: 8px; }
.pj-epics { display: flex; flex-direction: column; gap: 14px; }
.pj-ms__grip { flex: 0 0 28px; }
.pj-ms__grip + .pj-ms__name { margin-inline-start: 0; } /* keeps the 12px column gap, so the handle's touch area stops short of the name */
.pj-ms.is-ghost { background: var(--primary-tint); opacity: 0.7; }
.pj-ms.is-chosen > .pj-ms__head .pj-ms__grip { color: var(--primary); }
.pj-ms.is-dragging { box-shadow: var(--shadow-md); }
.pj-lbl { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.pj-lbl--grow { flex: 1 1 240px; }
.pj-notes { height: auto; padding: 6px 8px; background: var(--surface-2); border-color: var(--line); resize: vertical; }
.pj-empty { padding: 10px 0 4px; font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line); }
.pj-add__in { flex: 1 1 auto; }

/* ----- Project Tasks tab (GEO-263): one markup, two layouts. Desktop (over 900px): each task is a soft block and its subtasks a checklist.
   Phone: a calm list, two lines a task, subtasks indented under one guide line. Editing happens in the task panel. ----- */
.pj-ms { gap: 4px; padding: 8px 16px 10px; }
.pj-ms__head { display: flex; align-items: center; gap: 10px; min-block-size: 44px; }
.pj-ms__name, .pj-ms__title { flex: 1 1 auto; min-inline-size: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.pj-ms__name { block-size: 32px; padding: 0 8px; margin-inline-start: -8px; border: 1px solid transparent; border-radius: var(--radius-xs); background: transparent; font-family: inherit; text-overflow: ellipsis; }
@media (hover: hover) and (pointer: fine) { .pj-ms__name:hover:not(:disabled) { border-color: var(--line-strong); } }
.pj-ms__prog { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.pj-ms__due { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.pj-ms__due.is-late { color: var(--critical); font-weight: 600; }
.pj-ms__done { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--good-text); white-space: nowrap; }
.pj-ms__done .pj-sico { inline-size: 14px; block-size: 14px; }
.pj-meter { display: inline-block; inline-size: 48px; block-size: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; flex: none; }
.pj-meter i { display: block; block-size: 100%; inline-size: var(--w); background: var(--primary); border-radius: 99px; }

/* the caret: shows and hides what is under it */
.pj-caret, .pj-icon, .pj-play { position: relative; inline-size: 28px; block-size: 28px; flex: 0 0 28px; padding: 0; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-xs); color: var(--ink-3); cursor: pointer; }
.pj-caret[aria-expanded="false"] svg, .pj-subtoggle[aria-expanded="false"] > svg { transform: rotate(-90deg); }
@media (prefers-reduced-motion: no-preference) { .pj-caret svg, .pj-subtoggle > svg { transition: transform var(--dur-fast) var(--ease-out); } }
@media (hover: hover) and (pointer: fine) { .pj-caret:hover, .pj-icon:hover, .pj-play:not(.is-off):hover { background: var(--surface-2); color: var(--ink); } }
@media (pointer: coarse) { .pj-caret::before, .pj-icon::before, .pj-play::before { content: ""; position: absolute; inset: -8px; } }
.pj-play.is-off { visibility: hidden; pointer-events: none; }
.pj-play.is-running { color: var(--good-text); }
.pj-ms.is-folded > .pj-ms__head { margin-block-end: 0; }

/* the epic's ... menu */
.pj-menu { position: relative; }
.pj-menu__pop { position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 4px); z-index: 20; min-inline-size: 260px; display: flex; flex-direction: column; gap: 2px; padding: 6px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); outline: 1px solid var(--line); }
.pj-menu__lbl { white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pj-menu__lbl .pj-date { inline-size: 140px; }
.pj-menu__it { text-align: start; padding: 8px; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; min-block-size: 36px; }
.pj-menu__it.is-strong { font-weight: 700; color: var(--primary); }
.pj-menu__it.is-danger { color: var(--critical); }
.pj-menu__it.is-armed { background: var(--critical-tint); font-weight: 600; }
.pj-menu__it:disabled { opacity: 0.5; cursor: default; }
@media (hover: hover) and (pointer: fine) { .pj-menu__it:not(:disabled):hover { background: var(--surface-2); } }
@media (pointer: coarse) { .pj-menu__it { min-block-size: 44px; } }

/* a task: the row's parts sit in named areas */
.pj-task, .pj-sub { list-style: none; }
.pj-task__row { display: grid; align-items: center; column-gap: 10px; min-block-size: 40px; }
.pj-task__row > .pj-grip, .pj-task__row > .pj-gut { grid-area: lead; justify-self: center; }
.pj-task__row > .pj-caret { grid-area: lead; display: none; }
.pj-task__row > .pj-cb { grid-area: lead; justify-self: center; }
.pj-task__row > .pj-chip, .pj-task__row > .pj-st, .pj-task__row > .pj-tag { grid-area: chip; }
.pj-task__row > .pj-ttl { grid-area: title; }
.pj-task__row > .pj-play { grid-area: play; }
.pj-m { display: contents; }
.pj-m > .pj-who { grid-area: who; }
.pj-m > .pj-dt { grid-area: due; }
.pj-m > .pj-hrs { grid-area: hrs; }
.pj-sico { flex: none; }
.pj-sico[data-cat="in_progress"] { color: var(--primary); }
.pj-sico[data-cat="waiting_customer"] { color: var(--warning-text); }
.pj-sico[data-cat="blocked"] { color: var(--critical); }
.pj-sico[data-cat="done"] { color: var(--good); }
.pj-sico[data-cat="todo"], .pj-sico[data-cat="cancelled"] { color: var(--ink-3); }
.pj-vh { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pj-ttl { display: flex; align-items: center; gap: 8px; min-inline-size: 0; min-block-size: 32px; padding: 0; border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink); text-align: start; cursor: pointer; }
.pj-ttl__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-inline-size: 0; }
@media (hover: hover) and (pointer: fine) { .pj-ttl:hover .pj-ttl__t { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); } }
.pj-sub .pj-ttl { font-weight: 500; font-size: 13px; }
.is-closed > .pj-task__row .pj-ttl { color: var(--ink-3); }
.pj-task[data-cat="cancelled"] > .pj-task__row .pj-ttl__t, .pj-sub[data-cat="cancelled"] > .pj-task__row .pj-ttl__t { text-decoration: line-through; }
.pj-count { flex: none; font-size: 11.5px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); border-radius: 99px; padding: 1px 7px; display: none; }
.pj-chip { display: inline-flex; align-items: center; gap: 6px; justify-self: end; padding: 3px 10px 3px 6px; border-radius: 99px; background: var(--surface); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; max-inline-size: 100%; min-inline-size: 0; }
.pj-chip__t { overflow: hidden; text-overflow: ellipsis; }
.pj-st { display: none; }
.pj-tag { font-size: 12px; color: var(--ink-2); white-space: nowrap; justify-self: end; padding-inline-end: 10px; }
.pj-who { display: inline-flex; align-items: center; gap: 7px; min-inline-size: 0; font-size: 12.5px; color: var(--ink-2); }
.pj-av { inline-size: 22px; block-size: 22px; flex: 0 0 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-tint); color: var(--primary); font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em; }
.pj-who.is-none .pj-av { background: none; border: 1.5px dashed var(--line-strong); }
.pj-who.is-none { color: var(--ink-3); }
.pj-who__n { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-who__f { display: none; }
.pj-dt { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; font-size: 12.5px; color: var(--ink-2); min-inline-size: 0; }
.pj-dt.is-none { color: var(--ink-3); }
.pj-dt.is-late { color: var(--critical); }
.pj-dt__late { font-weight: 600; }
.pj-wait { color: var(--warning-text); }
.pj-hrs { padding: 0 2px; border: 0; background: transparent; font: inherit; font-size: 12.5px; color: var(--ink-3); text-align: end; white-space: nowrap; cursor: pointer; border-radius: var(--radius-xs); min-block-size: 28px; }
.pj-hrs b { color: var(--ink); font-weight: 600; }
.pj-hrs.is-over b { color: var(--serious-text); }
@media (hover: hover) and (pointer: fine) { .pj-hrs:hover { background: var(--surface-2); } }
@media (pointer: coarse) { .pj-hrs, .pj-ttl { min-block-size: 44px; } }
.pj-cb { position: relative; inline-size: 18px; block-size: 18px; padding: 0; border-radius: 5px; border: 1.5px solid var(--line-strong); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--surface); }
.pj-cb.is-on { background: var(--good); border-color: var(--good); }
.pj-cb svg { inline-size: 13px; block-size: 13px; }
.pj-cb:disabled { cursor: default; opacity: 0.6; }
@media (pointer: coarse) { .pj-cb::before { content: ""; position: absolute; inset: -13px; } }

.pj-subs { display: block; }
.pj-subtoggle { display: inline-flex; align-items: center; gap: 6px; min-block-size: 32px; margin-inline-start: 34px; padding: 0; border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.pj-subtoggle .pj-meter { background: var(--surface); margin-inline-start: 4px; }
.pj-sublist { list-style: none; margin: 0; padding: 2px 0; display: flex; flex-direction: column; }
.pj-subbody { display: flex; flex-direction: column; }
.pj-sub { border-block-start: 1px solid var(--line); }
.pj-sub:first-child { border-block-start: 0; }
.pj-sub > .pj-task__row { min-block-size: 36px; }
.pj-addrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 4px; }
.pj-addrow .pj-add__in { flex: 1 1 220px; }
.pj-addrow .pj-hours { inline-size: 64px; flex: none; }
.pj-add { display: inline-flex; align-items: center; gap: 6px; min-block-size: 36px; padding-inline: 6px; border: 0; border-radius: var(--radius-xs); background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; margin-block: 0; }
@media (hover: hover) and (pointer: fine) { .pj-add:hover { color: var(--ink); background: var(--surface-2); } }
@media (pointer: coarse) { .pj-add { min-block-size: 44px; } }
.pj-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block-start: 4px; }
.pj-foot__note { font-size: 12px; color: var(--ink-3); }
.pj-loose { margin: 0; padding-inline: 4px; font-size: 12.5px; color: var(--ink-3); }
.pj-linkbtn { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; }
.pj-task.is-ghost, .pj-ms.is-ghost { background: var(--primary-tint); opacity: 0.7; }
.pj-task.is-chosen .pj-grip { color: var(--primary); }
.pj-task.is-dragging { background: var(--surface); box-shadow: var(--shadow-md); }
.pj-ms:has(.pj-task.is-ghost) { outline: 2px dashed var(--primary); outline-offset: -2px; }

@media (min-width: 901px) {
  .pj-list { gap: 8px; padding-block: 4px 2px; }
  .pj-task { background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 10px 6px 4px; }
  .pj-task__row { grid-template-columns: 24px minmax(0, 1fr) 176px 124px minmax(150px, 210px) 84px 28px; grid-template-areas: "lead title chip who due hrs play"; }
  .pj-subtoggle > .num { white-space: nowrap; }
  .pj-subbody { padding-inline-start: 34px; }
  .pj-gut { display: none; }
  .pj-sub > .pj-task__row { grid-template-columns: 24px minmax(0, 1fr) 176px 124px minmax(150px, 210px) 84px 28px; }
  .pj-sub > .pj-task__row .pj-ttl__t { font-weight: 400; }
  .pj-sub > .pj-task__row .pj-hrs { color: var(--ink-3); }
  .pj-sub .pj-av { display: inline-flex; }
  .pj-sub .pj-who { position: relative; }
  .pj-sub .pj-who__n { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
  .pj-sub .pj-who { justify-self: end; padding-inline-end: 52px; }
}
@media (min-width: 901px) and (max-width: 1500px) { .pj-who { position: relative; } .pj-who__n { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); } .pj-task__row { grid-template-columns: 24px minmax(0, 1fr) 160px 28px minmax(140px, 190px) 76px 28px; } .pj-sub > .pj-task__row { grid-template-columns: 24px minmax(0, 1fr) 160px 28px minmax(140px, 190px) 76px 28px; } .pj-sub .pj-who { padding-inline-end: 0; justify-self: center; } }

@media (max-width: 900px) {
  .pj-ms { padding: 6px 10px 8px; }
  .pj-ms__head { display: grid; grid-template-columns: 28px 28px minmax(0, 1fr) auto 28px; gap: 0 8px; padding-block: 6px; }
  .pj-ms__grip { grid-column: 1; grid-row: 1; }
  .pj-ms__head > .pj-caret { grid-column: 2; grid-row: 1; }
  .pj-ms__name, .pj-ms__title { grid-column: 3 / 5; grid-row: 1; }
  .pj-ms__head .pj-menu { grid-column: 5; grid-row: 1; }
  .pj-ms__prog { grid-column: 3; grid-row: 2; margin: 0; }
  .pj-ms__due, .pj-ms__done { grid-column: 4 / 6; grid-row: 2; justify-self: end; }
  .pj-list { gap: 0; }
  .pj-task { border-block-start: 1px solid var(--line); padding-block: 4px; }
  .pj-list > .pj-task:first-child { border-block-start-color: transparent; }
  .pj-task__row { grid-template-columns: 28px 20px minmax(0, 1fr) 28px; grid-template-areas: "lead chip title play" ". . m play"; align-items: start; column-gap: 8px; padding-block: 4px; }
  .pj-sub > .pj-task__row { grid-template-columns: 0 20px minmax(0, 1fr) 28px; }
  .pj-task__row > .pj-grip, .pj-task__row > .pj-caret { margin-block-start: 0; }
  .pj-task.has-subs > .pj-task__row > .pj-grip { display: none; }
  .pj-task.has-subs > .pj-task__row > .pj-caret { display: inline-flex; }
  .pj-task__row > .pj-chip, .pj-task__row > .pj-st { display: inline-flex; padding: 0; background: none; justify-self: center; align-self: center; grid-area: chip; min-block-size: 30px; align-items: center; }
  .pj-chip__t, .pj-tag, .pj-cb, .pj-gut, .pj-subtoggle, .pj-addsub-wrap { display: none; }
  .pj-task__row > .pj-play { grid-row: 1 / span 2; align-self: start; margin-block-start: 1px; }
  .pj-ttl { min-block-size: 30px; align-items: center; }
  .pj-ttl__t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pj-count { display: inline-block; }
  .pj-m { grid-area: m; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; }
  .pj-m > .pj-who, .pj-m > .pj-dt, .pj-m > .pj-hrs { grid-area: auto; }
  .pj-who__s { display: none; }
  .pj-who__f { display: inline; }
  .pj-who__n { display: inline; }
  .pj-av { inline-size: 20px; block-size: 20px; flex-basis: 20px; font-size: 9px; }
  .pj-hrs { text-align: start; padding: 0; min-block-size: 22px; }
  .pj-subbody { margin-inline-start: 28px; padding-inline-start: 0; border-inline-start: 1.5px solid var(--line-strong); }
  .pj-sublist { padding-block: 0 4px; }
  .pj-sub { border-block-start: 0; }
  .pj-sub > .pj-task__row { min-block-size: 0; padding-block: 3px; }
  .pj-subbody .pj-sublist { margin-inline-start: 8px; }
}

/* ----- Workflow states editor (#/workflow) ----- */
.pj-states-link { color: var(--primary); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .pj-states-link:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 2px; } }
/* ----- Workflow profiles (Settings > Workflow profiles in the app) ----- */
.wf { gap: 16px; }
.wf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 16px; flex-wrap: wrap; }
.wf-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px 20px; align-items: start; }
.wf-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wf-plist { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wf-pgroup { display: flex; flex-direction: column; gap: 2px; }
.wf-ptitle { margin: 0; padding-block-end: 2px; padding-inline: 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.wf-pempty { margin: 0; padding: 4px 10px; font-size: 13px; color: var(--ink-3); }
.wf-pitem {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 6px 10px;
  border: 1px solid transparent; border-radius: var(--radius-xs); background: none; color: var(--ink-2); font: inherit; font-size: 14px; text-align: start;
}
.wf-pitem small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.wf-pname { min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }  /* the full name is in the editor beside it */
.wf-pitem[aria-pressed="true"] { background: var(--primary-tint); color: var(--primary-strong); font-weight: 600; }
.wf-pitem--new { border-style: dashed; border-color: var(--line-strong); color: var(--primary-strong); font-weight: 600; justify-content: flex-start; }
@media (hover: hover) and (pointer: fine) { .wf-pitem:not([aria-pressed="true"]):hover { border-color: var(--ink-3); } }
.wf-pitem:active { background: var(--surface-2); }
@media (pointer: coarse) { .wf-pitem, .wf-find, .wf-new input { min-height: 44px; } }
.wf-find, .wf-new input {
  width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
}
.wf-new { display: flex; flex-direction: column; gap: 8px; }
.wf-new .pj-select { width: 100%; height: 36px; }
.wf-new__btns { display: flex; gap: 8px; }
.pj-profile { width: auto; max-width: 220px; height: 32px; }
.wf-ptop { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.wf-rename { display: flex; gap: 8px; flex: 1 1 100%; min-width: 0; }
.wf-pinput { flex: 1 1 auto; width: auto; min-width: 0; font-size: 17px; font-weight: 600; }
.wf-pheading { margin: 0; flex: 1 1 260px; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.pf-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.wf-pselect { display: none; width: 100%; height: 40px; }
.wf-main .wf-cat { flex-basis: 96px; }
.wf-main .wf-label { flex-basis: 120px; }
@media (max-width: 720px) {
  .wf-layout { grid-template-columns: minmax(0, 1fr); }
  .wf-pselect { display: block; }
  /* a dropdown picks the profile on a phone, as in the Settings menu; only "+ New profile" stays in the list */
  .wf-find, .wf-ptitle, .wf-pempty, .wf-pitem:not(.wf-pitem--new) { display: none; }
  .wf-pgroup:not(:has(.wf-pitem--new, .wf-new)) { display: none; }
}

.wf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.wf-row { border-top: 1px solid var(--line); padding-block: 8px; padding-inline-start: 9px; }
.wf-row.is-hidden .wf-label { color: var(--ink-3); }
.wf-row.is-dragging { background: var(--primary-tint); border-radius: var(--radius-xs); box-shadow: var(--shadow-md); position: relative; z-index: 1; }
.wf-row__main { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.wf-cat { flex: 0 0 140px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.wf-label { flex: 1 1 200px; width: auto; min-width: 0; }
.wf-count { font-size: 12px; color: var(--ink-3); white-space: nowrap; min-width: 64px; text-align: end; }
.wf-actions { display: inline-flex; gap: 6px; }
.wf-grip {
  flex: none; width: 28px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-3); cursor: grab; touch-action: none;
}
.wf-grip:active, .is-dragging .wf-grip { cursor: grabbing; }
.wf-grip svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) { .wf-grip:hover { color: var(--ink); background: var(--surface-2); } }
.wf-icon {
  position: relative; width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--ink-2);
}
.wf-icon svg { width: 16px; height: 16px; }
.wf-icon[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  .wf-icon:not([aria-disabled="true"]):hover { border-color: var(--ink-3); }
  .wf-icon.is-danger:not([aria-disabled="true"]):hover { color: var(--critical); border-color: var(--critical); background: var(--critical-tint); }
}
.wf-icon:active:not([aria-disabled="true"]) { background: var(--surface-2); }
/* Move up / down for screen readers and keyboards: out of sight until focused. */
.wf-sr:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* The label of an icon button, shown above it on hover or keyboard focus. */
.wf-icon::after {
  content: attr(data-tip); position: absolute; inset-block-end: calc(100% + 6px); inset-inline-end: 0; z-index: 4;
  width: max-content; max-width: 260px; padding: 5px 8px; border-radius: 6px; background: var(--ink); color: var(--bg);
  font-size: 12px; font-weight: 400; line-height: 1.35; text-align: start; white-space: normal; pointer-events: none;
  opacity: 0; visibility: hidden;
}
.wf-icon.is-danger:focus-visible:not([aria-disabled="true"]) { color: var(--critical); border-color: var(--critical); }
.wf-icon:focus-visible::after { opacity: 1; visibility: visible; }
@media (hover: hover) and (pointer: fine) { .wf-icon:hover::after { opacity: 1; visibility: visible; } }
@media (prefers-reduced-motion: no-preference) { .wf-icon::after { transition: opacity var(--dur-fast) var(--ease-out), visibility var(--dur-fast); } }
.wf-move { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-block: 8px 2px; margin-inline-start: 152px; font-size: 13px; color: var(--ink-2); }
.wf-move .pj-select { width: 200px; }
.wf-main > .wf-move { margin-inline-start: 0; }
.wf-add { display: flex; gap: 8px; flex-wrap: wrap; }
.wf-add input {
  height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; min-width: 0; flex: 1 1 220px;
}
.wf-add .pj-select { width: 190px; height: 32px; }
@media (max-width: 900px) {
  .wf-cat { flex-basis: 100%; }
  .wf-move { margin-inline-start: 0; }
  /* On a phone a label hangs from the row (not its own button) and opens rightward from the row's left edge,
     so it stays on screen wherever the icons sit. */
  .wf-row__main { position: relative; }
  .wf-icon { position: static; }
  .wf-icon::after { inset-inline-end: auto; inset-inline-start: 0; max-width: min(260px, calc(100vw - 48px)); }
  .wf-count { order: 3; text-align: start; min-width: 0; }
}
@media (pointer: coarse) {
  .wf-icon, .wf-grip { width: 44px; height: 44px; }
  .wf-label, .wf-add input, .wf-add .pj-select { height: 44px; }
  .wf-sr.pf-btn:focus { min-height: 44px; }
}

/* ----- Projects list (#/projects) ----- */
.pjl { gap: 12px; }
.pjl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pjl-row { border-top: 1px solid var(--line); }
.pjl-link { display: grid; grid-template-columns: minmax(0, 1.4fr) 130px 110px minmax(0, 2fr) auto; gap: 8px 14px; align-items: center; padding: 11px 6px; color: inherit; text-decoration: none; border-radius: var(--radius-xs); }
@media (hover: hover) and (pointer: fine) { .pjl-link:hover { background: var(--surface-2); } a.pjl-link:hover .pjl-name > span { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; } a.pjl-link:hover .pjl-open { color: var(--primary); border-color: var(--primary); } }
.pjl-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.pjl-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pjl-ic { inline-size: 16px; block-size: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pjl-name .pjl-ic { color: var(--ink-3); }
.pjl-open { display: inline-flex; align-items: center; gap: 2px; padding: 4px 6px 4px 10px; border: 1px solid var(--line-strong); border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pjl-status { font-size: 12.5px; color: var(--ink-2); }
.pjl-counts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.pjl-none { color: var(--ink-3); }
@media (max-width: 900px) { .pjl-link { grid-template-columns: minmax(0, 1fr) auto; } .pjl-counts { grid-column: 1 / -1; } .pjl-open { grid-row: 1; grid-column: 2; } .pjl-link > .pf-pill { justify-self: start; } }

/* ----- Project templates (project page panel, #/templates) ----- */
.pj-tpl { gap: 10px; padding-block: 14px; }
.pj-tpl.is-empty { border-color: var(--primary); background: var(--primary-tint); }
.pj-tpl__h { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.pj-tpl__row { display: flex; flex-wrap: wrap; gap: 8px; }
.pj-tpl__row .pj-select { flex: 1 1 260px; width: auto; height: 32px; }
.pj-tpl__row input {
  flex: 1 1 260px; height: 32px; padding-inline: 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; min-width: 0;
}
/* Add (green) and save (light blue) carry their meaning in colour. */
.pf-btn.is-success, .pf-btn.is-success.is-armed {
  background: color-mix(in oklab, var(--good) 78%, var(--ink)); border-color: color-mix(in oklab, var(--good) 78%, var(--ink)); color: var(--primary-ink);
}
@media (hover: hover) and (pointer: fine) { .pf-btn.is-success:hover { background: color-mix(in oklab, var(--good) 66%, var(--ink)); border-color: color-mix(in oklab, var(--good) 66%, var(--ink)); } }
.pf-btn.is-soft {
  background: color-mix(in oklab, var(--primary) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--primary) 32%, var(--surface)); color: var(--primary-strong);
}
@media (hover: hover) and (pointer: fine) { .pf-btn.is-soft:hover { background: color-mix(in oklab, var(--primary) 20%, var(--surface)); } }

.tp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tp-item { border-top: 1px solid var(--line); padding-block: 10px; }
.tp-item__main { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.tp-toggle { inline-size: 28px; block-size: 28px; border: 0; background: transparent; color: var(--ink-3); border-radius: var(--radius-xs); display: inline-flex; align-items: center; justify-content: center; position: relative; }
@media (hover: hover) and (pointer: fine) { .tp-toggle:hover { background: var(--surface-2); color: var(--ink); } }
.tp-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.tp-name { flex: 1 1 200px; min-inline-size: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.tp-count { font-size: 12px; color: var(--ink-3); }
.tp-desc { margin-block: 4px 0; margin-inline-start: 36px; }

/* The outline: epics in blue, their tasks in teal and indented one level further. */
.tp-preview { display: flex; flex-direction: column; gap: 10px; margin-block: 10px 4px; margin-inline-start: 36px; }
.tp-epic { display: flex; flex-direction: column; gap: 2px; }
.tp-epic__h {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 7px 10px;
  background: color-mix(in oklab, var(--primary) 9%, var(--surface));
  border-inline-start: 3px solid var(--primary); border-radius: var(--radius-xs);
}
.tp-epic__n { overflow-wrap: anywhere; flex: 1 1 180px; font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--primary-strong); }
.tp-epic.is-loose .tp-epic__h { background: var(--surface-2); border-inline-start-color: var(--line-strong); }
.tp-epic.is-loose .tp-epic__n { color: var(--ink-2); }
.tp-tasks { list-style: none; margin: 0; padding: 0; margin-inline-start: 22px; display: flex; flex-direction: column; gap: 2px; }
.tp-task {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 5px 10px;
  border-inline-start: 3px solid color-mix(in oklab, var(--cat-integrations) 55%, transparent); border-radius: var(--radius-xs);
}
.tp-task__t { overflow-wrap: anywhere; flex: 1 1 200px; font-size: 13px; color: var(--ink); }
.tp-chip {
  font-size: 11.5px; color: var(--ink-3); white-space: nowrap; padding: 1px 8px; border-radius: 999px; background: var(--surface-2);
}
.tp-chip.is-epic { color: var(--primary-strong); background: color-mix(in oklab, var(--primary) 14%, var(--surface)); }
.tp-task .tp-chip { color: color-mix(in oklab, var(--cat-integrations) 70%, var(--ink)); background: color-mix(in oklab, var(--cat-integrations) 11%, var(--surface)); }

/* Editing */
.tp-item.is-editing { background: color-mix(in oklab, var(--primary) 3%, var(--surface)); border-radius: var(--radius-xs); padding-inline: 12px; }
.tp-edit-head { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.tp-edit-head .pj-title { background: var(--surface); border-color: var(--line); }
.tp-name-in, .tp-epic__in { font-weight: 600; }
.tp-edit-epic__h { flex-wrap: wrap; }
.tp-epic__in { flex: 1 1 220px; inline-size: auto; background: var(--surface); border-color: var(--line); }
.tp-edit-task { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 4px 6px; border-inline-start: 3px solid color-mix(in oklab, var(--cat-integrations) 55%, transparent); }
.tp-edit-task .pj-title { flex: 1 1 220px; inline-size: auto; background: var(--surface); border-color: var(--line); }
.tp-num { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.tp-num .pj-hours { inline-size: 76px; }
.tp-moveto { display: inline-flex; gap: 6px; flex: 0 1 260px; min-inline-size: 0; max-inline-size: 100%; }
.tp-move { flex: 1 1 auto; inline-size: 0; min-inline-size: 0; } /* a long epic name must not widen the row */
.tp-edit-acts { display: inline-flex; gap: 6px; margin-inline-start: auto; }
.tp-add { align-self: flex-start; margin-inline-start: 22px; }
.tp-edit-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 10px; }
.tp-edit-foot__end { display: inline-flex; gap: 8px; margin-inline-start: auto; }
@media (max-width: 900px) { .tp-desc, .tp-preview { margin-inline-start: 0; } .tp-tasks { margin-inline-start: 12px; } .tp-add { margin-inline-start: 12px; } }
@media (pointer: coarse) {
  .tp-toggle::before { content: ""; position: absolute; inset: -8px; }
  .pj-title, .pj-hours, .tp-move { min-block-size: 44px; }
  .tp-edit-acts .pf-btn::before { inset-inline: -3px; } /* the 6px gap between buttons: hit areas meet without overlapping */
  .pj-back { position: relative; }
  .pj-back::before { content: ""; position: absolute; inset-block: -13px; inset-inline: -4px; } /* 19px link -> 45px */
  .tp-item.is-editing .pf-btn { min-block-size: 44px; } /* wrapped editor rows: full-size targets that do not overlap */
  .tp-item.is-editing .pf-btn::before { inset-block: 0; }
}

/* ----- Touch: 44px hit areas and press feedback (good-css Interaction) -----
   The visual size stays; a transparent pseudo-element extends the tap target. */
@media (pointer: coarse) {
  .cal__btn, .seg__btn, .chip, .theme-seg__btn, .pf-btn, .pj-more, .pf-toggle, .nav-item, .cal__leg-check { position: relative; }
  .cal__btn::before, .seg__btn::before, .chip::before, .theme-seg__btn::before, .pf-btn::before,
  .pj-more::before, .pf-toggle::before { content: ""; position: absolute; inset-block: -8px; inset-inline: -4px; }
  .cal__leg-check::before { content: ""; position: absolute; inset-block: -13px; inset-inline: -4px; } /* 19px label -> 45px */
  /* The segmented control has a 2px gap: extend by half of it so neighbours do not overlap. */
  .seg__btn::before, .theme-seg__btn::before { inset-inline: -1px; }
  .theme-seg__btn { inline-size: 44px; }
  .nav-item:active, .td-item:active, .backlog__row:active { background: var(--surface-2); }
}
@media (max-width: 720px) and (pointer: coarse) {
  /* The Today tabs scroll in a strip that clips overflow, so the strip carries the extra tap room. */
  .td-tab::before { content: ""; position: absolute; inset-block: -8px; inset-inline: 0; }
  .td-tabs { padding-block: 8px; margin-block: -8px 2px; }
}
@media (prefers-reduced-motion: no-preference) {
  .cal__btn, .chip, .pf-btn, .td-tab, .pf-toggle { transition-property: background, border-color, color, transform; }
  .seg__btn { transition-property: background, color, box-shadow, transform; }
  .cal__btn:active, .seg__btn:active, .chip:active, .pf-btn:active, .td-tab:active, .pf-toggle:active { transform: scale(0.97); }
}

/* Phone: the tables that scroll sideways in these views keep their first column (the name) pinned, as Health
   and Profitability do. The card turns solid so the pinned cells match it; detail rows (colspan) are left alone. */
@media (max-width: 720px) {
  :is(.schedule-view, .clients-view, .team-view, .sow-view, .tri-view, .adopt-view, .cap-view) .bl-wrap { background: var(--surface); }
  :is(.schedule-view, .clients-view, .team-view, .sow-view, .tri-view, .adopt-view, .cap-view) .bl-wrap > .bl-table > thead > tr > th:first-child,
  :is(.schedule-view, .clients-view, .team-view, .sow-view, .tri-view, .adopt-view, .cap-view) .bl-wrap > .bl-table > tbody > tr > td:first-child:not([colspan]) {
    position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1;
    inline-size: 38vw; min-inline-size: 120px; max-inline-size: 40vw;
    white-space: normal; overflow-wrap: break-word;
    box-shadow: 1px 0 0 var(--line); text-align: start;
  }
  :is(.schedule-view, .clients-view, .team-view, .sow-view, .tri-view, .adopt-view, .cap-view) .bl-wrap > .bl-table > thead > tr > th:first-child { z-index: 2; }
  :is(.schedule-view, .clients-view, .team-view, .sow-view, .tri-view, .adopt-view, .cap-view) .bl-wrap > .bl-table > tbody > tr > td:first-child .bl-title { min-width: 0; }
}
/* My time (GEO-168): one person's week, a row per task and a column per day */
.team-view > .seg:first-child { margin-block-end: 14px; }
.mt-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mt-focus { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--ink-2); }
.mt-focus b { font-size: 20px; font-weight: 600; color: var(--ink); }
.mt-focus .pn-bar { flex: 1 1 140px; max-inline-size: 260px; }
.mt-table { table-layout: auto; min-inline-size: 600px; }
.mt-table th.mt-day, .mt-table td.mt-cell { inline-size: 62px; }
.mt-table td.mt-total { inline-size: 72px; }
.mt-nav .pf-btn { white-space: nowrap; }
.mt-table th, .mt-table td { padding-inline: 6px; }
.mt-table thead th.mt-day { text-align: center; white-space: nowrap; }
.mt-day small { display: block; font-size: 10.5px; font-weight: 500; color: var(--ink-3); }
.mt-name { text-align: start; font-weight: 400; min-inline-size: 190px; position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.mt-proj { display: block; font-size: 11.5px; color: var(--ink-3); }
.mt-task { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.mt-cell { text-align: center; }
.mt-in { inline-size: 52px; text-align: center; padding-inline: 4px; }
.mt-total { text-align: end; font-weight: 600; white-space: nowrap; }
.mt-table tfoot th, .mt-table tfoot td { border-block-start: 1px solid var(--line-strong); font-weight: 600; }
@media (pointer: coarse) { .mt-in { min-block-size: 44px; } }
@media (max-width: 720px) { .mt-name { min-inline-size: 132px; } .mt-in { inline-size: 46px; } }

/* =========================================================================
   Calmer look (GEO-253)
   ========================================================================= */

/* The Triage 2x2 keeps its settled colors; the shared tokens moved, so they are pinned here. */
.tri-view {
  --primary: light-dark(#2563EB, #3B82F6); --primary-strong: light-dark(#1D4FD7, #5C97F8);
  --primary-tint-2: light-dark(#DCE7FD, #233156);
  --good: light-dark(#1E9E63, #34B27E); --good-tint: light-dark(#E4F6EC, #14312A);
  --warning: light-dark(#C67A12, #E4A33C); --warning-tint: light-dark(#FBEFD8, #35280F);
  --critical: light-dark(#C5341F, #EC6A54); --critical-tint: light-dark(#FBE2DD, #3A1C17);
}

/* Muted text that sits directly on the blue page (not on a card) needs the darker shade to stay at 4.5:1. */
/* The darker muted shade is the default inside .main (it sits on the blue page); surfaces that are white (or dark cards) restore the card shade. */
.main { --ink-3: var(--ink-3-page); }
.main :is(.card, .cc-card, .bl-wrap, .hl-sec, .td-list, .tip__body, .pf-detail, .pn-card, .cv-card) { --ink-3: var(--ink-3-card); }

/* Filter chips: neutral, no colored dots; the selected chip is ink, not saturated blue. */
.chip { background: transparent; border-color: var(--line-strong); }
.chip .cdot { display: none; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.is-active .chip__count { background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); }

/* A status that stands alone keeps color on the text and dot, without a tinted pill. */
.pf-pill:not(.cv-tier) { background: transparent; border: 0; padding-inline: 0; }
.pf-pill.is-neutral:not(.cv-tier), .pf-pill.is-good { color: var(--ink-2); }

/* Row category dots repeat the text beside them. */
.bl-cell .cdot, .pf-sub .cdot { display: none; }

/* One filled primary button per screen: Done in Today is an outline. */
.pf-btn.is-primary.td-done { background: transparent; color: var(--ink); border-color: var(--line-strong); }

/* Today: no side bars; kind tags are plain gray text; only overdue and the At risk count carry color. */
.td-bar { display: none; }
.td-kind { background: transparent; box-shadow: none; color: var(--ink-3); padding-inline: 0; font-weight: 500; }
.td-tab.is-warning .td-tab__n, .td-tab.is-info .td-tab__n { color: var(--ink); }
.td-tab { box-shadow: none; }
.td-group__head.is-warning::before, .td-group__head:not(.is-critical)::before { display: none; }
.td-due.is-late { color: var(--critical); }
.pf-over { color: var(--serious-text); }

/* Info tip (i): helper text behind a click, reachable by keyboard. */
/* Empty status lines (filled only when an action reports back) take no room. */
.adopt-note:empty, .pj-note:empty { min-height: 0; margin: 0; }
.tip { position: relative; display: inline-flex; vertical-align: 1px; margin-inline-start: 6px; }
.tip__btn { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid var(--ink-3); background: transparent; color: var(--ink-2); font: 600 11px/1 var(--font-sans); cursor: pointer; }  /* ink-3 ring: 3:1 or better on white cards and on the blue page */
.tip__btn[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tip__body { position: absolute; z-index: 50; inset-block-start: calc(100% + 8px); inset-inline-start: -8px; inline-size: max-content; max-inline-size: min(300px, calc(100vw - 32px)); padding: 10px 12px; border-radius: 10px; background: var(--ink); color: var(--bg); font: 450 12.5px/1.45 var(--font-sans); text-align: start; text-transform: none; letter-spacing: 0; box-shadow: var(--shadow-md); }
@media (pointer: coarse) { .tip__btn { position: relative; } .tip__btn::before { content: ""; position: absolute; inset: -13px; } }

/* Status text uses the -text shades: the bar and dot colors are too light for small text on white. */
.avail.limited, .prio.medium, .td-due.is-today { color: var(--warning-text); }
.sow-age.is-serious, .clients-view .bl-oldest.is-serious, .adopt-overdue, .prio.high { color: var(--serious-text); }
.sch-pill.is-serious { color: light-dark(color-mix(in srgb, var(--serious-text) 82%, #000), var(--serious-text)); }
