@layer base {
  body {
    background: var(--surface-canvas);
    color: var(--ink-primary);
    font-family: var(--font-montserrat), ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
    text-rendering: optimizeLegibility;
  }

  input,
  select,
  textarea {
    caret-color: var(--accent);
  }

  /* iOS Safari auto-zooms when a focused input's computed font-size is below
     16px and the page stays zoomed. Floor form controls on coarse pointers
     (touch) so sub-16px Tailwind utilities cannot trigger it. */
  @media (pointer: coarse) {
    input,
    select,
    textarea {
      font-size: max(16px, 1em);
    }
  }

  input::placeholder,
  textarea::placeholder {
    color: color-mix(in srgb, var(--ink-tertiary) 84%, transparent);
  }

  input:disabled,
  select:disabled,
  textarea:disabled,
  button:disabled,
  [aria-disabled="true"] {
    cursor: not-allowed;
  }

  :where(a, button, [role="button"], input, select, textarea) {
    transition-duration: var(--duration-base);
    transition-property:
      background-color,
      border-color,
      box-shadow,
      color,
      opacity,
      transform;
    transition-timing-function: var(--ease-out-quint);
  }

  :where(a, button, [role="button"]):not(:disabled):not([aria-disabled="true"]) {
    cursor: pointer;
  }

  /* Focus ring — DLS §10: 2px accent over a 2px canvas-colored offset */
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  [tabindex]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--surface-canvas), 0 0 0 4px var(--accent);
  }
}

@layer components {
  /* Shared 2026 interaction layer. These classes let product surfaces inherit
     the mobile workout flow's tactile feel without reworking data components. */
  /* DLS status badge classes — replace Tailwind named light-palette classes. */
  .fysigo-status-done {
    color: var(--status-done);
    border-color: color-mix(in srgb, var(--status-done) 40%, var(--line-default));
    background: var(--status-done-soft);
  }
  .fysigo-status-missed {
    color: var(--status-missed);
    border-color: color-mix(in srgb, var(--status-missed) 45%, var(--line-default));
    background: var(--status-missed-soft);
  }
  .fysigo-status-skipped {
    color: var(--ink-secondary);
    border-color: var(--line-default);
    background: var(--neutral-elevated);
  }
  .fysigo-status-rest {
    color: var(--ink-secondary);
    border-color: var(--line-default);
    background: var(--surface-sunken);
  }
  .fysigo-status-carryover {
    color: var(--ink-secondary);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line-default));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-card));
  }
  .fysigo-status-paused {
    color: var(--ink-tertiary);
    border-color: var(--line-default);
    background: var(--surface-sunken);
  }
  .fysigo-notice-warning {
    border-color: color-mix(in srgb, var(--status-borderline) 45%, var(--line-default));
    background: color-mix(in srgb, var(--status-borderline) 10%, var(--surface-card));
  }
  .fysigo-notice-warning-icon {
    color: var(--status-borderline);
  }
  .fysigo-banner-viewas {
    border-color: color-mix(in srgb, var(--purple) 40%, var(--line-default));
    background: color-mix(in srgb, var(--purple) 15%, var(--surface-card));
  }
  .fysigo-banner-viewas-text {
    color: color-mix(in srgb, var(--purple) 70%, var(--ink-primary));
  }
  .fysigo-banner-viewas-control {
    color: color-mix(in srgb, var(--purple) 70%, var(--ink-primary));
    border-color: color-mix(in srgb, var(--purple) 60%, var(--line-default));
  }
  .fysigo-banner-viewas-control:hover {
    background: color-mix(in srgb, var(--purple) 20%, transparent);
  }

  .fysigo-shell {
    background:
      linear-gradient(180deg, rgba(208, 242, 41, 0.035), transparent 18rem),
      var(--surface-canvas);
  }

  .fysigo-header {
    z-index: var(--z-header);
    background:
      linear-gradient(180deg, rgba(58, 58, 58, 0.68), rgba(58, 58, 58, 0.44)),
      var(--surface-canvas);
    backdrop-filter: blur(18px) saturate(1.08);
  }

  .fysigo-shell-frame {
    display: flex;
    flex: 1;
    margin-inline: auto;
    max-width: 1920px;
    width: 100%;
  }

  /* Coach schedule: grow the shell frame with the viewport up to 2400px so day
     columns use laptop→ultrawide width; the 1920px cap stays everywhere else. */
  .fysigo-shell-frame:has(.coach-schedule-full-bleed) {
    max-width: min(2400px, 100%);
  }

  .fysigo-shell-main {
    flex: 1;
    min-width: 0;
    /* Mobile bottom padding clears the home indicator only. The one surface
       that still renders the fixed BottomTabBar (admin — see SHELL_COMPOSITION
       in AppShell.tsx) gets the 5.5rem bar reserve below; every other surface
       (client + coach use the sticky-top mobile top bar, which flows inline and
       needs no reserve) carried that reserve as ~88px of dead scroll slack. */
    padding: 1.5rem 1rem calc(1.5rem + var(--safe-bottom));
  }

  /* Bar reserve = 4rem bar height + 1.5rem breathing room. Mobile-only: the
     bar is md:hidden and the ≥768px padding-block rule below owns md+. */
  @media (max-width: 767.98px) {
    [data-surface="admin"] .fysigo-shell-main {
      padding-bottom: calc(5.5rem + var(--safe-bottom));
    }
  }

  @media (min-width: 640px) {
    .fysigo-shell-main {
      padding-inline: 1.5rem;
    }
  }

  @media (min-width: 768px) {
    .fysigo-shell-main {
      padding-block: 2rem;
    }
  }

  @media (min-width: 1024px) {
    .fysigo-shell-main {
      padding-inline: 2rem;
    }
  }

  /* Chat surface: the chat module fills the viewport below the header
     exactly — zero main padding at every breakpoint, so the document has NO
     scroll slack for iOS Safari to pan into when the keyboard opens (the
     floating-bar/dead-gap failure, 2026-07-03). */
  [data-surface="chat"] .fysigo-shell-main {
    padding: 0;
  }

  .fysigo-sidebar {
    background: var(--surface-canvas);
    border-right: 1px solid var(--line-default);
    height: calc(100dvh - 64px - 24px);
    overflow-y: auto;
    scrollbar-gutter: stable;
    top: 64px;
  }

  .fysigo-sidebar-toggle {
    background: var(--surface-raised);
    border: 1px solid var(--line-default);
    color: var(--ink-secondary);
    transition:
      background-color var(--duration-base) var(--ease-out-quint),
      border-color var(--duration-base) var(--ease-out-quint),
      color var(--duration-base) var(--ease-out-quint),
      transform var(--duration-base) var(--ease-out-quint);
  }

  .fysigo-sidebar-toggle:hover {
    background: var(--surface-sunken);
    border-color: var(--neutral-elevated-line);
    color: var(--ink-primary);
    transform: var(--interactive-lift);
  }

  .fysigo-nav-touch {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition:
      background-color var(--duration-base) var(--ease-out-quint),
      border-color var(--duration-base) var(--ease-out-quint),
      box-shadow var(--duration-base) var(--ease-out-quint),
      color var(--duration-base) var(--ease-out-quint),
      opacity var(--duration-base) var(--ease-out-quint),
      transform var(--duration-base) var(--ease-out-quint);
  }

  .fysigo-nav-touch:active {
    transform: var(--interactive-press);
  }

  .fysigo-sheet-backdrop {
    animation: fade-in var(--duration-base) var(--ease-out);
  }

  .fysigo-bottom-sheet {
    animation: sheet-up var(--duration-slow) var(--ease-out);
  }

  .fysigo-nav-link {
    position: relative;
    border-radius: 8px;
    color: var(--ink-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 0.625rem;
    text-decoration: none;
  }

  .fysigo-nav-link::after {
    background: var(--gradient-accent);
    border-radius: 999px;
    bottom: 0.125rem;
    content: "";
    height: 2px;
    left: 0.625rem;
    opacity: 0;
    position: absolute;
    right: 0.625rem;
    transform: scaleX(0.45);
    transform-origin: center;
    transition:
      opacity var(--duration-base) var(--ease-out-quint),
      transform var(--duration-base) var(--ease-out-quint);
  }

  .fysigo-nav-link:hover {
    background: var(--surface-sunken);
    color: var(--ink-primary);
    transform: var(--interactive-lift);
  }

  .fysigo-nav-link[aria-current="page"] {
    color: var(--ink-primary);
  }

  .fysigo-nav-link[aria-current="page"]::after {
    opacity: 1;
    transform: scaleX(1);
  }

  .fysigo-control {
    align-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    display: inline-flex;
    justify-content: center;
  }

  .fysigo-control:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
    box-shadow: var(--interactive-ring);
    color: var(--ink-primary);
    transform: var(--interactive-lift);
  }

  .fysigo-control:active {
    transform: var(--interactive-press);
  }

  .fysigo-primary {
    background: var(--accent);
    color: var(--accent-foreground);
    font-weight: 800;
  }

  .fysigo-primary:hover {
    box-shadow: var(--shadow-accent-glow-sm);
    filter: saturate(1.05);
    transform: var(--interactive-lift);
  }

  .fysigo-primary:active {
    transform: var(--interactive-press);
  }

  .fysigo-surface {
    border: 1px solid var(--line-default);
    border-radius: var(--radius-lg); /* 10px — the canonical card radius (DLS r-card) */
    background:
      linear-gradient(180deg, rgba(243, 243, 243, 0.025), transparent 48%),
      var(--surface-card);
  }

  /* Fuel surfaces are deliberately outline-free. Tonal separation and the
     shared elevation token establish hierarchy without card borders. */
  .fysigo-fuel-surface {
    background: var(--surface-card);
    border: 1px solid var(--line-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
  }

  .fysigo-traffic-gradient {
    background: var(--gradient-fuel-traffic);
  }

  .fysigo-sweet-spot-gradient {
    background: var(--gradient-fuel-sweet-spot);
  }

  .fysigo-fuel-state-pill {
    align-items: center;
    border-radius: var(--radius-sm);
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25;
    min-height: 1.75rem;
    padding-inline: 0.625rem;
  }

  .fysigo-fuel-state-pill--green {
    background: color-mix(in srgb, var(--fuel-status-green) 12%, transparent);
    color: var(--fuel-status-green);
  }

  .fysigo-fuel-state-pill--orange {
    background: color-mix(in srgb, var(--fuel-status-orange) 12%, transparent);
    color: var(--fuel-status-orange);
  }

  .fysigo-fuel-state-pill--red {
    background: color-mix(in srgb, var(--fuel-status-red) 12%, transparent);
    color: var(--fuel-status-red-text);
  }

  .fysigo-fuel-gauge-link {
    transition: background-color var(--duration-fast) var(--ease-out-quint);
  }

  .fysigo-fuel-gauge-link:hover {
    background: color-mix(in srgb, var(--ink-primary) 4%, transparent);
  }

  .fysigo-fuel-gauge-link:focus-visible {
    box-shadow: var(--shadow-focus-ring);
  }

  .fysigo-fuel-nav-link {
    color: var(--ink-secondary);
    position: relative;
  }

  .fysigo-fuel-nav-link::after {
    background: var(--accent);
    border-radius: 999px;
    bottom: -1px;
    content: "";
    height: 2px;
    inset-inline: 0.75rem;
    opacity: 0;
    position: absolute;
    transform: scaleX(0.5);
    transition:
      opacity var(--duration-base) var(--ease-out-quint),
      transform var(--duration-base) var(--ease-out-quint);
  }

  .fysigo-fuel-nav-link:hover {
    color: var(--ink-primary);
  }

  .fysigo-fuel-nav-link[aria-current="page"] {
    color: var(--ink-primary);
  }

  .fysigo-fuel-nav-link[aria-current="page"]::after {
    opacity: 1;
    transform: scaleX(1);
  }

  .fysigo-fuel-nav-link:focus-visible {
    box-shadow: var(--shadow-focus-ring);
  }

  .fysigo-fuel-nav-pending {
    background: currentColor;
    border-radius: 999px;
    height: 0.25rem;
    opacity: 0;
    transition: opacity var(--duration-base) var(--ease-out-quint);
    width: 0.25rem;
  }

  .fysigo-fuel-nav-pending[data-pending="true"] {
    opacity: 0.7;
  }

  .fysigo-trajectory-rail__track {
    background: var(--surface-sunken);
    border-radius: 999px;
    height: 0.5rem;
    overflow: hidden;
  }

  .fysigo-trajectory-rail__fill {
    border-radius: inherit;
    height: 100%;
    min-width: 0;
    transition: transform var(--duration-base) var(--ease-out-quint);
    transform-origin: left center;
  }

  .fysigo-adherence-ring__track {
    fill: none;
    stroke: var(--surface-sunken);
  }

  .fysigo-adherence-ring__value {
    fill: none;
    stroke: var(--fuel-status-color);
    stroke-linecap: round;
    transition: stroke-dashoffset var(--duration-base) var(--ease-out-quint);
  }

  .fysigo-adherence-ring--green {
    --fuel-status-color: var(--fuel-status-green);
  }

  .fysigo-adherence-ring--orange {
    --fuel-status-color: var(--fuel-status-orange);
  }

  .fysigo-adherence-ring--red {
    --fuel-status-color: var(--fuel-status-red);
  }

  .fysigo-compact-sparkline__line {
    fill: none;
    stroke: var(--fuel-status-green);
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .fysigo-compact-sparkline__point {
    fill: var(--surface-card);
    stroke: var(--fuel-status-green);
  }

  /* Opt-in brand top-hairline modifier. Base .fysigo-surface is PLAIN so the
     hairline never stacks on every box (Daniel 2026-07-01: "too much — on top of
     every box"). Add this to the ONE hero/top card of a screen; see the "Top
     accent" note below for the rule. */
  .fysigo-surface--accent {
    background:
      linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--accent) 88%, transparent),
        color-mix(in srgb, var(--teal) 62%, transparent),
        transparent
      ) top center / min(14rem, calc(100% - 2rem)) 1px no-repeat,
      linear-gradient(180deg, rgba(243, 243, 243, 0.025), transparent 48%),
      var(--surface-card);
  }

  .fysigo-interactive-card {
    transform: translate3d(0, 0, 0);
    will-change: transform, border-color, box-shadow;
  }

  /* === Top accent ========================================================
     The 1px Fysigo wordmark gradient (orange → lime → green → teal, faded at
     both ends) that floats across the top edge of a card.

     OPT-IN, ONCE PER SCREEN — it is NOT auto-applied. Until 2026-07-01 an
     implicit :where([bg-card][border]) rule stamped this hairline onto EVERY
     card + border box, which read as "too much — on top of every box" (Daniel,
     2026-07-01). That implicit rule (and its [data-no-top-accent] opt-out) were
     removed. Add the hairline deliberately by putting `.fysigo-top-accent` on
     the ONE hero/top card of a screen; leave every other card plain.
     Codified 2026-05-31, made opt-in 2026-07-01 with Daniel. See public/brand/system.html §11.
     ====================================================================== */
  .fysigo-top-accent {
    background-image:
      linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--orange) 60%, transparent),
        color-mix(in srgb, var(--lime)   88%, transparent),
        color-mix(in srgb, #69e82f       80%, transparent),
        color-mix(in srgb, var(--teal)   72%, transparent),
        transparent
      ),
      linear-gradient(180deg, rgba(243, 243, 243, 0.025), transparent 48%),
      var(--surface-card);
    background-position:
      top center,
      top center,
      top center;
    background-repeat: no-repeat;
    background-size:
      min(14rem, calc(100% - 2rem)) 1px,
      100% 100%,
      100% 100%;
  }
  /* Wider variant for hero / dashboard cards. */
  .fysigo-top-accent--wide {
    background-size:
      min(28rem, calc(100% - 2rem)) 1px,
      100% 100%,
      100% 100%;
  }

  /* === Spectrum scale ====================================================
     Canonical good-to-bad visualization. Orange end = bad, teal end = good.
     The needle is the data point's position on the spectrum (0–100%).
     Pair the scale with status-text-color on the adjacent numeric value
     so the eye reads color twice: once on the value, once on the position.
     Codified 2026-05-31 with Daniel. See <SpectrumScale /> for the React
     wrapper; this class is the CSS-only primitive for static markup.
     ====================================================================== */
  .fysigo-spectrum-scale {
    position: relative;
    width: 100%;
    height: 10px;
  }
  .fysigo-spectrum-scale > .fysigo-spectrum-bar {
    position: absolute;
    inset: 3px 0 3px 0;
    background: var(--gradient-spectrum);
    border-radius: 2px;
    overflow: hidden;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.05) inset,
      0 4px 10px rgba(254, 131, 1, 0.10),
      0 4px 10px rgba(4, 170, 114, 0.10);
  }
  .fysigo-spectrum-scale > .fysigo-spectrum-needle {
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 4px;
    background: var(--ink-primary);
    border-radius: 2px;
    box-shadow: 0 0 0 1px var(--surface-canvas); /* more white, a hairline of canvas (Tony 2026-10-29) */
    transform: translateX(-2px);
  }
  /* Tall variant for deep-dive surfaces. */
  .fysigo-spectrum-scale--tall { height: 24px; }
  .fysigo-spectrum-scale--tall > .fysigo-spectrum-bar {
    inset: 9px 0 9px 0;
    border-radius: 4px;
  }
  /* Tick marks on the scale — render at boundary positions
     (e.g. standard-low, optimal-low, optimal-high, standard-high).
     Tiny vertical hairlines that sit on the gradient. */
  .fysigo-spectrum-scale > .fysigo-spectrum-tick {
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 1px;
    background: rgba(15, 15, 15, 0.55);
  }
  .fysigo-spectrum-scale--tall > .fysigo-spectrum-tick {
    top: 5px;
    bottom: 5px;
  }

  /* ====== Marker language primitives ===================================
     Building blocks the bloodwork v2 mockup is composed from. Reusable
     across any data-heavy surface (sleep, lifting metrics, earnings)
     so the visual rhythm matches. Documented at
     public/brand/system.html §11. Codified 2026-05-31. */

  /* Headline strip: composite score (left) + vertical divider + a 4-up
     distribution (right). One translucent card, premium spacing. */
  .fysigo-headline-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1px minmax(0, 2fr);
    gap: 28px;
    align-items: center;
    padding: 22px 24px;
    background: var(--surface-card);
    border: 1px solid var(--line-default);
    border-radius: var(--r-card);
  }
  .fysigo-headline-strip__divider {
    background: var(--line-default);
    height: 64px;
    width: 1px;
  }
  @media (max-width: 720px) {
    .fysigo-headline-strip {
      grid-template-columns: 1fr;
      gap: 14px;
      padding: 16px;
    }
    .fysigo-headline-strip__divider { display: none; }
  }

  /* Marker card: name + value + spectrum scale + delta/range footer.
     The card a coach or member scans first when looking at one data
     point. Mono numbers, sentence-case names, sparingly colored values
     (status color when out of optimal, plain foreground when in). */
  .fysigo-marker-card {
    background: var(--surface-card);
    border: 1px solid var(--line-default);
    border-radius: var(--r-card);
    padding: 18px;
    text-align: left;
  }

  /* Row variant: same data, table-row geometry. Used in system view. */
  .fysigo-marker-row {
    display: grid;
    grid-template-columns: minmax(180px, 220px) 90px minmax(0, 1fr) 110px;
    gap: 24px;
    align-items: center;
    padding: 18px 4px;
    border-top: 1px solid var(--line-default);
  }
  .fysigo-marker-row:first-child { border-top: none; }
  @media (max-width: 720px) {
    .fysigo-marker-row {
      grid-template-columns: 1fr;
      gap: 8px;
    }
  }

  /* System narrative: the editorial paragraph above each grouped block
     ("Your cardiovascular markers are directionally improving since…"). */
  .fysigo-system-narrative {
    background: var(--surface-sunken);
    border: 1px solid var(--line-default);
    border-radius: var(--r-card);
    padding: 20px 22px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink-secondary);
  }
  .fysigo-system-narrative b {
    color: var(--ink-primary);
    font-weight: 700;
  }

  /* Compare-draws table (Wave D · screen 04). 4-col grid: name / from / to
     / outcome. The "outcome" cell renders a bordered pill describing the
     zone transition or improvement direction. */
  .fysigo-compare-head,
  .fysigo-compare-row {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(0, 1fr) 200px;
    gap: 24px;
    align-items: center;
    padding: 16px 4px;
    border-top: 1px solid var(--line-default);
  }
  .fysigo-compare-head {
    border-top: none;
    border-bottom: 1px solid var(--line-default);
    padding-top: 6px;
    padding-bottom: 10px;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted, var(--ink-secondary));
  }
  @media (max-width: 720px) {
    .fysigo-compare-head,
    .fysigo-compare-row {
      grid-template-columns: 1fr;
      gap: 8px;
    }
    .fysigo-compare-head { display: none; }
  }
  .fysigo-compare-outcome {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-secondary);
    background: transparent;
  }
  .fysigo-compare-outcome--moved-in {
    color: var(--status-optimal);
    border-color: color-mix(in srgb, var(--status-optimal) 50%, var(--line-default));
  }
  .fysigo-compare-outcome--moved-out {
    color: var(--status-out-of-range);
    border-color: color-mix(in srgb, var(--status-out-of-range) 50%, var(--line-default));
  }
  .fysigo-compare-outcome--improved {
    color: var(--status-optimal);
    border-color: color-mix(in srgb, var(--status-optimal) 30%, var(--line-default));
  }
  .fysigo-compare-outcome--worsened {
    color: var(--status-out-of-range);
    border-color: color-mix(in srgb, var(--status-out-of-range) 30%, var(--line-default));
  }
  .fysigo-compare-outcome--steady {
    color: var(--ink-secondary);
  }

  /* Lens cards (Wave D · screen 05). Each card pairs 3–6 markers under a
     fixed clinical lens with a one-line verdict pill + reading paragraph. */
  .fysigo-lens-card {
    background: var(--surface-card);
    border: 1px solid var(--line-default);
    border-radius: var(--r-card);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .fysigo-lens-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .fysigo-lens-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink-primary);
    margin: 0;
  }
  .fysigo-lens-verdict {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: transparent;
  }
  .fysigo-lens-verdict--green {
    color: var(--status-optimal);
    border-color: color-mix(in srgb, var(--status-optimal) 50%, var(--line-default));
  }
  .fysigo-lens-verdict--amber {
    color: var(--status-borderline);
    border-color: color-mix(in srgb, var(--status-borderline) 50%, var(--line-default));
  }
  .fysigo-lens-verdict--red {
    color: var(--status-out-of-range);
    border-color: color-mix(in srgb, var(--status-out-of-range) 50%, var(--line-default));
  }
  .fysigo-lens-reading {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ink-secondary);
    margin: 0;
  }
  .fysigo-lens-reading b {
    color: var(--ink-primary);
    font-weight: 700;
  }
  .fysigo-lens-markers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
  }
  @media (max-width: 540px) {
    .fysigo-lens-markers { grid-template-columns: 1fr; }
  }
  .fysigo-lens-mark {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .fysigo-lens-mark-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
  }
  .fysigo-lens-mark-name {
    font-size: 12px;
    color: var(--ink-secondary);
  }
  .fysigo-lens-mark-val {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12.5px;
    color: var(--ink-primary);
  }

  .fysigo-interactive-card:hover {
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line-strong));
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32), var(--interactive-ring);
    transform: var(--interactive-lift);
  }

  .fysigo-interactive-card:active {
    transform: var(--interactive-press);
  }

  /* Rolling-queue (Train) row — browsed/selected affordance (#17).
     "Next up" already owns the lime --accent (border + badge). Selection must
     read as a SEPARATE state, so the browsed row gets a NEUTRAL ring on
     keyboard focus / focus-within, overriding the global lime focus ring for
     this row only. A row that is both NEXT UP and selected shows lime border +
     lime badge AND this neutral ring — distinctly both. */
  .fysigo-queue-row:focus-visible,
  .fysigo-queue-row:focus-within {
    outline: none;
    box-shadow: var(--queue-selection-ring);
  }
  /* The row's <Link> is the focusable element; suppress the default accent
     focus ring on it so the neutral row ring above is the only selection cue. */
  .fysigo-queue-row a:focus-visible {
    box-shadow: none;
  }

  .fysigo-input {
    border: 1px solid var(--line-strong);
    background: var(--surface-sunken);
    color: var(--ink-primary);
  }

  .fysigo-input:hover {
    border-color: color-mix(in srgb, var(--accent) 28%, var(--line-strong));
  }

  .fysigo-input:focus,
  .fysigo-input:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
    outline: none;
  }

  /* === Typography ramp ===================================================
     The DLS type scale as semantic utilities. One family (Montserrat); each
     step pins size + line-height + weight + tracking together so callers
     never re-derive them. Numeric steps (.fy-value, .fy-hero) carry tabular
     figures so columns line up. Source of truth: public/dls/index.html §10
     (Typography). Use these instead of ad-hoc text-[Npx] arbitrary values.
     ====================================================================== */
  .fy-display {
    font-size: 3rem; /* 48px */
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
  .fy-h1 {
    font-size: 2rem; /* 32px */
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
  .fy-h2 {
    font-size: 1.625rem; /* 26px */
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.015em;
  }
  .fy-h3 {
    font-size: 1.125rem; /* 18px */
    font-weight: 700;
    line-height: 1.3;
  }
  .fy-body {
    font-size: 0.9375rem; /* 15px */
    font-weight: 400;
    line-height: 1.6;
  }
  .fy-small {
    font-size: 0.8125rem; /* 13px */
    font-weight: 400;
    line-height: 1.5;
    color: var(--ink-secondary);
  }
  /* THE eyebrow / kicker (Tony 2026-10-29) — one recipe instead of twelve:
     mono, 11px, uppercase, 0.14em tracking, tertiary ink. Pair a status colour
     class after it when the eyebrow carries state. */
  .fy-eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    line-height: var(--text-micro--line-height, 1.3);
    font-weight: var(--text-micro--font-weight, 500);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-tertiary);
  }

  .fy-label {
    font-size: 0.8125rem; /* 13px */
    font-weight: 500;
    line-height: 1.4;
    color: var(--ink-secondary);
  }
  .fy-value {
    font-size: 1.75rem; /* 28px */
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
  }
  .fy-hero {
    font-size: 4rem; /* 64px */
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
  }

  .landing-main-hero-bg {
    background:
      linear-gradient(90deg, rgba(15, 15, 15, 0.95) 0%, rgba(15, 15, 15, 0.72) 42%, rgba(15, 15, 15, 0.4) 100%),
      linear-gradient(180deg, transparent 0%, var(--surface-canvas) 92%),
      url("/landing-proposal-assets/confluence-header.png") center right / cover no-repeat;
    inset: -1rem -1rem auto -1rem;
    min-height: min(72dvh, 720px);
    opacity: 0.92;
    position: absolute;
  }
}

@media (hover: hover) and (pointer: fine) {
  :where(button, a, [role="button"]):not(:disabled):not([aria-disabled="true"]):hover {
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
  }
}

@media (max-width: 767px) {
  body {
    overscroll-behavior-y: none;
  }
}

/* ── Fysigo scroll standard (DLS · /dls#scroll) ──────────────────────
   Native scrollbars are HIDDEN app-wide. Scrolling is a universally
   understood gesture; a bar is visual noise. The ONE visible scroll
   indicator in the whole app is the timeline's branded NowScrubber rail.
   Scrolling itself is never affected — wheel, trackpad, touch, and
   keyboard all still work. Horizontal scrollers MUST signal scrollability
   another way (scroll-snap + a peeking next item), since there is no bar.
   `.scrollbar-none` above is the explicit, self-documenting form of this
   same default; new scroll containers need no opt-in — they inherit it. */
* {
  scrollbar-width: none;          /* Firefox / standard */
  -ms-overflow-style: none;       /* legacy Edge */
}
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;                  /* WebKit: Safari, iOS WKWebView, Chrome */
}

/* Drawer / panel entrance */
@keyframes slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.animate-slide-in {
  animation: slide-in var(--duration-slow) var(--ease-out);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.animate-fade-in {
  animation: fade-in var(--duration-base) var(--ease-out);
}

@keyframes sheet-up {
  from {
    opacity: 0.96;
    transform: translate3d(0, 1.5rem, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Chat message-bubble entrance — a light rise + fade so new messages "land".
   Motion-safe-gated so reduced-motion users get the message with no animation. */
@keyframes fy-bubble-in {
  from {
    opacity: 0;
    transform: translate3d(0, 6px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
.fy-bubble-in {
  animation: fy-bubble-in var(--duration-base) var(--ease-out-quint);
}
@media (prefers-reduced-motion: reduce) {
  .fy-bubble-in {
    animation: none;
  }
}

/* Typing-indicator dots — three dots that pulse in sequence. */
@keyframes fy-typing-dot {
  0%,
  60%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* Coach calendar view transitions — Week ⇄ Month. The week body fades in; the
   month grid scales up from 98% so the switch reads as "the month opening up".
   Both are motion-safe-gated at the call site (prefers-reduced-motion off). */
@keyframes fy-cal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fy-cal-zoom {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Shimmer keyframes — used by route-skeleton bars in /loading.tsx files.
   Codified 2026-05-31 with the instant-landing-CTAs plan. */
@keyframes fy-skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Knight-Rider scan keyframes — drives the masked highlight that sweeps
   left↔right across the FYSIGO-spectrum BrandStripeLoader. The highlight is
   a translated mask layer; this only moves its X position so the underlying
   --gradient-wordmark stays put. Reduced-motion is handled by the component
   (it omits the .fy-stripe-scan class), reinforced by the global reduce rule
   below. Codified 2026-06-02 with the branded-long-load plan. */
@keyframes fy-stripe-scan {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}
.fy-stripe-scan {
  animation: fy-stripe-scan var(--duration-reveal, 1100ms) var(--ease-in-out) infinite;
}

/* THE loader — one spinner for every surface (Tony 2026-10-29): an ink ring and
   an inner lime ring that draw on and off while the pair rotates. <Spinner> renders
   it; the design board and the DLS page use the same class. Colours are tokens
   only (ink-primary + lime). Size scales from the 48px master via
   --fy-loader-size (1 = 48px); the size modifiers match <Spinner size>. */
.fy-loader {
  --fy-loader-size: 1;
  --fy-loader-ring: var(--ink-primary);
  --fy-loader-accent: var(--lime);
  display: inline-block;
  flex-shrink: 0;
  width: calc(48px * var(--fy-loader-size));
  height: calc(48px * var(--fy-loader-size));
  border-radius: 50%;
  position: relative;
  animation: fy-loader-rotate 1s linear infinite;
}
.fy-loader::before,
.fy-loader::after {
  content: '';
  box-sizing: border-box;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: calc(5px * var(--fy-loader-size)) solid var(--fy-loader-ring);
  -webkit-mask: conic-gradient(from var(--fy-loader-tail), #000 var(--fy-loader-len), transparent 0);
  mask: conic-gradient(from var(--fy-loader-tail), #000 var(--fy-loader-len), transparent 0);
  animation: fy-loader-arc 2s infinite;
}
.fy-loader::after {
  inset: calc(8px * var(--fy-loader-size));
  transform: rotate3d(90, 90, 0, 180deg);
  border-color: var(--fy-loader-accent);
}
.fy-loader--sm { --fy-loader-size: calc(16 / 48); }
.fy-loader--md { --fy-loader-size: calc(24 / 48); }
.fy-loader--lg { --fy-loader-size: calc(36 / 48); }
.fy-loader--xl { --fy-loader-size: 1; }
@keyframes fy-loader-rotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* The arc is a conic mask on each ring: it starts at --fy-loader-tail and is
   --fy-loader-len long. The head runs ahead, then the tail chases it a full turn,
   so the last frame (tail 360°, 20° arc) is the first frame (tail 0°, 20° arc) —
   the loop has no seam. Registered so the angles interpolate. */
@property --fy-loader-tail { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --fy-loader-len  { syntax: '<angle>'; inherits: false; initial-value: 20deg; }
@keyframes fy-loader-arc {
  0%   { --fy-loader-tail: 0deg;   --fy-loader-len: 20deg;  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
  50%  { --fy-loader-tail: 30deg;  --fy-loader-len: 290deg; animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
  100% { --fy-loader-tail: 360deg; --fy-loader-len: 20deg; }
}
/* Reduced motion: a frozen frame would be a 20° sliver. Stop the motion and show both rings whole — still reads as "loading". */
@media (prefers-reduced-motion: reduce) {
  .fy-loader,
  .fy-loader::before,
  .fy-loader::after {
    animation: none;
    -webkit-mask: none;
    mask: none;
  }
}

/* Program decks (My Programs, /app/programs) — the deck-of-cards motion set.
   fan-in: cards rise + settle into the fanned grid (staggered per card via
   inline animation-delay). draw: the drawn-card overlay pulls forward from
   the pile. pop: the drawn card's duration numeral re-settles when a dose
   chip rescales it. All three flatten to instant states under
   prefers-reduced-motion. Codified 2026-07-07 with the decks surface. */
@keyframes fy-deck-fan-in {
  from {
    opacity: 0;
    transform: translateY(14px) rotate(-1.5deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.fy-deck-fan-in {
  opacity: 0;
  animation: fy-deck-fan-in 320ms var(--ease-out-quint) forwards;
}
@keyframes fy-deck-draw {
  from {
    opacity: 0;
    transform: translateY(44px) rotate(2.5deg) scale(0.92);
  }
}
.fy-deck-draw {
  animation: fy-deck-draw 340ms var(--ease-out-quint);
}
@keyframes fy-deck-pop {
  from {
    transform: scale(0.9);
  }
  to {
    transform: scale(1);
  }
}
.fy-deck-pop {
  animation: fy-deck-pop 220ms var(--ease-out-quint);
}
@media (prefers-reduced-motion: reduce) {
  .fy-deck-fan-in,
  .fy-deck-draw,
  .fy-deck-pop {
    animation: none;
  }
  .fy-deck-fan-in {
    opacity: 1;
  }
}

/* Interval-timer progress ring — the stroke offset eases as each segment
   fills. Motion-OK only; the component's motion-reduce:!transition-none and the
   global reduce rule below both flatten it to a static ring. Codified 2026-06-02
   with the standalone CrossFit/interval timer (v1). */
.fy-interval-ring {
  transition: stroke-dashoffset var(--duration-base, 200ms) linear,
    stroke var(--duration-base, 200ms) var(--ease-out);
}

/* Tabata gym dashboard — coach TV shell (Furnace board uses fy-wod-board black canvas). */
.fy-tabata-dashboard {
  --fy-tabata-ink: var(--ink-primary);
  background: #000000;
  color: var(--ink-primary);
}
.fy-tabata-flood {
  background: #000000;
  transition: background-color var(--duration-slow, 320ms) var(--ease-out-quint, cubic-bezier(0.22, 1, 0.36, 1));
}
.fy-tabata-dashboard--leadIn .fy-tabata-flood {
  background: color-mix(in srgb, var(--orange) 14%, #000000);
}
.fy-tabata-dashboard--work .fy-tabata-flood {
  background: color-mix(in srgb, var(--lime) 12%, #000000);
}
.fy-tabata-dashboard--rest .fy-tabata-flood {
  background: color-mix(in srgb, var(--teal) 10%, #000000);
}
.fy-tabata-dashboard--warn .fy-tabata-flood {
  background: color-mix(in srgb, var(--status-borderline) 18%, #000000);
}
.fy-tabata-dashboard--done .fy-tabata-flood {
  background: color-mix(in srgb, var(--teal) 12%, #000000);
}
.fy-tabata-dashboard--warn .fy-tabata-clock--pulse {
  color: var(--status-borderline);
}

/* CrossFit WOD board — Armageddon-scale hero clock + Fysigo spectrum rail. */
.fy-wod-board {
  background: #000000;
}
.fy-wod-board--leadIn .fy-wod-phase-label {
  color: var(--orange);
}
.fy-wod-board--work .fy-wod-phase-label {
  color: var(--lime);
}
.fy-wod-board--rest .fy-wod-phase-label {
  color: var(--teal);
}
.fy-wod-board--done .fy-wod-phase-label,
.fy-wod-board--warn .fy-wod-phase-label {
  color: var(--lime);
}
.fy-wod-phase-label {
  font-size: clamp(2rem, 5.5vw, 4.5rem);
  line-height: 1;
}
.fy-wod-phase-label--time {
  font-size: clamp(2.5rem, 8vw, 6rem);
  letter-spacing: 0.06em;
}
.fy-wod-clock {
  font-size: clamp(5rem, min(28vw, 22vh), 22rem);
  width: 100%;
  text-align: center;
}
.fy-wod-spectrum-track {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.fy-wod-spectrum-fill {
  background: var(--gradient-wordmark);
  box-shadow:
    0 0 24px color-mix(in srgb, var(--lime) 35%, transparent),
    0 0 40px color-mix(in srgb, var(--teal) 25%, transparent);
  transform-origin: left center;
  transition: transform 1s linear;
}

/* Interval timer — mobile full-screen; desktop = left config rail beside Train nav */
.fy-interval-timer-shell {
  height: 100dvh;
}
@media (min-width: 768px) {
  .fy-interval-timer-panel {
    position: relative;
  }
  .fy-interval-timer-panel::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: var(--gradient-wordmark);
    opacity: 0.85;
    pointer-events: none;
  }
}
.fy-interval-gradient-divider {
  height: 1px;
  background: var(--gradient-wordmark);
  opacity: 0.9;
}
.fy-tabata-clock--pulse {
  animation: fy-tabata-clock-pulse var(--duration-base, 200ms) var(--ease-in-out) infinite;
}
@keyframes fy-tabata-clock-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .fy-wod-spectrum-fill {
    transition-duration: 1ms;
  }
}

/* ============================================================
   Massage capability V1 — RatingBar + PunctualityBar gradients.
   Flat brand-palette gradients; the components own layout + thumb.
   Sourced from --orange/--lime/--green/--teal/--red so they stay
   on-brand and dark-mode safe (the canvas is always dark).
   Added 2026-06-13.
   ============================================================ */
.fysigo-grad-rating {
  /* 0–5 rating. Below 3.0 trends amber→red (bad); from 3.0 the bar
     turns green and trends green→teal (good). Stops are placed on the
     0..5 scale (3.0 = 60%). */
  background: linear-gradient(
    90deg,
    var(--red) 0%,
    var(--orange) 30%,
    var(--lime) 55%,
    var(--green) 60%,
    var(--teal) 100%
  );
}
.fysigo-grad-punctuality {
  /* Time-to-appointment. Green from "early" through the last minute,
     a yellow sliver in the final 30 seconds, red once the time passes.
     Left = early (good), right = late (bad). */
  background: linear-gradient(
    90deg,
    var(--teal) 0%,
    var(--green) 70%,
    var(--lime) 88%,
    var(--status-borderline) 94%,
    var(--red) 100%
  );
}

/* Reduced motion — DLS §5: strip travel, keep the state change */
@media (prefers-reduced-motion: reduce) {
  .fysigo-fuel-nav-link::after,
  .fysigo-fuel-nav-pending,
  .fysigo-trajectory-rail__fill,
  .fysigo-adherence-ring__value {
    transition: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* === Onboarding v2 promoted patterns (2026-09-24) =========================
   Daniel-approved primitives from public/proposals/2026-09-24-onboarding-v2.html:
   - SpectrumProgress: a completion bar with a white spark dot.
   - AmbientGlow: a three-blob brand-wash ambient background.
   - ConnectCard: bounded hero + feature-row connect/permission pattern.

   The ambient glow is for HERO MOMENTS ONLY — Welcome, Ready-to-start, and
   paywall-style screens. It is not general decoration; the accent budget still
   applies. Source: Daniel's 2026-09-24 approval of the onboarding-v2 board.
   ========================================================================= */

@layer components {
  /* ── SpectrumProgress ─────────────────────────────────────────────────── */
  .fysigo-spectrum-progress {
    position: relative;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-sunken);
    overflow: visible;
  }

  .fysigo-spectrum-progress__fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: calc(var(--f, 0) * 100%);
    min-width: calc(0.001 * 100%);
    background: var(--gradient-spectrum);
    background-size: calc(100% / var(--f, 1)) 100%;
    border-radius: inherit;
    transition: width 700ms var(--ease-spring);
  }

  /* White spark dot at the fill's leading edge. The board explicitly calls for
     a white (#fff) dot; no pure-white token exists in the DLS. */
  .fysigo-spectrum-progress__fill::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 9999px;
    background: #ffffff;
    box-shadow: 0 0 12px 4px color-mix(in srgb, var(--lime) 70%, transparent);
  }

  .fysigo-spectrum-progress__caption {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 10.5px; /* exact value from the onboarding-v2 board */
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-tertiary);
  }

  .fysigo-spectrum-progress__caption--complete {
    color: var(--lime);
  }

  /* ── AmbientGlow ──────────────────────────────────────────────────────── */
  .fysigo-ambient-glow {
    position: absolute;
    inset: -20%;
    z-index: 0;
    filter: blur(40px) saturate(1.2);
    opacity: 0.9;
    pointer-events: none;
  }

  .fysigo-ambient-glow--soft {
    opacity: 0.38;
  }

  .fysigo-ambient-glow--low {
    top: auto;
    bottom: 0;
    height: 90%;
  }

  .fysigo-ambient-glow__blob {
    position: absolute;
    border-radius: 9999px;
    mix-blend-mode: screen;
  }

  .fysigo-ambient-glow__blob--orange {
    width: 55%;
    height: 55%;
    top: 5%;
    left: 0%;
    background: radial-gradient(
      circle at 50% 50%,
      color-mix(in srgb, var(--orange) 70%, transparent) 0%,
      transparent 65%
    );
    animation: fysigo-ambient-drift-orange 11s ease-in-out infinite alternate;
  }

  .fysigo-ambient-glow__blob--lime {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 30%;
    background: radial-gradient(
      circle at 50% 50%,
      color-mix(in srgb, var(--lime) 55%, transparent) 0%,
      transparent 65%
    );
    animation: fysigo-ambient-drift-lime 13s ease-in-out infinite alternate;
  }

  .fysigo-ambient-glow__blob--teal {
    width: 55%;
    height: 55%;
    top: 45%;
    left: 55%;
    background: radial-gradient(
      circle at 50% 50%,
      color-mix(in srgb, var(--teal) 60%, transparent) 0%,
      transparent 65%
    );
    animation: fysigo-ambient-drift-teal 15s ease-in-out infinite alternate;
  }

  /* ── ScreenBand (pattern 9.13) ────────────────────────────────────────── */
  .fysigo-screen-band__sentinel {
    height: 1px;
    margin-bottom: -1px;
    pointer-events: none;
  }

  .fysigo-screen-band {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    min-height: var(--band-height);
    padding: 0 40px;
    overflow: hidden;
    background: var(--surface-canvas);
    border-bottom: 1px solid var(--line-default);
    transition: min-height 180ms ease;
    container: screen-band / inline-size;
  }

  .fysigo-screen-band[data-collapsed="true"] {
    min-height: var(--band-height-collapsed);
  }

  .fysigo-screen-band__glow {
    position: absolute;
    inset: -20%;
    z-index: 0;
    opacity: var(--band-glow-opacity);
    filter: blur(var(--band-glow-blur)) saturate(1.1);
    pointer-events: none;
  }

  .fysigo-screen-band__blob {
    position: absolute;
    border-radius: 9999px;
    mix-blend-mode: screen;
  }

  .fysigo-screen-band__blob--orange {
    left: -10%;
    top: 10%;
    width: 70%;
    height: 60%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--orange) 90%, transparent), transparent);
  }

  .fysigo-screen-band__blob--lime {
    right: -12%;
    top: 14%;
    width: 70%;
    height: 62%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--lime) 75%, transparent), transparent);
  }

  .fysigo-screen-band__blob--teal {
    left: 10%;
    top: 32%;
    width: 80%;
    height: 58%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--teal) 85%, transparent), transparent);
  }

  .fysigo-screen-band__inner {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .fysigo-screen-band__copy {
    display: grid;
    min-width: 0;
    gap: 6px;
  }

  .fysigo-screen-band__eyebrow {
    margin: 0;
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-tertiary);
  }

  .fysigo-screen-band__title {
    margin: 0;
    font-size: var(--text-h1);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--ink-primary);
  }

  .fysigo-screen-band__lede {
    margin: 0;
    font-size: var(--text-body);
    color: var(--ink-secondary);
  }

  .fysigo-screen-band__aside {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 28px;
  }

  .fysigo-screen-band__hero {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }

  .fysigo-screen-band__hero-value {
    display: block;
    margin: 0;
    font-size: var(--text-hero);
    font-weight: 800;
    letter-spacing: -0.03em;
    /* Line box taller than the 64px numeral's glyph box so the label never
       touches it (the guardian measured a 343-445 px² overlap at line-height 1). */
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    color: var(--ink-primary);
  }

  .fysigo-screen-band__hero[data-zone="optimal"] .fysigo-screen-band__hero-value { color: var(--status-optimal); }
  .fysigo-screen-band__hero[data-zone="borderline"] .fysigo-screen-band__hero-value { color: var(--status-borderline); }
  .fysigo-screen-band__hero[data-zone="out-of-range"] .fysigo-screen-band__hero-value { color: var(--status-out-of-range); }

  .fysigo-screen-band__hero-value small {
    margin-left: 4px;
    font-size: var(--text-h3);
    font-weight: 700;
    letter-spacing: 0;
    color: var(--ink-tertiary);
  }

  .fysigo-screen-band__hero-label {
    font-family: var(--font-mono);
    display: block;
    margin: 0;
    font-size: var(--text-micro);
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.3;
    text-transform: uppercase;
    color: var(--ink-tertiary);
  }

  .fysigo-screen-band__actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .fysigo-screen-band__settings {
    position: relative;
    display: inline-flex;
    flex: none; /* never squeezed below 44px by a crowded action cluster */
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    border-radius: 9999px;
    background: var(--surface-raised);
    color: var(--ink-secondary);
    text-decoration: none;
  }

  .fysigo-screen-band__settings:hover,
  .fysigo-screen-band__settings:focus-visible {
    color: var(--ink-primary);
    background: var(--neutral-elevated);
  }

  /* Visible tooltip from the aria-label (the icon is unnamed otherwise). */
  .fysigo-screen-band__settings::after {
    content: attr(aria-label);
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-tile);
    background: var(--surface-overlay);
    font-size: var(--text-small);
    font-weight: 600;
    white-space: nowrap;
    color: var(--ink-primary);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
  }

  .fysigo-screen-band__settings:hover::after,
  .fysigo-screen-band__settings:focus-visible::after {
    opacity: 1;
  }

  /* Wordmark: auto picks colour everywhere, mono under admin. */
  .fysigo-wordmark--mono { display: none; }
  [data-surface="admin"] .fysigo-wordmark--color { display: none; }
  [data-surface="admin"] .fysigo-wordmark--mono { display: inline; }

  /* Collapsed (scrolled) and compact (iPad portrait): headline + actions only. */
  .fysigo-screen-band[data-collapsed="true"] .fysigo-screen-band__lede,
  .fysigo-screen-band[data-collapsed="true"] .fysigo-screen-band__hero {
    display: none;
  }

  /* Layout follows the BAND's own width, never the viewport (Daniel 2026-10-29: a
     700-800px column between sidebar and inspector overlapped title and hero).
     >=900: one row. <900: the hero drops under the title. <560: actions wrap under. */
  @container screen-band (max-width: 899px) {
    .fysigo-screen-band__inner {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-areas: "copy actions" "hero hero";
      align-items: center;
      row-gap: 12px;
      padding-block: 16px;
    }
    .fysigo-screen-band__aside { display: contents; }
    .fysigo-screen-band__copy { grid-area: copy; }
    .fysigo-screen-band__actions { grid-area: actions; }
    .fysigo-screen-band__hero { grid-area: hero; align-items: flex-start; }
  }
  @container screen-band (max-width: 559px) {
    .fysigo-screen-band__inner {
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas: "copy" "hero" "actions";
    }
    .fysigo-screen-band__actions { flex-wrap: wrap; justify-self: start; }
  }
  @media (max-width: 820px) {
    .fysigo-screen-band {
      min-height: var(--band-height-compact);
      padding: 0 20px;
    }
    .fysigo-screen-band__title {
      font-size: var(--text-h2);
    }
    .fysigo-screen-band__lede {
      display: none;
    }
  }

  /* ── BandMenu ─────────────────────────────────────────────────────────── */
  .fysigo-band-menu { position: relative; display: inline-block; }
  .fysigo-band-menu__button {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
    border: 1px solid var(--line-strong); border-radius: 9999px; background: var(--surface-raised);
    font: inherit; font-size: var(--text-body); font-weight: 700; color: var(--ink-primary); cursor: pointer;
  }
  .fysigo-band-menu__button:hover,
  .fysigo-band-menu__button[aria-expanded="true"] { background: var(--neutral-elevated); }
  .fysigo-band-menu__list {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; display: grid; min-width: 180px; padding: 6px;
    border: 1px solid var(--line-strong); border-radius: var(--r-tile); background: var(--surface-overlay);
  }
  .fysigo-band-menu__item {
    display: flex; align-items: center; min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--r-tile);
    background: transparent; font: inherit; font-size: var(--text-body); font-weight: 600; text-align: left;
    text-decoration: none; color: var(--ink-secondary); cursor: pointer;
  }
  .fysigo-band-menu__item:hover,
  .fysigo-band-menu__item:focus-visible { background: var(--neutral-elevated); color: var(--ink-primary); outline: none; }
  /* Selected = colour only (RULES #icons): no edge bar, fill or ring. */
  .fysigo-band-menu__item[aria-checked="true"] { color: var(--accent); }

  /* Live workout: no band, no glow — before hydration too. */
  [data-calm] .fysigo-screen-band,
  [data-calm] .fysigo-screen-band__sentinel {
    display: none;
  }

  /* Calm wins: no glow on any band (ModalBand included) inside or under [data-calm]. */
  [data-calm] .fysigo-screen-band__glow,
  [data-calm].fysigo-screen-band__glow {
    display: none;
  }

  /* ── DetailPanel (9.1 inspector) ──────────────────────────────────────── */
  .fysigo-detail-panel {
    position: relative;
    display: flex;
    width: var(--detail-w, var(--inspector-w));
    max-width: 100%;
    flex-direction: column;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
  }
  .fysigo-detail-panel[data-sticky="true"] { position: sticky; top: 24px; align-self: flex-start; }
  /* State is a solid dot before the title, never a coloured bar down the card edge (RULES #edges). */
  .fysigo-detail-panel[data-edge] .fysigo-detail-panel__title::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 10px;
    border-radius: 9999px;
    vertical-align: middle;
  }
  .fysigo-detail-panel[data-edge="optimal"] .fysigo-detail-panel__title::before { background: var(--status-optimal); }
  .fysigo-detail-panel[data-edge="borderline"] .fysigo-detail-panel__title::before { background: var(--status-borderline); }
  .fysigo-detail-panel[data-edge="out-of-range"] .fysigo-detail-panel__title::before { background: var(--status-out-of-range); }
  .fysigo-detail-panel__head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 12px; }
  .fysigo-detail-panel__titles { min-width: 0; flex: 1; }
  .fysigo-detail-panel__eyebrow {
    margin: 0 0 4px;
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-tertiary);
  }
  .fysigo-detail-panel__title { margin: 0; font-size: var(--text-h2); font-weight: 700; line-height: 1.15; color: var(--ink-primary); }
  .fysigo-detail-panel__actions { display: flex; align-items: center; gap: 8px; }
  .fysigo-detail-panel__close,
  .fysigo-modal-band__close {
    display: inline-flex;
    flex: none;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9999px;
    background: var(--surface-raised);
    color: var(--ink-secondary);
    cursor: pointer;
  }
  .fysigo-detail-panel__close:hover,
  .fysigo-modal-band__close:hover { background: var(--neutral-elevated); color: var(--ink-primary); }
  .fysigo-detail-panel__body { min-height: 0; flex: 1; overflow-y: auto; padding: 0 20px 20px; }
  .fysigo-detail-panel__foot { padding: 16px 20px; border-top: 1px solid var(--line-default); }

  .fysigo-detail-panel[data-side="sheet"] { position: fixed; inset: auto 0 0 0; z-index: var(--z-drawer); width: auto; max-height: 80dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .fysigo-detail-panel[data-side="sheet"][data-open="false"] { display: none; }
  @media (max-width: 820px) {
    .fysigo-detail-panel:not([data-side="inspector"]) { position: fixed; inset: auto 0 0 0; z-index: var(--z-drawer); width: auto; max-height: 80dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .fysigo-detail-panel:not([data-side="inspector"])[data-open="false"] { display: none; }
  }

  /* ── ModalBand ────────────────────────────────────────────────────────── */
  .fysigo-modal-band {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--line-default);
    background: var(--surface-canvas);
  }
  .fysigo-modal-band__inner { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 16px 16px 24px; }
  .fysigo-modal-band__copy { display: grid; min-width: 0; gap: 4px; }
  .fysigo-modal-band__eyebrow { margin: 0; font-family: var(--font-mono); font-size: var(--text-micro); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-tertiary); }
  .fysigo-modal-band__title { margin: 0; font-size: var(--text-h2); font-weight: 800; letter-spacing: -0.015em; line-height: 1.15; color: var(--ink-primary); }
  .fysigo-modal-band__lede { margin: 0; font-size: var(--text-body); color: var(--ink-secondary); }
  .fysigo-modal-band__aside { display: flex; flex-shrink: 0; align-items: center; gap: 8px; }

  /* ── Stepper ──────────────────────────────────────────────────────────── */
  .fysigo-stepper { display: flex; margin: 0; padding: 0; list-style: none; gap: 8px; }
  .fysigo-stepper__step { flex: 1; min-width: 0; }
  .fysigo-stepper__hit { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 10px; padding: 0 8px; border: 0; background: transparent; text-align: left; color: var(--ink-tertiary); }
  button.fysigo-stepper__hit { cursor: pointer; }
  .fysigo-stepper__dot { display: inline-flex; flex: none; width: 28px; height: 28px; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 9999px; font-size: var(--text-small); font-weight: 700; }
  .fysigo-stepper__text { display: grid; min-width: 0; }
  .fysigo-stepper__label { font-size: var(--text-label); font-weight: 600; }
  .fysigo-stepper__desc { font-size: var(--text-small); color: var(--ink-tertiary); }
  .fysigo-stepper__step[data-state="done"] .fysigo-stepper__hit { color: var(--ink-secondary); }
  .fysigo-stepper__step[data-state="done"] .fysigo-stepper__dot { border-color: var(--ink-secondary); }
  .fysigo-stepper__step[data-state="current"] .fysigo-stepper__hit { color: var(--ink-primary); }
  /* Current = colour only: accent numeral, no fill or ring (RULES #icons). */
  .fysigo-stepper__step[data-state="current"] .fysigo-stepper__dot { color: var(--accent); }
  .fysigo-stepper[data-size="sm"] .fysigo-stepper__dot { width: 22px; height: 22px; }
  .fysigo-stepper-count { display: inline-flex; min-height: 28px; align-items: center; gap: 8px; margin: 0; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9999px; background: var(--surface-raised); font-family: var(--font-mono); font-size: var(--text-micro); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-secondary); }

  /* ── TreeCanvas ───────────────────────────────────────────────────────── */
  .fysigo-tree { overflow: auto; padding: 16px; }
  .fysigo-tree__list { display: flex; margin: 0; padding: 0; list-style: none; gap: 24px; }
  .fysigo-tree[data-direction="down"] .fysigo-tree__list { flex-direction: row; }
  .fysigo-tree[data-direction="right"] .fysigo-tree__list { flex-direction: column; }
  .fysigo-tree__item { position: relative; display: flex; align-items: center; gap: 24px; }
  .fysigo-tree[data-direction="down"] .fysigo-tree__item { flex-direction: column; align-items: center; }
  .fysigo-tree[data-direction="down"] .fysigo-tree__item > .fysigo-tree__list { border-top: 1px solid var(--line-strong); padding-top: 16px; }
  .fysigo-tree[data-direction="right"] .fysigo-tree__item > .fysigo-tree__list { border-left: 1px solid var(--line-strong); padding-left: 16px; }
  .fysigo-tree__node { display: inline-grid; min-width: 120px; min-height: 44px; gap: 2px; padding: 8px 14px; border: 1px solid var(--line-default); border-radius: var(--r-card); background: var(--surface-card); text-align: left; color: var(--ink-primary); }
  button.fysigo-tree__node { cursor: pointer; }
  /* Selected = colour only: the label turns accent, the border never changes. */
  .fysigo-tree__node[data-selected="true"] .fysigo-tree__label { color: var(--accent); }
  .fysigo-tree__label { font-size: var(--text-label); font-weight: 600; }
  .fysigo-tree__meta { font-family: var(--font-mono); font-size: var(--text-micro); color: var(--ink-tertiary); }
  .fysigo-tree__item[data-state="todo"] > .fysigo-tree__node { color: var(--ink-tertiary); }
  .fysigo-tree__item[data-state="current"] > .fysigo-tree__node .fysigo-tree__label { color: var(--ink-primary); }
  .fysigo-tree__empty { margin: 0; color: var(--ink-tertiary); }

  /* ── NutrientGroup ────────────────────────────────────────────────────── */
  .fysigo-nutrient-group { display: grid; gap: 4px; }
  .fysigo-nutrient-group__head { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; }
  .fysigo-nutrient-group__toggle { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; color: var(--ink-primary); cursor: pointer; }
  .fysigo-nutrient-group__title { margin: 0; font-size: var(--text-h3); font-weight: 700; }
  .fysigo-nutrient-group__summary { font-size: var(--text-small); color: var(--ink-tertiary); }
  .fysigo-nutrient-group__rows { margin: 0; padding: 0; list-style: none; }
  .fysigo-nutrient__row { display: grid; min-height: 44px; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; row-gap: 4px; padding: 6px 0; color: inherit; text-decoration: none; }
  .fysigo-nutrient__name { font-size: var(--text-label); color: var(--ink-primary); }
  .fysigo-nutrient__value { font-size: var(--text-label); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-secondary); text-align: right; }
  .fysigo-nutrient__value small { margin-left: 4px; font-size: var(--text-small); font-weight: 500; color: var(--ink-tertiary); }
  .fysigo-nutrient__bar { grid-column: 1 / -1; height: 3px; overflow: hidden; border-radius: 9999px; background: var(--line-default); }
  .fysigo-nutrient__bar > span { display: block; height: 100%; background: var(--ink-secondary); }
  .fysigo-nutrient[data-zone="optimal"] .fysigo-nutrient__bar > span { background: var(--status-optimal); }
  .fysigo-nutrient[data-zone="borderline"] .fysigo-nutrient__bar > span { background: var(--status-borderline); }
  .fysigo-nutrient[data-zone="out-of-range"] .fysigo-nutrient__bar > span { background: var(--status-out-of-range); }
  .fysigo-nutrient[data-zone="optimal"] .fysigo-nutrient__value { color: var(--status-optimal); }
  .fysigo-nutrient[data-zone="borderline"] .fysigo-nutrient__value { color: var(--status-borderline); }
  .fysigo-nutrient[data-zone="out-of-range"] .fysigo-nutrient__value { color: var(--status-out-of-range); }
  .fysigo-nutrient-group__empty { margin: 0; padding: 8px 0; color: var(--ink-tertiary); }
  .fysigo-nutrient-group__actions { display: flex; min-height: 44px; align-items: center; }

  /* ── DestinationTile ──────────────────────────────────────────────────── */
  .fysigo-tile { display: grid; min-height: 44px; align-content: start; gap: 6px; padding: 16px; border: 1px solid var(--line-default); border-radius: var(--r-card); background: var(--surface-card); color: var(--ink-primary); text-decoration: none; }
  .fysigo-tile:hover { border-color: var(--line-strong); }
  .fysigo-tile__top { display: flex; align-items: center; justify-content: space-between; color: var(--ink-secondary); }
  .fysigo-tile__badge { padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 9999px; background: var(--surface-raised); font-family: var(--font-mono); font-size: var(--text-micro); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-secondary); }
  .fysigo-tile__hero { font-size: var(--text-value); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
  .fysigo-tile[data-zone="optimal"] .fysigo-tile__hero { color: var(--status-optimal); }
  .fysigo-tile[data-zone="borderline"] .fysigo-tile__hero { color: var(--status-borderline); }
  .fysigo-tile[data-zone="out-of-range"] .fysigo-tile__hero { color: var(--status-out-of-range); }
  .fysigo-tile__title { font-size: var(--text-h3); font-weight: 700; }
  .fysigo-tile__desc { font-size: var(--text-small); color: var(--ink-tertiary); }

  /* ── ConnectCard ──────────────────────────────────────────────────────── */
  .fysigo-connect-hero {
    position: relative;
    height: 190px;
    border-radius: var(--radius-lg);
    background: var(--surface-sunken);
    border: 1px solid var(--line-default);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .fysigo-connect-feature {
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }

  .fysigo-connect-feature + .fysigo-connect-feature {
    margin-top: 16px;
  }

  .fysigo-connect-feature__icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lime);
  }

  .fysigo-connect-feature__icon svg {
    width: 20px;
    height: 20px;
  }

  .fysigo-connect-feature__title {
    font-size: 14px; /* exact value from the onboarding-v2 board */
    font-weight: 700;
    color: var(--ink-primary);
  }

  .fysigo-connect-feature__detail {
    font-size: 12.5px; /* exact value from the onboarding-v2 board */
    color: var(--ink-tertiary);
  }
}

@keyframes fysigo-ambient-drift-orange {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(6%, 4%) scale(1.06); }
}

@keyframes fysigo-ambient-drift-lime {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-4%, 6%) scale(1.08); }
}

@keyframes fysigo-ambient-drift-teal {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5%, -5%) scale(1.07); }
}

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

  .fysigo-ambient-glow__blob--orange,
  .fysigo-ambient-glow__blob--lime,
  .fysigo-ambient-glow__blob--teal {
    animation: none;
  }
}

