/* ============================================================================
   The Risk Lab — "Pulse" design system, second pass (Nov 2026)
   Source of truth: docs/design/pulse/README.md (section "Second pass").
   Served at /theme.css (app.py) and linked by EVERY page in web/. Page files only
   add page-specific selectors on top of these primitives.

   Palette:  warm neutrals · ink anchors · one electric lime accent (unchanged).
   Type:     Manrope 500/600/700/800 for words, JetBrains Mono for numbers and labels.
   Shape:    14px cards, 9px controls, hairlines instead of colour blocks. True pills
             only where --r-round says so (chips, toggles). --r-pill keeps its old name
             so existing rules follow the new shape from one token.
   ========================================================================== */

:root{
  /* --- palette (design system §01) --- */
  --canvas:#F2F2EF;        /* app background */
  --surface:#F4F4F2;       /* nested tiles, chart bars, secondary buttons on white */
  --card:#FFFFFF;          /* cards, pills, inputs */
  --ink:#111111;           /* primary actions, dark cards, text */
  --lime:#C7F33C;          /* highlights, THE key data point / action per view */
  --lime-pale:#E9F9B0;     /* secondary highlights, "advancing" chips */
  --lime-hover:#B9E62E;

  /* --- text --- */
  --text:#111111;
  --text-2:#4F4F4B;        /* secondary text (table cells, hover links) */
  --muted:#6E6E6A;         /* muted body, crumbs, inactive segments — AA on white/surface */
  --muted-2:#767671;       /* captions, placeholders — AA on white */
  --muted-3:#B8B8B4;       /* on-ink captions */
  --on-ink-muted:#8A8A86;  /* caption on an ink card */
  --on-lime:#5C7311;       /* caption on a lime card */
  --on-lime-2:#7A9022;     /* sub-line on a lime card */
  --on-lime-pale:#8A9E4E;  /* caption on pale lime */

  /* --- lines & hovers --- */
  --line:#D9D9D5;          /* input borders, outlined pills */
  --line-soft:#EBEBE8;     /* table header rule */
  --line-row:#EFEFEC;      /* table row dividers */
  --line-canvas:#DBDBD8;   /* hairline on canvas-coloured tiles */
  --line-check:#BDBDBA;    /* unchecked checkbox ring */
  --hover:#F4F4F2;         /* white → hover */
  --hover-2:#ECECEA;       /* surface → hover */
  --row-hover:#FAFAF8;     /* table row hover */
  --ink-hover:#2A2A28;
  --accent-text:#4E6310;   /* eyebrows and links on light: lime itself fails contrast as text */

  /* --- charts --- */
  --hatch:#C4C4C1;         /* hatched-area stroke */
  --chart-line:#BDBDBA;
  --chart-dot:#9A9A96;
  --chart-guide:#ABABA8;

  /* --- avatar tonal fills (design system §04) --- */
  --av-1:#D8D3C8; --av-2:#C9CFD8; --av-3:#D2D8C9; --av-4:#B8B4AC;

  /* --- semantic (deliberately restrained so lime stays the hero) --- */
  --bad:#B4412E;  --bad-bg:#F6E7E3;  --bad-line:#EAC9C1;
  --warn:#8A6116; --warn-bg:#FBF1DC; --warn-line:#EEDDB4;
  /* UI-UX-RULES §8: status green must read as "done" and stay clearly distinct from the
     amber warn token — the old olive-on-lime (#5C7311/#E9F9B0) sat too close to amber.
     Brand lime stays in --lime*; --ok is status-only. */
  --ok:#1F7A3E;   --ok-bg:#E3F4E8;   --ok-line:#BFE3CA;
  /* UI-UX-RULES §3: one scrim for every overlay — ~70% dim plus blur. */
  --scrim:rgba(17,17,17,.7); --scrim-blur:blur(6px);
  --info:#41566B; --info-bg:#E8EDF2; --info-line:#D3DCE6;

  /* --- shape --- */
  --r-card:14px; --r-tile:12px; --r-inner:10px; --r-input:9px; --r-tag:5px; --r-pill:9px; --r-round:999px;
  --shadow-float:0 18px 50px rgba(17,17,17,.14);   /* modals/drawers only */

  /* --- type --- */
  --font:"Manrope",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --mono:"JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}

/* ---------- base ---------- */
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{background:var(--canvas);color:var(--ink);font-family:var(--font);font-size:14px;font-weight:500;line-height:1.55;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
h1,h2,h3,h4,h5{font-weight:800;letter-spacing:-.025em;margin:0;line-height:1.2;text-wrap:balance}
p{margin:0 0 .6em}
a{color:var(--ink);cursor:pointer;text-underline-offset:2px;text-decoration-thickness:1px}
a:hover{color:var(--text-2)}
a.plain{text-decoration:none;color:inherit}
strong,b{font-weight:700}
.num{font-family:var(--mono);font-variant-numeric:tabular-nums;letter-spacing:-.01em}
:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
::placeholder{color:var(--muted-2)}
::selection{background:var(--lime);color:var(--ink)}
hr,.divider{border:0;height:1px;background:var(--line-soft);margin:16px 0}

/* ---------- type scale (design system §02) ---------- */
.t-hero{font-size:clamp(38px,6.2vw,74px);font-weight:800;letter-spacing:-.045em;line-height:1.02}
.t-heading{font-size:clamp(28px,4.2vw,46px);font-weight:800;letter-spacing:-.035em;line-height:1.1}
.t-title{font-size:20px;font-weight:800;letter-spacing:-.02em}
.t-card{font-size:16px;font-weight:800;letter-spacing:-.015em}
.t-body{font-size:14px}
.t-caption{font-size:13px;color:var(--muted)}
.t-eyebrow,.eyebrow{font:600 12px/1.4 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--accent-text)}
.dim{color:var(--muted)}
.lede{font-size:clamp(15px,1.5vw,18px);line-height:1.6;color:var(--text-2);max-width:62ch}
.data-xl{font-family:var(--mono);font-size:46px;font-weight:600;letter-spacing:-.04em;line-height:1}
.data-lg{font-family:var(--mono);font-size:36px;font-weight:600;letter-spacing:-.04em;line-height:1.1}
.data-md{font-family:var(--mono);font-size:28px;font-weight:600;letter-spacing:-.03em;line-height:1}
.data-sm{font-family:var(--mono);font-size:22px;font-weight:600;letter-spacing:-.03em;line-height:1}
.muted{color:var(--muted)}
.muted2{color:var(--muted-2)}
.small{font-size:13px}

/* ---------- logo mark (beaker glyph, lime liquid fill) ---------- */
.mark{width:36px;height:36px;border-radius:10px;background:var(--ink);display:grid;place-items:center;flex:0 0 auto}
.mark.sm{width:30px;height:30px;border-radius:9px}
.mark .mark-ico{display:block;width:30px;height:30px}
.mark.sm .mark-ico{width:25px;height:25px}
.wordmark{font-size:14px;font-weight:800;letter-spacing:-.02em;color:var(--ink);text-decoration:none}

/* ---------- app shell: fixed full-height left navigation ----------
   Main content reserves the rail width. Navigation scrolls independently on short
   screens; mobile uses the off-canvas menu below. */
.appshell{--shell-gut:28px;display:flex;gap:20px;align-items:flex-start;margin:0 0 0 232px;padding:0 var(--shell-gut) 64px}
.appshell>main{flex:1;min-width:0}
/* the topbar runs edge to edge; everything under it sits on one measure */
.appshell>main>*:not(.topbar){max-width:1240px;margin-inline:auto}
.sidebar{width:232px;background:var(--card);border-radius:0;border-right:1px solid var(--line-soft);padding:12px 12px 16px;
  display:flex;flex-direction:column;gap:2px;position:fixed;top:0;left:0;bottom:0;z-index:20;
  overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none}
.sidebar>*{flex-shrink:0}
/* viewport-fit=cover (index.html): a landscape phone with a notch keeps the rail and the content clear of it.
   env() is 0 on every other screen, and the phone tier below re-sets both paddings. */
.sidebar{padding-left:calc(12px + env(safe-area-inset-left,0px))}
.appshell{padding-right:calc(var(--shell-gut) + env(safe-area-inset-right,0px))}
.sidebar:hover{scrollbar-width:thin}
.sidebar::-webkit-scrollbar{width:0}
.sidebar:hover::-webkit-scrollbar{width:6px}
.sidebar::-webkit-scrollbar-thumb{background:var(--line);border-radius:3px}
.sidebar .sb-brand{display:flex;align-items:center;gap:10px;padding:2px 8px 10px;text-decoration:none;color:var(--ink)}
.sidebar .sb-eyebrow{font:600 11px/1.3 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:14px 10px 6px}
#tabnav .sb-eyebrow:first-child{padding-top:4px}
.sidebar .sb-item{appearance:none;border:0;background:transparent;width:100%;display:flex;align-items:center;gap:10px;
  padding:8px 10px;border-radius:8px;font:inherit;font-size:14px;font-weight:600;color:var(--text-2);cursor:pointer;
  text-align:left;text-decoration:none;line-height:1.25;position:relative;transition:background .12s,color .12s}
.sidebar .sb-item:hover{background:var(--surface);color:var(--ink)}
.sidebar .sb-item.on{background:var(--ink);color:#FFFFFF}
/* Nav icons: one stroke glyph per destination, drawn with a mask so it follows currentColor. CSS only. */
.sidebar .sb-item .sb-ico{width:16px;height:16px;flex:0 0 auto;color:var(--muted);background:currentColor;
  -webkit-mask:var(--ico) center/16px 16px no-repeat;mask:var(--ico) center/16px 16px no-repeat}
.sb-item[data-go="dashboard"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='7' height='9' rx='1.5'/><rect x='14' y='3' width='7' height='5' rx='1.5'/><rect x='14' y='12' width='7' height='9' rx='1.5'/><rect x='3' y='16' width='7' height='5' rx='1.5'/></svg>")}
.sb-item[data-go="clients"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='8' r='4'/><path d='M2 21v-1a6 6 0 0 1 6-6h2a6 6 0 0 1 6 6v1'/><path d='M17 4.5a4 4 0 0 1 0 7'/><path d='M22 21v-1a6 6 0 0 0-3-5.2'/></svg>")}
.sb-item[data-go="workflows"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='6' cy='6' r='3'/><circle cx='18' cy='18' r='3'/><path d='M9 6h6a3 3 0 0 1 3 3v6'/><path d='M6 9v9'/></svg>")}
.sb-item[data-go="inbox"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 12h-6l-2 3h-4l-2-3H2'/><path d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/></svg>")}
.sb-item[data-go="tasks"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 11l3 3 8-8'/><path d='M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9'/></svg>")}
.sb-item[data-go="compliance"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l8 3v6c0 5-3.4 8-8 9-4.6-1-8-4-8-9V6z'/><path d='M9 12l2 2 4-4'/></svg>")}
.sb-item[data-go="quotes"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/><path d='M14 3v5h5'/><path d='M9 13h6M9 17h6'/></svg>")}
.sb-item[data-go="applications"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='5' y='4' width='14' height='17' rx='2'/><path d='M9 4V3h6v1'/><path d='M9 13l2 2 4-4'/></svg>")}
.sb-item[data-go="policies"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='7' width='18' height='13' rx='2'/><path d='M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/><path d='M3 13h18'/></svg>")}
.sb-item[data-go="revenue"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 20V10M10 20V4M16 20v-7M21 20H3'/></svg>")}
.sb-item[data-go="partners"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8 12l3 3a2 2 0 0 0 3 0l5-5a2 2 0 0 0 0-3l-1-1a2 2 0 0 0-3 0l-1 1'/><path d='M16 12l-3-3a2 2 0 0 0-3 0l-5 5a2 2 0 0 0 0 3l1 1a2 2 0 0 0 3 0l1-1'/></svg>")}
.sb-item[data-go="hub"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M2 7l10-4 10 4-10 4z'/><path d='M6 9v5c0 1.7 2.7 3 6 3s6-1.3 6-3V9'/></svg>")}
.sb-item[data-go="templates"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><path d='M3 9h18M9 21V9'/></svg>")}
.sb-item[data-go="lic_practices"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 21h18M5 21V7l7-4 7 4v14'/><path d='M9 21v-6h6v6'/></svg>")}
.sb-item[data-go="lic_clients"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='8' r='4'/><path d='M2 21v-1a6 6 0 0 1 6-6h2a6 6 0 0 1 6 6v1'/></svg>")}
.sb-item[data-go="lic_compliance"]{--ico:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l8 3v6c0 5-3.4 8-8 9-4.6-1-8-4-8-9V6z'/><path d='M9 12l2 2 4-4'/></svg>")}
.sidebar .sb-item.on .sb-ico{color:var(--lime)}
.sidebar .sb-item .sb-svg{width:16px;height:16px;flex:0 0 auto;display:inline-block;margin-left:-2px;margin-right:-2px}
.sidebar .sb-item .sb-svg svg{display:block;width:16px;height:16px}
.sidebar .sb-item .sb-lbl{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sidebar .sb-item .sb-chev{color:var(--muted-2);font-size:13px;line-height:1;flex:0 0 auto;transition:transform .15s}
.sidebar .sb-item.open .sb-chev{transform:rotate(90deg)}
.sidebar .sb-item.on .sb-chev{color:var(--muted-3)}
.sidebar .sb-item .count{margin-left:auto;font:600 11px/18px var(--mono);padding:0 6px;border-radius:5px;min-width:18px;background:var(--lime-pale);color:var(--accent-text)}
.sidebar .sb-item.on .count{background:var(--lime);color:var(--ink)}
.sidebar .sb-item .sb-dot{width:8px;height:8px;border-radius:50%;background:var(--lime);flex:0 0 auto}
.sidebar .sb-sub{display:flex;flex-direction:column;gap:1px;margin:2px 0 6px 17px;padding-left:10px;border-left:1px solid var(--line)}
.sidebar .sb-sub .sb-item{padding:6px 10px;font-size:13px;color:var(--muted)}
.sidebar .sb-sub .sb-item:hover{color:var(--ink)}
.sidebar .sb-sub .sb-item.on{background:var(--surface);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line-soft)}
.sidebar .sb-sub.hide{display:none}
@media(max-width:1099.98px){
  .appshell{--shell-gut:16px;padding:0 calc(var(--shell-gut) + env(safe-area-inset-right,0px)) 60px var(--shell-gut)}
  /* Keep the rail fixed on tablets; tighten the topbar at narrower widths. */
  .topbar{gap:10px}
  .tb-btn{padding:0 14px}
  .tb-user{padding:4px 12px 4px 4px}
  .tb-user .tb-uname{max-width:120px}
}

/* Topbar base rule. It sits before the phone tier below, which re-sets its margin and padding. */
.topbar{position:sticky;top:var(--ribbon-h,0px);z-index:30;height:56px;display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin:0 calc(var(--shell-gut)*-1) 20px;padding:0 var(--shell-gut);background:rgba(255,255,255,.88);
  -webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);border-bottom:1px solid var(--line-soft)}

/* ---------- UX-M-1 (Phase 1 W3): off-canvas sidebar below 760px ----------
   Below the breakpoint the rail slides over content from the topbar menu button.
   z-index sits UNDER .drawer-overlay (60) and .modal-overlay (90) so a drawer or modal
   opened from a nav destination still covers it. */
.sb-toggle{display:none}
.sb-overlay{display:none}
@media(max-width:760px){
  .appshell{margin-left:0}
  .sb-toggle{appearance:none;border:0;background:var(--card);color:var(--ink);border-radius:var(--r-pill);
    height:38px;padding:0 16px;display:inline-flex;align-items:center;gap:8px;font:inherit;font-size:14px;
    font-weight:600;cursor:pointer;white-space:nowrap;flex:0 0 auto}
  .sb-toggle:hover{background:var(--hover)}
  .sb-toggle .sb-toggle-ico{font-size:15px;line-height:1}
  /* visibility (not just the transform) is what takes the closed drawer out of the tab
     order and off the accessibility tree — translated-off content stays focusable and
     screen-reader reachable, so a phone user could tab into ~15 invisible nav rows. It is
     delayed by the slide duration on the way OUT so the animation still plays, and applies
     instantly on the way IN (the open rule doesn't transition it). */
  .sidebar{position:fixed;top:0;left:0;bottom:0;width:82vw;max-width:300px;z-index:56;
    border-radius:0 var(--r-card) var(--r-card) 0;max-height:100vh;padding:16px 12px;
    transform:translateX(-102%);visibility:hidden;
    transition:transform .22s ease, visibility 0s .22s}
  body.sb-open .sidebar{transform:translateX(0);visibility:visible;
    transition:transform .22s ease;box-shadow:0 0 44px rgba(17,17,17,.22)}
  .sb-overlay{display:block;position:fixed;inset:0;background:rgba(17,17,17,.42);z-index:55;
    opacity:0;pointer-events:none;transition:opacity .22s ease}
  body.sb-open .sb-overlay{opacity:1;pointer-events:auto}
}
@media(max-width:760px) and (prefers-reduced-motion:reduce){
  .sidebar,.sb-overlay{transition:none}
}

/* ---------- Mobile pass — app shell (ux3-m-shell) ----------
   Phone tier = the shell's existing 760px breakpoint. Everything here is scoped to it, so the
   desktop layout is untouched. Definition of done (docs: mobile brief): no horizontal page scroll,
   >=44px targets, a sticky topbar that never wraps, a drawer that locks body scroll, popovers that
   fit the viewport, floating things (recorder, 2FA nudge, toast) that never cover primary buttons. */
/* --topbar-h: height of the sticky phone topbar. Anything else that sticks to the top of the viewport on a phone
   (save bars, table headers, bulk bars) offsets itself by this so it never slides under the topbar. 0 above 760px. */
:root{--topbar-h:0px;--ribbon-h:0px}
:root:has([id$="staging-ribbon"]){--ribbon-h:18px}     /* the staging ribbon is a fixed 18px strip (liferisk_mcp/staging.py); matched by suffix because tests/test_staging.py keeps its literal id out of theme.css */
@media(max-width:760px){
  :root{--topbar-h:calc(60px + var(--ribbon-h))}
  .appshell{padding:calc(12px + var(--ribbon-h)) 12px calc(72px + env(safe-area-inset-bottom))}
  /* topbar: one row, sticky, canvas-coloured so content scrolls under it cleanly. The negative margin
     cancels the .appshell padding so the bar is full-bleed. */
  .topbar{position:sticky;top:var(--ribbon-h);z-index:30;height:auto;min-height:60px;margin:-12px -12px 10px;
    padding:8px 12px;background:var(--canvas);flex-wrap:nowrap;gap:8px}
  .topbar .tb-left{min-width:0;overflow:hidden}
  .topbar .tb-right{flex:0 0 auto;min-width:0}
  .sb-toggle{height:44px;min-width:44px;padding:0 18px;font-size:14px}
  .sb-toggle:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
  .tb-user.compact{width:44px;height:44px}
  /* the drawer: dynamic viewport height so the browser chrome / keyboard never clips the last nav rows;
     body scroll is locked while it is open; every row is a >=44px target with 8px between neighbours */
  .sidebar{top:var(--ribbon-h);max-height:calc(100dvh - var(--ribbon-h));height:calc(100dvh - var(--ribbon-h));padding:calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom))}
  body.sb-open{overflow:hidden}
  .sidebar .sb-item{min-height:44px}
  .sidebar .sb-sub .sb-item{padding:11px 16px;min-height:44px}
  .sidebar .sb-brand{min-height:48px}
  .sidebar .sb-eyebrow{padding-top:14px}
  /* popovers hanging off the topbar (profile + the global +) become fixed panels that always fit */
  #userDrop,#addMenu{position:fixed;top:calc(var(--topbar-h) + 4px + env(safe-area-inset-top));right:12px;left:12px;width:auto;
    min-width:0;max-height:calc(100dvh - var(--topbar-h) - 16px - env(safe-area-inset-top))}
  #userDrop .ud-item,#addMenu .ud-item{min-height:44px;font-size:15px}
  #userDrop .linkbtn{min-height:44px;display:inline-flex;align-items:center}
  /* banners: text first, actions on their own row, every control a real target */
  body .trial-banner{border-radius:var(--r-inner);flex-direction:column;align-items:stretch;text-align:center;gap:10px;padding:12px 14px}
  body .trial-banner .tb-actions{flex-wrap:wrap;justify-content:center;gap:8px}
  body .trial-banner .tb-upgrade,body .trial-banner .tb-manage{min-height:44px;padding:0 18px}
  body .trial-banner .tb-close{min-width:44px;min-height:44px;font-size:20px}
  /* the 2FA nudge sits in the page flow (see place in the two-step script), full width */
  main>#tfGrace{position:static;max-width:none;margin:0 0 14px;box-shadow:none;z-index:auto}
  #tfGrace .tf-row{display:flex;gap:8px;flex-wrap:wrap}
  #tfGrace .btn{min-height:44px;flex:1 1 120px}
  /* toast: top of the screen so it never sits on a bottom sheet / footer / recorder. It carries
     inline position styles, hence !important. */
  #wsToast{top:calc(8px + var(--ribbon-h) + env(safe-area-inset-top))!important;bottom:auto!important;left:12px!important;right:12px!important;
    transform:none!important;text-align:center;border-radius:14px!important;padding:12px 16px!important;max-width:none!important}
  /* anything else that sticks to the top of the viewport clears the sticky topbar (the list bulk bar is defined later in
     index.html at the same specificity, hence the body prefix) */
  body .bulkbar{top:calc(var(--topbar-h) + 8px)}
  /* meeting recorder: a bottom sheet, not a floating card that covers a corner */
  body #recorder{left:0;right:0;bottom:0;width:auto;max-width:none;border-radius:var(--r-card) var(--r-card) 0 0;
    max-height:min(88dvh,640px);padding:18px 16px calc(16px + env(safe-area-inset-bottom));z-index:75}
  #recorder .btn.minibtn{min-height:44px;padding:0 18px;flex:1 1 auto}
  #recorder input,#recorder select{font-size:16px;min-height:44px}
  #recorder .modal-x{width:44px;height:44px}
}
/* landscape phone (short + coarse pointer): the 2FA nudge sits in the page flow too (placeGrace moves it into <main>) */
@media(max-height:500px) and (pointer:coarse){
  main>#tfGrace{position:static;max-width:none;margin:0 0 14px;box-shadow:none;z-index:auto}
  #tfGrace .tf-row{display:flex;gap:8px;flex-wrap:wrap}
  #tfGrace .btn{min-height:44px;flex:1 1 120px}
}

/* ---------- topbar: Team (admin) / Settings / user chip, above every page (§3.1) ---------- */
.topbar .tb-left{flex:1;min-width:0}
.topbar .tb-right{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.tb-btn{appearance:none;border:1px solid var(--line);background:var(--card);color:var(--ink);border-radius:var(--r-pill);
  height:36px;padding:0 14px;display:inline-flex;align-items:center;gap:8px;font:inherit;font-size:14px;
  font-weight:700;cursor:pointer;white-space:nowrap}
.tb-btn:hover{background:var(--hover)}
.tb-btn.on{background:var(--ink);color:#FFFFFF}
.tb-btn svg{width:16px;height:16px;flex:0 0 auto;display:block}
.tb-btn.hide{display:none}
.tb-user{appearance:none;border:0;background:transparent;border-radius:var(--r-pill);height:36px;
  padding:0;display:inline-flex;align-items:center;gap:10px;cursor:pointer;font:inherit}
.tb-user .avatar{width:36px;height:36px;border-radius:9px;font-family:var(--mono);font-size:12px;font-weight:600}
.tb-user .avatar.ink{color:var(--lime)}
.tb-user:hover{opacity:.85}
/* Wave 4: subtle highlight while the Settings view is open — Team/Settings no longer have
   their own topbar buttons to carry that state, so the chip picks it up instead. */
.tb-user.on .avatar{box-shadow:0 0 0 2px var(--lime)}
.tb-user .tb-uname{font-size:14px;font-weight:600;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tb-user .sb-chev{color:var(--muted-2);font-size:11px;line-height:1}
/* the user dropdown now hangs off the topbar chip, anchored below it (not the old sidebar float) */
.usermenu{position:relative}
/* Dropdown menus (#userDrop, #clientMenu) are position:absolute, anchored below their
   trigger — not viewport-centred like .modal/.drawer, so they can't lean on a vh-based
   max-height alone. The base max-height/overflow below is the fallback; fitDropdown() in
   index.html sets an inline max-height at open time, capped to the real space between the
   trigger and the viewport bottom, so a long menu (or a short window) scrolls internally
   instead of running off-screen with no way back (Round 2 §3.1 follow-up). */
.userdrop{position:absolute;top:calc(100% + 8px);right:0;left:auto;z-index:60;background:var(--card);border-radius:var(--r-tile);border:1px solid var(--line-soft);
  box-shadow:var(--shadow-float);min-width:256px;padding:8px;max-height:calc(100vh - 24px);overflow-y:auto}
.userdrop.hide{display:none}
/* group label + divider inside a dropdown (the + menu's "This workflow" group) */
.ud-group{font:600 11px/1.3 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:8px 12px 4px}
.ud-sep{height:1px;background:var(--line-soft);margin:6px 8px}
/* org/seats tile (Round 2 §3.1 follow-up) — moved out of the sidebar's old .sb-foot into
   the user dropdown, directly under the identity block. Same look as the sidebar tile it
   replaced (surface bg, 24px radius, lime progress), sized down for the narrower dropdown. */
.ud-tile{background:var(--surface);border-radius:var(--r-tile);padding:14px 14px 12px;margin:0 2px 8px}
.ud-tile.hide{display:none}
.ud-tile .t{font-size:14px;font-weight:600;line-height:1.3}
.ud-tile .progress{background:var(--card);height:6px;margin-top:10px}
.ud-tile .progress>div{background:var(--lime)}
.ud-tile .c{font-size:13px;color:var(--muted);margin-top:8px}
.ud-tile .c a{color:var(--ink);font-weight:600}

/* ---------- search trigger in the topbar + the command palette it opens ---------- */
.tb-search{appearance:none;width:min(400px,100%);height:36px;display:flex;align-items:center;gap:8px;padding:0 8px 0 12px;border:1px solid var(--line);
  border-radius:var(--r-input);background:var(--card);color:var(--muted);font:inherit;font-size:14px;cursor:pointer;text-align:left}
.tb-search:hover{border-color:var(--muted-2);color:var(--ink)}
.tb-search svg{flex:0 0 auto}
.tb-search .tb-search-l{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.kbd{font:600 11px/1 var(--mono);padding:4px 6px;border-radius:5px;background:var(--surface);color:var(--muted);white-space:nowrap}
.cmdk-overlay{position:fixed;inset:0;z-index:120;background:var(--scrim);-webkit-backdrop-filter:var(--scrim-blur);backdrop-filter:var(--scrim-blur);
  display:flex;align-items:flex-start;justify-content:center;padding:12vh 16px 16px}
.cmdk-overlay.hide{display:none}
.cmdk{width:min(620px,100%);max-height:min(70vh,560px);display:flex;flex-direction:column;background:var(--card);border-radius:var(--r-card);box-shadow:var(--shadow-float);overflow:hidden}
.cmdk-head{display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--line-soft)}
.cmdk-head svg{flex:0 0 auto;color:var(--muted)}
.cmdk-head input{border:0;box-shadow:none;padding:16px 0;font-size:16px;background:transparent;min-height:0}
.cmdk-head input:focus{box-shadow:none}
.cmdk-list{overflow-y:auto;padding:6px;flex:1;min-height:0}
.cmdk-group{font:600 11px/1.3 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:10px 10px 4px}
.cmdk-item{appearance:none;display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:9px 10px;border:0;border-radius:8px;background:transparent;
  color:var(--ink);font:inherit;font-size:14px;font-weight:600;text-align:left;cursor:pointer}
.cmdk-item small{font-size:13px;font-weight:500;color:var(--muted);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cmdk-item.on{background:var(--ink);color:#FFFFFF}
.cmdk-item.on small{color:var(--muted-3)}
.cmdk-empty{padding:18px 12px;color:var(--muted);font-size:14px}
.cmdk-foot{display:flex;gap:14px;padding:9px 14px;border-top:1px solid var(--line-soft);font-size:12px;color:var(--muted)}
.cmdk-foot span{display:inline-flex;align-items:center;gap:6px}
@media(max-width:760px){
  .tb-search .kbd{display:none}
  .cmdk-overlay{padding:0}
  .cmdk{width:100%;max-height:100dvh;height:100dvh;border-radius:0}
  .cmdk-item{min-height:44px}
}

/* ---------- pill navigation (design system §03 Navigation) ---------- */
.pnav{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.pnav>a,.pnav>button{appearance:none;border:1px solid var(--line);background:var(--card);color:var(--ink);border-radius:var(--r-pill);
  padding:9px 16px;font:inherit;font-size:14px;font-weight:700;line-height:1.2;cursor:pointer;text-decoration:none;
  display:inline-flex;align-items:center;gap:8px;white-space:nowrap;position:relative}
.pnav>a:hover,.pnav>button:hover{background:var(--hover);color:var(--ink)}
.pnav>a.on,.pnav>button.on{background:var(--ink);border-color:var(--ink);color:#FFFFFF}
.pnav.on-surface>a,.pnav.on-surface>button{background:var(--surface)}
.pnav.on-surface>a:hover,.pnav.on-surface>button:hover{background:var(--hover-2)}
.pnav.on-surface>a.on,.pnav.on-surface>button.on{background:var(--ink)}
.pnav.compact>a,.pnav.compact>button{padding:6px 12px;font-size:13px}

/* ---------- buttons (design system §03 Actions) — pills only ---------- */
.btn{appearance:none;border:1px solid var(--line);border-radius:var(--r-pill);padding:8px 16px;min-height:38px;font:inherit;font-size:14px;font-weight:700;
  line-height:1.2;cursor:pointer;background:var(--card);color:var(--ink);display:inline-flex;align-items:center;
  justify-content:center;gap:8px;white-space:nowrap;text-decoration:none;transition:background .12s,color .12s,border-color .12s}
.btn:hover{background:var(--hover);color:var(--ink);border-color:var(--muted-2)}
.btn.primary{background:var(--ink);border-color:var(--ink);color:#FFFFFF}
.btn.primary:hover{background:var(--ink-hover);border-color:var(--ink-hover);color:#FFFFFF}
.btn.ghost{background:var(--surface);border-color:transparent;color:var(--ink)}          /* secondary on a white card */          /* secondary on a white card */
.btn.ghost:hover{background:var(--hover-2);border-color:transparent}
.btn.white{background:var(--card)}                              /* secondary on the canvas */
.btn.lime{background:var(--lime);border-color:var(--lime);color:var(--ink)}              /* the ONE most valuable action */              /* the ONE most valuable action */
.btn.lime:hover{background:var(--lime-hover);border-color:var(--lime-hover)}
.btn.outline{background:transparent;border:1px solid var(--line);color:var(--ink)}
.btn.outline:hover{background:var(--hover)}
.btn.danger{background:var(--bad-bg);border-color:transparent;color:var(--bad)}
.btn.danger:hover{background:#F0D9D3;border-color:transparent;color:var(--bad)}
.btn.link{background:transparent;border:0;min-height:0;padding:0;border-radius:0;text-decoration:underline;text-underline-offset:2px}
.btn.sm,.minibtn{padding:5px 12px;min-height:32px;font-size:13px}
.btn.xs{padding:3px 9px;min-height:26px;font-size:12px;border-radius:7px}
.btn.lg{padding:11px 20px;min-height:44px;font-size:15px}
.btn:disabled,.btn[aria-disabled="true"]{opacity:.5;cursor:not-allowed}
.btn.icon,.icobtn{width:36px;height:36px;min-height:0;padding:0;border-radius:var(--r-pill);flex:0 0 auto;font-size:14px}
.icobtn{appearance:none;border:1px solid transparent;background:var(--surface);color:var(--ink);display:inline-flex;align-items:center;
  justify-content:center;cursor:pointer;line-height:1}
.icobtn:hover{background:var(--hover-2)}
.icobtn.white{background:var(--card);border-color:var(--line)} .icobtn.white:hover{background:var(--hover);border-color:var(--muted-2)} .icobtn.white:hover{background:var(--hover)}
.icobtn.ink{background:var(--ink);color:#FFFFFF} .icobtn.ink:hover{background:var(--ink-hover)}
.icobtn.lime{background:var(--lime)} .icobtn.lime:hover{background:var(--lime-hover)}
.icobtn.sm{width:30px;height:30px;font-size:13px;border-radius:8px}
.icobtn.xs{width:26px;height:26px;font-size:12px;border-radius:7px}
.icobtn.danger{color:var(--bad)} .icobtn.danger:hover{background:var(--bad-bg)}
.icobtn:disabled{opacity:.45;cursor:default}
.icobtn svg{display:block}

/* ---------- pills / status chips (design system §04 Status & data tags) ---------- */
.pill{display:inline-flex;align-items:center;gap:5px;border-radius:var(--r-tag);padding:4px 7px;font:600 11px/1 var(--mono);letter-spacing:.01em;
  background:rgba(17,17,17,.06);color:var(--text-2);white-space:nowrap;vertical-align:middle}
.pill.ink{background:var(--ink);color:#FFFFFF}
.pill.lime{background:var(--lime-pale);color:var(--accent-text)}
.pill.lime-solid{background:var(--lime);color:var(--ink)}
.pill.outline{background:transparent;box-shadow:inset 0 0 0 1px var(--line);color:var(--muted)}
.pill.outline-ink{background:transparent;box-shadow:inset 0 0 0 1px var(--line);color:var(--ink)}
.pill.bad{background:var(--bad-bg);color:var(--bad)}
.pill.warn{background:var(--warn-bg);color:var(--warn)}
.pill.ok{background:var(--ok-bg);color:var(--ok)}
.pill.info{background:var(--info-bg);color:var(--info)}
.pill.sm{padding:3px 6px;font-size:11px}
.pill.xs{padding:2px 5px;font-size:11px}
/* a11y: a .tag/.pill used as a real <button> (not a span) resets native button chrome only —
   the pill/tag rules above still own background/color/padding/radius */
button.tag,button.pill{appearance:none;border:0;font:inherit;cursor:pointer}
/* data tags: rounded-square lime call-outs for chart values / deltas */
.tag{display:inline-flex;align-items:center;gap:5px;background:var(--lime);color:var(--ink);border-radius:var(--r-tag);padding:4px 7px;
  font:600 11px/1 var(--mono);white-space:nowrap}
.tag.ink{background:var(--ink);color:var(--lime)}
.tag.surface{background:rgba(17,17,17,.06);color:var(--text-2)}
.tag.sm{padding:3px 6px;font-size:11px;border-radius:var(--r-tag)}

/* ---------- cards (design system §05) — 28px, flat, no border ---------- */
.card{background:var(--card);border:1px solid var(--line-soft);border-radius:var(--r-card);padding:20px;box-shadow:none;margin:0 0 16px}
.card.surface{background:var(--card)}
.card.ink{background:var(--ink);border-color:var(--ink);color:#FFFFFF}
.card.lime{background:var(--lime);border-color:var(--lime);color:var(--ink)}
.card.lime-pale{background:var(--lime-pale);border-color:var(--lime-pale)}
.card.warn{background:var(--warn-bg);border-color:var(--warn-line);color:var(--warn)}
.card.warn a{font-weight:700;color:inherit}
.card.dashed{background:var(--surface);border:1px dashed #C9C9C6}
.card.tight{padding:16px}
.card.flush{padding:0;overflow:hidden}
.card h2{font-size:20px;font-weight:800;letter-spacing:-.02em;margin:0 0 4px}
.card h3{font-size:16px;font-weight:800;letter-spacing:-.015em;margin:0 0 8px}
.card .sub{font-size:13px;color:var(--muted);margin:0 0 14px}
.card.ink .sub,.card.ink .muted{color:var(--on-ink-muted)}
.card.lime .sub{color:var(--on-lime-2)} .card.lime .muted{color:var(--on-lime)}
.card-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.card-head .ttl{display:flex;flex-direction:column;gap:4px}
.card-head .ttl h3{margin:0}
.card-head .acts{display:flex;gap:8px;align-items:center}
.card-kicker{font-size:13px;color:var(--muted)}

/* ---------- forms ---------- */
label{display:block;font-size:13px;font-weight:600;color:var(--text-2);margin:0 0 5px}
input,select,textarea{width:100%;font:inherit;font-size:14px;color:var(--ink);background:var(--card);
  border:1px solid var(--line);border-radius:var(--r-input);padding:9px 12px;line-height:1.3}
input:hover,select:hover,textarea:hover{border-color:var(--muted-2)}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--ink);box-shadow:0 0 0 3px rgba(199,243,60,.45)}
input:disabled,select:disabled,textarea:disabled{background:var(--surface);color:var(--muted)}
input[type="checkbox"],input[type="radio"]{width:auto;accent-color:var(--ink);margin:0}
input[type="date"],input[type="time"]{min-height:38px}
select{appearance:none;-webkit-appearance:none;padding-right:34px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%239A9A96' stroke-width='1.5'/></svg>");
  background-repeat:no-repeat;background-position:right 14px center}
select[multiple]{background-image:none;padding-right:14px}
textarea{resize:vertical;min-height:96px}
input[type="file"]{padding:8px 10px;font-size:13px}
input[type="file"]::file-selector-button{font:inherit;font-size:13px;font-weight:600;border:0;border-radius:var(--r-pill);
  background:var(--surface);padding:6px 14px;margin-right:10px;cursor:pointer;color:var(--ink)}
.field{margin-bottom:14px}
.row{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:12px}
.row3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px;margin-bottom:12px}
/* Two- and three-up form rows stack on a phone (UX audit B/F82) — a 1fr 1fr pair is ~150px a
   side at 320px, too narrow for a date or an email. */
@media(max-width:600px){.row,.row3{grid-template-columns:1fr}}
fieldset{border:0;padding:0;margin:0}
/* search: surface pill with an ink circular button (design system §04) */
.search{display:flex;align-items:center;gap:10px;background:var(--card);border:1px solid var(--line);border-radius:var(--r-input);padding:3px 3px 3px 12px}
.search input{border:0;background:transparent;padding:6px 0;box-shadow:none;font-size:14px}
.search input:focus{box-shadow:none}
.search .icobtn{background:var(--ink);color:#FFFFFF}
.search.on-canvas{background:var(--card)}
/* toggle switch 46×28: ink track + lime knob on; #E0E0DD track + white knob off */
.switch{position:relative;display:inline-block;width:40px;height:24px;flex:0 0 auto}
.switch input{opacity:0;width:0;height:0;position:absolute}
.switch .sl{position:absolute;inset:0;background:#D9D9D5;border-radius:var(--r-round);transition:.18s;cursor:pointer}
.switch .sl:before{content:"";position:absolute;width:18px;height:18px;left:3px;top:3px;background:#FFFFFF;border-radius:50%;transition:.18s}
.switch input:checked+.sl{background:var(--ink)}
.switch input:checked+.sl:before{transform:translateX(16px);background:var(--lime)}
.switch input:focus-visible+.sl{outline:2px solid var(--ink);outline-offset:2px}

/* ---------- segmented control: surface track, ink thumb ---------- */
.seg{display:inline-flex;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:3px;gap:2px;align-items:center;max-width:100%}
.seg>button,.seg>a{appearance:none;border:0;background:transparent;border-radius:7px;padding:6px 12px;font:inherit;
  font-size:13px;font-weight:700;color:var(--muted);cursor:pointer;line-height:1.3;text-decoration:none;white-space:nowrap}
.seg>button:hover,.seg>a:hover{color:var(--ink)}
.seg>button.on,.seg>a.on{background:var(--ink);color:#FFFFFF}
.seg.on-canvas{background:var(--card)}
/* filter chips (quiet outlined pills) */
.chip,.tk-chip{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;padding:5px 11px;border-radius:var(--r-round);
  border:1px solid var(--line);background:var(--card);color:var(--text-2);cursor:pointer;line-height:1.3;white-space:nowrap}
.chip:hover,.tk-chip:hover{color:var(--ink);background:var(--hover)}
.chip.on,.tk-chip.on{background:var(--ink);border-color:var(--ink);color:#FFFFFF}
.chip.miss{background:var(--warn-bg);border-color:var(--warn-line);color:var(--warn)}
.chip.static{cursor:default}
.chips{display:flex;flex-wrap:wrap;gap:6px}

/* ---------- avatars (design system §04) ---------- */
.avatar{width:36px;height:36px;border-radius:50%;background:var(--av-1);color:var(--ink);display:inline-grid;
  place-items:center;font-size:12px;font-weight:700;letter-spacing:.01em;flex:0 0 auto;border:0;cursor:default;
  font-family:inherit;text-decoration:none;line-height:1}
.avatar.sm{width:28px;height:28px;font-size:11px}
.avatar.md{width:32px;height:32px;font-size:12px}
.avatar.lg{width:40px;height:40px;font-size:14px}
.avatar.xl{width:48px;height:48px;font-size:16px}
.avatar.ink{background:var(--ink);color:#FFFFFF}
.avatar.ink.on-lime{color:var(--lime)}
.avatar.lime{background:var(--lime);color:var(--ink)}
.avatar.av-1{background:var(--av-1)} .avatar.av-2{background:var(--av-2)}
.avatar.av-3{background:var(--av-3)} .avatar.av-4{background:var(--av-4)}
.avatar[role="button"],button.avatar{cursor:pointer}
.avatar-stack{display:flex;align-items:center}
.avatar-stack .avatar{border:3px solid var(--canvas)}
.avatar-stack .avatar+.avatar{margin-left:-12px}
.card .avatar-stack .avatar{border-color:var(--card)}

/* ---------- tables ---------- */
table{width:100%;border-collapse:collapse;font-size:14px}
th{text-align:left;font:600 11px/1.3 var(--mono);letter-spacing:.05em;text-transform:uppercase;color:var(--muted);padding:8px 10px;border-bottom:1px solid var(--line);
  white-space:nowrap}
td{padding:12px 10px;border-bottom:1px solid var(--line-row);vertical-align:middle}
tbody tr:last-child td{border-bottom:0}
tfoot td{border-bottom:0;border-top:1px solid var(--line);font-weight:700}
td.r,th.r{text-align:right}
th.sortable{cursor:pointer;user-select:none}
th.sortable:hover{color:var(--ink)}
th.sortable .sortind{font-size:11px;margin-left:4px;color:var(--ink);visibility:hidden}
th.sortable.sorted .sortind{visibility:visible}
tr.clickable,tr[data-eng],tr[data-c]{cursor:pointer}
tbody tr.clickable:hover td,tbody tr.hoverable:hover td{background:var(--row-hover)}
.tbl-wrap{overflow-x:auto}

/* ---------- lists ---------- */
.listrows{list-style:none;padding:0;margin:0;font-size:14px}
.listrows li{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 6px;border-radius:0;
  border-bottom:1px solid var(--line-row);cursor:pointer}
.listrows li:last-child{border-bottom:0}
.listrows li:hover{background:var(--row-hover)}
.listrows .nm{font-weight:700}
.listrows li.empty{cursor:default;color:var(--muted)}
.listrows li.empty:hover{background:transparent}
.empty{color:var(--muted);font-size:14px;padding:10px 0}
/* task-style check rows (dashboard "Today's tasks") */
.checkrow{display:flex;align-items:center;gap:10px;padding:8px 6px;border-radius:8px;font-size:14px}
.checkrow:hover{background:var(--row-hover)}
.checkrow .box{width:18px;height:18px;border-radius:5px;border:1.5px solid var(--line-check);display:grid;place-items:center;
  font-size:11px;flex:0 0 auto;cursor:pointer;background:transparent;appearance:none;font:inherit;padding:0}
.checkrow.done .box{background:var(--lime);border-color:var(--lime)}
.checkrow.done span{color:var(--muted-2);text-decoration:line-through}

/* ---------- settings: grouped panes (2 Dec 2026) ----------
   A long settings pane is a stack of cards under small group labels, with jump links at the top. */
.set-stack{display:flex;flex-direction:column;gap:16px}
.set-stack.hide{display:none}
.set-stack>.card{margin:0}
.set-jump{display:flex;gap:8px;flex-wrap:wrap}
.set-jump button{appearance:none;border:1px solid var(--line);background:var(--card);color:var(--ink);font:inherit;font-size:13px;font-weight:600;
  padding:6px 14px;border-radius:999px;cursor:pointer;min-height:36px}
.set-jump button:hover{background:var(--surface)}
.set-jump button:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.set-sec-h{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;margin:12px 2px -4px;scroll-margin-top:84px}
.set-sec-h b{font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--ink)}
.set-sec-h span{font-size:13px;color:var(--muted)}
@media(max-width:760px){ .set-jump button{min-height:44px} .set-sec-h{scroll-margin-top:calc(var(--topbar-h) + 12px)} }
/* ---------- beta banner (2 Dec 2026) ----------
   One line at the top of the public pages and under the app's topbar. In the page flow, not fixed:
   it scrolls away, so it never sits on top of the sticky header, the sidebar or a pinned panel. */
.beta-banner{display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;margin:0;padding:8px 16px;
  background:var(--ink);color:#fff;font-size:13px;font-weight:500;line-height:1.4;text-align:center}
.beta-banner .beta-tag{flex:0 0 auto;padding:1px 8px;border-radius:999px;background:#fff;color:var(--ink);
  font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}
.beta-banner.in-app{justify-content:flex-start;text-align:left;margin:12px auto 16px;padding:10px 14px;
  border-radius:var(--r-inner);background:var(--info-bg);color:var(--info)}
.beta-banner.in-app .beta-tag{background:var(--info);color:#fff}
/* ---------- alerts / notices ---------- */
.alert,.warn-box,.notice{border-radius:var(--r-inner);padding:12px 14px;font-size:14px;margin-bottom:16px}
.alert.ok,.notice.ok{background:var(--ok-bg);color:var(--ok)}
.alert.gap,.alert.warn,.notice.warn,.warn-box{background:var(--warn-bg);color:var(--warn)}
.alert.bad,.notice.bad{background:var(--bad-bg);color:var(--bad)}
.alert.info,.notice.info{background:var(--info-bg);color:var(--info)}
.alert a{font-weight:700;color:inherit}

/* ---------- charts ---------- */
.bars{display:flex;align-items:flex-end;gap:12px;height:190px;padding-top:26px}
.bars .col{flex:1;display:flex;flex-direction:column;align-items:center;gap:8px;height:100%;justify-content:flex-end;position:relative;min-width:0}
.bars .bar{width:100%;background:var(--line-soft);border-radius:4px 4px 0 0;min-height:4px}
.card.surface .bars .bar{background:var(--card)}
.bars .bar.top{background:var(--lime)}
.card.surface .bars .bar.top{background:var(--lime)}
.bars .lbl{font:500 11px/1.3 var(--mono);color:var(--muted);white-space:nowrap}
.bars .val{position:absolute;top:-26px;left:50%;transform:translateX(-50%);z-index:1}
.chart-axis{display:flex;justify-content:space-between;font:500 11px/1.3 var(--mono);color:var(--muted);padding-top:10px}
.hatch-swatch{display:inline-block;width:20px;height:10px;border-radius:3px;border:1px solid var(--line);
  background:repeating-linear-gradient(45deg,#C9C9C6 0 2px,#FFFFFF 2px 6px);vertical-align:middle}
.progress{height:6px;background:var(--surface);border-radius:var(--r-round);overflow:hidden}
.progress>div{height:100%;background:var(--ink);width:0;transition:width .4s}
.progress.lime>div{background:var(--lime)}

/* ---------- layout helpers ---------- */
.page{max-width:1240px;min-width:0;margin:0 auto;padding:24px 28px 64px}
/* Round 2 Wave 3a: hero simplified to H1 + one action row, vertically centred, dashboard
   only consumer — crumbs/date-pill rules dropped as dead code along with the markup. */
.hero{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 0 20px}
.hero .hero-l{display:flex;flex-direction:column;min-width:0}
/* Compact enough to share one calm row with dashboard actions at wide desktop sizes. */
.hero h1{font-size:clamp(24px,20px + 1vw,32px);font-weight:800;letter-spacing:-.035em;line-height:1.1;margin:0}
.hero .hero-r{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.pagehead{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;margin-bottom:16px;flex-wrap:wrap}
.pagehead h2{font-size:clamp(22px,18px + 1vw,28px);font-weight:800;letter-spacing:-.035em;line-height:1.1;margin:0}
.grid2{display:grid;grid-template-columns:minmax(0,380px) minmax(0,1fr);gap:16px;align-items:start}
.grid2.even{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
/* Round 3 §5.1 fix: a bare 1fr track has an implicit minmax(auto,1fr) minimum — same class of bug as the .appshell align-items gap above — so a wide child (the revenue "Trail by insurer" donut + legend row, or any .tbl-wrap table) still pushed the single collapsed column past the viewport. minmax(0,1fr) matches the desktop rule's own minimum and lets each card's own overflow-x:auto (.tbl-wrap) do the clipping instead. */
@media(max-width:880px){.grid2,.grid2.even{grid-template-columns:minmax(0,1fr)}}
.stack{display:flex;flex-direction:column;gap:16px}
.rowbreak{height:20px}
.foot{text-align:center;color:var(--muted);font-size:12px;margin-top:24px}
.crumb{font-size:13px;font-weight:600;color:var(--muted);margin-bottom:10px;display:flex;gap:7px;align-items:center;flex-wrap:wrap}
.crumb a{color:var(--muted);text-decoration:none}
.crumb a:hover{color:var(--ink);text-decoration:underline}
.crumb .sep{color:var(--muted-3)}
.crumb .here{color:var(--ink);font-weight:600}

/* ---------- overlays: modal / drawer / busy ---------- */
.modal-overlay{position:fixed;inset:0;background:var(--scrim);-webkit-backdrop-filter:var(--scrim-blur);backdrop-filter:var(--scrim-blur);z-index:90;display:flex;align-items:center;justify-content:center;padding:24px}
.modal-overlay.hide{display:none}
.modal{background:var(--card);border-radius:var(--r-card);max-width:760px;width:100%;max-height:88vh;display:flex;flex-direction:column;
  box-shadow:var(--shadow-float);overflow:hidden}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 10px}
.modal-head h3{margin:0;font-size:18px;font-weight:800;letter-spacing:-.015em}
.modal-x{appearance:none;background:var(--surface);border:0;width:32px;height:32px;border-radius:8px;font-size:18px;line-height:1;
  cursor:pointer;color:var(--ink);display:inline-grid;place-items:center;padding:0}
.modal-x:hover{background:var(--hover-2)}
.modal-body{padding:4px 20px 14px;overflow:auto}
.modal-foot{padding:10px 20px 16px;display:flex;gap:8px;justify-content:flex-end}
.modal-foot:empty{display:none}
/* UI-UX-RULES §3: create/edit/upload/review flows open as a large centred overlay sheet
   (not a side drawer), page behind dimmed ~70% with blur. Every flow goes through
   openDrawer(), so this one rule converts all of them. */
.drawer-overlay{position:fixed;inset:0;background:var(--scrim);-webkit-backdrop-filter:var(--scrim-blur);backdrop-filter:var(--scrim-blur);z-index:60;display:flex;justify-content:center;align-items:center;padding:24px}
.drawer-overlay.hide{display:none}
.drawer{width:min(860px,100%);max-height:min(92vh,100%);background:var(--card);border-radius:var(--r-card);box-shadow:var(--shadow-float);
  display:flex;flex-direction:column;animation:drawerIn .16s ease;overflow:hidden}
.drawer-overlay.wide .drawer{width:min(1080px,100%)}
@keyframes drawerIn{from{transform:translateY(12px);opacity:.5}to{transform:none;opacity:1}}
@media (max-width:600px){.drawer-overlay,.modal-overlay{padding:0}.drawer,.drawer-overlay.wide .drawer{width:100%;height:100%;border-radius:0}
  .modal{max-height:100vh;height:100%;border-radius:0}}
@media (prefers-reduced-motion:reduce){.drawer{animation:none}}
/* §1: negatives left, positives right — the first negative action is pushed to the left edge. */
/* §1 order is set by uiOrderActions() + .is-neg spacing in index.html (UI kit). */
.drawer-head{display:flex;justify-content:space-between;align-items:center;padding:16px 20px 10px}
.drawer-head h3{font-size:18px;font-weight:800;letter-spacing:-.015em;margin:0}
.drawer-body{padding:4px 20px 14px;overflow:auto;flex:1}
.drawer-foot{display:flex;gap:8px;justify-content:flex-end;padding:10px 20px 16px;border-top:1px solid var(--line-soft)}
/* UX round 4 §3: sheet density. Fields sit 8px apart, labels are 12px with a 4px gap to the control, and a textarea grows with its
   content instead of scrolling inside a sheet that also scrolls. Scoped to the sheet bodies so page forms keep their rhythm. */
.drawer-body .field,.modal-body .field{margin-bottom:8px}
.drawer-body label,.modal-body label{font-size:12px;margin-bottom:4px}
.drawer-body .row,.drawer-body .row3,.modal-body .row,.modal-body .row3{gap:8px 12px;margin-bottom:8px}
textarea.autogrow{resize:none;overflow-y:auto;min-height:64px;max-height:40vh}
/* .sheet-2col: two columns when the sheet is wide (>=720px of sheet), one below. Container query on the .sheet-host wrapper,
   so it follows the sheet's width and not the window's. */
.sheet-host{container-type:inline-size;container-name:sheet}   /* wrapper around a .sheet-2col grid, only where it is used */
.sheet-2col{display:grid;grid-template-columns:minmax(0,1fr);gap:0 28px;align-items:start}
.sheet-2col>.sheet-col{min-width:0}
.sheet-2col>.sheet-full{grid-column:1/-1}
@container sheet (min-width:720px){.sheet-2col{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}

/* ---------- loading feedback (spinner; the floating #loadPill lives in index.html) ---------- */
@keyframes bspinner{to{transform:rotate(360deg)}}
.spinner{width:18px;height:18px;border:2px solid rgba(17,17,17,.15);border-top-color:var(--ink);border-radius:50%;
  animation:bspinner .7s linear infinite;display:inline-block;flex:0 0 auto}
.card.ink .spinner{border-color:rgba(255,255,255,.2);border-top-color:var(--lime)}

/* ---------- misc primitives ---------- */
.kv{font-size:14px;margin:3px 0} .kv b{color:var(--ink);font-weight:600}
/* Beta marker for features that work but are still changing (recorder, partner portal). */
.beta-tag{display:inline-block;font:600 10px/1 var(--mono);letter-spacing:.06em;text-transform:uppercase;padding:3px 6px;border-radius:5px;border:1px solid var(--line);color:var(--muted);background:var(--card);vertical-align:middle;margin-left:6px;white-space:nowrap}
.badge{font:600 11px/1 var(--mono);padding:4px 7px;border-radius:var(--r-tag);flex-shrink:0;text-align:center}
.badge.pass,.badge.ok{background:var(--ok-bg);color:var(--ok)}
.badge.missing,.badge.bad{background:var(--bad-bg);color:var(--bad)}
.badge.manual,.badge.warn{background:var(--warn-bg);color:var(--warn)}
.count{display:inline-block;min-width:16px;text-align:center;background:var(--lime);color:var(--ink);font:600 11px/16px var(--mono);
  border-radius:5px;padding:0 5px;margin-left:6px}
.count.bad{background:var(--bad);color:#FFFFFF}
pre.md,pre.code{white-space:pre-wrap;background:var(--surface);border:0;border-radius:var(--r-inner);padding:14px 16px;
  font-family:var(--mono);font-size:12px;max-height:340px;overflow:auto}
details.acc{background:var(--surface);border:0;border-radius:var(--r-inner);margin:0 0 10px;padding:0}
details.acc>summary{list-style:none;cursor:pointer;padding:11px 14px;font-size:14px;font-weight:700;color:var(--ink);
  display:flex;align-items:center;gap:8px;user-select:none}
details.acc>summary::-webkit-details-marker{display:none}
details.acc>summary::before{content:"\203A";color:var(--muted);font-weight:700;transition:transform .15s;display:inline-block}
details.acc[open]>summary::before{transform:rotate(90deg)}
details.acc>summary .sumhint{font-weight:500;font-size:12px;color:var(--muted-2);margin-left:auto;text-align:right}
details.acc .accbody{padding:4px 16px 16px}
.hide{display:none}
/* body scroll-lock while a modal/drawer/full-screen chat is open (Round 2 §3.1) — the
   JS toggle is ref-counted (see web/index.html lockScroll/unlockScroll). */
body.no-scroll{overflow:hidden}

/* ---------- Mobile pass — touch targets and form fonts (phone tier) ----------
   Rule: every button, icon button, tab, chip and toggle is a >=44px target and iOS never zooms a focused
   field (inputs >=16px). Pills that are too small to grow visibly get an invisible hit area instead (the
   .m-hit helper below). Scoped to <=760px plus a landscape phone (short + coarse pointer, the overlay kit's own tier),
   so the desktop / tablet density is unchanged. */
@media(max-width:760px),(max-height:500px) and (pointer:coarse){
  .btn,.btn.sm,.btn.xs,.minibtn{min-height:44px}
  .btn.link{min-height:44px;padding:0 4px}
  .icobtn,.icobtn.sm,.icobtn.xs,.btn.icon{width:44px;height:44px;min-width:44px;font-size:15px}
  .miniico,button.miniico{width:44px;height:44px;min-width:44px}
  th[tabindex],th.sortable{height:44px;padding-bottom:0;vertical-align:middle}
  .tb-btn,.pnav>a,.pnav>button,.pnav.compact>a,.pnav.compact>button{min-height:44px}
  .chip,.tk-chip{min-height:44px;padding:0 16px}
  .seg>button,.seg>a{min-height:44px;padding:0 16px;font-size:14px;display:inline-flex;align-items:center;justify-content:center}
  .seg{padding:0}
  /* !important on purpose: dozens of page-level rules set 12.5-14px on one field or another, and iOS zooms the
     page whenever a focused field is under 16px. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),select,textarea{font-size:16px!important}
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select{min-height:44px}
  input[type="date"],input[type="time"]{min-height:44px}
  /* checkboxes / radios / switches: the glyph stays, the hit area grows */
  input[type="checkbox"],input[type="radio"]{width:22px;height:22px}
  .switch{width:52px;height:32px}
  .switch .sl:before{width:26px;height:26px}
  .switch input:checked+.sl:before{transform:translateX(20px)}
  .switch::after{content:"";position:absolute;left:-4px;right:-4px;top:50%;height:44px;transform:translateY(-50%)}   /* 32px track, 44px hit area (the label is the target) */
  .m-hit{position:relative}
  .m-hit::after{content:"";position:absolute;left:-6px;right:-6px;top:50%;height:44px;transform:translateY(-50%)}
  .listrows li{min-height:44px}
  /* the sticky topbar must not cover what scrollIntoView / focus scrolls to */
  .view .card,.view>*,[data-adm-pane],[data-card]{scroll-margin-top:calc(var(--topbar-h) + 12px)}
  input,select,textarea{scroll-margin:calc(var(--topbar-h) + 16px) 0 96px}
  /* a bare checkbox / radio inside a <label> is tapped through the label: make the label the 44px target */
  label:not(.switch):has(>input[type="checkbox"]),label:not(.switch):has(>input[type="radio"]){min-height:44px}
}
