/* Pager — the design system (see docs/DESIGN.md).
   Layers: tokens (colors, type, spacing) → base (elements) → components (classes) → views (screen-specific) → utilities.
   Theme hooks written by app.js at runtime: --accent-l/-d, --accent-ink-l/-d, --accent2-l/-d, --accent2-ink-l/-d,
   --low/--high/--critical (+ *-ink) on :root, and data-theme (light|dark|auto), data-density (comfortable|compact),
   data-font (system|grotesque|humanist). Everything else is derived from those with color-mix()/OKLCH — never hard-code
   a color in a component. The accent appears on exactly four things: the primary action, the current nav item, focus,
   and the on-call banner edge. */
@layer tokens, base, components, views, utilities;

@font-face {
  font-family: "InterVariable";
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ========================================================================== tokens */
@layer tokens {
  :root {
    /* --- brand (set by the Appearance screen) --- */
    --accent-l: #174ea0; --accent-ink-l: #ffffff; --accent-d: #8aa8d8; --accent-ink-d: #111111;
    --accent2-l: #f29130; --accent2-ink-l: #1a1200; --accent2-d: #f29130; --accent2-ink-d: #111111;
    --accent-text-l: #174ea0; --accent-text-d: #8aa8d8;   /* the accent as text (current nav item), mixed toward ink until 4.5:1 */
    --accent: var(--accent-l); --accent-ink: var(--accent-ink-l); --accent-2: var(--accent2-l); --accent-2-ink: var(--accent2-ink-l); --accent-text: var(--accent-text-l);
    --low: #b8740a; --low-ink: #111111; --high: #e5560f; --high-ink: #111111; --critical: #dc2626; --critical-ink: #ffffff;

    /* --- neutral scale (plain hex first; the OKLCH derivation below overrides where supported) --- */
    --surface-1: #f3f4f6; --surface-2: #ffffff; --surface-3: #eceef1;
    --ink-1: #17191d; --ink-2: #4a4f58; --ink-3: #636973;
    --line-1: rgba(23, 25, 29, .10); --line-2: rgba(23, 25, 29, .18);
    --ok: #0f7a55; --ok-text: #0b6a49; --ok-tint: #e3f4ec;
    --danger: #c92a2a; --danger-text: #a61e1e; --danger-tint: #fbe7e7;
    --info-text: #1d4ed8;
    --low-text: #7d4e05; --high-text: #9a3a0a; --critical-text: #a11a1a;
    --low-tint: #faf0e0; --high-tint: #fbe9de; --critical-tint: #fbe3e3;
    --shadow-overlay: 0 18px 50px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .08);
    --scrim: rgba(10, 10, 12, .48);
    color-scheme: light;

    /* --- legacy aliases (older markup and inline styles still name these) --- */
    --bg: var(--surface-1); --surface: var(--surface-2); --inset: var(--surface-3);
    --ink: var(--ink-1); --muted: var(--ink-3); --line: var(--line-2);
    --green: var(--ok); --green-ink: var(--ok-text); --green-soft: var(--ok-tint);
    --red: var(--danger); --red-ink: var(--danger-text); --red-soft: var(--danger-tint);
    --blue: var(--info-text);
    --shadow: var(--shadow-overlay);

    /* --- focus (the accent is one of its four places) --- */
    --focus: var(--accent);
    --focus-halo: color-mix(in srgb, var(--accent) 28%, transparent);

    /* --- type: fluid, two weights --- */
    --font-sans: "InterVariable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font: var(--font-sans);
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --fs: clamp(16px, 15.4px + 0.2vw, 17px);        /* body 16–17 px */
    --w-regular: 400; --w-strong: 600;
    --t-xs: .75rem;                                   /* 12 px: uppercase labels only */
    --t-sm: .875rem;                                  /* 14 px: captions and meta lines */
    --t-base: 1rem;
    --t-md: 1.0625rem;
    --t-lg: clamp(1.125rem, 1.05rem + .35vw, 1.3125rem);      /* section titles */
    --t-xl: clamp(1.375rem, 1.2rem + .8vw, 1.75rem);          /* the on-call name, sheet titles */
    --t-2xl: clamp(1.75rem, 1.45rem + 1.4vw, 2.375rem);       /* screen titles */
    --track-display: -0.025em; --track-title: -0.015em; --track-label: .08em;
    --lh-body: 1.5; --lh-tight: 1.15;

    /* --- spacing, shape, sizes (density flips these) --- */
    --pad: 16px; --pad-s: 12px; --gap: 10px; --name: var(--t-xl); --tile-av: 56px;
    --btn-h: 44px; --btn-pad: 10px 16px; --page-h: 64px; --page-font: 1.3125rem; --nav-h: 64px;
    --radius: 16px; --radius-sm: 12px; --radius-xs: 8px;
    --sheet-x: 20px;

    /* --- motion --- */
    --ease: cubic-bezier(.2, .8, .2, 1);
    --spring: cubic-bezier(.22, 1.1, .32, 1);
    --dur-1: .12s; --dur-2: .2s; --dur-3: .32s;
  }

  /* A light block nested in a dark page (the Appearance preview, also "auto" on a light device) restates the light set. */
  [data-theme="light"], [data-theme="auto"] {
    --accent: var(--accent-l); --accent-ink: var(--accent-ink-l); --accent-2: var(--accent2-l); --accent-2-ink: var(--accent2-ink-l); --accent-text: var(--accent-text-l);
    --surface-1: #f3f4f6; --surface-2: #ffffff; --surface-3: #eceef1; --ink-1: #17191d; --ink-2: #4a4f58; --ink-3: #636973;
    --line-1: rgba(23, 25, 29, .10); --line-2: rgba(23, 25, 29, .18);
    --ok: #0f7a55; --ok-text: #0b6a49; --ok-tint: #e3f4ec; --danger: #c92a2a; --danger-text: #a61e1e; --danger-tint: #fbe7e7; --info-text: #1d4ed8;
    --low-text: #7d4e05; --high-text: #9a3a0a; --critical-text: #a11a1a; --low-tint: #faf0e0; --high-tint: #fbe9de; --critical-tint: #fbe3e3;
    --shadow-overlay: 0 18px 50px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .08); --scrim: rgba(10, 10, 12, .48);
    color-scheme: light;
  }

  /* Neutrals derived from the chosen accent: a whisper of its hue in light, true neutral in dark (OLED-friendly, never navy). */
  @supports (color: color-mix(in oklch, red 10%, white)) {
    :root, [data-theme="light"], [data-theme="auto"] {
      --surface-1: color-mix(in oklch, var(--accent) 4%, oklch(97.2% 0 none));
      --surface-2: oklch(100% 0 none);
      --surface-3: color-mix(in oklch, var(--accent) 5%, oklch(95% 0 none));
      --ink-1: color-mix(in oklch, var(--accent) 10%, oklch(17% 0 none));
      --ink-2: color-mix(in oklch, var(--accent) 10%, oklch(38% 0 none));
      --ink-3: color-mix(in oklch, var(--accent) 8%, oklch(46% 0 none));
      --line-1: color-mix(in srgb, var(--ink-1) 10%, transparent);
      --line-2: color-mix(in srgb, var(--ink-1) 18%, transparent);
      --ok: oklch(52% .13 160); --ok-text: oklch(42% .12 160); --ok-tint: color-mix(in oklch, var(--ok) 12%, var(--surface-2));
      --danger: oklch(52% .2 27); --danger-text: oklch(44% .18 27); --danger-tint: color-mix(in oklch, var(--danger) 10%, var(--surface-2));
      --info-text: oklch(45% .17 262);
      /* toward a hueless grey (not the accent-tinted ink) so each severity keeps its hue; contrastReport() in app.js mirrors these */
      --low-text: color-mix(in oklch, var(--low) 70%, oklch(17% 0 none));
      --high-text: color-mix(in oklch, var(--high) 68%, oklch(17% 0 none));
      --critical-text: color-mix(in oklch, var(--critical) 72%, oklch(17% 0 none));
      --low-tint: color-mix(in oklch, var(--low) 12%, var(--surface-2));
      --high-tint: color-mix(in oklch, var(--high) 10%, var(--surface-2));
      --critical-tint: color-mix(in oklch, var(--critical) 9%, var(--surface-2));
    }
  }

  /* Dark: true neutral greys on an OKLCH lightness scale. The lightened accent (-d) keeps 4.5:1 on these. */
  [data-theme="dark"] {
    --accent: var(--accent-d); --accent-ink: var(--accent-ink-d); --accent-2: var(--accent2-d); --accent-2-ink: var(--accent2-ink-d); --accent-text: var(--accent-text-d);
    --surface-1: #0b0b0c; --surface-2: #171718; --surface-3: #232325;
    --ink-1: #ececec; --ink-2: #b3b3b5; --ink-3: #939396;
    --line-1: rgba(236, 236, 236, .11); --line-2: rgba(236, 236, 236, .2);
    --ok: #3fcf95; --ok-text: #6fdfb0; --ok-tint: #12302a; --danger: #ff6b6b; --danger-text: #ff8a8a; --danger-tint: #3a1d1d; --info-text: #8ab4ff;
    --low-text: #e9b25c; --high-text: #ff9a66; --critical-text: #ff8484; --low-tint: #2b2416; --high-tint: #2e2017; --critical-tint: #301a1a;
    --shadow-overlay: 0 18px 50px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4); --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
  @supports (color: color-mix(in oklch, red 10%, white)) {
    [data-theme="dark"] {
      --surface-1: oklch(12% 0 none); --surface-2: oklch(19% 0 none); --surface-3: oklch(24% 0 none);
      --ink-1: oklch(94% 0 none); --ink-2: oklch(78% 0 none); --ink-3: oklch(68% 0 none);
      --line-1: color-mix(in srgb, var(--ink-1) 11%, transparent); --line-2: color-mix(in srgb, var(--ink-1) 20%, transparent);
      --ok: oklch(76% .15 160); --ok-text: oklch(82% .13 160); --ok-tint: color-mix(in oklch, var(--ok) 16%, var(--surface-2));
      --danger: oklch(70% .18 27); --danger-text: oklch(78% .14 27); --danger-tint: color-mix(in oklch, var(--danger) 16%, var(--surface-2));
      --info-text: oklch(78% .11 262);
      --low-text: color-mix(in oklch, var(--low) 62%, var(--ink-1));
      --high-text: color-mix(in oklch, var(--high) 60%, var(--ink-1));
      --critical-text: color-mix(in oklch, var(--critical) 62%, var(--ink-1));
      --low-tint: color-mix(in oklch, var(--low) 16%, var(--surface-2));
      --high-tint: color-mix(in oklch, var(--high) 14%, var(--surface-2));
      --critical-tint: color-mix(in oklch, var(--critical) 14%, var(--surface-2));
    }
  }
  @media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
      --accent: var(--accent-d); --accent-ink: var(--accent-ink-d); --accent-2: var(--accent2-d); --accent-2-ink: var(--accent2-ink-d); --accent-text: var(--accent-text-d);
      --surface-1: #0b0b0c; --surface-2: #171718; --surface-3: #232325;
      --ink-1: #ececec; --ink-2: #b3b3b5; --ink-3: #939396;
      --line-1: rgba(236, 236, 236, .11); --line-2: rgba(236, 236, 236, .2);
      --ok: #3fcf95; --ok-text: #6fdfb0; --ok-tint: #12302a; --danger: #ff6b6b; --danger-text: #ff8a8a; --danger-tint: #3a1d1d; --info-text: #8ab4ff;
      --low-text: #e9b25c; --high-text: #ff9a66; --critical-text: #ff8484; --low-tint: #2b2416; --high-tint: #2e2017; --critical-tint: #301a1a;
      --shadow-overlay: 0 18px 50px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4); --scrim: rgba(0, 0, 0, .6);
      color-scheme: dark;
    }
    @supports (color: color-mix(in oklch, red 10%, white)) {
      [data-theme="auto"] {
        --surface-1: oklch(12% 0 none); --surface-2: oklch(19% 0 none); --surface-3: oklch(24% 0 none);
        --ink-1: oklch(94% 0 none); --ink-2: oklch(78% 0 none); --ink-3: oklch(68% 0 none);
        --line-1: color-mix(in srgb, var(--ink-1) 11%, transparent); --line-2: color-mix(in srgb, var(--ink-1) 20%, transparent);
        --ok: oklch(76% .15 160); --ok-text: oklch(82% .13 160); --ok-tint: color-mix(in oklch, var(--ok) 16%, var(--surface-2));
        --danger: oklch(70% .18 27); --danger-text: oklch(78% .14 27); --danger-tint: color-mix(in oklch, var(--danger) 16%, var(--surface-2));
        --info-text: oklch(78% .11 262);
        --low-text: color-mix(in oklch, var(--low) 62%, var(--ink-1));
        --high-text: color-mix(in oklch, var(--high) 60%, var(--ink-1));
        --critical-text: color-mix(in oklch, var(--critical) 62%, var(--ink-1));
        --low-tint: color-mix(in oklch, var(--low) 16%, var(--surface-2));
        --high-tint: color-mix(in oklch, var(--high) 14%, var(--surface-2));
        --critical-tint: color-mix(in oklch, var(--critical) 14%, var(--surface-2));
      }
    }
  }

  [data-density="compact"] {
    --pad: 12px; --pad-s: 8px; --gap: 6px; --name: var(--t-lg); --tile-av: 44px;
    --btn-h: 40px; --btn-pad: 8px 12px; --page-h: 54px; --page-font: 1.125rem; --nav-h: 56px;
    --radius: 12px; --radius-sm: 10px; --radius-xs: 6px; --sheet-x: 16px;
  }
  /* The bundled face is the default; the two optional choices load from Google Fonts when online and fall back to it. */
  [data-font="grotesque"] { --font: "Bricolage Grotesque", var(--font-sans); }
  [data-font="humanist"] { --font: "Source Sans 3", var(--font-sans); }
}

/* ========================================================================== base */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
  html, body { margin: 0; min-height: 100%; }
  body {
    background: var(--surface-1); color: var(--ink-1); font-family: var(--font); font-weight: var(--w-regular);
    font-size: 1rem; line-height: var(--lh-body); -webkit-font-smoothing: antialiased; font-optical-sizing: auto;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
    accent-color: var(--accent);
  }
  button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
  button { cursor: pointer; }
  button:disabled { cursor: default; }
  a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: .18em; text-decoration-thickness: 1px; }
  a:hover { text-decoration-color: currentColor; }
  b, strong { font-weight: var(--w-strong); }
  h1, h2, h3, h4 { font-weight: var(--w-strong); line-height: var(--lh-tight); text-wrap: balance; overflow-wrap: break-word; }
  h1 { font-size: var(--t-2xl); letter-spacing: var(--track-display); margin: 8px 0 16px; }
  h2 { font-size: var(--t-lg); letter-spacing: var(--track-title); margin: 28px 0 10px; color: var(--ink-1); }
  h3 { font-size: var(--t-md); letter-spacing: var(--track-title); margin: 16px 0 6px; }
  p { margin: 0 0 .75em; }
  p:last-child { margin-bottom: 0; }
  img, svg { display: inline-block; vertical-align: middle; }
  time, .countdown, .when, .num, .code, .dp-value, .dp-day, .dp-spin input, .dp-colon, .timeline time, .chart text, .stepper input, .ladder-ticks, .grid-days, .tz-list .off, .step { font-variant-numeric: tabular-nums slashed-zero; }
  ::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-halo); }
  :focus:not(:focus-visible) { outline: 0; }
  /* WCAG 2.4.11: whatever gets focus scrolls clear of the fixed bottom nav (phones) — and of a sheet's sticky header and action bar. */
  html { scroll-padding-top: 16px; scroll-padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
  @media (min-width: 900px) { html { scroll-padding-bottom: 16px; } }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after, ::backdrop { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
    /* Entrances become plain fades: the only thing that still moves is opacity. */
    dialog.sheet[open], dialog.sheet[open]::backdrop, [popover]:popover-open, .toast, .dp { transition: opacity .15s linear !important; transform: none !important; }
  }
}

/* ========================================================================== components */
@layer components {
  /* ---- icons: one 24-grid, 1.75 px stroke set (PATHS in app.js) ---- */
  .ic { width: 20px; height: 20px; flex: none; vertical-align: -5px; }
  .ic.big { width: 24px; height: 24px; vertical-align: -6px; }
  .ic.flip { transform: scaleX(-1); }
  .logo { width: 28px; height: 28px; border-radius: 8px; flex: none; }
  .logo.big { width: 44px; height: 44px; border-radius: 12px; }
  .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* ---- view transitions (tabs, opening a page's details): short and quiet; the nav and top bar stay put ---- */
  .nav { view-transition-name: nav; }
  .topbar { view-transition-name: topbar; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
  ::view-transition-group(page-detail) { animation-duration: .22s; animation-timing-function: var(--ease); }
  ::view-transition-old(page-detail), ::view-transition-new(page-detail) { height: 100%; object-fit: cover; object-position: top; animation-duration: .22s; }
  ::view-transition-group(*) { animation-timing-function: var(--ease); }

  /* ---- skeletons: the shape of what is coming ---- */
  .skel { display: block; background: linear-gradient(90deg, var(--surface-3) 0%, color-mix(in srgb, var(--ink-1) 9%, var(--surface-3)) 50%, var(--surface-3) 100%); background-size: 200% 100%; border-radius: var(--radius-xs); animation: shimmer 1.4s ease-in-out infinite; }
  .skel-card { border-radius: var(--radius); margin-bottom: var(--pad); }
  .skel-line { height: 14px; margin: 10px 0; }
  .skel-line.short, .skel-line:last-child { width: 60%; }
  .skel-row { display: flex; align-items: center; gap: 12px; padding: 12px var(--pad); }
  .skel-row + .skel-row { border-top: 1px solid var(--line-1); }
  .skel-av { width: 40px; height: 40px; border-radius: 50%; flex: none; }
  .skel-lines { flex: 1; min-width: 0; }
  .skel-lines .skel-line { margin: 6px 0; }
  @keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

  /* ---- shell ---- */
  .shell { max-width: 760px; margin: 0 auto; padding: 10px 16px 24px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0 14px; min-height: 56px; }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: var(--w-strong); font-size: var(--t-md); letter-spacing: var(--track-title); min-width: 0; flex: 1; }
  .brand img { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; flex: none; }
  .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tzpill { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-xs); font-weight: var(--w-strong); letter-spacing: .02em; color: var(--ink-2); background: var(--surface-3); border-radius: 999px; padding: 4px 10px; min-height: 32px; text-decoration: none; flex: none; white-space: nowrap; }
  .tzpill .ic { width: 15px; height: 15px; color: var(--ink-3); }
  /* The account button: the signed-in person's avatar (with the "you" marker) opening a popover menu. */
  .acct { border: 0; background: none; padding: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--ink-2); }
  .acct:hover { background: var(--surface-3); }

  /* ---- bottom nav (phones) / left rail (desktop); the current item is one of the accent's four places ---- */
  .nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface-2) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line-1); display: grid; grid-template-columns: repeat(4, 1fr); z-index: 20; }
  .nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-weight: var(--w-strong); font-size: var(--t-xs); letter-spacing: .01em; min-height: 44px; position: relative; border-radius: var(--radius-sm); margin: 6px 4px; transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease); }
  .nav a svg { width: 24px; height: 24px; }
  .nav a:hover { color: var(--ink-1); }
  .nav a.active { color: var(--accent-text); }
  .nav a:active { transform: scale(.97); }
  .nav-qa { display: none; }
  @media (min-width: 900px) {
    body { padding-bottom: 0; }
    .shell { margin-left: 224px; max-width: 840px; }
    .nav { top: 0; bottom: auto; height: 100vh; width: 208px; right: auto; border-top: 0; border-right: 1px solid var(--line-1); background: var(--surface-1); -webkit-backdrop-filter: none; backdrop-filter: none;
      grid-template-columns: 1fr; grid-auto-rows: 48px; align-content: start; padding: 88px 12px 0; gap: 2px; }
    .nav a { flex-direction: row; justify-content: flex-start; padding: 0 14px; gap: 12px; font-size: .9375rem; margin: 0; min-height: 44px; }
    .nav a.active { background: color-mix(in srgb, var(--accent) 10%, transparent); }
    .nav-qa { display: flex; align-items: center; gap: 8px; margin: 18px 2px 0; padding: 8px 12px; min-height: 44px; border: 1px solid var(--line-1); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-3); font-weight: var(--w-strong); font-size: var(--t-sm); text-align: left; }
    .nav-qa .ic { display: none; }
    .nav-qa span { flex: 1; }
    .nav-qa kbd { font: var(--w-strong) .6875rem var(--font); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--ink-2); white-space: nowrap; }
    .nav-qa:hover { color: var(--ink-1); border-color: var(--line-2); }
  }

  /* ---- text helpers ---- */
  .muted { color: var(--ink-3); }
  .sub { color: var(--ink-3); font-size: var(--t-sm); }
  /* Explanations (a sentence or more) read at body size; .sub stays for short meta. */
  .help { color: var(--ink-2); font-size: var(--t-base); text-wrap: pretty; }
  p.sub, p.help { margin: 6px 0 10px; }
  p.sub:last-child, p.help:last-child { margin-bottom: 0; }
  p.sub:first-child, p.help:first-child { margin-top: 0; }
  .small { font-size: var(--t-sm); }
  .row { display: flex; align-items: center; gap: 10px; }
  .row.wrap { flex-wrap: wrap; }
  .between { justify-content: space-between; }
  .grow { flex: 1; min-width: 0; }
  .stack > * + * { margin-top: var(--gap); }
  .mt { margin-top: 12px; }

  /* ---- elevation: the page (surface-1), one raised surface (surface-2, no border, no shadow), one overlay (shadow) ---- */
  .card, .team { background: var(--surface-2); border-radius: var(--radius); padding: var(--pad); margin-bottom: var(--pad); container: card / inline-size; }
  :is(.card, .team) > :is(h2, h3):first-child { margin-top: 0; }
  .edge { border-top: 3px solid var(--team, var(--line-2)); }
  .team-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 6px 12px; }
  .team-head h2 { margin: 0; font-size: var(--t-lg); }

  /* Grouped inset list: rows separated by hairlines inside one raised surface (people, devices, heartbeats, settings). */
  .list { background: var(--surface-2); border-radius: var(--radius); padding: 0; margin: 0 0 var(--pad); list-style: none; overflow: clip; }
  .list > * { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: 100%; margin: 0; padding: 12px var(--pad); min-height: 56px; border: 0; background: transparent; color: inherit; text-align: left; border-radius: 0; }
  .list > * + * { border-top: 1px solid var(--line-1); }
  .list > button:hover, .list > a:hover { background: var(--surface-3); }
  .list > button:active, .list > a:active { background: color-mix(in srgb, var(--ink-1) 8%, var(--surface-2)); }
  .list .chev { color: var(--ink-3); margin-left: auto; }
  .list .lead { color: var(--ink-2); }
  .list .trail { margin-left: auto; color: var(--ink-3); font-size: var(--t-sm); white-space: nowrap; }
  .list b { display: block; }

  .list-title { margin: 20px 4px 8px; }
  .list > * > .grow { flex: 1 1 11rem; }
  .list > * > :last-child:not(.grow) { margin-left: auto; }
  .card .list > * { padding-inline: 0; }
  .list .input { width: auto; margin: 0; }
  .list .sub .row { margin-top: 8px; font-size: var(--t-base); }
  .list.log > * { min-height: 0; padding-block: 10px; color: var(--ink-1); }
  section > .warn, section > .hint { margin: 0 0 12px; }
  section > .list + :is(.sub, .help) { margin: -6px 4px 0; }
  form.row { flex-wrap: wrap; }
  .inline-error { flex-basis: 100%; }
  .pre { white-space: pre-wrap; }
  details.more > summary { list-style: none; margin: -8px 0 8px; }
  details.more > summary::-webkit-details-marker { display: none; }
  details.more[open] > summary { display: none; }

  /* ---- on-call tiles ---- */
  /* No tile box: the person on call leads (big name, ringed avatar); the next layers are hairline-separated rows. */
  .oncall { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
  .oncall + .oncall { border-top: 1px solid var(--line-1); }
  .oncall.primary { padding: 2px 0 14px; }
  .oncall .name { font-weight: var(--w-strong); font-size: var(--t-md); line-height: var(--lh-tight); letter-spacing: var(--track-title); }
  .oncall.primary .name { font-size: var(--name); letter-spacing: var(--track-display); }
  .oncall.primary .avatar { width: var(--tile-av); height: var(--tile-av); font-size: 1.25rem; }
  .oncall .sub { margin-top: 3px; }
  .oncall.empty .avatar { background: var(--surface-3); color: var(--ink-3); }
  .oncall.empty .name { font-size: var(--t-base); color: var(--danger-text); }
  .override-tag { font-weight: var(--w-strong); color: var(--ink-2); }

  /* ---- avatars: initials on a soft gradient of the person's hue; .ring = on call now; .you = the signed-in person ---- */
  .avatar { --av: oklch(60% .12 250); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; position: relative;
    font-weight: var(--w-strong); font-size: .9375rem; letter-spacing: .02em; line-height: 1;
    background: linear-gradient(145deg, color-mix(in oklch, var(--av) 28%, var(--surface-2)), color-mix(in oklch, var(--av) 55%, var(--surface-2)));
    color: color-mix(in oklch, var(--av) 62%, var(--ink-1)); }
  .avatar.ring { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--av); }
  .avatar.you::after { content: "you"; position: absolute; right: -4px; bottom: -4px; font-size: .5625rem; font-weight: var(--w-strong); letter-spacing: .04em; text-transform: uppercase; line-height: 1; padding: 3px 5px; border-radius: 999px; background: var(--ink-1); color: var(--surface-2); box-shadow: 0 0 0 2px var(--surface-2); }
  .avatar.sm { width: 32px; height: 32px; font-size: .75rem; }
  .avatar.sm.you::after { right: -9px; bottom: -6px; font-size: .5rem; padding: 2px 4px; }
  .avatar.xs { width: 26px; height: 26px; font-size: .6875rem; }
  .avatar.lg { width: 56px; height: 56px; font-size: 1.25rem; }

  /* ---- the one obvious button ---- */
  .pagebtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 14px; border: 0; border-radius: var(--radius); min-height: var(--page-h); padding: 12px 18px;
    font-size: var(--page-font); font-weight: var(--w-strong); letter-spacing: var(--track-title); background: var(--accent); color: var(--accent-ink);
    transition: transform var(--dur-1) var(--ease), filter var(--dur-2) var(--ease); }
  .pagebtn .ic { width: 26px; height: 26px; }
  .pagebtn:hover { filter: brightness(1.06); }
  .pagebtn:active { transform: scale(.98); filter: brightness(.96); }
  .pagebtn:disabled { opacity: .45; filter: none; transform: none; }
  .pagebtn:focus-visible { outline-offset: 3px; }
  /* Sticky variant for phones: the Now screen pins the current team's button above the bottom nav. */
  .pagebtn.sticky { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 5; box-shadow: var(--shadow-overlay); }
  @media (min-width: 900px) { .pagebtn.sticky { position: static; box-shadow: none; } }

  /* ---- identity banner (accent edge = one of the four) + station health ---- */
  .me { display: flex; align-items: center; gap: 14px; padding: 14px var(--pad); border-radius: var(--radius); margin-bottom: 14px; background: var(--surface-2); }
  .me.on { border-left: 4px solid var(--accent); }
  .me .ic { color: var(--ink-2); }
  .me b { display: block; font-size: var(--t-md); letter-spacing: var(--track-title); }
  /* Station health: quiet chips (icon + words); trouble is colored text, never a filled badge. */
  .health { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 2px 18px; padding: 0; list-style: none; }
  .health li { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-3); min-height: 28px; max-width: 100%; }
  .health li .ic { width: 16px; height: 16px; }
  .health li.ok .ic { color: var(--ok); }
  .health li.bad { color: var(--danger-text); }
  .health li.bad .ic { color: var(--danger); }
  .health li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ---- a page (incident) card: severity is a 3 px rail + a small uppercase label, status is quiet text ---- */
  .incident { --rail: var(--high); position: relative; background: var(--surface-2); border-radius: var(--radius); padding: 14px var(--pad) 14px calc(var(--pad) + 8px); margin-bottom: 10px; }
  .incident::before { content: ""; position: absolute; left: 8px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--rail); }
  .incident.critical { --rail: var(--critical); }
  .incident.low { --rail: var(--low); }
  .incident.acked { --rail: var(--ok); }
  .incident.resolved { --rail: var(--line-2); }
  .incident:has(.sev.test) { --rail: var(--ink-3); }
  .incident .title { font-weight: var(--w-strong); font-size: var(--t-md); letter-spacing: var(--track-title); line-height: 1.25; margin-top: 6px; text-wrap: balance; }
  .incident .meta { color: var(--ink-3); font-size: var(--t-sm); margin-top: 2px; }
  .incident .body { margin-top: 6px; white-space: pre-wrap; color: var(--ink-2); }
  .incident.open::before { animation: breathe 2.4s ease-in-out infinite; }
  @keyframes breathe { 50% { opacity: .5; } }
  .head { margin: 28px 0 10px; }
  .head > h2 { margin: 0; }
  .idbtn { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--ink-3); font-size: var(--t-sm); min-height: 32px; padding: 0 2px 0 6px; margin: -6px -6px -6px 0; border-radius: var(--radius-xs); }
  .idbtn:hover { color: var(--ink-1); background: var(--surface-3); }
  .idbtn .ic { width: 16px; height: 16px; }
  .paging { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: var(--t-sm); color: var(--ink-2); }
  .paging b { color: var(--ink-1); }
  .chain { display: flex; align-items: center; gap: 12px; }
  p.contacts { margin: 10px 0 0; }
  #page-dock { margin-top: 24px; }
  @media (max-width: 899px) {
    main:has(#page-dock) .team .pagebtn { display: none; }
    html:has(#page-dock) { scroll-padding-bottom: calc(var(--nav-h) + var(--page-h) + 40px + env(safe-area-inset-bottom)); }
    body:has(#page-dock) .toast { bottom: calc(var(--nav-h) + var(--page-h) + 26px + env(safe-area-inset-bottom)); }
  }
  @media (min-width: 900px) { #page-dock { display: none; } }
  .incident.resolved .title { color: var(--ink-2); }
  .countdown { font-weight: var(--w-strong); color: var(--ink-1); }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
  .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
  .actions.center { justify-content: center; }

  .sev { --sev: var(--high); --sev-text: var(--high-text); display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: var(--w-strong); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--sev-text); padding: 0; background: none; border-radius: 0; vertical-align: middle; line-height: 1.4; }
  .sev::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sev); flex: none; }
  .sev.critical { --sev: var(--critical); --sev-text: var(--critical-text); }
  .sev.low { --sev: var(--low); --sev-text: var(--low-text); }
  .sev.test { --sev: var(--ink-3); --sev-text: var(--ink-2); }
  .sev.rail { padding-left: 9px; border-left: 3px solid var(--sev); border-radius: 2px; }
  .sev.rail::before { display: none; }
  .status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); font-weight: var(--w-regular); color: var(--ink-3); padding: 0; background: none; border-radius: 0; }
  .status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); flex: none; }
  .status.open::before { background: var(--critical); animation: pulse 2s ease-in-out infinite; }
  .status.acked, .status.sent, .status.on { color: var(--ok-text); }
  .status.acked::before, .status.sent::before, .status.on::before { background: var(--ok); }
  .status.failed, .status.off { color: var(--danger-text); }
  .status.failed::before, .status.off::before { background: var(--danger); }
  .list .status { white-space: nowrap; flex: none; }
  .status.pending::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
  .status.cancelled { text-decoration: line-through; }
  .status.resolved::before { background: var(--line-2); }

  /* ---- buttons: primary filled (accent) · tonal (default) · text; press = scale(.98); loading = inline spinner, no layout shift ---- */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: var(--surface-3); color: var(--ink-1); border-radius: var(--radius-sm); padding: var(--btn-pad); min-height: var(--btn-h);
    font-weight: var(--w-strong); font-size: .9375rem; letter-spacing: 0; text-decoration: none; position: relative; white-space: nowrap;
    transition: background var(--dur-2) var(--ease), transform var(--dur-1) var(--ease), filter var(--dur-2) var(--ease); }
  .btn:hover { background: color-mix(in srgb, var(--ink-1) 8%, var(--surface-3)); }
  .btn:active { transform: scale(.98); }
  .btn.primary, .btn.accent { background: var(--accent); color: var(--accent-ink); }
  .btn.primary:hover, .btn.accent:hover { background: var(--accent); filter: brightness(1.07); }
  .btn.danger { background: var(--danger-tint); color: var(--danger-text); }
  .btn.danger:hover { background: color-mix(in srgb, var(--danger) 18%, var(--surface-2)); }
  .btn[aria-pressed="true"] { background: var(--ink-1); color: var(--surface-2); }
  .btn.ghost, .btn.text { background: transparent; color: var(--ink-1); }
  .btn.ghost:hover, .btn.text:hover { background: var(--surface-3); }
  .btn.big { padding: 14px 18px; font-size: var(--t-md); width: 100%; min-height: 52px; border-radius: var(--radius-sm); }
  .btn.small { padding: 6px 12px; font-size: var(--t-sm); min-height: 36px; border-radius: var(--radius-xs); }
  .btn.wide { width: 100%; }
  .btn.icon { padding: 0; width: var(--btn-h); min-width: var(--btn-h); }
  .btn.icon.small { width: 36px; min-width: 36px; }
  .btn:disabled { opacity: .5; transform: none; filter: none; }
  /* Loading: the label goes transparent (keeping its width) and a spinner sits over it — busy(btn) in app.js. */
  .btn.loading, .btn[aria-busy="true"], .pagebtn.loading, .pagebtn[aria-busy="true"] { --spin: var(--ink-2); color: transparent !important; opacity: 1; position: relative; pointer-events: none; }
  .btn.loading::after, .btn[aria-busy="true"]::after, .pagebtn.loading::after, .pagebtn[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--spin); border-right-color: transparent; animation: spin .7s linear infinite; }
  .btn.primary.loading, .btn.accent.loading, .pagebtn.loading, .btn.primary[aria-busy="true"], .btn.accent[aria-busy="true"], .pagebtn[aria-busy="true"] { --spin: var(--accent-ink); }
  .pagebtn.loading::after, .pagebtn[aria-busy="true"]::after { width: 24px; height: 24px; border-width: 2.5px; }
  .spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-right-color: var(--ink-2); animation: spin .7s linear infinite; vertical-align: -4px; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .linkbtn { background: none; border: 0; padding: 6px 4px; min-height: 32px; color: var(--ink-1); font: inherit; font-weight: var(--w-strong); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; cursor: pointer; }
  .linkbtn:hover { text-decoration-color: currentColor; }
  .linkbtn:focus-visible { border-radius: 6px; }
  .linkbtn:disabled { opacity: .55; cursor: default; text-decoration: none; }

  /* ---- pills / chips / dots: quiet, neutral; state is a colored dot or colored text, never a colored fill ---- */
  .chip { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-xs); font-weight: var(--w-strong); letter-spacing: .02em; border-radius: 999px; padding: 3px 9px; background: var(--surface-3); color: var(--ink-2); min-height: 24px; }
  /* Filter chips (the schedule legend): pressed = shown; off = no fill, struck through. */
  .chip.filter { cursor: pointer; border: 0; min-height: 36px; padding: 4px 12px 4px 6px; gap: 7px; font-size: var(--t-sm); color: var(--ink-1); }
  .chip.filter .avatar { width: 24px; height: 24px; font-size: .5625rem; }
  .chip.filter[aria-pressed="false"] { background: transparent; color: var(--ink-3); text-decoration: line-through; box-shadow: inset 0 0 0 1px var(--line-2); }
  .chip.filter[aria-pressed="false"] .avatar { filter: grayscale(1); opacity: .6; }

  /* ---- empty / hints: no box, one sentence, the next action as a button ---- */
  .empty { background: transparent; border: 0; padding: 28px 16px 24px; text-align: center; color: var(--ink-2); margin: 6px 0 16px; }
  .empty b { display: block; font-size: var(--t-md); font-weight: var(--w-strong); letter-spacing: var(--track-title); color: var(--ink-1); margin-bottom: 4px; text-wrap: balance; }
  .empty p { margin: 0; text-wrap: balance; }
  .empty .ic { width: 28px; height: 28px; color: var(--ink-3); margin-bottom: 8px; }
  .empty .actions { margin-top: 14px; }
  .illo { display: block; width: 112px; height: 76px; margin: 0 auto 10px; }
  .illo .a { fill: var(--surface-3); stroke: none; }
  .illo .b { fill: none; stroke: var(--ink-3); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
  .illo .c { fill: var(--ink-3); stroke: none; }
  .hint { background: var(--surface-3); border-radius: var(--radius-sm); padding: 10px 12px; font-size: var(--t-sm); color: var(--ink-2); }
  .warn { background: var(--danger-tint); color: var(--danger-text); border-radius: var(--radius-sm); padding: 10px 12px; font-size: var(--t-sm); }
  .ok { background: var(--ok-tint); color: var(--ok-text); border-radius: var(--radius-sm); padding: 10px 12px; font-size: var(--t-sm); }
  .inline-error { color: var(--danger-text); font-size: var(--t-sm); margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
  .inline-error .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
  label.f:has(input:user-invalid) > input, label.f:has(select:user-invalid) > select { border-color: var(--danger); }

  /* ---- forms ---- */
  form { margin: 0; }
  label.f, div.f { display: block; font-weight: var(--w-strong); font-size: var(--t-sm); color: var(--ink-2); margin-top: 14px; }
  label.f > input, label.f > select, label.f > textarea, .input { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; min-height: 48px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-1); font-size: 1rem; font-weight: var(--w-regular);
    transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease); }
  .team label.f > input, .team label.f > select, .team label.f > textarea, .team .input, .card label.f > input, .card label.f > select, .card label.f > textarea, .card .input { background: var(--surface-1); }
  label.f > input:hover, label.f > select:hover, label.f > textarea:hover, .input:hover { border-color: var(--ink-3); }
  label.f > input:focus-visible, label.f > select:focus-visible, label.f > textarea:focus-visible, .input:focus-visible { border-color: var(--accent); }
  input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
  textarea { min-height: 88px; resize: vertical; line-height: var(--lh-body); }
  select { appearance: none; -webkit-appearance: none; padding-right: 36px !important; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
  input[type="color"] { padding: 3px; width: 100%; min-height: 48px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-2); margin-top: 6px; cursor: pointer; }
  input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
  .toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-weight: var(--w-regular); min-height: 44px; }
  .toggle input { width: 24px; height: 24px; flex: none; accent-color: var(--accent); margin: 0; }
  .toggle .help { display: block; }
  .list > .toggle { margin: 0; }
  /* Switch look for toggles that opt in (class="toggle switch"): the box stays a checkbox for assistive tech. */
  .switch input { appearance: none; -webkit-appearance: none; width: 44px !important; height: 26px !important; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background var(--dur-2) var(--ease); }
  .switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); transition: transform var(--dur-2) var(--ease); }
  .switch input:checked { background: var(--accent); }
  .switch input:checked::after { transform: translateX(18px); }
  .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

  .colors { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
  .colors button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
  .colors button.active { border-color: var(--ink-1); box-shadow: 0 0 0 2px var(--surface-2) inset; }
  .code { font-family: var(--font-mono); font-weight: var(--w-strong); font-size: 1.625rem; letter-spacing: .12em; background: var(--surface-3); padding: 10px 14px; border-radius: var(--radius-sm); display: inline-block; }
  summary.sum { cursor: pointer; min-height: 32px; display: flex; align-items: center; }

  /* ---- segmented controls (.seg severity, .choice settings, .tabs teams) ---- */
  .seg, .choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 6px; padding: 4px; background: var(--surface-3); border-radius: var(--radius-sm); }
  .choice.two { grid-template-columns: repeat(2, 1fr); }
  .choice.three { grid-template-columns: repeat(3, 1fr); }
  .seg button, .choice button { border: 0; background: transparent; color: var(--ink-2); border-radius: calc(var(--radius-sm) - 4px); padding: 9px 6px; min-height: 44px; font-weight: var(--w-strong); font-size: .9375rem; transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
  .seg button:hover, .choice button:hover { color: var(--ink-1); }
  .seg button small, .choice button small { display: block; font-weight: var(--w-regular); color: var(--ink-3); font-size: var(--t-xs); margin-top: 2px; overflow-wrap: break-word; }
  .seg button.active, .choice button.active { background: var(--surface-2); color: var(--ink-1); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
  .seg button.active small, .choice button.active small { color: var(--ink-2); }
  .seg button.active.low { color: var(--low-text); box-shadow: inset 0 -3px 0 var(--low), 0 1px 2px rgba(0, 0, 0, .12); }
  .seg button.active.high { color: var(--high-text); box-shadow: inset 0 -3px 0 var(--high), 0 1px 2px rgba(0, 0, 0, .12); }
  .seg button.active.critical { color: var(--critical-text); box-shadow: inset 0 -3px 0 var(--critical), 0 1px 2px rgba(0, 0, 0, .12); }
  .tabs { display: flex; gap: 2px; overflow-x: auto; padding: 4px; background: var(--surface-3); border-radius: var(--radius-sm); scrollbar-width: none; width: max-content; max-width: 100%; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabrow { display: flex; gap: 2px; flex: none; }
  .tab { border: 0; background: transparent; color: var(--ink-2); border-radius: calc(var(--radius-sm) - 4px); padding: 8px 14px; min-height: 40px; font-weight: var(--w-strong); white-space: nowrap; font-size: .9375rem; }
  .tab:hover { color: var(--ink-1); }
  .tab.active { background: var(--surface-2); color: var(--ink-1); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

  /* ---- bottom sheet: a native <dialog> (showModal) with a grabber and a scrim; springs up, fades for reduced motion ---- */
  html:has(dialog[open]) { overflow: hidden; }
  dialog.sheet { position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 640px; max-height: calc(100dvh - 24px); border: 0; background: var(--surface-2); color: var(--ink-1);
    border-radius: 24px 24px 0 0; padding: 0 var(--sheet-x) calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; box-shadow: var(--shadow-overlay);
    scroll-padding-top: 84px; scroll-padding-bottom: 96px; }
  dialog.sheet[open] { transform: translateY(0); opacity: 1; transition: transform var(--dur-3) var(--spring), opacity var(--dur-2) var(--ease); }
  @starting-style { dialog.sheet[open] { transform: translateY(48px); opacity: 0; } }
  dialog.sheet.vt { animation: none; transition: none; }
  dialog.sheet::backdrop { background: var(--scrim, rgba(10, 10, 12, .48)); transition: opacity var(--dur-2) var(--ease); }
  @starting-style { dialog.sheet[open]::backdrop { opacity: 0; } }
  .sheet.tall { height: calc(100dvh - 24px); }
  @media (min-width: 900px) {
    dialog.sheet { inset: 0; margin: auto; height: fit-content; border-radius: 20px; max-height: 92vh; }
    .sheet.tall { height: fit-content; }
    @starting-style { dialog.sheet[open] { transform: translateY(8px) scale(.98); opacity: 0; } }
  }
  .sheet-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 4; background: var(--surface-2); margin: 0 calc(-1 * var(--sheet-x)); padding: 22px var(--sheet-x) 10px; border-bottom: 1px solid var(--line-1); }
  .sheet-head::before { content: ""; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line-2); }
  .sheet-head h3 { margin: 0; flex: 1; font-size: var(--t-xl); font-weight: var(--w-strong); letter-spacing: var(--track-display); line-height: 1.15; overflow-wrap: anywhere; min-width: 0; }
  @media (min-width: 900px) { .sheet-head::before { display: none; } .sheet-head { padding-top: 16px; } }
  .sheet-head > button { border: 0; background: var(--surface-3); color: var(--ink-1); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; flex: none; }
  .sheet-head > button:hover { background: color-mix(in srgb, var(--ink-1) 10%, var(--surface-3)); }
  .sheet-guard { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--danger-tint); color: var(--danger-text); border-radius: var(--radius-sm); padding: 8px 10px; font-weight: var(--w-strong); font-size: var(--t-sm); }
  .sheet-guard[hidden] { display: none; }
  .sheet .actions { margin-top: 18px; }
  .sheet .actions.bar { position: sticky; bottom: calc(-22px - env(safe-area-inset-bottom)); z-index: 3; background: var(--surface-2); margin: 16px calc(-1 * var(--sheet-x)) 0; padding: 10px var(--sheet-x) calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-1); }
  .sheet .actions.bar .pagebtn { margin-top: 0 !important; }
  .sheet p { color: var(--ink-2); }
  .sheet-head + * { margin-top: 12px; }
  .sheet .list { background: var(--surface-1); }

  /* ---- quick actions + team chooser ---- */
  .qa-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
  .qa { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: var(--surface-1); color: var(--ink-1); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 56px; }
  .qa b { display: block; font-size: var(--t-base); }
  .qa .sub { display: block; }
  .qa > .ic { color: var(--ink-2); }
  .qa:hover { background: var(--surface-3); }
  .qa .sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }

  /* ---- popovers (menus, the zone pill): Popover API with a quiet entrance; anchored where the browser can ---- */
  [popover] { position: fixed; inset: auto; margin: 0; padding: 6px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--ink-1); box-shadow: var(--shadow-overlay); min-width: 200px; max-width: min(92vw, 360px);
    opacity: 1; transform: translateY(0); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), display var(--dur-2) allow-discrete, overlay var(--dur-2) allow-discrete; }
  [popover]:not(:popover-open) { opacity: 0; transform: translateY(-4px); }
  @starting-style { [popover]:popover-open { opacity: 0; transform: translateY(-4px); } }
  [popover]::backdrop { background: transparent; }
  [data-theme="dark"] [popover], [popover][data-theme="dark"] { background: var(--surface-3); }
  .menu:popover-open { display: flex; flex-direction: column; gap: 2px; }
  .menu > button, .menu > a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; min-height: 44px; border: 0; background: none; border-radius: 10px; text-align: left; color: inherit; font: inherit; text-decoration: none; white-space: nowrap; }
  .menu > button:hover, .menu > a:hover { background: var(--surface-3); }
  .menu > button .ic, .menu > a .ic { color: var(--ink-2); }
  .menu > button.danger, .menu > a.danger { color: var(--danger-text); }
  .menu > button.danger .ic { color: var(--danger); }
  .menu-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line-1); margin-bottom: 4px; }
  .menu-head b { display: block; }
  .menu-head label.f { flex-basis: 100%; margin-top: 4px; }
  [popover].anchored { top: 60px; right: 12px; }
  @supports (anchor-name: --a) {
    [popover].anchored { position-anchor: --menu; top: anchor(bottom); right: anchor(right); margin-top: 6px; position-try-fallbacks: flip-block; }
    [data-anchor] { anchor-name: --menu; }
  }

  /* ---- calendar + time picker: its own <dialog>, bottom sheet on phones, anchored popover on desktop ---- */
  .dpf { margin-top: 14px; }
  .dp-label { display: block; font-weight: var(--w-strong); font-size: var(--t-sm); color: var(--ink-2); }
  .dp-btn { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 6px; min-height: 48px; padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-1); font-size: 1rem; font-weight: var(--w-regular); text-align: left; }
  .team .dp-btn, .card .dp-btn { background: var(--surface-1); }
  .dp-btn:hover { border-color: var(--ink-3); }
  .dp-btn .ic { color: var(--ink-3); }
  .dp-btn .dp-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  dialog.dp-bg { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; overflow: auto; }
  dialog.dp-bg[open] { display: flex; align-items: flex-end; justify-content: center; }
  dialog.dp-bg.phone::backdrop { background: var(--scrim, rgba(10, 10, 12, .48)); }
  dialog.dp-bg.desk::backdrop { background: transparent; }
  .dp { background: var(--surface-2); color: var(--ink-1); width: 100%; max-width: 480px; max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; border-radius: 24px 24px 0 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); animation: up var(--dur-3) var(--spring); box-shadow: var(--shadow-overlay); }
  .dp-bg.phone .dp::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 10px; }
  .dp-bg.desk .dp { border-radius: 16px; max-height: calc(100vh - 16px); padding-bottom: 14px; animation-name: pop; animation-duration: var(--dur-2); }
  @supports (anchor-name: --a) {
    .dp-bg.desk .dp.anchored { position: fixed; position-anchor: --dp; inset: auto; top: anchor(bottom); left: anchor(left); margin-top: 6px; position-try-fallbacks: flip-block, flip-inline; }
    [data-dp-anchor] { anchor-name: --dp; }
  }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .dp-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
  .dp-title { font-weight: var(--w-strong); font-size: var(--t-base); }
  .dp-value { color: var(--ink-2); font-size: var(--t-sm); }
  .dp-x { border: 0; background: var(--surface-3); color: var(--ink-1); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; flex: none; }
  .dp-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 4px 0 2px; }
  .dp-month { font-weight: var(--w-strong); font-size: var(--t-base); }
  .dp-arrow { border: 0; background: var(--surface-3); color: var(--ink-1); border-radius: var(--radius-xs); width: 44px; height: 44px; display: grid; place-items: center; }
  .dp-arrow[data-nav="-1"] .ic { transform: scaleX(-1); }
  .dp-grid { display: grid; gap: 2px; }
  .dp-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .dp-wd span { text-align: center; font-size: var(--t-xs); font-weight: var(--w-strong); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding: 6px 0 2px; }
  .dp-day { border: 1px solid transparent; background: transparent; color: var(--ink-1); border-radius: var(--radius-xs); min-height: 44px; font-weight: var(--w-regular); font-size: .9375rem; padding: 0; }
  .dp-day.other { color: var(--ink-3); }
  .dp-day.today { border-color: var(--ink-2); font-weight: var(--w-strong); }
  .dp-day.sel { background: var(--ink-1); color: var(--surface-2); border-color: var(--ink-1); font-weight: var(--w-strong); }
  .dp-day:hover:not(.sel) { background: var(--surface-3); }
  .dp-time { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-1); }
  .dp-spin { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .dp-spin button { border: 0; background: var(--surface-3); color: var(--ink-1); border-radius: var(--radius-xs); width: 64px; height: 40px; display: grid; place-items: center; }
  .dp-spin input { width: 64px; min-height: 48px; text-align: center; font-size: 1.5rem; font-weight: var(--w-strong); border: 1px solid var(--line-2); border-radius: var(--radius-xs); background: var(--surface-2); color: var(--ink-1); padding: 0; -moz-appearance: textfield; }
  .dp-spin input::-webkit-outer-spin-button, .dp-spin input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .dp-colon { font-size: 1.5rem; font-weight: var(--w-strong); }
  .dp-ampm { display: flex; flex-direction: column; gap: 4px; margin-left: 6px; }
  .dp-ampm button { border: 0; background: var(--surface-3); color: var(--ink-1); border-radius: var(--radius-xs); min-width: 56px; min-height: 44px; font-weight: var(--w-strong); }
  .dp-ampm button.active { background: var(--ink-1); color: var(--surface-2); }
  .dp-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  .dp-q { border: 0; background: var(--surface-3); color: var(--ink-1); border-radius: 999px; padding: 8px 12px; min-height: 40px; font-weight: var(--w-strong); font-size: var(--t-sm); }
  .dp-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }

  /* ---- snackbar (toast() in app.js): bottom-centred, one line, optional action such as Undo ---- */
  .toast-host:empty { display: none; }
  /* Centred without a transform, so reduced motion (transform: none) keeps it on screen. */
  .toast { position: fixed; left: 0; right: 0; margin-inline: auto; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 14px; background: var(--ink-1); color: var(--surface-2);
    padding: 12px 16px; border-radius: 14px; font-size: .9375rem; font-weight: var(--w-regular); line-height: 1.35; z-index: 40; width: max-content; max-width: min(calc(100% - 32px), 520px); box-shadow: var(--shadow-overlay);
    opacity: 1; transition: opacity var(--dur-2) var(--ease), transform var(--dur-3) var(--spring); }
  @starting-style { .toast { opacity: 0; transform: translateY(12px); } }
  .toast.out { opacity: 0; transform: translateY(8px); }
  .toast.err { background: var(--danger); color: #fff; }
  .toast .toast-act { border: 0; background: transparent; color: inherit; font: inherit; font-weight: var(--w-strong); text-decoration: underline; text-underline-offset: 3px; padding: 6px 8px; margin: -6px -8px -6px 0; min-height: 32px; border-radius: 8px; white-space: nowrap; flex: none; }
  .toast .toast-act:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
  .toast .toast-act:focus-visible { outline-color: currentColor; box-shadow: none; }
  @media (min-width: 900px) { .toast { bottom: 24px; } }

  /* ---- login ---- */
  /* Sign-in: one centered column on the page (no card), the mark and the team name on top, the one action filled. */
  .login { max-width: 380px; margin: max(8vh, 24px) auto 0; padding: 0 4px; }
  .login-brand { display: grid; justify-items: center; gap: 14px; margin-bottom: 6px; text-align: center; }
  .login-brand h1 { margin: 0; }
  .login-brand .logo.big, .login-brand img { width: 56px; height: 56px; border-radius: 16px; object-fit: contain; }
  .login .btn.wide { margin: 10px 0 2px; }
  .login .actions .btn.big { width: 100%; }
  .login .linkbtn { color: var(--ink-2); font-weight: var(--w-regular); }
  .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; margin-top: 8px; }
  .center { text-align: center; }
  .otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 8px; }
  .otp-boxes input { width: 100%; min-width: 0; min-height: 60px; text-align: center; font-size: 1.625rem; font-weight: var(--w-strong); font-variant-numeric: tabular-nums slashed-zero; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-1); padding: 0; caret-color: var(--accent); }
  .otp-boxes input:focus-visible { border-color: var(--accent); }
  dialog .otp-boxes input { background: var(--surface-1); }
  .or { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; color: var(--ink-3); font-size: var(--t-sm); }
  .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-1); }
  dialog.sheet.reauth { max-width: 460px; }
  .reauth-body { display: grid; gap: 10px; padding-bottom: 8px; }
  .reauth-body p { margin: 0; }
  .reauth-body form .actions { margin-top: 8px; }

  /* ---- responsive helpers for cards (container queries) ---- */
  @container card (min-width: 560px) {
    .actions .btn.big { width: auto; min-width: 180px; }

  }
}

/* ========================================================================== views */
@layer views {
  /* ---- schedule: a timeline per layer; one today column and one now-hairline across all rows; days snap on phones ---- */
  .grid-wrap { background: var(--surface-2); border-radius: var(--radius); padding: 12px; margin-top: 12px; }
  .grid-scroll { --snap-pad: 88px 0; overflow-x: auto; }
  .grid { --cols: 14; --lbl: 88px; position: relative; }
  .grid-days { display: grid; grid-template-columns: var(--lbl) repeat(var(--cols), 1fr); font-size: var(--t-xs); color: var(--ink-3); }
  .grid-days div { padding: 4px 2px 6px; text-align: center; line-height: 1.25; display: flex; flex-direction: column; overflow: hidden; scroll-snap-align: start; }
  .grid-days div span:first-child { font-weight: var(--w-strong); }
  .grid-days div:first-child, .grid-row .lbl { position: sticky; left: 0; z-index: 3; background: var(--surface-2); scroll-snap-align: none; }
  .grid-days .today { color: var(--ink-1); }
  .grid-row { display: grid; grid-template-columns: var(--lbl) 1fr; align-items: center; margin-top: 4px; }
  .grid-row .lbl { font-weight: var(--w-strong); font-size: var(--t-sm); color: var(--ink-2); padding-right: 8px; min-height: 48px; display: flex; align-items: center; overflow-wrap: anywhere; }
  .track { position: relative; height: 48px; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / var(--cols) - 1px), var(--line-1) calc(100% / var(--cols) - 1px), var(--line-1) calc(100% / var(--cols))); }
  .todaycol, .nowline { position: absolute; top: 0; bottom: 0; left: calc(var(--lbl) + (100% - var(--lbl)) * var(--x)); pointer-events: none; }
  .todaycol { width: calc((100% - var(--lbl)) * var(--w)); background: color-mix(in srgb, var(--ink-1) 6%, transparent); border-radius: var(--radius-xs); }
  .nowline { top: 40px; width: 2px; margin-left: -1px; background: var(--danger); z-index: 2; }
  .nowline::before { content: ""; position: absolute; top: 0; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
  /* A shift: a soft tint of the person's avatar color with a solid edge; names clip, narrow blocks show initials. */
  .block { --av: var(--ink-3); position: absolute; top: 5px; bottom: 5px; display: flex; align-items: center; min-width: 0; overflow: hidden; border: 0; border-radius: var(--radius-xs); padding: 0 6px 0 9px; text-align: left;
    font-weight: var(--w-strong); font-size: var(--t-sm); white-space: nowrap; container-type: inline-size; transition: opacity var(--dur-2) var(--ease);
    background: color-mix(in oklch, var(--av) 24%, var(--surface-2)); color: color-mix(in oklch, var(--av) 55%, var(--ink-1)); box-shadow: inset 3px 0 0 var(--av); }
  .block:hover { background: color-mix(in oklch, var(--av) 34%, var(--surface-2)); }
  .block .nm { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .block .ini { display: none; }
  .block .ini::before { content: attr(data-i); }   /* generated: the visible initials stay out of the accessible name */
  @container (max-width: 60px) { .block .nm { display: none; } .block .ini { display: inline; } }
  .block.override { outline: 2px solid var(--ink-1); outline-offset: -2px; }
  .block.dim { opacity: .22; }
  .block.dim > * { visibility: hidden; }
  .block.picked { outline: 3px solid var(--ink-1); outline-offset: 2px; z-index: 2; }
  .block:focus-visible { z-index: 2; }
  .sched-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 12px; }
  .sched-bar .dp-jump { gap: 6px; }
  .sched-bar .dp-btn { margin-top: 0; width: auto; min-width: 150px; }
  .sched-bar .choice.range { margin-top: 0; width: auto; grid-template-columns: repeat(3, minmax(72px, 1fr)); }
  .legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
  .legend-key { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-3); padding: 4px; }
  .legend-key i { width: 16px; height: 12px; border-radius: 3px; outline: 2px solid var(--ink-1); outline-offset: -2px; }
  .swapbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-3); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 12px; }
  .swapbar .step { background: var(--ink-1); color: var(--surface-2); border-radius: 999px; width: 26px; height: 26px; display: grid; place-items: center; font-size: var(--t-sm); font-weight: var(--w-strong); flex: none; }
  .who { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 8px 0 2px; padding: 0; font-size: var(--t-sm); color: var(--ink-2); }
  .who li { display: inline-flex; align-items: center; gap: 6px; }
  .members > * { min-height: 52px; padding-block: 4px; }
  .members .ord { color: var(--ink-3); width: 16px; }

  /* ---- people: one grouped .list; rows are .person (role and state as quiet text, the ring = on call now) ---- */
  .title-row { margin: 8px 0 4px; gap: 12px; }
  .title-row > h1 { margin: 0; }
  .list > .person { min-height: 68px; }
  .person b { font-size: var(--t-md); letter-spacing: var(--track-title); }
  .person.off .avatar { filter: grayscale(1); }
  .sheet .list { margin-top: 10px; }
  .more-actions > button { color: var(--ink-1); font-weight: var(--w-strong); }
  .more-actions .lead { color: var(--ink-2); }
  .more-actions > .danger-text, .more-actions > .danger-text .lead { color: var(--danger-text); }

  /* ---- ladder + plan editors: a drag timeline over clean step rows (the − / + buttons are the non-drag way) ---- */
  .ladder-viz { background: var(--surface-1); border-radius: var(--radius-sm); padding: 10px 0 18px; margin-top: 10px; }
  .ladder-track { position: relative; margin-bottom: 4px; height: 4px; border-radius: 2px; background: var(--line-2); touch-action: none; }
  .ladder-ticks, .ladder-track { margin-left: 40px !important; margin-right: 40px !important; }
  .ladder-ticks { position: relative; height: 18px; font-size: .6875rem; color: var(--ink-3); font-weight: var(--w-strong); }
  .ladder-ticks span { position: absolute; transform: translateX(-50%); }
  .ladder-pill { position: absolute; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); color: var(--ink-1); border: 1.5px solid var(--ink-2); border-radius: 999px; padding: 4px 10px 4px 8px; min-height: 36px; font-weight: var(--w-strong); font-size: var(--t-sm); cursor: grab; user-select: none; white-space: nowrap; }
  .ladder-pill .ic { width: 16px; height: 16px; }
  .ladder-pill.drag { cursor: grabbing; border-color: var(--ink-1); z-index: 3; }
  .steps-list > * { gap: 8px; padding-block: 8px; }
  .ladder-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto 44px; align-items: center; }
  .stepper { display: flex; align-items: center; gap: 4px; }
  .stepper input { width: 64px !important; text-align: center; }
  .step-btn { border: 0; background: var(--surface-3); color: var(--ink-1); width: 44px; height: 44px; border-radius: var(--radius-xs); font-size: 1.375rem; font-weight: var(--w-strong); line-height: 1; display: grid; place-items: center; flex: none; }
  .ladder-row input, .ladder-row select { padding: 9px 10px; min-height: 44px; border-radius: var(--radius-xs); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-1); width: 100%; }
  .ladder-row .x, .plan-row .x { border: 0; background: none; color: var(--ink-2); width: 44px; height: 44px; border-radius: var(--radius-xs); display: grid; place-items: center; flex: none; }
  .ladder-row .x:hover, .plan-row .x:hover { background: var(--surface-3); }

  /* ---- timeline (page detail): per person, per channel, quiet states ---- */
  .tl-person { padding: 12px 0 2px; border-top: 1px solid var(--line-1); }
  h3 + .tl-person { border-top: 0; }
  .timeline { padding: 0; margin: 10px 0 0; list-style: none; }
  .timeline li { padding: 8px 0; border-top: 1px solid var(--line-1); font-size: var(--t-sm); color: var(--ink-2); }
  .timeline li:first-child { border-top: 0; }
  .timeline b { color: var(--ink-1); font-weight: var(--w-strong); }
  /* Vertical timeline: each step's channel icon sits on the rail in a small disc; the ACK moment is a filled ok disc. */
  .vtl { list-style: none; margin: 6px 0 0; padding: 0; position: relative; }
  .vtl::before { content: ""; position: absolute; left: 15px; top: 16px; bottom: 16px; width: 2px; background: var(--line-1); }
  .vtl li { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; font-size: var(--t-sm); color: var(--ink-2); }
  .vtl li > .ic { flex: none; width: 32px; height: 32px; padding: 7px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); }
  .vtl li > div { padding-top: 5px; }
  .vtl li > time { padding-top: 6px; white-space: nowrap; }
  .vtl b { color: var(--ink-1); }
  .vtl li.failed > .ic { color: var(--danger); }
  .vtl li.cancelled, .vtl li.cancelled b { color: var(--ink-3); }
  .vtl li.cancelled b { text-decoration: line-through; }
  .vtl li.ack > .ic { background: var(--ok); color: var(--surface-2); }
  .vtl li.ack b { color: var(--ok-text); }

  /* ---- appearance ---- */
  .palettes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
  .palettes button { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; border: 2px solid var(--line-1); background: var(--surface-2); color: var(--ink-1); border-radius: var(--radius-sm); padding: 10px; min-height: 60px; font-weight: var(--w-strong); font-size: var(--t-sm); }
  .palettes button.active { border-color: var(--ink-1); }
  .palettes .sw { display: flex; gap: 4px; }
  .palettes .sw i { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
  .contrast { margin-top: 10px; display: grid; gap: 2px; }
  .contrast div { display: flex; justify-content: space-between; gap: 10px; font-size: var(--t-sm); padding: 6px 10px 6px 0; color: var(--ink-2); border-top: 1px solid var(--line-1); }
  .contrast div:first-child { border-top: 0; }
  .contrast div span:last-child { color: var(--ok-text); font-weight: var(--w-strong); white-space: nowrap; }
  .contrast div.fail span:last-child { color: var(--danger-text); }
  .preview { border: 1px solid var(--line-2); border-radius: var(--radius); padding: var(--pad); background: var(--surface-1); color: var(--ink-1); margin-top: 8px; font-family: var(--font); }
  .preview .team { margin-bottom: 10px; }
  .logo-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
  .logo-row img { width: 48px; height: 48px; border-radius: 12px; object-fit: contain; background: var(--surface-3); }
  .logo-row .ph { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; color: var(--ink-3); }
  .vocab { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

  /* ---- handoff note ---- */
  .handoff { margin-top: 10px; background: var(--low-tint); border-radius: var(--radius-sm); padding: 10px 12px; border-left: 3px solid var(--low); }
  .handoff .ic { color: var(--low-text); }
  .handoff .text { margin-top: 6px; white-space: pre-wrap; color: var(--ink-1); font-size: .9375rem; }
  .handoff .x { border: 0; background: transparent; color: var(--ink-2); width: 36px; height: 36px; border-radius: var(--radius-xs); display: grid; place-items: center; }
  .handoff .x:hover { background: color-mix(in srgb, var(--ink-1) 8%, transparent); }

  /* ---- fairness ---- */
  /* Fairness: horizontal bars with gridlines and an axis; after hours = a hatched, darker segment (texture, not hue). */
  .chart { margin: 4px 0 0; }
  .chart svg { display: block; max-width: 520px; overflow: visible; }
  .chart text { font: var(--w-regular) 12px var(--font); fill: var(--ink-2); }
  .chart .val { font-weight: var(--w-strong); fill: var(--ink-1); }
  .chart .tick { fill: var(--ink-3); font-size: 11px; }
  .chart .axis { stroke: var(--line-2); }
  .chart .gridline { stroke: var(--line-1); }
  .chart .day { fill: color-mix(in srgb, var(--ink-1) 22%, var(--surface-2)); }
  .chart .ah { fill: url(#hatch); }
  .chart .ah-bg { fill: var(--ink-1); }
  .chart .ah-line { stroke: var(--surface-2); stroke-width: 1.6; }
  .chart .legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: var(--t-sm); color: var(--ink-2); margin-top: 6px; }
  .chart .legend span { display: inline-flex; align-items: center; gap: 6px; }

  /* ---- heartbeats, time zone list, getting started ---- */
  .tz-list { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--line-1); border-radius: var(--radius-sm); max-height: 260px; overflow-y: auto; background: var(--surface-2); }
  .tz-list li + li { border-top: 1px solid var(--line-1); }
  .tz-list button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--ink-1); text-align: left; padding: 10px 12px; min-height: 44px; font-weight: var(--w-regular); }
  .tz-list button.active { background: var(--surface-3); font-weight: var(--w-strong); }
  .tz-list button:hover { background: var(--surface-3); }
  /* Getting started: a checklist; with 3+ done it folds into one row (details/summary) with the fraction and a bar. */
  .start > summary, .start > h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: var(--t-md); font-weight: var(--w-strong); list-style: none; cursor: pointer; min-height: 32px; }
  .start > h2 { cursor: auto; }
  .start > summary::-webkit-details-marker { display: none; }
  .start > * > .ic { color: var(--ok); }
  .start > summary .chev { color: var(--ink-3); transition: transform var(--dur-2) var(--ease); }
  .start[open] > summary .chev { transform: rotate(180deg); }
  .prog { width: 56px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: none; }
  .prog::before { content: ""; display: block; height: 100%; width: var(--p); background: var(--ok); }
  .start .steps { list-style: none; margin: 10px 0 4px; padding: 0; }
  .start .steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-1); }
  .start .tick { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; }
  .start .tick .ic { width: 14px; height: 14px; }
  .start li.done .tick { background: var(--ok); border-color: var(--ok); color: var(--surface-2); }
  .start li.done b { color: var(--ink-3); font-weight: var(--w-regular); text-decoration: line-through; }

  /* ---- contact plan ---- */
  .pickset { border: 0; padding: 0; margin: 20px 0 0; min-width: 0; }
  .pickset legend { font-weight: var(--w-strong); padding: 0; font-size: var(--t-md); }
  .picks { display: flex; flex-wrap: wrap; gap: 8px; }
  .pick { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px 4px 8px; min-height: 44px; cursor: pointer; background: var(--surface-3); }
  .pick input { width: 20px; height: 20px; margin: 0; }
  .pick span { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--w-strong); font-size: var(--t-sm); }
  .pick:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--ink-1); }
  .steps-list > * { padding-inline: 12px; }
  .plan-row input { width: 64px; flex: none; margin: 0; }
  .plan-row select { flex: 1; min-width: 0; margin: 0; }

  /* ---- phones (360–430 px wide): one column, bigger targets, nothing overflows ---- */
  .oncall > div, .list > * > div, .incident, .vtl li > div { min-width: 0; }
  .oncall .name, .person .name, .incident .title, .empty b, .team-head h2, .list b { overflow-wrap: break-word; }
  .incident .row, .tl-person .row { flex-wrap: wrap; }
  .hint, .warn, .ok { overflow-wrap: break-word; }
  @media (max-width: 899px) {
    .btn.small, .tab, .chip.filter, .handoff .x, .dp-q { min-height: 44px; }
    .handoff .x { width: 44px; }

    .seg button { padding: 10px 4px; }
  }
  @media (max-width: 480px) {
    .two:not(.choice), .vocab { grid-template-columns: 1fr; }
    .palettes { grid-template-columns: repeat(2, 1fr); }

    .oncall.primary .name { font-size: var(--t-lg); }
    .sched-bar { flex-direction: column; align-items: stretch; }
    .sched-bar .dp-jump .dp-btn { flex: 1; min-width: 0; }
    .sched-bar .choice.range { width: 100%; }


    .tzpill { font-size: .6875rem; padding: 4px 8px; gap: 3px; }

    .ladder-row { gap: 6px; }
    .stepper input { width: 52px !important; padding-left: 4px !important; padding-right: 4px !important; }
    .step-btn { width: 40px; }
    .dp-spin button, .dp-spin input { width: 58px; }
    .dp-ampm button { min-width: 50px; }
    .code { font-size: 1.375rem; letter-spacing: .08em; }
    .chart svg { max-width: 100%; }
    .otp-boxes { gap: 6px; }
    .otp-boxes input { min-height: 52px; font-size: 1.375rem; }
  }
}

/* ========================================================================== utilities */
@layer utilities {
  .num { font-variant-numeric: tabular-nums slashed-zero; }
  .balance { text-wrap: balance; }
  .pretty { text-wrap: pretty; }
  .nowrap { white-space: nowrap; }
  .clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .snap-x { scroll-snap-type: x mandatory; overflow-x: auto; overscroll-behavior-x: contain; scroll-padding-inline: var(--snap-pad, 16px); }
  .snap-x.loose { scroll-snap-type: x proximity; }
  .snap-x > * { scroll-snap-align: start; }
  .danger-text { color: var(--danger-text); }
  /* The hidden attribute always wins over component display rules. */
  [hidden] { display: none !important; }
}
