﻿/* =========================================================
   Current — visual system
   Apple-style canvas, grouped cards and type; Material 3 style
   tonal accent, state layers and soft elevation.
   Light by default; dark follows prefers-color-scheme unless
   <html data-theme="light">. Force dark with data-theme="dark".
   ========================================================= */

:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #f5f5f7;
  --bg-deep: #ececf0;
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --surface-3: #e8e8ed;
  --track: #e8e8ed;
  --nav-bg: rgba(245, 245, 247, 0.78);
  --side-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(0, 0, 0, 0.04);

  /* Text */
  --text: #1d1d1f;
  --text-soft: #3a3a3c;
  --muted: #6e6e73;
  --muted-2: #737378;

  /* Hairlines */
  --line: #e5e5ea;
  --line-strong: #d2d2d7;

  /* Primary: Google blue, tonal pair */
  --accent: #0b57d0;
  --accent-hover: #0a4cb8;
  --accent-text: #0b57d0;
  --on-accent: #ffffff;
  --tonal: #d3e3fd;
  --on-tonal: #041e49;
  --state-hover: rgba(11, 87, 208, 0.08);
  --state-press: rgba(11, 87, 208, 0.12);
  --neutral-hover: rgba(0, 0, 0, 0.04);
  --neutral-press: rgba(0, 0, 0, 0.08);

  /* Data + semantic colours (HR zones Z1–Z5 = blue, accent, yellow, coral, purple)
     "--blue" is the secondary data hue (teal) so it stays distinct from the blue primary. */
  --blue: #0f8b8d;
  --coral: #d0603f;
  --purple: #8155c6;
  --yellow: #a36c00;
  --red: #c5221f;
  --green: #188038;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.14);

  /* Radius */
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;

  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;

  --ease: cubic-bezier(.2, 0, 0, 1);
  --sidebar-w: 240px;

  /* Derived tints */
  --accent-soft: color-mix(in srgb, var(--accent) 9%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 32%, transparent);
  --blue-soft: color-mix(in srgb, var(--blue) 11%, transparent);
  --coral-soft: color-mix(in srgb, var(--coral) 11%, transparent);
  --purple-soft: color-mix(in srgb, var(--purple) 11%, transparent);
  --yellow-soft: color-mix(in srgb, var(--yellow) 12%, transparent);
  --red-soft: color-mix(in srgb, var(--red) 9%, transparent);
  --green-soft: color-mix(in srgb, var(--green) 11%, transparent);

  /* Legacy aliases (referenced by JS inline styles) */
  --mint: var(--accent);
  --mint-2: var(--accent);
  --mint-soft: var(--accent-soft);
  --mint-glow: transparent;
  --panel: var(--surface);
  --panel-2: var(--surface-2);
  --panel-3: var(--surface-3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --bg-deep: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-3: #3a3a3c;
    --track: #3a3a3c;
    --nav-bg: rgba(0, 0, 0, 0.72);
    --side-bg: rgba(28, 28, 30, 0.72);
    --card-border: rgba(255, 255, 255, 0.04);
    --text: #f5f5f7;
    --text-soft: #d1d1d6;
    --muted: #98989d;
    --muted-2: #8e8e93;
    --line: #38383a;
    --line-strong: #48484a;
    --accent: #a8c7fa;
    --accent-hover: #c2d7fb;
    --accent-text: #a8c7fa;
    --on-accent: #062e6f;
    --tonal: #0842a0;
    --on-tonal: #d3e3fd;
    --state-hover: rgba(168, 199, 250, 0.08);
    --state-press: rgba(168, 199, 250, 0.12);
    --neutral-hover: rgba(255, 255, 255, 0.06);
    --neutral-press: rgba(255, 255, 255, 0.1);
    --blue: #5cc8c4;
    --coral: #f09a7c;
    --purple: #c3a6f2;
    --yellow: #e6c25c;
    --red: #ff7b72;
    --green: #6dd58c;
    --shadow-sm: none;
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --blue-soft: color-mix(in srgb, var(--blue) 15%, transparent);
    --coral-soft: color-mix(in srgb, var(--coral) 15%, transparent);
    --purple-soft: color-mix(in srgb, var(--purple) 15%, transparent);
    --yellow-soft: color-mix(in srgb, var(--yellow) 15%, transparent);
    --red-soft: color-mix(in srgb, var(--red) 14%, transparent);
    --green-soft: color-mix(in srgb, var(--green) 15%, transparent);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-deep: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --track: #3a3a3c;
  --nav-bg: rgba(0, 0, 0, 0.72);
  --side-bg: rgba(28, 28, 30, 0.72);
  --card-border: rgba(255, 255, 255, 0.04);
  --text: #f5f5f7;
  --text-soft: #d1d1d6;
  --muted: #98989d;
  --muted-2: #8e8e93;
  --line: #38383a;
  --line-strong: #48484a;
  --accent: #a8c7fa;
  --accent-hover: #c2d7fb;
  --accent-text: #a8c7fa;
  --on-accent: #062e6f;
  --tonal: #0842a0;
  --on-tonal: #d3e3fd;
  --state-hover: rgba(168, 199, 250, 0.08);
  --state-press: rgba(168, 199, 250, 0.12);
  --neutral-hover: rgba(255, 255, 255, 0.06);
  --neutral-press: rgba(255, 255, 255, 0.1);
  --blue: #5cc8c4;
  --coral: #f09a7c;
  --purple: #c3a6f2;
  --yellow: #e6c25c;
  --red: #ff7b72;
  --green: #6dd58c;
  --shadow-sm: none;
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --blue-soft: color-mix(in srgb, var(--blue) 15%, transparent);
  --coral-soft: color-mix(in srgb, var(--coral) 15%, transparent);
  --purple-soft: color-mix(in srgb, var(--purple) 15%, transparent);
  --yellow-soft: color-mix(in srgb, var(--yellow) 15%, transparent);
  --red-soft: color-mix(in srgb, var(--red) 14%, transparent);
  --green-soft: color-mix(in srgb, var(--green) 15%, transparent);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
::selection { background: var(--tonal); color: var(--on-tonal); }
html { scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted-2); }

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 650; letter-spacing: -0.015em; color: var(--text); }
strong { font-weight: 600; }
[class*="stat"] strong, [class*="kpi"] strong, .tabular { font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
img { max-width: 100%; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 17px; height: 17px; }
.icon-xs { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }

.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 1000;
  background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 600; transition: top .2s;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .nav-item:focus-visible, .filter-chip:focus-visible { outline-offset: 2px; }

.ambient { display: none; }

.app-shell { position: relative; z-index: 1; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column;
  padding: 24px 16px 16px;
  background: var(--side-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; margin-bottom: 32px; }
.brand-mark { display: inline-flex; width: 30px; height: 30px; color: var(--accent); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-mark-sm { width: 28px; height: 28px; }
.brand-word { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: .12em; color: var(--text); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 0 12px 8px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted-2);
}
.nav-label-spaced { margin-top: 24px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  color: var(--text-soft); font-weight: 500; font-size: var(--fs-base);
  transition: color .18s var(--ease), background .18s var(--ease);
}
.nav-item .icon { width: 20px; height: 20px; color: var(--muted); transition: color .18s var(--ease); }
.nav-item:hover { color: var(--text); background: var(--neutral-hover); }
.nav-item:active { background: var(--neutral-press); }
.nav-item.active { color: var(--on-tonal); background: var(--tonal); font-weight: 600; }
.nav-item.active .icon { color: var(--on-tonal); }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sensor-mini {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-md); padding: 10px; text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.sensor-mini:hover { border-color: var(--line-strong); background: var(--surface-2); }
.sensor-mini-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm);
  color: var(--accent); background: var(--accent-soft);
}
.sensor-mini-icon .icon { width: 17px; height: 17px; }
.sensor-mini-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sensor-mini-copy strong { font-size: var(--fs-sm); font-weight: 600; }
.sensor-mini-copy span { color: var(--muted-2); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: 0 0 auto; }
.status-dot.on { background: var(--accent); }
.status-dot.demo { background: var(--yellow); }
.profile-mini {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border: 0; border-radius: var(--radius-sm); background: transparent;
  text-align: left; cursor: pointer; color: inherit;
}
.profile-mini:hover { background: var(--surface-2); }
.profile-mini-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.profile-mini-copy strong { font-size: var(--fs-sm); font-weight: 600; }
.profile-mini-copy span { color: var(--muted-2); font-size: var(--fs-xs); }
.profile-mini .icon { color: var(--muted-2); }
.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  border: 0; font-weight: 650; font-size: var(--fs-sm);
  font-family: var(--font-display); flex: 0 0 auto;
}
.avatar-top { width: 34px; height: 34px; border: 0; cursor: pointer; }

/* ---------- Main / topbar ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 32px;
  background: var(--nav-bg); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-brand { display: none; align-items: center; gap: 9px; border: 0; background: none; font-family: var(--font-display); font-weight: 700; letter-spacing: .1em; font-size: var(--fs-md); color: var(--text); padding: 0; }
.page-crumb { display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: var(--fs-sm); font-weight: 500; }
.crumb-current { color: var(--text); font-weight: 600; }
.date-chip { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
.demo-badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px;
  background: var(--yellow-soft); border: 0;
  color: var(--yellow); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
}
.device-pill {
  display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--muted); font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.device-pill:hover { border-color: var(--line-strong); color: var(--text); }
.device-pill .icon { color: var(--muted-2); }
.device-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.device-pill.connected { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.device-pill.connected .device-pill-dot { background: var(--accent); }
.device-pill.connected .icon { color: var(--accent); }
.device-pill-hr { color: var(--accent-text); font-variant-numeric: tabular-nums; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.view { position: relative; max-width: 1400px; margin: 0 auto; padding: 32px 32px 72px; }
.mobile-nav { display: none; }

/* ---------- Typography / common ---------- */
.eyebrow {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
  color: var(--accent-text); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
}
.eyebrow .icon { width: 14px; height: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(28px, 2.8vw, 34px); line-height: 1.15; letter-spacing: -.025em; font-weight: 700; }
.page-head .page-sub { margin-top: 6px; color: var(--muted); font-size: var(--fs-md); max-width: 620px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { font-size: var(--fs-lg); letter-spacing: -.01em; }
.section-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.section-link { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--accent-text); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; padding: 6px 0; }
.section-link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.mint { color: var(--accent-text); }
.blue { color: var(--blue); }
.coral { color: var(--coral); }
.purple { color: var(--purple); }
.yellow { color: var(--yellow); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-size: var(--fs-base); font-weight: 600; letter-spacing: .005em; cursor: pointer; white-space: nowrap;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn .icon { width: 18px; height: 18px; }
/* Filled (primary) */
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 92%, var(--on-accent)); box-shadow: var(--shadow-sm); }
.btn-primary:active { background: color-mix(in srgb, var(--accent) 88%, var(--on-accent)); box-shadow: none; }
/* Filled tonal (secondary) */
.btn-secondary { background: var(--tonal); color: var(--on-tonal); }
.btn-secondary:hover { background: color-mix(in srgb, var(--tonal) 92%, var(--on-tonal)); box-shadow: var(--shadow-sm); }
.btn-secondary:active { background: color-mix(in srgb, var(--tonal) 88%, var(--on-tonal)); box-shadow: none; }
/* Outlined (ghost) */
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--accent-text); }
.btn-ghost:hover { background: var(--state-hover); }
.btn-ghost:active { background: var(--state-press); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 15%, transparent); }
.btn-danger:active { background: color-mix(in srgb, var(--red) 20%, transparent); }
.btn-sm { height: 36px; padding: 0 16px; font-size: var(--fs-sm); }
.btn-lg { height: 44px; padding: 0 24px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .38; pointer-events: none; box-shadow: none; }
.btn-round { border-radius: 999px; }

/* ---------- Cards / chips ---------- */
.card {
  position: relative; border: 1px solid var(--card-border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-pad { padding: 24px; }
.card-hover { transition: box-shadow .18s var(--ease); }
.card-hover:hover { box-shadow: var(--shadow-md); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-title { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 650; }
.card-kicker { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border: 0; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.chip .icon { width: 12px; height: 12px; }
.chip-mint { background: var(--accent-soft); color: var(--accent-text); }
.chip-blue { background: var(--blue-soft); color: var(--blue); }
.chip-coral { background: var(--coral-soft); color: var(--coral); }
.chip-purple { background: var(--purple-soft); color: var(--purple); }
.chip-yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .6; }

.progress-bar { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.divider { height: 1px; background: var(--line); margin: 18px 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; color: var(--muted); }
.empty-state .empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted-2); margin-bottom: 12px; }
.empty-state h3 { font-size: var(--fs-md); color: var(--text); margin-bottom: 4px; }
.empty-state p { font-size: var(--fs-sm); max-width: 320px; }
.empty-state .btn { margin-top: 16px; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

.readiness-card { min-height: 300px; padding: 24px; }
.readiness-top { display: flex; justify-content: space-between; align-items: flex-start; }
.readiness-top > .icon { color: var(--muted-2); }
.readiness-body { display: flex; align-items: center; gap: 22px; margin-top: 16px; }
.score-ring {
  --score: 0; position: relative; width: 124px; height: 124px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--accent) calc(var(--score) * 1%), var(--track) 0);
}
.score-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.score-ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.score-ring-inner strong { font-family: var(--font-display); font-size: 34px; line-height: 1; font-weight: 700; letter-spacing: -.02em; }
.score-ring-inner span { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); margin-top: 4px; }
.readiness-copy { min-width: 0; }
.readiness-copy .status-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 650; }
.readiness-copy .status-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; max-width: 220px; }
.readiness-factors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.factor { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.factor span { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.factor strong { display: block; font-size: var(--fs-base); font-weight: 650; margin-top: 2px; }
.factor strong.mint { color: var(--accent-text); }
.factor strong.yellow { color: var(--yellow); }

.today-card { min-height: 300px; padding: 24px; display: flex; flex-direction: column; }
.today-card > * { position: relative; }
.today-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.today-card .workout-title { font-size: clamp(22px, 2.2vw, 28px); margin-top: 10px; font-weight: 700; letter-spacing: -.02em; }
.today-card .workout-desc { color: var(--muted); font-size: var(--fs-base); margin-top: 6px; max-width: 440px; }
.today-main-set {
  display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 12px 14px;
  background: var(--surface-2); border: 0; border-radius: var(--radius-md);
  width: fit-content; max-width: 100%;
}
.today-main-set .set-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.today-main-set .set-copy { display: flex; flex-direction: column; min-width: 0; }
.today-main-set .set-copy span { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.today-main-set .set-copy strong { font-size: var(--fs-base); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-footer { margin-top: auto; padding-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.today-meta { display: flex; gap: 20px; }
.today-meta div { display: flex; flex-direction: column; }
.today-meta span { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.today-meta strong { font-size: var(--fs-md); font-weight: 650; margin-top: 1px; }
.rest-day { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: var(--fs-base); margin-top: 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { padding: 16px; min-height: 110px; position: relative; overflow: hidden; }
.stat-card > *:not(.stat-card-spark) { position: relative; z-index: 1; }
.stat-card-spark { position: absolute; right: 14px; bottom: 14px; width: 84px; opacity: .6; pointer-events: none; }
.stat-card-spark .sparkline { height: 26px; margin: 0; }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; }
.stat-card .stat-label { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.stat-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); }
.stat-icon .icon { width: 15px; height: 15px; }
.stat-value { display: flex; align-items: baseline; gap: 5px; margin-top: 10px; }
.stat-value strong { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-value span { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.stat-delta { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--coral); }
.stat-delta .icon { width: 12px; height: 12px; }
.sparkline { width: 100%; height: 24px; margin-top: 3px; }

/* ---------- Charts ---------- */
.chart-card { padding: 24px; }
.chart-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.chart-header h3 { font-size: var(--fs-md); }
.chart-header p { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.legend-dot.blue { background: var(--blue); }
.legend-dot.coral { background: var(--coral); }
.legend-dot.purple { background: var(--purple); }
.chart-wrap { position: relative; width: 100%; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-body); font-size: 11px; fill: var(--muted-2); font-weight: 500; }
.chart text[style] { font-size: 11px !important; }
.chart .chart-grid { stroke: var(--line); stroke-width: 1; }
.chart .chart-axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .chart-line-blue { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .chart-line-coral { fill: none; stroke: var(--coral); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .chart-bar { fill: color-mix(in srgb, var(--accent) 30%, transparent); transition: fill .15s; }
.chart .chart-bar:hover { fill: color-mix(in srgb, var(--accent) 55%, transparent); }
.chart .chart-bar.active { fill: var(--accent); }
.chart .chart-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .chart-dot-blue { fill: var(--surface); stroke: var(--blue); stroke-width: 2; }
.chart .chart-area { fill: url(#areaMint); }
.chart .chart-area-blue { fill: url(#areaBlue); }
.chart .chart-label { font-size: 11px; }
.chart .chart-value { font-size: 11px; font-weight: 650; fill: var(--text-soft); }
.chart .zone-bar { rx: 4; }

/* JS-generated colours (charts.js / data.js zones / views.js heatmap use fixed
   neon hex values). Remap them to the theme palette. */
[stroke="#66f4cf"] { stroke: var(--accent); }
[stroke="#65b9ff"] { stroke: var(--blue); }
[stroke="#ff9477"] { stroke: var(--coral); }
[stroke="#c49bff"] { stroke: var(--purple); }
[stroke="#f4d36f"] { stroke: var(--yellow); }
[stop-color="#66f4cf"] { stop-color: var(--accent); }
[stop-color="#65b9ff"] { stop-color: var(--blue); }
[stop-color="#ff9477"] { stop-color: var(--coral); }
[stop-color="#c49bff"] { stop-color: var(--purple); }
[stop-color="#f4d36f"] { stop-color: var(--yellow); }
[fill="#66f4cf"] { fill: var(--accent); }
[fill="#65b9ff"] { fill: var(--blue); }
[fill="#ff9477"] { fill: var(--coral); }
[fill="#c49bff"] { fill: var(--purple); }
[fill="#f4d36f"] { fill: var(--yellow); }
[stroke="rgba(255,255,255,.065)"] { stroke: var(--track); }
[stroke="rgba(244,211,111,.45)"] { stroke: var(--yellow); stroke-opacity: .55; }
svg [style*="drop-shadow"] { filter: none !important; }
[style*="color:#66f4cf"] { color: var(--accent-text) !important; }
[style*="color:#65b9ff"] { color: var(--blue) !important; }
[style*="color:#ff9477"] { color: var(--coral) !important; }
[style*="color:#c49bff"] { color: var(--purple) !important; }
[style*="color:#f4d36f"] { color: var(--yellow) !important; }
[style*="background:#66f4cf"] { background: var(--accent) !important; }
[style*="background:#65b9ff"] { background: var(--blue) !important; }
[style*="background:#ff9477"] { background: var(--coral) !important; }
[style*="background:#c49bff"] { background: var(--purple) !important; }
[style*="background:#f4d36f"] { background: var(--yellow) !important; }
[style*="--zone-color:#66f4cf"] { --zone-color: var(--accent) !important; }
[style*="--zone-color:#65b9ff"] { --zone-color: var(--blue) !important; }
[style*="--zone-color:#ff9477"] { --zone-color: var(--coral) !important; }
[style*="--zone-color:#c49bff"] { --zone-color: var(--purple) !important; }
[style*="--zone-color:#f4d36f"] { --zone-color: var(--yellow) !important; }
[style*="background:rgba(255,255,255,.045)"],
[style*="background:rgba(255,255,255,.05)"] { background: var(--track) !important; }
[style*="background:rgba(102,244,207,.16)"] { background: color-mix(in srgb, var(--accent) 22%, var(--track)) !important; }
[style*="background:rgba(102,244,207,.25)"] { background: color-mix(in srgb, var(--accent) 35%, var(--track)) !important; }
[style*="background:rgba(102,244,207,.32)"] { background: color-mix(in srgb, var(--accent) 45%, var(--track)) !important; }
[style*="background:rgba(102,244,207,.55)"] { background: color-mix(in srgb, var(--accent) 70%, var(--track)) !important; }
[style*="background:rgba(102,244,207,.9)"] { background: var(--accent) !important; }
/* Tiny inline font sizes from JS templates → readable minimums */
[style*="font-size:8px"]:not(text), [style*="font-size:9px"]:not(text) { font-size: var(--fs-xs) !important; }
[style*="font-size:10px"]:not(text), [style*="font-size:10.5px"]:not(text), [style*="font-size:11px"]:not(text) { font-size: var(--fs-sm) !important; }
.chip[style*="height:20px"] { height: 24px !important; }

.zone-list { display: flex; flex-direction: column; gap: 12px; }
.zone-row { display: grid; grid-template-columns: 30px 1fr 44px; align-items: center; gap: 10px; }
.zone-tag { font-size: var(--fs-xs); font-weight: 650; color: var(--muted); }
.zone-track { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.zone-fill { height: 100%; border-radius: 999px; background: var(--zone-color); opacity: .85; }
.zone-minutes { font-size: var(--fs-sm); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.zone-meta { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.zone-meta span { font-size: var(--fs-xs); color: var(--muted); }
.zone-meta strong { color: var(--text); font-size: var(--fs-sm); }

.recent-list { display: flex; flex-direction: column; }
.recent-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.recent-row:first-child { border-top: 0; padding-top: 4px; }
.recent-row:hover .session-info strong { color: var(--accent-text); }
.session-date-block { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--surface-2); }
.session-date-block span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.session-date-block strong { font-family: var(--font-display); font-size: var(--fs-md); line-height: 1.15; font-weight: 700; }
.session-info { min-width: 0; }
.session-info strong { display: block; font-size: var(--fs-base); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .15s; }
.session-info span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-metric { text-align: right; }
.session-metric strong { display: block; font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums; }
.session-metric span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.session-metric.hide-mobile { min-width: 56px; }
.recent-arrow { color: var(--muted-2); }

.technique-mini { display: flex; flex-direction: column; gap: 10px; }
.tech-metric { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border-radius: var(--radius-md); background: var(--surface-2); }
.tech-metric-label { display: flex; align-items: center; gap: 10px; }
.tech-metric-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); }
.tech-metric-icon.purple { background: var(--purple-soft); color: var(--purple); }
.tech-metric-icon.blue { background: var(--blue-soft); color: var(--blue); }
.tech-metric-label span { display: block; color: var(--muted); font-size: var(--fs-xs); }
.tech-metric-label strong { display: block; font-size: var(--fs-base); margin-top: 1px; }
.tech-metric-trend { display: flex; align-items: center; gap: 4px; color: var(--green); font-size: var(--fs-xs); font-weight: 600; }
.tech-metric-trend .icon { width: 12px; height: 12px; }

/* ---------- Week strip / Train ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 24px; }
.day-tile {
  position: relative; min-height: 90px; padding: 12px 10px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.day-tile:hover { border-color: var(--line-strong); }
.day-tile.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day-tile.complete { background: var(--surface-2); }
.day-tile .day-name { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.day-tile .day-num { font-family: var(--font-display); font-size: 20px; line-height: 1.1; font-weight: 700; }
.day-tile .day-workout { margin-top: auto; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.day-tile .day-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); position: absolute; right: 10px; top: 12px; }
.day-tile .day-check { position: absolute; right: 9px; top: 9px; color: var(--accent); }
.day-tile .day-check .icon { width: 14px; height: 14px; }
.day-tile.today .day-name { color: var(--accent-text); }

.train-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 16px; align-items: start; }
.plan-card { padding: 24px; }
.plan-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.plan-progress-wrap { min-width: 100px; text-align: right; }
.plan-progress-wrap strong { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.plan-progress-wrap span { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; margin-top: 2px; }
.plan-progress-wrap .progress-bar { margin-top: 8px; }
.plan-session-list { display: flex; flex-direction: column; gap: 8px; }
.plan-session {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border-radius: var(--radius-md); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.plan-session:hover { border-color: var(--line-strong); background: var(--surface-2); }
.plan-session.complete { opacity: .65; }
.plan-session.today-session { border-color: var(--accent-line); background: var(--accent-soft); }
.plan-session-date { display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid var(--line); padding-right: 10px; }
.plan-session-date span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.plan-session-date strong { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; margin-top: 1px; }
.plan-session-info { min-width: 0; }
.plan-session-info strong { display: block; font-size: var(--fs-base); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-session-info span { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.plan-session-actions { display: flex; align-items: center; gap: 6px; }
.plan-start-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; }
.plan-start-btn:hover { background: var(--accent-hover); }
.plan-start-btn .icon { width: 13px; height: 13px; }
.complete-check { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.complete-check .icon { width: 13px; height: 13px; }
.rest-row { padding: 12px; border-radius: var(--radius-md); border: 1px dashed var(--line-strong); color: var(--muted); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.rest-row .icon { width: 14px; height: 14px; }

.focus-card { padding: 24px; }
.focus-card .focus-ring { position: relative; width: 112px; height: 112px; margin: 6px auto 16px; }
.focus-card .focus-ring svg { width: 100%; height: 100%; }
.focus-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.focus-ring-label strong { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; }
.focus-ring-label span { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; margin-top: 4px; }
.focus-copy { text-align: center; color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.focus-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.focus-stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.focus-stat span { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.focus-stat strong { display: block; font-size: var(--fs-base); margin-top: 2px; }

.library-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 32px 0 16px; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: var(--fs-sm); font-weight: 550; cursor: pointer;
}
.filter-chip { transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease); }
.filter-chip:hover { color: var(--text); background: var(--neutral-hover); border-color: var(--line-strong); }
.filter-chip.active { background: var(--tonal); border-color: transparent; color: var(--on-tonal); font-weight: 600; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.workout-card {
  padding: 16px; min-height: 200px; display: flex; flex-direction: column; cursor: pointer;
  transition: border-color .15s;
}
.workout-card:hover { border-color: var(--line-strong); }
.workout-card .wc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.workout-card .wc-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); }
.workout-card .wc-icon.blue { background: var(--blue-soft); color: var(--blue); }
.workout-card .wc-icon.coral { background: var(--coral-soft); color: var(--coral); }
.workout-card .wc-icon.purple { background: var(--purple-soft); color: var(--purple); }
.workout-card .wc-icon.yellow { background: var(--yellow-soft); color: var(--yellow); }
.workout-card h3 { font-size: var(--fs-lg); margin-top: 14px; }
.workout-card p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.workout-card .wc-meta { display: flex; gap: 14px; margin-top: auto; padding-top: 16px; flex-wrap: wrap; }
.wc-meta div { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.wc-meta .icon { width: 13px; height: 13px; color: var(--muted-2); }
.workout-card .wc-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.wc-focus { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; color: var(--accent-text); }
.wc-focus.blue { color: var(--blue); }
.wc-focus.coral { color: var(--coral); }
.wc-focus.purple { color: var(--purple); }
.wc-focus.yellow { color: var(--yellow); }
.wc-arrow { color: var(--muted-2); }
.create-workout-card {
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent;
  cursor: pointer; color: var(--muted); transition: border-color .15s, color .15s, background .15s;
}
.create-workout-card:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.create-workout-card .plus-circle { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); }
.create-workout-card strong { font-size: var(--fs-base); }
.create-workout-card span { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- Progress ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi-card { padding: 16px; }
.kpi-card .kpi-label { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-card .kpi-label .icon { width: 14px; height: 14px; color: var(--muted-2); }
.kpi-card .kpi-value { display: flex; align-items: baseline; gap: 5px; margin-top: 10px; }
.kpi-card .kpi-value strong { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-card .kpi-value span { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.kpi-card .kpi-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: 10px; }
.kpi-trend { font-size: var(--fs-xs); font-weight: 600; color: var(--green); }
.kpi-trend.down { color: var(--coral); }
.kpi-trend.neutral { color: var(--muted); }
.kpi-spark { width: 74px; height: 22px; }

.progress-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.progress-main { grid-column: span 8; }
.progress-side { grid-column: span 4; }
.progress-half { grid-column: span 6; }
.metric-toggle { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); }
.metric-toggle button { height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.metric-toggle button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.big-stat { display: flex; align-items: center; gap: 16px; }
.big-stat .big-ring { flex: 0 0 auto; }
.big-stat-copy .big-num { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.big-stat-copy .big-num span { font-size: var(--fs-sm); color: var(--muted); font-family: var(--font-body); font-weight: 500; letter-spacing: 0; }
.big-stat-copy p { color: var(--muted); font-size: var(--fs-sm); margin-top: 6px; max-width: 200px; }
.metric-list { display: flex; flex-direction: column; }
.metric-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.metric-row:first-child { border-top: 0; }
.metric-row-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); }
.metric-row-label .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.metric-row-value { font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums; }
.metric-row-value small { font-size: var(--fs-xs); color: var(--muted); margin-left: 3px; font-weight: 500; }
.readiness-history { display: flex; align-items: flex-end; gap: 4px; height: 64px; margin-top: 12px; }
.rh-bar { flex: 1; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--accent) 22%, var(--track)); min-height: 4px; position: relative; }
.rh-bar.high { background: color-mix(in srgb, var(--accent) 60%, var(--track)); }
.rh-bar.low { background: color-mix(in srgb, var(--coral) 50%, var(--track)); }
.rh-bar.today { background: var(--accent); }
.insight-box { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); margin-top: 16px; }
.insight-box .icon { color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.insight-box p { color: var(--text-soft); font-size: var(--fs-sm); line-height: 1.55; }
.insight-box strong { color: var(--text); }

/* ---------- Sessions ---------- */
.sessions-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; width: 260px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.search-box input { width: 100%; height: 40px; border-radius: 999px !important; padding: 0 12px 0 36px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: var(--fs-base); }
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input::placeholder { color: var(--muted-2); }
.sessions-list-card { overflow: hidden; }
.session-table-head {
  display: grid; grid-template-columns: 64px minmax(160px, 1.7fr) .8fr .8fr .8fr .7fr .7fr 28px;
  gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
}
.session-table-row {
  display: grid; grid-template-columns: 64px minmax(160px, 1.7fr) .8fr .8fr .8fr .7fr .7fr 28px;
  gap: 12px; align-items: center; padding: 13px 20px; border-top: 1px solid var(--line);
  cursor: pointer; transition: background .15s;
}
.session-table-row:first-child { border-top: 0; }
.session-table-row:hover { background: var(--surface-2); }
.st-row-date { display: flex; flex-direction: column; }
.st-row-date strong { font-size: var(--fs-sm); font-weight: 650; }
.st-row-date span { font-size: var(--fs-xs); color: var(--muted); }
.st-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-type-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.st-type-icon .icon { width: 15px; height: 15px; }
.st-title-copy { min-width: 0; }
.st-title-copy strong { display: block; font-size: var(--fs-base); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-title-copy span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-cell { font-size: var(--fs-sm); font-weight: 550; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.st-cell span { display: block; color: var(--muted); font-size: 11px; font-weight: 500; margin-bottom: 1px; }
.session-table-row .st-cell > span:first-child:not(.load-pill) { display: none; }
.st-cell .load-pill { display: inline-block; margin: 0; min-width: 36px; text-align: center; }
.st-load { display: flex; align-items: center; gap: 7px; }
.load-pill { font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.load-pill.high { background: var(--coral-soft); color: var(--coral); }
.load-pill.mid { background: var(--yellow-soft); color: var(--yellow); }
.st-arrow { color: var(--muted-2); }
.session-mobile-list { display: none; }

/* ---------- Session detail ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 4px 0; margin-bottom: 16px; }
.back-link:hover { color: var(--text); }
.detail-hero { padding: 24px; margin-bottom: 16px; }
.detail-hero-top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.detail-title { font-size: clamp(24px, 2.6vw, 32px); font-weight: 700; letter-spacing: -.02em; margin-top: 10px; }
.detail-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 22px; }
.detail-stat { padding: 12px 14px; background: var(--surface-2); border: 0; border-radius: var(--radius-md); }
.detail-stat span { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.detail-stat strong { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; }
.detail-stat strong small { font-family: var(--font-body); font-size: var(--fs-xs); color: var(--muted); font-weight: 500; margin-left: 2px; letter-spacing: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 16px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }
.sets-card { padding: 24px; }
.sets-table { width: 100%; border-collapse: collapse; }
.sets-table th { text-align: left; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; padding: 0 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sets-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--text-soft); }
.sets-table tr:last-child td { border-bottom: 0; }
.sets-table .set-index { color: var(--muted-2); width: 28px; }
.sets-table .set-name { min-width: 130px; }
.sets-table .set-name strong { display: block; font-size: var(--fs-sm); color: var(--text); }
.sets-table .set-name span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.set-hr { color: var(--coral) !important; }
.set-skip { color: var(--muted-2); font-style: italic; }
.detail-note { color: var(--text-soft); font-size: var(--fs-sm); line-height: 1.6; }
.hr-chart-card { padding: 24px; }
.hr-chart { width: 100%; height: auto; }
.hr-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.hr-summary div { text-align: center; padding: 9px; border-radius: var(--radius-sm); background: var(--surface-2); }
.hr-summary span { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.hr-summary strong { display: block; font-size: var(--fs-base); margin-top: 2px; }
.source-note { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.source-note .icon { width: 15px; height: 15px; flex: 0 0 auto; color: var(--muted-2); margin-top: 1px; }
.split-bars { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.split-row { display: grid; grid-template-columns: 34px 1fr 48px; align-items: center; gap: 8px; }
.split-row span { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.split-track { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; }
.split-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.split-row strong { font-size: var(--fs-xs); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Device ---------- */
.device-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 16px; align-items: start; }
.device-hero { padding: 24px; min-height: 320px; display: flex; flex-direction: column; }
.device-hero-content { position: relative; z-index: 1; display: flex; align-items: center; gap: 32px; flex: 1; }
.sensor-visual-wrap { flex: 0 0 auto; width: 200px; height: 170px; display: grid; place-items: center; position: relative; border-radius: var(--radius); background: var(--surface-2); }
.sensor-strap { position: absolute; width: 200px; height: 44px; border-radius: 30px; border: 2px solid var(--line-strong); transform: rotate(-8deg); }
.sensor-visual { position: relative; width: 140px; height: 62px; border-radius: 36px; background: #20282c; border: 1px solid #343e43; box-shadow: 0 6px 14px rgba(0,0,0,.18); transform: rotate(-8deg); }
.sensor-visual::after { content: ""; position: absolute; left: 20px; top: 12px; width: 36px; height: 36px; border-radius: 50%; background: #2c373b; border: 1px solid #3c484d; }
.sensor-led { position: absolute; left: 34px; top: 25px; width: 9px; height: 9px; border-radius: 50%; background: #4fd1b0; z-index: 1; }
.sensor-button { position: absolute; right: 20px; top: 18px; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #4a5559; background: #2c3437; }
.sensor-wave { display: none; }
.device-hero-copy { flex: 1; min-width: 0; }
.device-hero-copy h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.device-hero-copy p { color: var(--muted); font-size: var(--fs-base); line-height: 1.6; margin-top: 6px; max-width: 340px; }
.device-status-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.device-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.device-status-dot.connected { background: var(--accent); }
.device-status-dot.demo { background: var(--yellow); }
.device-status-text { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.device-hero-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.device-hr { display: flex; align-items: baseline; gap: 6px; margin-top: 18px; }
.device-hr strong { font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.device-hr span { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.device-hr .heartbeat { width: 20px; height: 20px; color: var(--coral); margin-right: 4px; align-self: center; }
.device-hr .heartbeat.beating { animation: heartbeat 1.4s ease-in-out infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.12); } 28% { transform: scale(1); } }
.device-meta { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.device-meta div { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.device-meta .icon { width: 14px; height: 14px; color: var(--muted-2); }

.device-side-card { padding: 24px; }
.setup-steps { display: flex; flex-direction: column; gap: 14px; counter-reset: step; }
.setup-step { display: flex; gap: 12px; align-items: flex-start; }
.setup-step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: var(--fs-xs); font-weight: 650; flex: 0 0 auto; }
.setup-step-copy strong { display: block; font-size: var(--fs-sm); font-weight: 650; }
.setup-step-copy span { display: block; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; margin-top: 2px; }
.sync-card { padding: 24px; margin-top: 16px; }
.device-grid .sync-card { margin-top: 0; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 150px; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; text-align: center; padding: 24px;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent); }
.dropzone strong { font-size: var(--fs-base); }
.dropzone span { color: var(--muted); font-size: var(--fs-sm); }
.dropzone small { color: var(--muted-2); font-size: var(--fs-xs); margin-top: 2px; }
.sync-info { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.55; }
.sync-info .icon { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; }
.settings-list { display: flex; flex-direction: column; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--text); cursor: default; }
button.settings-row { cursor: pointer; }
.settings-row:first-child { border-top: 0; padding-top: 0; }
.settings-row-label { display: flex; align-items: center; gap: 12px; }
.settings-row-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); }
.settings-row-icon .icon { width: 16px; height: 16px; }
.settings-row-copy strong { display: block; font-size: var(--fs-sm); font-weight: 600; }
.settings-row-copy span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.settings-row-value { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }

/* ---------- Onboarding ---------- */
.onboarding {
  position: fixed; inset: 0; z-index: 100; background: var(--surface);
  display: grid; grid-template-columns: 1.05fr .95fr; overflow: auto;
}
.onboarding-art {
  position: relative; min-height: 100vh; padding: 44px 52px; overflow: hidden;
  background: var(--bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.onboarding-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.onboarding-brand .brand-word { font-size: 17px; }
.onboarding-hero { margin-top: auto; margin-bottom: auto; position: relative; z-index: 1; padding: 60px 0; }
.onboarding-hero .kicker { color: var(--accent-text); font-size: var(--fs-sm); font-weight: 650; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 18px; }
.onboarding-hero h1 { font-size: clamp(38px, 4.4vw, 58px); line-height: 1.05; letter-spacing: -.03em; font-weight: 750; max-width: 600px; }
.onboarding-hero h1 em { font-style: normal; color: var(--accent-text); }
.onboarding-hero p { color: var(--muted); font-size: var(--fs-md); max-width: 420px; line-height: 1.65; margin-top: 20px; }
.onboarding-art-stats { display: flex; gap: 36px; margin-top: 40px; }
.onboarding-art-stat span { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.onboarding-art-stat strong { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-top: 2px; }
.onboarding-art-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-xs); }
.onboarding-art-foot .icon { width: 14px; height: 14px; color: var(--accent); }
.onboarding-panel { display: flex; align-items: center; justify-content: center; padding: 36px; min-height: 100vh; }
.onboarding-card { width: 100%; max-width: 440px; }
.onboarding-progress { display: flex; gap: 6px; margin-bottom: 30px; }
.onboarding-progress span { height: 3px; flex: 1; border-radius: 3px; background: var(--track); }
.onboarding-progress span.done { background: var(--accent); }
.onboarding-step .step-kicker { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.onboarding-step h2 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; line-height: 1.2; }
.onboarding-step .step-sub { color: var(--muted); font-size: var(--fs-base); line-height: 1.6; margin-top: 8px; margin-bottom: 24px; }
.onboarding-actions { display: flex; gap: 8px; margin-top: 24px; }
.onboarding-actions .btn { flex: 1; }
.onboarding-skip { display: block; width: 100%; border: 0; background: none; color: var(--muted); font-size: var(--fs-sm); cursor: pointer; margin-top: 14px; padding: 6px; }
.onboarding-skip:hover { color: var(--text); }
.onboarding-demo { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-sm); flex-wrap: wrap; }
.onboarding-demo button { border: 0; background: none; color: var(--accent-text); font-size: var(--fs-sm); font-weight: 650; cursor: pointer; padding: 0; }
.onboarding-demo button:hover { text-decoration: underline; }
.step-back { border: 0; background: none; color: var(--muted); font-size: var(--fs-sm); cursor: pointer; padding: 4px 0; display: inline-flex; align-items: center; gap: 5px; margin-bottom: 16px; }
.step-back:hover { color: var(--text); }
.device-choice {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 8px;
}
.device-choice .sensor-mini-visual { width: 54px; height: 30px; border-radius: 20px; background: #20282c; border: 1px solid #343e43; position: relative; flex: 0 0 auto; }
.device-choice .sensor-mini-visual::after { content: ""; position: absolute; left: 11px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: #4fd1b0; }
.device-choice-copy { flex: 1; }
.device-choice-copy strong { display: block; font-size: var(--fs-base); }
.device-choice-copy span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.device-choice .status-dot { margin-left: auto; }
.onboarding-note { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); line-height: 1.55; margin-top: 16px; }
.onboarding-note .icon { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { color: var(--text-soft); font-size: var(--fs-sm); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; height: 44px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: var(--fs-md); outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--muted-2); }
.field textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.field-hint { color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.segmented { display: flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.segmented button { flex: 1; min-height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; padding: 0 10px; white-space: nowrap; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.toggle { position: relative; display: inline-flex; width: 38px; height: 22px; flex: 0 0 auto; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); border: 0; cursor: pointer; transition: background .15s; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Modal / toast ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(12, 18, 22, .45);
  animation: fadeIn .15s ease;
}
.modal {
  width: 100%; max-width: 660px; max-height: min(88vh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); animation: modalIn .2s var(--ease);
  overflow: hidden;
}
.modal-sm { max-width: 440px; }
.modal-lg { max-width: 820px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 0; }
.modal-head h2 { font-size: var(--fs-xl); font-weight: 700; }
.modal-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
.modal-close { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: 0 0 auto; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close .icon { width: 16px; height: 16px; }
.modal-body { padding: 18px 22px 22px; overflow: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface); }
.modal-foot .left { margin-right: auto; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; } to { opacity: 1; } }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px;
  padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); color: var(--text-soft); font-size: var(--fs-sm);
  pointer-events: auto; animation: toastIn .18s ease;
}
.toast .icon { width: 16px; height: 16px; flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.toast.error .icon { color: var(--red); }
.toast.warn .icon { color: var(--yellow); }
.toast strong { display: block; font-size: var(--fs-sm); color: var(--text); }
.toast span { display: block; color: var(--muted); margin-top: 2px; line-height: 1.45; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Live session ---------- */
body.live-mode .sidebar, body.live-mode .topbar, body.live-mode .mobile-nav { display: none; }
body.live-mode .main { margin-left: 0; }
body.live-mode .view { max-width: none; padding: 0; }
.live-shell { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.live-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.live-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.live-top-title { display: flex; flex-direction: column; min-width: 0; }
.live-top-title strong { font-size: var(--fs-md); }
.live-top-title span { color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.live-top-right { display: flex; align-items: center; gap: 8px; }
.live-content { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.live-main { display: flex; flex-direction: column; gap: 16px; }
.live-side { display: flex; flex-direction: column; gap: 16px; }
.live-interval-card { padding: 24px; min-height: 420px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.live-interval-card.rest-mode { background: color-mix(in srgb, var(--coral) 5%, var(--surface)); }
.live-interval-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; position: relative; z-index: 1; }
.live-set-count { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.live-focus { color: var(--accent-text); font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.live-focus.rest { color: var(--coral); }
.live-interval-body { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 24px 0; }
.live-interval-label { color: var(--muted); font-size: var(--fs-base); margin-bottom: 8px; }
.live-distance { font-family: var(--font-display); font-size: clamp(60px, 8vw, 88px); font-weight: 700; line-height: .95; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.live-distance span { font-size: .3em; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 5px; }
.live-stroke { color: var(--text-soft); font-size: var(--fs-md); margin-top: 10px; }
.live-target { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }
.live-target div { text-align: center; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 0; }
.live-target span { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.live-target strong { display: block; font-size: var(--fs-base); margin-top: 2px; font-variant-numeric: tabular-nums; }
.live-timer-wrap { text-align: center; margin-top: 18px; }
.live-timer { font-family: var(--font-display); font-size: 46px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.live-timer-sub { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; margin-top: 6px; }
.live-rest-copy { color: var(--muted); font-size: var(--fs-base); margin-top: 4px; }
.live-controls { position: relative; z-index: 1; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.live-controls .btn { min-width: 120px; }
.live-progress { display: flex; align-items: center; gap: 12px; padding: 16px 20px; }
.live-progress .progress-bar { flex: 1; height: 6px; }
.live-progress span { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.live-hr-card { padding: 24px; }
.live-hr-top { display: flex; justify-content: space-between; align-items: flex-start; }
.live-hr-value { display: flex; align-items: baseline; gap: 6px; margin-top: 10px; }
.live-hr-value strong { font-family: var(--font-display); font-size: 42px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.live-hr-value span { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.live-hr-zone { margin-top: 10px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-xs); }
.live-hr-zone .zone-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.live-hr-chart { width: 100%; height: 55px; margin-top: 14px; }
.live-hr-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 130px; text-align: center; gap: 8px; }
.live-hr-empty .icon { width: 22px; height: 22px; color: var(--muted-2); }
.live-hr-empty p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.live-queue { padding: 16px; }
.queue-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow: auto; }
.queue-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: var(--fs-sm); }
.queue-item.current { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.queue-item.done { opacity: .5; }
.queue-num { width: 20px; color: var(--muted-2); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.queue-item .queue-dist { font-weight: 650; margin-left: auto; font-variant-numeric: tabular-nums; }
.queue-item .queue-check { width: 13px; height: 13px; color: var(--accent); }
.queue-item.skipped .queue-check { color: var(--coral); }
.queue-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: livePulse 1.6s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.resume-live {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font-size: var(--fs-sm); font-weight: 650;
  box-shadow: var(--shadow);
  transition: background .15s ease;
}
.resume-live:hover { background: var(--accent-hover); }
.resume-live .icon { width: 15px; height: 15px; }
.resume-pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: livePulse 1.5s ease-in-out infinite; }
.live-end { padding: 6px 0; }
.live-end .btn { color: var(--coral); }
.rest-countdown { font-family: var(--font-display); font-size: clamp(60px, 8vw, 88px); font-weight: 700; line-height: .95; letter-spacing: -.04em; color: var(--coral); font-variant-numeric: tabular-nums; }
.rest-label { color: var(--muted); font-size: var(--fs-base); margin-bottom: 8px; }
.next-up { color: var(--text-soft); font-size: var(--fs-base); margin-top: 18px; }
.next-up span { color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.summary-stat { padding: 12px; border-radius: var(--radius-md); background: var(--surface-2); border: 0; text-align: center; }
.summary-stat span { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.summary-stat strong { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; margin-top: 2px; }
.summary-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow: auto; }
.summary-set { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--fs-sm); }
.summary-set span { color: var(--muted); }
.summary-set strong { font-variant-numeric: tabular-nums; }

/* ---------- Workout detail / builder ---------- */
.workout-detail-hero { padding: 16px; border-radius: var(--radius); background: var(--surface-2); border: 0; margin-bottom: 16px; }
.workout-detail-hero .wd-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.workout-detail-hero h3 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.workout-detail-hero p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; margin-top: 6px; max-width: 540px; }
.wd-meta { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.wd-meta div { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.wd-meta .icon { width: 14px; height: 14px; color: var(--muted-2); }
.blocks { display: flex; flex-direction: column; gap: 12px; }
.block { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.block-head strong { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); }
.block-head span { font-size: var(--fs-xs); color: var(--muted); }
.block-items { padding: 4px 0; }
.block-item { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 14px; }
.block-item + .block-item { border-top: 1px solid var(--line); }
.block-item-reps { font-size: var(--fs-sm); font-weight: 650; color: var(--text); }
.block-item-main strong { display: block; font-size: var(--fs-sm); font-weight: 600; }
.block-item-main span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.block-item-side { text-align: right; }
.block-item-side strong { display: block; font-size: var(--fs-xs); color: var(--accent-text); }
.block-item-side span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.builder-set-list { display: flex; flex-direction: column; gap: 6px; }
.builder-set { display: grid; grid-template-columns: 58px 1fr 1fr 62px 72px 32px; gap: 6px; align-items: end; padding: 8px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.builder-set .field { margin: 0; gap: 3px; min-width: 0; }
.builder-set .field label { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.builder-set input, .builder-set select { height: 34px; font-size: var(--fs-sm); padding: 0 8px; }
.builder-set select { padding-right: 22px; background-position: calc(100% - 12px) 15px, calc(100% - 7px) 15px; }
.builder-set .remove-set { width: 32px; height: 34px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.builder-set .remove-set:hover { color: var(--red); border-color: var(--red); }
.builder-set .remove-set .icon { width: 13px; height: 13px; }
.builder-total { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: var(--accent-soft); border-radius: var(--radius-sm); margin-top: 8px; }
.builder-total span { font-size: var(--fs-sm); color: var(--muted); }
.builder-total strong { font-size: var(--fs-base); color: var(--accent-text); }
.schedule-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px; }
.schedule-day { height: 52px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-soft); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.schedule-day span { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.schedule-day strong { font-size: var(--fs-base); }
.schedule-day:hover { border-color: var(--line-strong); color: var(--text); }
.schedule-day.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.schedule-day.selected span { color: var(--accent-text); }

/* ---------- Settings modal ---------- */
.settings-tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 18px; }
.settings-tabs button { flex: 1; min-height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; padding: 0 6px; white-space: nowrap; }
.settings-tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.zone-preview { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.zone-preview-row { display: grid; grid-template-columns: 30px 1fr 64px; gap: 8px; align-items: center; }
.zone-preview-row span { font-size: var(--fs-xs); color: var(--muted); font-weight: 650; }
.zone-preview-row div { height: 6px; border-radius: 99px; background: var(--zc); opacity: .7; }
.zone-preview-row strong { font-size: var(--fs-xs); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.danger-zone { border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); border-radius: var(--radius-md); padding: 14px; margin-top: 14px; background: var(--red-soft); }
.danger-zone h4 { color: var(--red); font-size: var(--fs-sm); }
.danger-zone p { color: var(--muted); font-size: var(--fs-xs); margin: 3px 0 10px; line-height: 1.5; }
.about-block { text-align: center; padding: 12px 0 4px; }
.about-block .brand-mark { margin: 0 auto 8px; width: 42px; height: 42px; }
.about-block h3 { font-size: 18px; }
.about-block p { color: var(--muted); font-size: var(--fs-xs); margin-top: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1220px) {
  :root { --sidebar-w: 216px; }
  .view { padding: 28px 24px 64px; }
  .topbar { padding: 0 24px; }
  .date-chip { display: none; }
  .readiness-body { gap: 16px; }
  .score-ring { width: 112px; height: 112px; }
  .score-ring-inner strong { font-size: 30px; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .train-layout { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); }
  .detail-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1020px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .mobile-brand { display: flex; }
  .page-crumb { display: none; }
  .topbar { height: 56px; padding: 0 16px; }
  .view { padding: 24px 20px 104px; }
  .mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 6px 8px;
    border-top: 1px solid var(--line);
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 52px; border-radius: var(--radius-sm); color: var(--muted); font-size: 12px; font-weight: 500; }
  .mobile-nav a .icon { width: 24px; height: 24px; padding: 2px 0; border-radius: 999px; transition: background-color .18s var(--ease); }
  .mobile-nav a.active { color: var(--text); font-weight: 600; }
  .mobile-nav a.active .icon { width: 52px; background: var(--tonal); color: var(--on-tonal); }
  .dash-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .readiness-card, .today-card { grid-column: span 6; }
  .span-8, .span-7, .span-5, .span-4 { grid-column: span 6; }
  .span-3 { grid-column: span 3; }
  .span-12 { grid-column: 1 / -1; }
  .progress-main, .progress-side, .progress-half { grid-column: span 12; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resume-live { right: 16px; bottom: 84px; }
  .train-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-side { display: grid; grid-template-columns: 1fr 1fr; }
  .device-grid { grid-template-columns: minmax(0, 1fr); }
  .live-content { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
  .live-side { display: grid; grid-template-columns: 1fr 1fr; }
  .live-side > :only-child { grid-column: 1 / -1; }
  .session-table-head, .session-table-row { grid-template-columns: 58px minmax(140px, 1.5fr) .8fr .8fr .8fr .7fr 24px; }
  .session-table-head > :nth-child(6), .session-table-row > :nth-child(6) { display: none; }
}

@media (max-width: 760px) {
  .topbar-right { gap: 8px; }
  .device-pill { padding: 0 10px; }
  .device-pill-text { display: none; }
  #device-pill-text { display: none; }
  .topbar .avatar-top { display: none; }
  .view { padding: 20px 16px 104px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
  .page-head h1 { font-size: 26px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  .readiness-card, .today-card, .span-8, .span-7, .span-6, .span-5, .span-4, .span-3, .span-12 { grid-column: 1 / -1; }
  .stat-card { grid-column: span 1; }
  .stats-grid-mobile { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .readiness-card { min-height: auto; padding: 16px; }
  .readiness-body { gap: 16px; }
  .score-ring { width: 100px; height: 100px; }
  .score-ring::before { inset: 8px; }
  .score-ring-inner strong { font-size: 28px; }
  .readiness-copy .status-title { font-size: 18px; }
  .readiness-factors { margin-top: 16px; }
  .today-card { min-height: auto; padding: 16px; }
  .today-footer { flex-direction: column; align-items: stretch; gap: 14px; }
  .today-footer .btn { width: 100%; }
  .today-meta { justify-content: space-between; }
  .week-strip { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; margin-bottom: 20px; }
  .day-tile { min-width: 76px; flex: 1; }
  .library-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-grid { gap: 12px; }
  .stat-card { padding: 14px; }
  .stat-value strong { font-size: 22px; }
  .stat-card-spark { display: none; }
  .kpi-card { padding: 14px; }
  .kpi-card .kpi-value strong { font-size: 22px; }
  .kpi-spark { width: 56px; }
  .progress-grid { gap: 12px; }
  .chart-card { padding: 16px; }
  .chart-header { flex-wrap: wrap; }
  .detail-hero { padding: 16px; }
  .detail-hero-top { flex-direction: column; }
  .detail-stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 18px; }
  .detail-stat { padding: 10px; }
  .detail-stat strong { font-size: 16px; }
  .detail-side { grid-template-columns: 1fr; }
  .recent-row { grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 12px; }
  .recent-row .hide-mobile { display: none; }
  .session-table-head { display: none; }
  .sessions-list-card { display: none; }
  .session-mobile-list { display: flex; flex-direction: column; gap: 8px; }
  .session-mobile-card { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px; cursor: pointer; }
  .session-mobile-card .session-info strong { font-size: var(--fs-base); }
  .session-mobile-card .session-metric strong { font-size: var(--fs-sm); }
  .sessions-toolbar { align-items: stretch; }
  .search-box { width: 100%; }
  .device-hero { padding: 16px; }
  .device-hero-content { flex-direction: column; gap: 16px; align-items: stretch; }
  .sensor-visual-wrap { width: 100%; height: 130px; }
  .device-hero-copy h2 { font-size: 21px; }
  .device-hero-actions { width: 100%; }
  .device-hero-actions .btn { flex: 1; }
  .device-meta { gap: 12px; }
  .sync-card { padding: 16px; }
  .plan-card { padding: 16px; }
  .plan-header { gap: 8px; }
  .plan-session { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; padding: 10px; }
  .focus-card { display: none; }
  .library-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 24px; }
  .filter-row { overflow-x: auto; flex-wrap: nowrap; width: 100%; padding-bottom: 2px; }
  .filter-chip { flex: 0 0 auto; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .modal-head { padding: 18px 16px 0; }
  .modal-body { padding: 16px 16px 20px; }
  .modal-foot { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .builder-set { grid-template-columns: 50px 1fr 1fr 54px 62px 30px; gap: 4px; }
  .toast-root { left: 16px; right: 16px; bottom: 80px; }
  .toast { max-width: none; min-width: 0; }
  .live-top { padding: 12px 16px; }
  .live-content { padding: 16px; gap: 12px; }
  .live-interval-card { min-height: 360px; padding: 16px; }
  .live-distance { font-size: 64px; }
  .live-timer { font-size: 38px; }
  .live-controls .btn { flex: 1; min-width: 100px; }
  .live-side { grid-template-columns: 1fr; }
  .live-hr-card, .live-queue { padding: 16px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .onboarding { display: block; overflow: auto; }
  .onboarding-art { min-height: auto; padding: 24px 20px 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .onboarding-hero { padding: 36px 0 8px; margin: 0; }
  .onboarding-hero h1 { font-size: 36px; }
  .onboarding-hero p { margin-top: 12px; font-size: var(--fs-base); }
  .onboarding-art-stats { margin-top: 22px; gap: 24px; }
  .onboarding-art-stat strong { font-size: 19px; }
  .onboarding-art-foot { display: none; }
  .onboarding-panel { min-height: auto; padding: 28px 20px 48px; }
  .onboarding-card { max-width: none; }
  .onboarding-step h2 { font-size: 24px; }
  .schedule-grid { gap: 4px; }
  .schedule-day { height: 48px; }
  .settings-tabs button { font-size: var(--fs-xs); }
}

@media (max-width: 420px) {
  .readiness-body { flex-direction: column; align-items: flex-start; }
  .readiness-factors { width: 100%; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
  .session-mobile-card { grid-template-columns: 40px minmax(0,1fr) auto; gap: 10px; }
  .builder-set { grid-template-columns: 44px 1fr 1fr 48px 56px 28px; gap: 4px; padding: 6px; }
  .builder-set .field label { font-size: 11px; }
  .builder-set input, .builder-set select { font-size: var(--fs-xs); padding: 0 5px; }
  .builder-set select { padding-right: 16px; background-position: calc(100% - 9px) 15px, calc(100% - 5px) 15px; }
  .kpi-grid { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Device: sensor sync (views-more.js) ---------- */
.sync-lead { color: var(--text-soft); font-size: var(--fs-base); line-height: 1.6; margin-bottom: 16px; max-width: 620px; }
.sync-progress { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.sync-progress-msg { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.sync-progress .progress-bar { height: 8px; }
.sync-progress .progress-bar > span { transition: width .3s var(--ease); }
.sync-hint { color: var(--muted); font-size: var(--fs-sm); }
.sync-result {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  border-radius: var(--radius-md); background: var(--green-soft); color: var(--text);
}
.sync-result > .icon { width: 20px; height: 20px; color: var(--green); margin-top: 1px; }
.sync-result strong { display: block; font-size: var(--fs-base); font-weight: 600; }
.sync-result span { display: block; color: var(--text-soft); font-size: var(--fs-sm); margin-top: 2px; line-height: 1.5; }
.sync-result-error { background: var(--red-soft); }
.sync-result-error > .icon { color: var(--red); }
.sync-mode { border: 0; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sync-mode legend { padding: 0; margin-bottom: 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-soft); }
.sync-mode-option {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface);
  transition: border-color .18s var(--ease), background-color .18s var(--ease), box-shadow .18s var(--ease);
}
.sync-mode-option:hover { background: var(--neutral-hover); }
.sync-mode-option input { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; border-radius: 50%; border: 2px solid var(--muted-2); display: grid; place-items: center; cursor: pointer; transition: border-color .18s var(--ease); }
.sync-mode-option input::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .18s var(--ease); }
.sync-mode-option input:checked { border-color: var(--accent); }
.sync-mode-option input:checked::after { transform: scale(1); }
.sync-mode-option input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sync-mode-option > span { display: flex; flex-direction: column; min-width: 0; }
.sync-mode-option strong { font-size: var(--fs-base); font-weight: 600; color: var(--text); }
.sync-mode-option > span > span { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; margin-top: 2px; }
.sync-mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.sync-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.sync-options { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.sync-toggle { display: inline-flex; align-items: center; gap: 12px; font-size: var(--fs-sm); color: var(--text-soft); cursor: pointer; line-height: 1.4; }
.sync-toggle input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); cursor: pointer; }
.sync-links { display: flex; gap: 8px 24px; flex-wrap: wrap; }
.sync-list { display: flex; flex-direction: column; margin-top: 12px; border-radius: var(--radius-md); background: var(--surface-2); overflow: hidden; }
.sync-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 12px 16px; border: 0; background: transparent; text-align: left; color: var(--text); cursor: pointer;
  transition: background-color .18s var(--ease);
}
.sync-item + .sync-item { box-shadow: inset 0 1px 0 var(--line); }
button.sync-item:hover { background: var(--neutral-hover); }
button.sync-item:active { background: var(--neutral-press); }
.sync-item > span { display: flex; flex-direction: column; min-width: 0; }
.sync-item strong { font-size: var(--fs-base); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-item > span > span { color: var(--muted); font-size: var(--fs-sm); margin-top: 1px; }
.sync-item > .icon { color: var(--muted-2); }
.sync-item-muted { cursor: default; }
.sync-item-muted strong { color: var(--muted); font-weight: 500; }
details.import-fallback { padding: 0; }
details.import-fallback > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px; cursor: pointer; list-style: none; border-radius: var(--radius);
  transition: background-color .18s var(--ease);
}
details.import-fallback > summary::-webkit-details-marker { display: none; }
details.import-fallback > summary::marker { content: ""; }
details.import-fallback > summary:hover { background: var(--neutral-hover); }
details.import-fallback > summary > span { display: flex; flex-direction: column; min-width: 0; }
details.import-fallback > summary strong { font-size: var(--fs-md); font-weight: 600; }
details.import-fallback > summary > span > span { color: var(--muted); font-size: var(--fs-sm); margin-top: 1px; }
details.import-fallback > summary > .icon { color: var(--muted-2); transition: transform .2s var(--ease); }
details.import-fallback[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
details.import-fallback[open] > summary > .icon { transform: rotate(90deg); }
details.import-fallback > :not(summary) { margin-left: 24px; margin-right: 24px; }
details.import-fallback > :last-child { margin-bottom: 24px; }
@media (max-width: 760px) {
  details.import-fallback > summary { padding: 16px; }
  details.import-fallback > :not(summary) { margin-left: 16px; margin-right: 16px; }
  details.import-fallback > :last-child { margin-bottom: 16px; }
  .sync-actions .btn { flex: 1; }
}

/* ---------- Refinements ---------- */
/* Consistency calendar fills its card instead of sitting small in a corner. */
.consistency-grid { display: flex; gap: 6px; padding: 6px 0 2px; }
.consistency-week { display: flex; flex-direction: column; gap: 6px; flex: 1 1 0; min-width: 0; max-width: 34px; }
.consistency-week > span { display: block; width: 100%; aspect-ratio: 1; border-radius: 5px; }

/* Stat tiles: hide the background sparkline when the tile is too narrow for it
   to sit beside the "vs last week" text without overlapping. */
.stat-card { container-type: inline-size; }
@container (max-width: 300px) { .stat-card-spark { display: none; } }

/* Technique rows: metric on the first line, its hint underneath, no cramped wrapping. */
.tech-metric { flex-wrap: wrap; row-gap: 6px; }
.tech-metric-label { flex: 1 1 auto; min-width: 0; }
.tech-metric-label span { white-space: nowrap; }
.tech-metric-trend { flex: 1 1 100%; padding-left: 40px; color: var(--muted); font-weight: 500; }

/* Smoother theme switching and number alignment. */
.detail-stat strong, .st-cell, .sets-table td, .metric-row-value, .summary-stat strong { font-variant-numeric: tabular-nums; }

/* ---------- Phone polish ---------- */
@media (max-width: 640px) {
  /* Syncing is the main job on a phone: show it before the sensor picture. */
  #sensor-sync-card { order: -1; }

  /* Filter chips scroll sideways without a visible scrollbar. */
  .filter-row { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-chip { flex: 0 0 auto; }

  /* Tables fit the screen instead of scrolling sideways. */
  .sets-table th, .sets-table td { padding-left: 4px; padding-right: 4px; font-size: 12px; }
  .sets-table .set-hr { white-space: nowrap; }
  .sets-table .set-name strong { font-size: 13px; }
  .sets-table .set-name, .sets-table .set-name strong, .sets-table .set-name span { white-space: normal; }
  .sets-table { width: 100%; }
  .sets-card { padding-left: 12px; padding-right: 12px; }
  .sets-table:not(.laps-table) th:nth-child(1), .sets-table:not(.laps-table) td:nth-child(1),
  .sets-table:not(.laps-table) th:nth-child(7), .sets-table:not(.laps-table) td:nth-child(7) { display: none; }
}

/* Comfortable touch targets on phones and tablets. */
@media (pointer: coarse) {
  .btn-sm, .filter-chip, .plan-start-btn { min-height: 40px; }
  .section-link, .back-link { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
  .metric-toggle button, .segmented button, .settings-tabs button { min-height: 38px; }
  .sync-toggle { min-height: 40px; }
}

/* Very long names (or ones without spaces) must never push the page sideways.
   Found by the random-use tester: a long workout name widened the workout screen. */
.live-top-left, .live-top-title { min-width: 0; }
.live-top-title strong, .live-top-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h1, h2, h3, .detail-title, .st-title-copy strong, .session-info strong { overflow-wrap: anywhere; }

/* =========================================================
   Easy for everyone, deep for power users
   ========================================================= */

/* ---- "See details" sections ---- */
.more-details { margin-top: 16px; }
.more-details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 48px; padding: 12px 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); transition: background .15s; }
.more-details > summary::-webkit-details-marker { display: none; }
.more-details > summary:hover { background: var(--surface-2); }
.more-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.more-label { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--fs-md); }
.more-label strong { font-weight: 600; color: var(--accent-text); }
.more-hint { color: var(--muted); font-size: var(--fs-sm); }
.more-chevron { transition: transform .2s; color: var(--accent-text); }
.more-details[open] > summary .more-chevron { transform: rotate(90deg); }
.more-details[open] > summary { margin-bottom: 16px; }
.power-hint { margin-top: 14px; color: var(--muted); font-size: var(--fs-sm); text-align: center; }

/* ---- Tap-to-explain terms ---- */
.term { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: help; text-align: left; border-bottom: 1px dotted var(--muted-2); line-height: 1.25; }
.term:hover { color: var(--accent-text); border-bottom-color: var(--accent-text); }
.term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.term-icon { width: 13px; height: 13px; color: var(--muted-2); flex: none; }
.explain-what { font-size: var(--fs-md); line-height: 1.6; color: var(--text); margin-bottom: 14px; }
.explain-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 8px; }
.explain-row .icon { width: 16px; height: 16px; color: var(--accent-text); flex: none; margin-top: 2px; }
.explain-row p { font-size: var(--fs-sm); line-height: 1.55; color: var(--text-soft); margin: 0; }

/* ---- Today: the simple top ---- */
.today-simple { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.today-simple > .card { padding: 22px; margin: 0; }
.goal-body { display: flex; align-items: center; gap: 20px; margin-top: 14px; }
.goal-ring { flex: none; }
.goal-big { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.goal-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.goal-line { margin-top: 10px; font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.goal-line.muted { font-weight: 500; color: var(--muted); margin-top: 4px; }
.last-swim-card { display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.last-swim-card .section-link { margin-top: auto; align-self: flex-start; }
.last-swim-title { font-size: 20px; font-weight: 700; margin: 2px 0 6px; overflow-wrap: anywhere; }
.last-swim-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-bottom: 10px; }
.last-swim-stats span { display: block; color: var(--muted); font-size: var(--fs-xs); }
.last-swim-stats strong { font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.last-swim-stats small { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; margin-left: 2px; }

/* ---- Trends ---- */
.trend-controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.trend-chips .more-chip { display: inline-flex; align-items: center; gap: 4px; }
.trend-period-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.trend-nav { display: flex; align-items: center; gap: 6px; }
.trend-nav .icon-btn[disabled] { opacity: .35; pointer-events: none; }
.trend-period-title { min-width: 130px; text-align: center; font-weight: 600; font-size: var(--fs-md); }
.trend-card { padding: 24px; }
.trend-headline { margin-bottom: 14px; }
.trend-metric-label { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.trend-value { font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.trend-change { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.trend-change.good { color: var(--green); }
.trend-change.bad { color: var(--coral); }
.trend-chart { margin: 6px -4px 0; }
.trend-note { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); margin-top: 6px; }
.trend-insight { margin-top: 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: var(--fs-md); line-height: 1.55; }
.trend-glance { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.glance-tile { padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); }
.glance-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); }
.glance-tile strong { display: block; margin-top: 6px; font-family: var(--font-display); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.glance-tile small { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; margin-left: 2px; }
.trend-lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.trend-lower .section-head > span { font-size: var(--fs-sm); }
.trend-advanced { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.trend-table td:first-child { color: var(--text); font-weight: 500; }

@media (max-width: 1020px) {
  .today-simple { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .today-simple > .today-card { grid-column: 1 / -1; }
  .trend-advanced { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .today-simple { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .today-simple > .card { padding: 18px; }
  .goal-big { font-size: 26px; }
  .trend-card { padding: 18px; }
  .trend-value { font-size: 34px; }
  .trend-glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trend-lower { grid-template-columns: minmax(0, 1fr); }
  .trend-period-row { flex-direction: column; align-items: stretch; }
  .trend-period-row .segmented { width: 100%; }
  .trend-period-row .segmented button { flex: 1; }
  .trend-nav { justify-content: space-between; }
  .trend-chips { flex-wrap: nowrap; overflow-x: auto; }
}
/* Today's workout card in the narrower simple layout: stack the footer. */
.today-simple .today-card { display: flex; flex-direction: column; }
.today-simple .today-footer { flex-direction: column; align-items: stretch; gap: 14px; margin-top: auto; padding-top: 14px; }
.today-simple .today-footer .btn { width: 100%; justify-content: center; }
.today-simple .today-meta { display: flex; gap: 18px; flex-wrap: wrap; }
.today-simple .today-meta strong { white-space: nowrap; }
.today-simple .workout-title { font-size: 22px; }

/* =========================================================
   Meets
   ========================================================= */
.meet-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 8px 2px 6px; border-radius: 999px; background: color-mix(in srgb, var(--yellow) 18%, transparent); color: var(--yellow); font-size: 11px; font-weight: 700; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.meet-badge .icon { width: 12px; height: 12px; }
.detail-hero-top .meet-badge { margin-left: 0; }
.swim-kind { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.swim-kind-toggle button { display: inline-flex; align-items: center; gap: 5px; }
.meet-name-input { height: 40px; min-width: 220px; flex: 1 1 220px; max-width: 360px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-sm); }
.meet-name-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sync-item-row { display: flex; align-items: stretch; gap: 8px; }
.sync-item-row .sync-item { flex: 1; min-width: 0; }
.meet-toggle { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 0 12px; min-height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; transition: background-color .18s, color .18s, border-color .18s; }
.meet-toggle:hover { color: var(--text); border-color: var(--muted-2); }
.meet-toggle.on { background: color-mix(in srgb, var(--yellow) 18%, transparent); color: var(--yellow); border-color: transparent; }
.trend-kind { align-self: flex-start; }
.trend-kind button { display: inline-flex; align-items: center; gap: 5px; }
@media (max-width: 640px) {
  .trend-kind { align-self: stretch; }
  .trend-kind button { flex: 1; justify-content: center; }
  .meet-name-input { max-width: none; }
}

/* =========================================================
   Motion: quick, subtle, and off for people who ask for less
   ========================================================= */
@property --score { syntax: "<number>"; inherits: true; initial-value: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ring-fill { from { --score: 0; } }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes line-draw { from { stroke-dashoffset: 4000; } to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: no-preference) {
  /* Page entrance: sections rise into place, one after another. */
  .view-enter > div > * { animation: rise .45s cubic-bezier(.22, .8, .24, 1) both; }
  .view-enter > div > *:nth-child(2) { animation-delay: .04s; }
  .view-enter > div > *:nth-child(3) { animation-delay: .08s; }
  .view-enter > div > *:nth-child(4) { animation-delay: .12s; }
  .view-enter > div > *:nth-child(5) { animation-delay: .16s; }
  .view-enter > div > *:nth-child(6) { animation-delay: .2s; }
  .view-enter > div > *:nth-child(n+7) { animation-delay: .24s; }
  /* Cards inside a row cascade too. */
  .view-enter .today-simple > *, .view-enter .trend-glance > *, .view-enter .stat-grid > * { animation: rise .45s cubic-bezier(.22, .8, .24, 1) both; }
  .view-enter .today-simple > *:nth-child(2), .view-enter .trend-glance > *:nth-child(2), .view-enter .stat-grid > *:nth-child(2) { animation-delay: .1s; }
  .view-enter .today-simple > *:nth-child(3), .view-enter .trend-glance > *:nth-child(3), .view-enter .stat-grid > *:nth-child(3) { animation-delay: .16s; }
  .view-enter .trend-glance > *:nth-child(4), .view-enter .stat-grid > *:nth-child(4) { animation-delay: .22s; }

  /* Rings fill up from empty. */
  .score-ring { animation: ring-fill 1.1s cubic-bezier(.22, .8, .24, 1) .15s both; }

  /* Chart bars grow up from the axis; lines draw themselves; fills fade in. */
  .chart rect.chart-bar { transform-box: fill-box; transform-origin: 50% 100%; animation: bar-grow .6s cubic-bezier(.22, .8, .24, 1) both; }
  .chart path[fill="none"] { stroke-dasharray: 4000; animation: line-draw 1.1s cubic-bezier(.4, 0, .2, 1) both; }
  .chart path[fill^="url"] { animation: fade-in .8s ease .25s both; }
  .chart circle { animation: fade-in .4s ease .6s both; }

  /* A new Trends number fades in when you switch metric or period. */
  .trend-value, .trend-change, .trend-insight { animation: fade-in .35s ease both; }

  /* "See details" opens smoothly. */
  .more-details[open] > .more-body { animation: rise .32s cubic-bezier(.22, .8, .24, 1) both; }

  /* Tactile press feedback. */
  .btn, .filter-chip, .segmented button, .meet-toggle, .icon-btn, .nav-item, .bottom-nav a { transition-property: background-color, border-color, color, box-shadow, transform; transition-duration: .18s; }
  .btn:active, .filter-chip:active, .segmented button:active, .meet-toggle:active, .icon-btn:active, .bottom-nav a:active { transform: scale(.96); }
  .card-hover:active, .session-table-row:active, .session-mobile-card:active, .sync-item:active { transform: scale(.99); transition: transform .1s; }
}
.meet-badge { font-style: normal; line-height: 1.4; width: auto; height: auto; flex: none; }
.session-info strong .meet-badge, .st-title-copy strong .meet-badge { margin-left: 6px; }

/* =========================================================
   Loading screen
   ========================================================= */
.app-loader { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: var(--bg); color: var(--text); transition: opacity .35s ease, visibility .35s ease; }
.app-loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.app-loader-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.app-loader-mark { width: 72px; height: 72px; color: var(--accent); overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent 4%, #000 22%, #000 78%, transparent 96%); mask-image: linear-gradient(90deg, transparent 4%, #000 22%, #000 78%, transparent 96%); }
.app-loader-word { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .32em; padding-left: .32em; color: var(--text); }
.app-loader-bar { width: 120px; height: 3px; border-radius: 999px; background: var(--track, rgba(127,127,127,.2)); overflow: hidden; margin-top: 6px; }
.app-loader-bar span { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@keyframes loader-flow { from { transform: translateX(0); } to { transform: translateX(-17.2px); } }
@keyframes loader-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes loader-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes loader-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  .app-loader-inner { animation: loader-in .4s ease both; }
  /* The two waves drift sideways at different speeds, like water moving. */
  .app-loader-mark .wave { animation: loader-flow 1.1s linear infinite; }
  .app-loader-mark .wave-back { animation-duration: 1.7s; opacity: .45; }
  .app-loader-mark { animation: loader-bob 2.2s ease-in-out infinite; }
  .app-loader-bar span { animation: loader-slide 1.1s cubic-bezier(.4, 0, .2, 1) infinite; }
}
@media (prefers-reduced-motion: reduce) {
  .app-loader-mark .wave-back { opacity: .45; }
  .app-loader-bar span { width: 100%; opacity: .6; }
}

/* ---------- Account ---------- */
.account-card { display: flex; flex-direction: column; gap: 14px; }
.account-hero { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius-md); background: var(--accent-soft); }
.account-hero > .icon { width: 22px; height: 22px; color: var(--accent); flex: none; margin-top: 2px; }
.account-hero h3 { font-size: var(--fs-md, 15px); margin-bottom: 3px; }
.account-hero p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.account-actions { display: flex; flex-direction: column; gap: 8px; }
.account-actions[hidden] { display: none; }
.account-who { display: flex; align-items: center; gap: 12px; }
.account-who strong { font-size: var(--fs-md, 15px); }
.account-avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--bg); font-weight: 700; font-size: 18px; flex: none; }
.sync-pill { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }
.sync-pill.ok { color: var(--green); }
.sync-pill.warn { color: var(--yellow); }
.sync-pill.bad { color: var(--red); }
.settings-row-btn { background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.modal-text { color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; margin-bottom: 10px; }
.modal-text.muted { font-size: var(--fs-xs); }
.form-error { color: var(--red); font-size: var(--fs-xs); line-height: 1.5; margin-top: 4px; }
.form-error[hidden] { display: none; }
.account-form .field { margin-bottom: 12px; }
.account-switch { margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.onboarding-signin { margin-top: 10px; }
@keyframes current-spin { to { transform: rotate(360deg); } }
.icon.spin { animation: current-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .icon.spin { animation: none; } }
.onboarding-signin[hidden] { display: none; }
/* Anything marked hidden stays hidden, whatever layout rule applies (the
   phone layout was showing the "Demo data" badge to everyone). */
[hidden] { display: none !important; }
