/* VitaLog — Fitness Health & Awareness Platform styles with dark/light theme support */

/* ─── Theme Variables: Clean Clinical Precision ─── */
:root,
[data-theme='dark'] {
  /* Warm charcoal backgrounds (not navy — differentiates from Dosafy/GitHub) */
  --bg-primary: #131518;
  --bg-surface: #1a1d21;
  --bg-elevated: #222529;
  --bg-input: #131518;
  /* Subtle borders — cards differentiate via shadows, not borders */
  --border: #2a2e33;
  --border-light: #1f2226;
  --border-input: #5e646d; /* 3.22:1 on #131518 — WCAG 1.4.11 */
  --border-control: #686f77; /* 3.10:1 on #222529 — toggles, checkboxes */
  /* Warmer text hierarchy */
  --text-primary: #eceff4;
  --text-secondary: #8c939c;
  --text-muted: #737a84; /* 4.54:1 on #131518 — WCAG AA pass */
  /* Teal/emerald accent — health technology signal, not code-editor blue */
  --accent: #2dd4a8;
  --accent-hover: #5eead4;
  --accent-dim: rgba(45, 212, 168, 0.12);
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #f87091; /* 5.5:1 on #131518 — WCAG AA (was #f43f5e @ 3.87:1) */
  --info: #38bdf8;
  /* Rounded, refined radius scale */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;
  /* Domain-specific colors */
  --color-blast: #ef4444;
  --color-cruise: #38bdf8;
  --color-pct: #34d399;
  --color-menstrual: #f43f5e;
  --color-follicular: #f59e0b;
  --color-ovulatory: #2dd4a8;
  --color-luteal: #a78bfa;
  --color-peak: #c084fc;
  /* Unit-safety color system — prevents mg/mcg/IU calc confusion */
  --unit-mg: #f59e0b;   /* amber  — mass, most common */
  --unit-mcg: #38bdf8;  /* sky    — micro mass (1000x smaller than mg) */
  --unit-iu: #a78bfa;   /* violet — international units (biological) */
  --unit-ml: #2dd4a8;   /* teal   — volume (not a dose) */
  /* Layered shadow system — elevated, not flat */
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.25);
  --shadow-elevated: 0 2px 4px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
  --shadow-float: 0 4px 8px rgba(0,0,0,0.3), 0 12px 40px rgba(0,0,0,0.4);
  --bottom-nav-height: 60px;
  --bg-card: #222529;
  --badge-bg: #2a2e33;
  --badge-color: #8c939c;
  --bm-skin: #3a2f2a;
  --bm-muscle: #2dd4a822;
  --bm-muscle-hover: #2dd4a844;
  --bm-gap: #131518;
  --bm-head: #4a3f3a;
  --bm-hair: #2a2320;
  /* Aliases for legacy inline-style references */
  --bg: #131518;
  --card-bg: #222529;
  --text: #eceff4;
  --text-tertiary: #484f58;
  --text-dim: #484f58;
  --bg-hover: #2a2e33;
  --bg-secondary: #1a1d21;
  --primary: #2dd4a8;
  --accent-primary: #2dd4a8;
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.15);
  --red: #f87091;
  --red-dim: rgba(248, 112, 145, 0.15);
  --blue: #38bdf8;
  --blue-dim: rgba(56, 189, 248, 0.15);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --purple: #a78bfa;
  --pink: #f472b6;
  --cyan: #22d3ee;
  /* Z-index layering system */
  --z-sticky: 50;
  --z-dropdown: 200;
  --z-modal: 9999;
  --z-toast: 10000;
  --z-overlay: 10001;
}

[data-theme='light'] {
  --bg-primary: #f4f5f7;
  --bg-surface: #ffffff;
  --bg-elevated: #f9fafb;
  --bg-input: #ffffff;
  --bg-card: #ffffff;
  --border: #e2e5ea;
  --border-light: #eef0f3;
  --border-input: #6b727b; /* 3.2:1 on #ffffff — WCAG 1.4.11 */
  --border-control: #6b727b;
  --text-primary: #1a1d21;
  --text-secondary: #5c636e;
  --text-muted: #5c636e;
  --accent: #0a7a5f; /* dark teal — 5.9:1 on white (WCAG AA) */
  --accent-hover: #086047;
  --accent-dim: rgba(10, 122, 95, 0.10);
  --success: #0d7d56;
  --warning: #a16207; /* 4.5:1+ on --bg-elevated */
  --danger: #c02942;
  --info: #0369a1;
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-elevated: 0 2px 4px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
  --shadow-float: 0 4px 8px rgba(0,0,0,0.08), 0 12px 40px rgba(0,0,0,0.12);
  --badge-bg: #e2e5ea;
  --badge-color: #5c636e;
  --bm-skin: rgba(100, 105, 115, 0.10);
  --bm-muscle: rgba(10, 122, 95, 0.18);
  --bm-muscle-hover: rgba(10, 122, 95, 0.28);
  --bm-gap: rgba(255, 255, 255, 0.65);
  --bm-head: rgba(100, 105, 115, 0.18);
  --bm-hair: rgba(60, 65, 75, 0.30);
  /* Aliases for legacy inline-style references */
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1a1d21;
  --text-tertiary: #8c939c;
  --text-dim: #8c939c;
  --bg-hover: #e2e5ea;
  --bg-secondary: #f9fafb;
  --primary: #0a7a5f;
  --accent-primary: #0a7a5f;
  --green: #0d7d56;
  --green-dim: rgba(13, 125, 86, 0.12);
  --red: #c02942;
  --red-dim: rgba(192, 41, 66, 0.12);
  --blue: #0369a1;
  --blue-dim: rgba(3, 105, 161, 0.12);
  --amber: #a16207;
  --amber-dim: rgba(161, 98, 7, 0.12);
  --purple: #7c3aed;
  --pink: #db2777;
  --cyan: #0891b2;
  /* Domain-specific colors (light theme variants) */
  --color-blast: #dc2626;
  --color-cruise: #0369a1;
  --color-pct: #0d7d56;
  --color-menstrual: #c02942;
  --color-follicular: #a16207;
  --color-ovulatory: #0a7a5f;
  --color-luteal: #7c3aed;
  --color-peak: #9333ea;
  /* Unit-safety colors — darker for contrast on white */
  --unit-mg: #a16207;
  --unit-mcg: #0369a1;
  --unit-iu: #6d28d9;
  --unit-ml: #0a7a5f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Seamless theme transition — applied temporarily during theme switch */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, fill 0.3s ease, stroke 0.3s ease !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11'; /* Inter refinements for characters like a, g, l, i */
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  transition: background 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ─── Landing Page ─── */
.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-surface) 50%, var(--bg-primary) 100%);
  animation: fadeIn 0.6s ease;
  position: relative;
  overflow: hidden;
}

.landing::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(45, 212, 168, 0.06) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(52, 211, 153, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

.landing-inner {
  text-align: center;
  max-width: 440px;
  width: 100%;
}

.landing-logo {
  font-size: 56px;
  color: var(--accent);
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.landing-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.landing-tagline {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 32px;
}

.landing-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 32px;
  text-align: left;
}

.landing-feature {
  display: flex;
  gap: 10px;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.landing-feature-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.landing-feature strong {
  font-size: 13px;
  display: block;
}

.landing-feature p {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.landing-cta {
  padding: 14px 48px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  margin-bottom: 16px;
}

.landing-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
}

.landing.hidden {
  display: none;
}

/* ─── App Shell ─── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Header ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: none;
  background: var(--bg-surface);
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0, 0, 0, 0.12);
  position: sticky;
  top: 0;
  z-index: 50;
}
[data-theme='light'] .header {
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo h1,
.header-wordmark {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.header-logo .logo-icon {
  font-size: 22px;
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.btn:hover {
  background: var(--bg-elevated);
  border-color: var(--text-muted);
}

.btn:active {
  transform: scale(0.95);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible, .btn:focus-visible, .tab-btn:focus-visible, .bottom-nav-btn:focus-visible,
.calendar-day:focus-visible, .protocol-item:focus-visible,
.card:focus-visible, .club-card:focus-visible, .sub-tab:focus-visible,
[role="button"]:focus-visible, [tabindex="0"]:focus-visible,
a:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
*:focus:not(:focus-visible) { outline: none; }

/* Skip link for keyboard users */
.skip-link { position: absolute; top: -100%; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 8px 16px; border-radius: var(--radius); z-index: 10000; font-size: 14px; text-decoration: none; }
.skip-link:focus { top: 8px; }

.btn:disabled, button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #2dd4a8 0%, #0d9373 100%);
  border: none;
  color: #131518; /* Dark text on bright teal: 10.22:1 — WCAG AA pass */
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(45, 212, 168, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5eead4 0%, #2dd4a8 100%);
  color: #131518;
  box-shadow: 0 4px 16px rgba(45, 212, 168, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 1px 4px rgba(45, 212, 168, 0.2);
}

/* Light theme: darker teal gradient, white text passes 4.9:1+ */
[data-theme='light'] .btn-primary {
  background: linear-gradient(135deg, #0a7d62 0%, #086047 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 122, 95, 0.25);
}
[data-theme='light'] .btn-primary:hover {
  background: linear-gradient(135deg, #0d9373 0%, #0a7d62 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(10, 122, 95, 0.32);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.1);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-group-sm {
  display: flex;
  gap: 2px;
}
.btn-group-sm .btn-sm {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-icon {
  padding: 6px 8px;
  min-width: 32px;
  justify-content: center;
}

.btn-ghost {
  border: none;
  background: none;
  color: var(--text-secondary);
  padding: 6px 8px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ─── Tab Navigation (Desktop) ─── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 0 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 11px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── Bottom Nav (Mobile) ─── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: none;
  box-shadow: 0 -1px 0 var(--border), 0 -4px 16px rgba(0, 0, 0, 0.18);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  scrollbar-width: none;
}
[data-theme='light'] .bottom-nav {
  box-shadow: 0 -1px 0 var(--border), 0 -4px 16px rgba(0, 0, 0, 0.05);
}

.bottom-nav::-webkit-scrollbar {
  display: none;
}

.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.bottom-nav-btn.active {
  color: var(--accent);
}

.bottom-nav-icon {
  font-size: 20px;
  line-height: 1;
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 600;
}

/* ─── Tab Content ─── */
.tab-content-wrapper {
  flex: 1;
}

.tab-content {
  display: none;
  padding: 20px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  transition: opacity 0.15s ease;
  content-visibility: hidden;
  contain-intrinsic-size: auto 500px;
}

.tab-content.active {
  display: block;
  animation: tabIn 0.2s ease;
  content-visibility: visible;
  contain-intrinsic-size: auto;
}

@keyframes tabIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Typography Scale ─── */
.text-page-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; letter-spacing: -0.3px; }
.text-card-title { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--text-muted); line-height: 1.4; letter-spacing: 0.4px; text-transform: uppercase; }
.text-body { font-size: 14px; color: var(--text-primary); line-height: 1.5; font-variant-numeric: tabular-nums; }
.text-caption { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.text-micro { font-size: 10px; color: var(--text-muted); line-height: 1.3; letter-spacing: 0.3px; font-weight: 500; }

/* Tabular numerics on all numeric display classes — clinical precision */
.stat-value, .biometric-metric-value, .bloodwork-marker-value,
.rest-timer-value, .workout-session-timer, .streak-value,
.vitascore-streak-number, .overlay-delta-pill, .efficacy-agg-val,
.today-date, .fasting-time, .ring-value, .weekly-day-card .value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ─── Small Action Buttons ─── */
/* Use for remove/delete/close/reorder buttons — ensures 32px min touch target */
.btn-action-sm {
  font-size: 11px;
  padding: 4px 8px;
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.btn-action-sm:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-action-sm.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-action-sm.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ─── Empty State Component ─── */
.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-secondary);
  animation: fadeSlideIn 0.3s ease;
}
.empty-state-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.empty-state-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.empty-state .btn { margin-top: 4px; }

/* ─── Skeleton Loaders ─── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: vlSkeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 12px; margin-bottom: 8px; width: 80%; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 60%; }
.skeleton-circle { border-radius: 50%; }
@keyframes vlSkeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Unit-safety badges — prevents mg/mcg/IU calc confusion ─── */
.unit-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-family: var(--font-mono, 'SF Mono', 'Consolas', monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 4px;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  vertical-align: baseline;
}
.unit-badge[data-unit="mg"]  { color: var(--unit-mg);  background: rgba(245,158,11,0.14);  border-color: rgba(245,158,11,0.3); }
.unit-badge[data-unit="mcg"] { color: var(--unit-mcg); background: rgba(56,189,248,0.14);  border-color: rgba(56,189,248,0.3); }
.unit-badge[data-unit="iu"],
.unit-badge[data-unit="IU"]  { color: var(--unit-iu);  background: rgba(167,139,250,0.14); border-color: rgba(167,139,250,0.3); }
.unit-badge[data-unit="ml"],
.unit-badge[data-unit="mL"],
.unit-badge[data-unit="cc"]  { color: var(--unit-ml);  background: rgba(45,212,168,0.14);  border-color: rgba(45,212,168,0.3); }
.unit-badge-lg { font-size: 11px; padding: 4px 10px; }

/* Unit-aware select — tints the dropdown to match the chosen unit */
.unit-select[data-unit="mg"]  { color: var(--unit-mg);  border-color: rgba(245,158,11,0.4); }
.unit-select[data-unit="mcg"] { color: var(--unit-mcg); border-color: rgba(56,189,248,0.4); }
.unit-select[data-unit="iu"]  { color: var(--unit-iu);  border-color: rgba(167,139,250,0.4); }
.unit-select[data-unit="ml"],
.unit-select[data-unit="cc"]  { color: var(--unit-ml);  border-color: rgba(45,212,168,0.4); }
.unit-select { font-weight: 600; font-family: var(--font-mono, monospace); text-transform: uppercase; letter-spacing: 0.5px; }

/* Light theme bumps background opacity slightly for AA */
[data-theme='light'] .unit-badge[data-unit="mg"]  { background: rgba(161,98,7,0.10);  border-color: rgba(161,98,7,0.28); }
[data-theme='light'] .unit-badge[data-unit="mcg"] { background: rgba(3,105,161,0.10);  border-color: rgba(3,105,161,0.28); }
[data-theme='light'] .unit-badge[data-unit="iu"]  { background: rgba(109,40,217,0.10); border-color: rgba(109,40,217,0.28); }
[data-theme='light'] .unit-badge[data-unit="ml"],
[data-theme='light'] .unit-badge[data-unit="cc"]  { background: rgba(10,122,95,0.10);  border-color: rgba(10,122,95,0.28); }

/* ─── Weekly schedule grid — drag to reschedule ─── */
.wk-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 10px;
  overflow-x: auto;
}
.wk-header { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); padding: 6px 4px; text-align: center; }
.wk-header.today { color: var(--accent); font-weight: 700; }
.wk-row-label { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-secondary); align-self: center; padding: 0 6px; letter-spacing: 0.5px; }
.wk-cell {
  min-height: 44px;
  background: var(--bg-input);
  border: 1px dashed transparent;
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.wk-cell.today { background: rgba(45,212,168,0.04); }
.wk-cell.drop-target { border-color: var(--accent); background: var(--accent-dim); }
.wk-cell.empty { background: transparent; }
.wk-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.wk-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.wk-chip:active { cursor: grabbing; }
.wk-chip.dragging { opacity: 0.4; transform: rotate(-2deg); cursor: grabbing; }
.wk-chip .swatch { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.wk-chip .wk-chip-name { font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70px; }
.wk-chip .wk-chip-dose { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--accent); font-variant-numeric: tabular-nums; margin-left: auto; flex-shrink: 0; }
.wk-chip.locked { cursor: not-allowed; opacity: 0.6; }
.wk-chip.locked::after { content: '🔒'; font-size: 8px; margin-left: 2px; }

.wk-grid-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding: 0 4px; }
.wk-grid-head h3 { font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.wk-grid-head .hint { font-size: 11px; color: var(--text-muted); font-style: italic; }
@media (max-width: 640px) {
  .wk-grid { grid-template-columns: 48px repeat(7, minmax(64px, 1fr)); }
  .wk-chip .wk-chip-dose { display: none; }
  .wk-chip .wk-chip-name { max-width: 50px; }
}

/* ─── Cards — shadow-driven, clinical precision ─── */
.card {
  background: var(--bg-elevated);
  border: 1px solid transparent;
  border-radius: var(--radius-lg); /* 14px — rounder, more Apple-like */
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}

/* Elevated variant — for hero stats (VitaScore, streak, etc.) */
.card-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-dim);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-elevated);
}

/* Glassmorphic variant — for floating hero stats */
.card-glass {
  background: rgba(34, 37, 41, 0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  box-shadow: var(--shadow-elevated);
}
[data-theme='light'] .card-glass {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
[data-theme='amoled'] .card-glass {
  background: rgba(10, 10, 10, 0.82);
}

/* AMOLED override — flat cards, no shadows */
[data-theme='amoled'] .card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: none;
}
[data-theme='amoled'] .card:hover {
  box-shadow: none;
  transform: none;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-compact {
  padding: 14px;
  margin-bottom: 12px;
}

/* ─── Expandable Sections ─── */
.expandable {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.expandable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.expandable-header:hover {
  background: var(--bg-elevated);
}

.expandable-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.expandable-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.expandable.open .expandable-arrow {
  transform: rotate(90deg);
}

.expandable-body {
  display: none;
  padding: 0 16px 16px;
  background: var(--bg-surface);
}

.expandable.open .expandable-body {
  display: block;
  animation: expandIn 0.2s ease;
}

@keyframes expandIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Chart Containers ─── */
.chart-container {
  width: 100%;
  height: 200px;
  position: relative;
}

.chart-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-container-sm {
  height: 120px;
}

.chart-container-lg {
  height: 260px;
}

/* ─── Alert Banners ─── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.alert-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-info {
  background: rgba(45, 212, 168, 0.1);
  border: 1px solid rgba(45, 212, 168, 0.3);
  color: var(--info);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.alert-danger {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--danger);
}

.alert-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}

/* ─── Today View ─── */
.today-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.today-date {
  font-size: 24px;
  font-weight: 700;
}

.today-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 2px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-badge.complete {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.status-badge.partial {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.status-badge.none {
  background: rgba(139, 148, 158, 0.1);
  color: var(--text-secondary);
}

.time-group {
  margin-bottom: 20px;
}

.time-group-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.dose-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.dose-item:hover {
  background: var(--bg-elevated);
}

.dose-item.administered {
  opacity: 0.55;
}

.dose-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-control);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.dose-checkbox:checked {
  background: var(--success);
  border-color: var(--success);
  animation: doseCheckBg 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes doseCheckBg {
  0%   { transform: scale(0.75); }
  65%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.dose-checkbox:checked::after {
  content: '';
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 14px;
  height: 14px;
  display: inline-block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  animation: doseCheckIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes doseCheckIn {
  from { transform: translate(-50%, -50%) scale(0) rotate(-15deg); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1) rotate(0deg);   opacity: 1; }
}

.dose-info {
  flex: 1;
  min-width: 0;
}

.dose-name {
  font-weight: 600;
  font-size: 15px;
}

.dose-details {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dose-site {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dose-color {
  width: 4px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dose-extra {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.daily-notes {
  width: 100%;
  min-height: 60px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.daily-notes::placeholder {
  color: var(--text-muted);
}

/* (empty-state — see primary definition at line ~587) */

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state-icon svg { width: 48px; height: 48px; opacity: 0.4; }

.empty-state p {
  font-size: 15px;
  margin-bottom: 16px;
}

.empty-state .empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state .empty-desc {
  font-size: 13px;
  line-height: 1.5;
  max-width: 380px;
  margin: 0 auto 16px;
}

.empty-state .empty-features {
  text-align: left;
  max-width: 360px;
  margin: 0 auto 20px;
  font-size: 13px;
  line-height: 2;
  color: var(--text-secondary);
}

.empty-state .empty-features div { color: var(--accent); }

.empty-state .empty-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.empty-state .empty-tip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 400px;
  margin: 0 auto 16px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: left;
}

/* ─── Half-life Bar ─── */
.halflife-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.halflife-track {
  width: 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.halflife-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.halflife-fill.high { background: var(--success); }
.halflife-fill.medium { background: var(--warning); }
.halflife-fill.low { background: var(--danger); }

/* ─── Cycle Progress ─── */
.cycle-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-top: 4px;
}

.cycle-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.cycle-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}

.cycle-ending {
  color: var(--warning);
  font-weight: 600;
}

/* ─── Titration Indicator ─── */
.titration-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(45, 212, 168, 0.15);
  color: var(--accent);
}

/* ─── Vial Status ─── */
.vial-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.vial-bar {
  width: 50px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.vial-fill {
  height: 100%;
  border-radius: 3px;
}

.vial-fill.ok { background: var(--success); }
.vial-fill.low { background: var(--warning); }
.vial-fill.empty { background: var(--danger); }

/* ─── Calendar ─── */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-month {
  font-size: 20px;
  font-weight: 700;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-day-header {
  background: var(--bg-elevated);
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.calendar-day {
  background: var(--bg-surface);
  min-height: 90px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.calendar-day:hover { background: var(--bg-elevated); }
.calendar-day.other-month { opacity: 0.3; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--accent); }

.calendar-day-number {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.calendar-day.today .calendar-day-number { color: var(--accent); }

.calendar-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.calendar-pill {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.4;
}

.calendar-pill.administered {
  opacity: 0.5;
  text-decoration: line-through;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.calendar-detail { margin-top: 16px; }

/* ─── Calculator ─── */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.calc-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.calc-result-value {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
}

.calc-result-unit {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.calc-result-secondary {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 24px;
  font-weight: 600;
  color: var(--success);
  margin-top: 16px;
}

.calc-concentration {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ─── Forms ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-input,
.form-select {
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input:focus:not(:focus-visible),
.form-select:focus:not(:focus-visible) {
  outline: none;
}
.form-input:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-input::placeholder { color: var(--text-muted); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Protocol List ─── */
.protocol-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: background 0.15s;
}

.protocol-item:hover { background: var(--bg-elevated); }

.protocol-color {
  width: 6px;
  align-self: stretch;
  border-radius: 3px;
  flex-shrink: 0;
}

.protocol-info {
  flex: 1;
  min-width: 0;
}

.protocol-name {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.protocol-schedule {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.protocol-dose {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: var(--text-muted);
}

.protocol-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.protocol-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-control);
  border-radius: 11px;
  transition: background 0.2s;
  pointer-events: none; /* let clicks pass through to the parent label/input */
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-float);
  position: relative;
}
[data-theme='light'] .modal {
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* ─── Bottom Sheet (mobile) ─── */
@media (max-width: 640px) {
  .modal-overlay.active {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
    padding-top: 28px !important;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px)) !important;
    max-height: 90vh !important;
  }
  .modal-overlay.active .modal {
    animation: vlSheetUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) both;
  }
  .modal::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    opacity: 0.8;
  }
}
@keyframes vlSheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ─── Swipe-to-Delete ─── */
.swipe-del-bg {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 76px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
}

/* ─── Pull-to-Refresh Indicator ─── */
#pull-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 18px;
  border-radius: 0 0 10px 10px;
  z-index: var(--z-modal);
  pointer-events: none;
  transition: transform 0.1s linear;
  white-space: nowrap;
}

/* ─── Quick Settings Panel ─── */
#quick-settings-panel {
  position: fixed;
  z-index: var(--z-dropdown);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  width: 230px;
  padding: 8px 4px;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
#quick-settings-panel.qs-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.qs-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 14px 8px;
}
.qs-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 14px 4px;
}
.qs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
  transition: background 0.1s;
}
.qs-row:hover { background: var(--bg-elevated); }
.qs-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.qs-label { flex: 1; font-weight: 500; }
.qs-val {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.qs-sep {
  height: 1px;
  background: var(--border-light);
  margin: 4px 10px;
}
.qs-check { cursor: pointer; }

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ─── Cycle Pattern Config ─── */
.cycle-type-group {
  display: flex;
  gap: 8px;
}

.cycle-type-btn {
  flex: 1;
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.cycle-type-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(45, 212, 168, 0.1);
}

.cycle-config {
  display: none;
  gap: 12px;
  margin-top: 8px;
}

.cycle-config.active { display: flex; }

.day-picker {
  display: flex;
  gap: 4px;
}

.day-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.day-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Profile Selector ─── */
.profile-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.profile-bar label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.profile-bar select {
  flex: 1;
}

/* ─── Journal ─── */
.journal-entry {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.journal-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.journal-date-nav .date-display {
  font-size: 18px;
  font-weight: 700;
  min-width: 200px;
  text-align: center;
}

.journal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.journal-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.journal-metric label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.star-rating {
  display: flex;
  gap: 4px;
}

.star-btn {
  font-size: 22px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, transform 0.1s;
  padding: 2px;
}

.star-btn.active { color: var(--warning); }
.star-btn:hover { color: var(--warning); }
.star-btn:active { transform: scale(1.2); }

/* Slider rating (journal slider mode) */
.slider-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.rating-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
}
.rating-slider:focus:not(:focus-visible) { outline: none; }
.rating-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.rating-slider-wrap {
}
.rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.rating-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}
.slider-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Compact water tracker */
.water-tracker-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.water-btn { width: 32px; height: 32px; padding: 0; font-size: 16px; line-height: 1; }
.water-progress-inline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.water-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: visible;
  position: relative;
}
.water-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.water-bar-fill.complete { background: var(--success); }
.water-bar-fill.water-pop {
  animation: waterPop 0.45s ease-out both;
}
@keyframes waterPop {
  0%   { filter: brightness(1.7) saturate(1.4); transform: scaleY(1.5); }
  55%  { filter: brightness(1.2) saturate(1.1); transform: scaleY(0.9); }
  100% { filter: brightness(1)   saturate(1);   transform: scaleY(1); }
}
.water-bar-label {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}
.water-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.water-unit {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

.journal-history {
  margin-top: 20px;
}

.journal-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.journal-history-item:last-child { border-bottom: none; }

.journal-history-date {
  font-weight: 600;
  min-width: 100px;
  color: var(--text-secondary);
}

.journal-history-metrics {
  display: flex;
  gap: 16px;
  flex: 1;
}

.journal-metric-sm {
  font-size: 12px;
  color: var(--text-muted);
}

.journal-metric-sm span {
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Weekly Overview Cards ─── */
.weekly-overview {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.weekly-day-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.weekly-day-card:hover {
  border-color: var(--accent);
}

.weekly-day-card.today {
  border-color: var(--accent);
  background: rgba(45, 212, 168, 0.08);
}

.weekly-day-card.has-data {
  border-left: 3px solid var(--success);
}

.weekly-day-card .day-name {
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.weekly-day-card .day-weight {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.weekly-day-card .day-stars {
  color: var(--warning);
  font-size: 10px;
  margin-top: 2px;
}

/* ─── Analytics / Cost Summary ─── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-top: 4px;
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cost-table th,
.cost-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.cost-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cost-table td:last-child {
  font-family: 'SF Mono', 'Consolas', monospace;
  text-align: right;
}

.cost-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border);
}

/* ─── Injection Site Map ─── */
.site-map-container {
  position: relative;
  width: 200px;
  height: 300px;
  margin: 0 auto;
}

.site-map-body {
  width: 100%;
  height: 100%;
  opacity: 0.3;
}

.site-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 0.15s;
}

.site-dot:hover { transform: translate(-50%, -50%) scale(1.3); }
.site-dot.suggested { animation: pulse 1.5s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 168, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(45, 212, 168, 0); }
}

.site-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.site-history-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.site-history-item:nth-child(odd) { background: var(--bg-elevated); }

/* ─── Settings Panel ─── */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.settings-row label {
  font-size: 14px;
}

.settings-row .form-input {
  width: 120px;
}

/* ─── Toast / Notification ─── */
.toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  padding: 12px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: var(--z-toast);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Enhanced Mobile Responsiveness ─── */
@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px;
  }
  .header-logo h1,
.header-wordmark { font-size: 16px; }
  .header-search {
    order: 3;
    width: 100%;
    margin-top: 4px;
  }
  .header-search .form-input {
    font-size: 14px;
  }
  .header-actions {
    gap: 2px;
  }
  .header-actions .btn {
    padding: 6px 8px;
    font-size: 12px;
  }
  .header-actions .btn:not(.btn-ghost) { padding: 5px 8px; font-size: 11px; min-height: 36px; }

  .tab-bar { display: none; }

  .bottom-nav {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: space-around;
    gap: 0;
    padding: 0 2px;
    flex-wrap: nowrap;
  }
  .bottom-nav-btn {
    flex: 1 1 0;
    min-width: 44px;
    padding: 6px 2px;
  }
  .bottom-nav-label {
    font-size: 10px;
  }
  .bottom-nav-icon {
    font-size: 18px;
  }

  .tab-content-wrapper {
    padding: 12px 8px 80px;
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }

  .tab-content { padding: 16px; }
  .calc-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .journal-grid { grid-template-columns: 1fr; }

  .today-header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .time-group-header {
    font-size: 13px;
    padding: 6px 10px;
  }
  .dose-item {
    padding: 10px;
    gap: 8px;
  }
  .dose-info {
    min-width: 0;
  }
  .dose-name {
    font-size: 14px;
    word-break: break-word;
  }
  .dose-details {
    font-size: 12px;
  }
  .dose-extra {
    display: none;
  }

  .protocol-item {
    flex-wrap: wrap;
    padding: 10px;
    gap: 8px;
  }
  .protocol-info {
    flex: 1;
    min-width: 0;
  }
  .protocol-name {
    font-size: 14px;
    word-break: break-word;
  }
  .protocol-schedule {
    font-size: 11px;
    word-break: break-word;
  }
  .protocol-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border-light);
  }

  .cost-table {
    font-size: 11px;
  }
  .cost-table th,
  .cost-table td {
    padding: 6px 4px;
  }

  .analytics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card {
    padding: 10px 8px;
  }
  .stat-value {
    font-size: 20px;
  }

  .calendar-grid {
    gap: 1px;
  }
  .calendar-day {
    min-height: 48px;
    padding: 2px;
  }
  .calendar-day-number {
    font-size: 11px;
  }
  .calendar-pill {
    font-size: 10px;
    padding: 1px 2px;
  }

  .card {
    padding: 12px;
  }
  .card-header {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .modal {
    width: 95vw;
    max-width: 95vw;
    max-height: 90vh;
    margin: 5vh auto;
    padding: 16px;
  }
  .modal-form {
    gap: 10px;
  }
  .form-input, .form-select {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .streak-bar {
    gap: 12px;
  }
  .streak-item {
    min-width: 0;
  }

  .bloodwork-card {
    padding: 10px;
  }
  .bloodwork-markers {
    gap: 4px;
  }
  .bloodwork-marker {
    padding: 6px 8px;
    font-size: 12px;
  }

  .workout-subtabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 4px;
  }
  .workout-subtab {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12px;
    padding: 6px 10px;
  }

  .settings-section {
    padding: 12px;
  }
  .settings-row {
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }
  .settings-row label {
    font-size: 13px;
  }

  /* Nutrition mobile */
  .macro-rings {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .meal-section {
    padding: 10px;
  }
  .food-item {
    font-size: 12px;
    padding: 8px;
  }

  .weekly-overview {
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }
  .weekly-day-card {
    padding: 6px 2px;
    font-size: 10px;
  }
  .weekly-day-card .day-weight {
    font-size: 11px;
  }

  .landing-features {
    grid-template-columns: 1fr;
  }
  .landing-title {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .header-logo h1,
.header-wordmark {
    font-size: 14px;
  }
  .landing-title {
    font-size: 28px;
  }
  .landing-tagline {
    font-size: 14px;
  }
  .landing-feature {
    flex-direction: column;
    text-align: center;
    gap: 4px;
  }
  .btn { padding: 6px 10px; font-size: 12px; }
  .calendar-day-header { font-size: 10px; padding: 6px 2px; }
  .stat-value {
    font-size: 18px;
  }
  .calendar-day {
    min-height: 40px;
  }
  .calendar-pills {
    display: none;
  }
  .modal {
    padding: 12px;
    border-radius: 8px;
  }
  .cost-table th:nth-child(3),
  .cost-table td:nth-child(3) {
    display: none;
  }
  .analytics-grid { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 28px 1fr 1fr 80px 28px; gap: 3px; font-size: 12px; }
  .set-row .form-input, .set-row .form-select { font-size: 12px; padding: 4px 6px; }
  .rpe-rir-compact { font-size: 10px !important; padding: 3px 1px !important; }
  .bloodwork-markers { grid-template-columns: 1fr; }
}

/* ─── Install Prompt ─── */
.install-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(45, 212, 168, 0.08);
  border: 1px solid rgba(45, 212, 168, 0.2);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}

.install-banner .btn {
  flex-shrink: 0;
}

/* ─── Searchable Preset Dropdown ─── */
.preset-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 110;
}

.preset-dd-cat {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px 4px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.preset-dd-cat:first-child {
  border-top: none;
}

.preset-dd-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.preset-dd-item:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}

/* ─── Mobile Touch & Accessibility ─── */
@media (pointer: coarse) {
  .btn, .tab-btn, .cycle-type-btn, .day-btn,
  .bottom-nav-btn, .expandable-header, .dose-item,
  .protocol-item, .calendar-day, .weekly-day-card,
  .preset-dd-item, .star-btn {
    min-height: 44px;
  }
  .btn-sm { min-height: 44px; }
  .btn-xs { min-height: 44px; min-width: 44px; }
  .btn-icon { min-width: 44px; min-height: 44px; }
  .btn-ghost { min-width: 44px; min-height: 44px; padding: 10px; }
  .dose-checkbox { width: 28px; height: 28px; }
  .toggle-switch { width: 48px; height: 28px; }
  .toggle-slider::before { height: 20px; width: 20px; left: 4px; bottom: 4px; }
  .toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
  .preset-dd-item { padding: 12px; min-height: 44px; }
  .star-btn { font-size: 28px; padding: 4px 6px; }
}

/* Prevent iOS zoom on input focus (requires 16px minimum) */
@media screen and (max-width: 768px) {
  .form-input, .form-select, .daily-notes, textarea, input[type="text"],
  input[type="number"], input[type="date"], input[type="time"], select {
    font-size: 16px;
  }
}

/* ─── Safe Area (notch, home indicator) ─── */
@supports (padding: env(safe-area-inset-top)) {
  .header {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
  }
  .tab-content {
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
  }
  .bottom-nav {
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }
  .landing {
    padding: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-right));
  }
  .toast {
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
  }
}

/* ─── Smooth Scrolling & Overscroll ─── */
.tab-content-wrapper {
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
}

.modal {
  -webkit-overflow-scrolling: touch;
}

/* Prevent pull-to-refresh interference */
html, body {
  overscroll-behavior-y: none;
}

/* ─── Global Search ─── */
.header-search { position: relative; flex: 1; max-width: 300px; margin: 0 16px; }
.search-results-dropdown { position: absolute; top: 100%; left: 0; right: 0; max-height: 400px; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,0.3); z-index: 110; }
.search-result-item { padding: 10px 14px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 8px; }
.search-result-item:hover { background: var(--bg-elevated); }
.search-result-item:last-child { border-bottom: none; }
.search-result-cat { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; padding: 6px 14px; background: var(--bg-elevated); }
@media (max-width: 768px) { .header-search { display: block; max-width: none; margin: 0; } }

/* ─── Streak Bar ─── */
.streak-bar { display: flex; gap: 16px; margin-bottom: 16px; }
.streak-item { display: flex; align-items: baseline; gap: 6px; }
.streak-value { font-family: 'SF Mono', 'Consolas', monospace; font-size: 24px; font-weight: 700; color: var(--accent); }
.streak-label { font-size: 12px; color: var(--text-secondary); }

/* ─── Correlation Insights ─── */
.correlation-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.correlation-item:last-child { border-bottom: none; }
.correlation-compound { font-weight: 600; min-width: 120px; }
.correlation-insight { flex: 1; color: var(--text-secondary); }
.correlation-arrow { font-size: 18px; font-weight: 700; }
.correlation-arrow.up { color: var(--success); }
.correlation-arrow.down { color: var(--danger); }
.correlation-arrow.neutral { color: var(--text-muted); }

/* ─── Bloodwork ─── */
.bloodwork-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.bloodwork-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bloodwork-card-date { font-weight: 700; font-size: 15px; }
.bloodwork-card-source { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.bloodwork-markers { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.bloodwork-marker { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13px; border-left: 3px solid transparent; }
.bloodwork-marker.in-range { background: color-mix(in srgb, var(--success) 8%, transparent); border-left-color: var(--success); }
.bloodwork-marker.slightly-out { background: color-mix(in srgb, var(--warning) 12%, transparent); border-left-color: var(--warning); }
.bloodwork-marker.out-of-range { background: color-mix(in srgb, var(--danger) 15%, transparent); border-left-color: var(--danger); }
.bloodwork-marker-name { color: var(--text-secondary); }
.bloodwork-marker-value { font-weight: 600; font-family: 'SF Mono', 'Consolas', monospace; }
.bloodwork-marker.in-range .bloodwork-marker-value { color: var(--success); }
.bloodwork-marker.slightly-out .bloodwork-marker-value { color: var(--warning); }
.bloodwork-marker.out-of-range .bloodwork-marker-value { color: var(--danger); }
.bloodwork-marker-unit { font-size: 11px; color: var(--text-muted); margin-left: 2px; }
.bloodwork-group-label { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin: 8px 0 4px; grid-column: 1 / -1; }
.bloodwork-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.bloodwork-notes { font-size: 12px; color: var(--text-secondary); margin-top: 8px; font-style: italic; }
.bw-modal-group { margin-bottom: 12px; }
.bw-modal-group-title { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; margin-bottom: 6px; border-bottom: 1px solid var(--border-light); padding-bottom: 4px; }
.bw-modal-markers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bw-marker-input { display: flex; align-items: center; gap: 6px; }
.bw-marker-input label { font-size: 12px; color: var(--text-secondary); min-width: 100px; flex-shrink: 0; }
.bw-marker-input input { width: 80px; }
.bw-marker-input .bw-unit { font-size: 10px; color: var(--text-muted); min-width: 45px; }
.bw-marker-input .bw-ref { font-size: 10px; color: var(--text-muted); }
.csv-preview-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 12px 0; max-height: 300px; overflow-y: auto; display: block; }
.csv-preview-table th, .csv-preview-table td { padding: 4px 8px; border: 1px solid var(--border-light); text-align: left; }
.csv-preview-table th { background: var(--bg-elevated); font-weight: 600; position: sticky; top: 0; }

/* ─── Bloodwork Unit Selector ─── */
.bw-unit-select { font-size: 11px; background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 1px 4px; cursor: pointer; margin-left: 2px; }
.bw-unit-select:focus { outline: 1px solid var(--accent); }

/* ─── Lab Report Side-by-Side View ─── */
.lab-report-viewer { display: flex; gap: 16px; max-height: 60vh; overflow: hidden; }
.lab-report-image { flex: 1; min-width: 0; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elevated); display: flex; align-items: flex-start; justify-content: center; padding: 8px; }
.lab-report-image img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.lab-report-fields { flex: 1; min-width: 0; overflow-y: auto; max-height: 60vh; padding-right: 8px; }
.lab-report-fields .bw-marker-input input.has-value { border-color: var(--success); background: rgba(52, 211, 153, 0.06); }

/* ─── Quick Entry Textarea ─── */
.quick-entry-area { width: 100%; min-height: 80px; font-family: 'SF Mono', 'Consolas', monospace; font-size: 13px; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; resize: vertical; }
.quick-entry-area:focus { border-color: var(--accent); }
.quick-entry-area:focus:not(:focus-visible) { outline: none; }
.quick-entry-area:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.quick-entry-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.quick-entry-results { margin-top: 8px; }
.quick-entry-match { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; border-radius: var(--radius-sm); background: rgba(52, 211, 153, 0.08); margin-bottom: 4px; font-size: 13px; }
.quick-entry-match-label { color: var(--text-secondary); }
.quick-entry-match-value { font-weight: 600; color: var(--success); font-family: 'SF Mono', 'Consolas', monospace; }

/* ─── PDF Preview ─── */
.pdf-preview-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 12px 0; }
.pdf-preview-table th, .pdf-preview-table td { padding: 6px 10px; border: 1px solid var(--border-light); text-align: left; }
.pdf-preview-table th { background: var(--bg-elevated); font-weight: 600; font-size: 11px; text-transform: uppercase; }
.pdf-preview-table input { width: 80px; }
.pdf-preview-status { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; padding: 8px; background: var(--bg-elevated); border-radius: var(--radius-sm); }
.pdf-fallback-msg { font-size: 12px; color: var(--warning); margin-bottom: 8px; padding: 8px; background: rgba(245, 158, 11, 0.1); border-radius: var(--radius-sm); }

/* ─── Upload Buttons Row ─── */
.bw-upload-methods { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.bw-upload-methods .btn { font-size: 12px; }

@media (max-width: 768px) {
  .bloodwork-markers { grid-template-columns: 1fr; }
  .bw-modal-markers { grid-template-columns: 1fr; }
  .lab-report-viewer { flex-direction: column; max-height: none; }
  .lab-report-image { max-height: 40vh; }
  .lab-report-fields { max-height: 40vh; }
  .wearable-import-btns { flex-direction: column; }
  .wearable-import-btns .btn { width: 100%; }
}

/* ─── Workout Tab ─── */
.workout-subtabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.workout-subtab { padding: 10px 16px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; }
.workout-subtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.exercise-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.exercise-row:last-child { border-bottom: none; }
.exercise-name { font-weight: 600; font-size: 14px; flex: 1; }
.exercise-muscle { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.exercise-type-badge { font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 600; }
.exercise-type-badge.compound { background: rgba(45, 212, 168, 0.15); color: var(--accent); }
.exercise-type-badge.isolation { background: rgba(163, 113, 247, 0.15); color: #a371f7; }
.set-row { display: grid; grid-template-columns: 36px 1fr 1fr 90px 32px; gap: 6px; align-items: center; padding: 4px 0; font-size: 13px; }
.rpe-rir-cell { display: flex; gap: 3px; align-items: center; }
.rpe-rir-compact { font-size: 11px !important; padding: 4px 2px !important; min-width: 0; flex: 1; }
.set-row-header { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.set-number { font-weight: 700; color: var(--text-secondary); text-align: center; }
.prev-value { font-size: 11px; color: var(--text-muted); }
.rest-timer { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-elevated); border-radius: var(--radius); margin: 8px 0; }
.rest-timer-value { font-family: 'SF Mono', 'Consolas', monospace; font-size: 24px; font-weight: 700; color: var(--accent); }
.workout-day-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 8px; }
.workout-day-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.rm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rm-table th, .rm-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); text-align: center; }
.rm-table th { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.rm-table td:first-child { text-align: left; font-weight: 600; }
.pr-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.muscle-group-header { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 0 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.workout-exercise-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.workout-exercise-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.workout-session-timer { font-family: 'SF Mono', 'Consolas', monospace; font-size: 18px; font-weight: 700; color: var(--accent); }
.workout-plan-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; transition: background 0.15s; }
.workout-plan-item:hover { background: var(--bg-elevated); }
.workout-plan-name { font-weight: 600; font-size: 15px; flex: 1; }
.workout-plan-meta { font-size: 12px; color: var(--text-secondary); }
.exercise-search-dropdown { position: fixed; max-height: 240px; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 9999; }
.exercise-search-item { padding: 8px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 8px; }
.exercise-search-item:hover { background: var(--bg-elevated); }
.exercise-search-item:last-child { border-bottom: none; }
.progress-exercise-item { padding: 10px 0; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background 0.15s; }
.progress-exercise-item:hover { background: var(--bg-elevated); }
.progress-exercise-name { font-weight: 600; font-size: 14px; }
.progress-exercise-pr { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
/* ─── Demographics / Settings ─── */
.form-input-sm { max-width: 180px; }

/* ─── Bloodwork Reference Range ─── */
.bloodwork-marker-ref { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* ─── Delta View ─── */
.delta-summary { margin-bottom: 12px; }
.delta-highlight { font-size: 13px; line-height: 1.5; }
.delta-table { }
.delta-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; gap: 8px; flex-wrap: wrap; }
.delta-label { font-weight: 600; min-width: 120px; }
.delta-values { color: var(--text-secondary); flex: 1; text-align: center; white-space: nowrap; }
.delta-change { font-weight: 600; text-align: right; white-space: nowrap; min-width: 130px; }

/* ─── PCT Recovery ─── */
.pct-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.pct-score-circle {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; flex-shrink: 0;
  /* Fallback for browsers without conic-gradient support */
  background: var(--border);
  background: conic-gradient(var(--success) calc(var(--pct) * 1%), var(--border) 0%);
  position: relative;
}
.pct-score-circle::before {
  content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg-surface);
}
.pct-score-circle span { position: relative; z-index: 1; }
.progress-bar-bg { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }

/* ─── Protocol Overlay ─── */
.overlay-controls { }
.overlay-marker-groups { display: flex; flex-wrap: wrap; gap: 12px; }
.overlay-marker-group { min-width: 160px; }
.overlay-group-label { font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.overlay-marker-option { display: flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; padding: 2px 0; color: var(--text-secondary); }
.overlay-marker-option:hover { color: var(--text-primary); }
.overlay-marker-option input[type="checkbox"] { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
.overlay-marker-swatch { display: inline-block; width: 10px; height: 3px; border-radius: 1px; flex-shrink: 0; }
.overlay-canvas-wrap { width: 100%; min-height: 300px; position: relative; }
.overlay-canvas-wrap canvas { width: 100%; display: block; }
.overlay-chart-card { padding: 12px; overflow-x: auto; }

.overlay-phase-table { font-size: 12px; }
.overlay-phase-header { display: grid; grid-template-columns: 100px 90px 1fr 1fr; gap: 8px; padding: 6px 0; border-bottom: 2px solid var(--border); font-weight: 700; color: var(--text-secondary); text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
.overlay-phase-row { display: grid; grid-template-columns: 100px 90px 1fr 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-light); align-items: center; }
.overlay-phase-date { font-weight: 600; font-family: 'SF Mono', 'Consolas', monospace; font-size: 11px; }
.overlay-phase-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.overlay-phase-compounds { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.overlay-phase-changes { display: flex; flex-wrap: wrap; gap: 4px; }
.overlay-delta-pill { font-size: 11px; font-weight: 600; font-family: 'SF Mono', 'Consolas', monospace; padding: 1px 6px; background: var(--bg-elevated); border-radius: var(--radius-sm); white-space: nowrap; }

.overlay-insight { padding: 8px 12px; margin-bottom: 8px; background: var(--bg-elevated); border-radius: var(--radius-sm); }
.overlay-insight-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.overlay-insight-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

@media (max-width: 640px) {
  .overlay-marker-groups { gap: 8px; }
  .overlay-marker-group { min-width: 140px; }
  .overlay-phase-header, .overlay-phase-row { grid-template-columns: 80px 70px 1fr; }
  .overlay-phase-header span:last-child, .overlay-phase-row span:last-child { display: none; }
}

/* ─── Community Efficacy Data ��── */
.efficacy-contribute { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.efficacy-rate-card { background: var(--bg-elevated); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 8px; }
.efficacy-rate-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.efficacy-rate-stars { display: flex; flex-direction: column; gap: 4px; }
.efficacy-rate-field { display: flex; align-items: center; gap: 8px; }
.efficacy-rate-label { font-size: 11px; color: var(--text-secondary); min-width: 60px; }
.efficacy-stars { display: flex; gap: 2px; cursor: pointer; }
.efficacy-star { font-size: 18px; color: var(--border); transition: color 0.15s; user-select: none; }
.efficacy-star.active { color: #f0883e; }
.efficacy-star.hover { color: #ffa657; }
.efficacy-star:hover { transform: scale(1.2); }

.efficacy-compound-card { }
.efficacy-compound-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.efficacy-compound-name { font-size: 15px; font-weight: 700; }
.efficacy-report-count { font-size: 11px; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 8px; border-radius: 10px; }

.efficacy-agg-row { padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.efficacy-agg-row:last-child { border-bottom: none; }
.efficacy-agg-dose { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.efficacy-agg-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.efficacy-agg-metric { display: flex; align-items: center; gap: 4px; }
.efficacy-agg-label { font-size: 10px; color: var(--text-muted); min-width: 44px; }
.efficacy-agg-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.efficacy-agg-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.efficacy-agg-val { font-size: 11px; font-weight: 600; font-family: 'SF Mono', 'Consolas', monospace; min-width: 22px; text-align: right; }

.efficacy-goals { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.efficacy-goal-tag { font-size: 10px; padding: 1px 6px; background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: 8px; color: var(--text-secondary); }

.efficacy-bw-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; border-bottom: 1px solid var(--border-light); }
.efficacy-bw-row:last-child { border-bottom: none; }

@media (max-width: 640px) {
  .efficacy-agg-bars { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Quick Entry ─── */
.qe-preview-item { padding: 4px 0; font-size: 13px; }

/* ─── Muscle Map ─── */
.muscle-map { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.muscle-map-item { font-size: 10px; padding: 3px 7px; border-radius: 3px; font-weight: 600; background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-light); }
.muscle-map-item.primary { background: rgba(52, 211, 153, 0.2); color: var(--success); border-color: var(--success); }
.muscle-map-item.secondary { background: rgba(45, 212, 168, 0.1); color: var(--text-secondary); border-color: var(--border); }

/* ─── Custom Exercise Badge ─── */
.exercise-type-badge.custom { background: rgba(219, 127, 247, 0.15); color: #db7ff7; }

/* ─── Body Map ─── */
.body-map-container { display: flex; gap: 12px; justify-content: center; padding: 12px 0; }
.body-map-view { text-align: center; flex: 1; max-width: 200px; background: rgba(255, 255, 255, 0.02); border-radius: 12px; padding: 8px 4px 4px; border: 1px solid rgba(255, 255, 255, 0.06); }
.body-map-view-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 6px; letter-spacing: 1px; }
.body-map-svg { width: 100%; height: auto; }
.body-map-legend { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.muscle-pill { display: inline-flex; align-items: center; font-size: 10px; padding: 3px 8px; border-radius: 10px; font-weight: 600; }
.muscle-pill.primary { background: rgba(52, 211, 153, 0.2); color: var(--success); }
.muscle-pill.secondary { background: rgba(45, 212, 168, 0.15); color: #2dd4a8; }
.custom-exercise-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px; background: var(--bg-surface); }

/* ─── Isometric Stopwatch ─── */
.stopwatch-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-secondary); cursor: pointer; font-size: 14px; transition: all 0.2s; flex-shrink: 0; }
.stopwatch-btn:hover { border-color: var(--accent); color: var(--accent); }
.stopwatch-btn.running { background: rgba(52, 211, 153, 0.15); border-color: var(--success); color: var(--success); animation: pulse-glow 1.5s infinite; }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.3); } 50% { box-shadow: 0 0 8px 2px rgba(52, 211, 153, 0.2); } }
.isometric-duration { font-family: monospace; font-size: 13px; font-weight: 700; min-width: 55px; text-align: center; }

/* ─── Cardio Exercise ─── */
.exercise-type-badge.cardio { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.cardio-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; padding: 8px 0; }
.cardio-field label { font-size: 11px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; display: block; margin-bottom: 4px; }

/* ─── Muscles Overview ─── */
.muscle-volume-bar { margin-bottom: 10px; }
.muscle-volume-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.muscle-volume-track { height: 18px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.muscle-volume-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; min-width: 2px; background: var(--accent); }

/* ─── Stat Box ─── */
.stat-box { background: var(--bg-elevated); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 10px 14px; text-align: center; flex: 1; min-width: 80px; }
.stat-box .stat-value { font-size: 20px; font-weight: 800; line-height: 1.2; }
.stat-box .stat-label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ─── Wiki entries ─── */
.wiki-entry summary::-webkit-details-marker { display: none; }
.wiki-entry summary { list-style: none; }
.wiki-entry summary::before { content: ''; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; background-position: center; width: 12px; height: 12px; display: inline-block; margin-right: 6px; transition: transform 0.2s; }
.wiki-entry[open] summary::before { transform: rotate(90deg); }

/* (Toggle Switch — see primary definition at lines ~1391-1423) */

/* ─── Nutrition Tab ─── */
.nutrition-date-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 16px; }
.nutrition-date-display { font-weight: 700; font-size: 16px; min-width: 160px; text-align: center; }

.macro-ring-container { display: flex; justify-content: center; gap: 20px; margin: 16px 0; flex-wrap: wrap; }
.macro-ring { text-align: center; }
.macro-ring svg { width: 80px; height: 80px; transform: rotate(-90deg); }
.macro-ring-big svg { width: 120px; height: 120px; }
.macro-ring circle { fill: none; stroke-width: 8; }
.macro-ring .bg { stroke: var(--border); }
.macro-ring .fill { stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; animation: ringFadeIn 0.6s ease; }

@keyframes ringFadeIn {
  from { opacity: 0; stroke-dashoffset: 314; }
  to { opacity: 1; }
}
.macro-ring-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.macro-ring-value { font-size: 16px; font-weight: 700; }

.meal-section { margin-bottom: 16px; padding: 12px; background: var(--bg-elevated); border-radius: var(--radius); border: 1px solid var(--border-light); }
.meal-section-header { display: flex; justify-content: space-between; align-items: center; padding: 6px 0 8px; border-bottom: 2px solid var(--border); margin-bottom: 8px; }
.meal-section-title { font-weight: 700; font-size: 14px; }
.meal-section-total { font-size: 12px; color: var(--text-secondary); }
.food-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.food-name { flex: 1; font-weight: 500; }
.food-macros { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); }
.food-macro { text-align: center; min-width: 40px; }
.food-macro-value { font-weight: 600; color: var(--text-primary); }
.food-macro-label { font-size: 10px; }

.food-search-results { max-height: 200px; overflow-y: auto; }
.food-search-item { display: flex; justify-content: space-between; align-items: center; padding: 8px; cursor: pointer; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.food-search-item:hover { background: var(--bg-elevated); }
.food-macros-inline { font-size: 11px; color: var(--text-secondary); }

.food-preview-box { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; font-weight: 600; text-align: center; margin: 8px 0; color: var(--accent); }

.quick-add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.quick-add-btn { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* (stat-box — see primary definition at line ~2819) */

.nutr-trend-bars { display: flex; gap: 4px; align-items: flex-end; height: 100px; margin-bottom: 8px; }
.nutr-trend-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.nutr-trend-bar { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; transition: height 0.3s ease; }
.nutr-trend-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.nutr-trend-val { font-size: 10px; color: var(--text-secondary); font-weight: 600; }

.macro-split-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; margin-top: 8px; }
.macro-split-segment { height: 100%; transition: width 0.4s ease; }

/* ─── Loading Skeleton ─── */
/* (shimmer keyframe — reusing vlSkeletonShimmer from line ~618) */

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-light) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: vlSkeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 14px;
  margin-bottom: 10px;
  width: 100%;
}

.skeleton-line:last-child { width: 60%; }

.skeleton-card {
  height: 120px;
  margin-bottom: 16px;
  border-radius: var(--radius);
}

.skeleton-tab-loading {
  padding: 20px;
  animation: fadeSlideIn 0.15s ease;
}

.skeleton-tab-loading .skeleton-header {
  height: 28px;
  width: 45%;
  margin-bottom: 20px;
}

.skeleton-tab-loading .skeleton-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.skeleton-tab-loading .skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-tab-loading .skeleton-content {
  flex: 1;
}

.skeleton-tab-loading .skeleton-content .skeleton-line { margin-bottom: 8px; }
.skeleton-tab-loading .skeleton-content .skeleton-line:nth-child(2) { width: 75%; }
.skeleton-tab-loading .skeleton-content .skeleton-line:nth-child(3) { width: 50%; }

/* ─── Chart skeleton placeholder (used while async data loads) ─── */
.skeleton-chart {
  height: 180px;
  border-radius: var(--radius-sm);
  margin: 4px 0 8px;
}

/* ─── Inline spinner (shown inside buttons / small containers) ─── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ─── Screen-reader only (visually hidden, still announced) ─── */
.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;
}

/* ─── Error boundary fallback card ─── */
.error-boundary {
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed var(--danger);
  border-radius: var(--radius);
  margin: 16px;
  background: color-mix(in srgb, var(--danger) 6%, transparent);
}
.error-boundary__icon { font-size: 36px; margin-bottom: 12px; }
.error-boundary__title { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.error-boundary__msg { font-size: 12px; color: var(--text-secondary); margin-bottom: 20px; font-family: monospace; }

/* ─── Offline Indicator ─── */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: var(--warning);
  color: #000;
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.offline-banner.visible { transform: translateY(0); }

.offline-banner .offline-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d32f2f;
  margin-right: 6px;
  vertical-align: middle;
}

.offline-queue-toggle { vertical-align: middle; margin-left: 4px; text-decoration: underline; }
.offline-queue-panel {
  position: fixed; top: 30px; left: 50%; transform: translateX(-50%);
  z-index: 10001; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  width: 380px; max-width: 95vw; max-height: 50vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.offline-queue-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.offline-queue-list { overflow-y: auto; max-height: 35vh; padding: 4px 0; }
.offline-queue-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; font-size: 12px; border-bottom: 1px solid var(--border-subtle, rgba(128,128,128,0.1));
}
.offline-queue-item:last-child { border-bottom: none; }
.oq-item-info { flex: 1; min-width: 0; }
.oq-method { font-weight: 700; font-family: monospace; font-size: 10px; color: var(--accent); }
.oq-path { color: var(--text-secondary); word-break: break-all; }
.oq-age { color: var(--text-muted); font-size: 10px; margin-left: 6px; }
.oq-retries { color: var(--warning); font-size: 10px; }
.oq-item-actions { flex-shrink: 0; margin-left: 8px; }
.offline-queue-footer { padding: 8px 14px; border-top: 1px solid var(--border); text-align: right; }

.sync-pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 183, 77, 0.15);
  color: var(--warning);
  font-weight: 600;
}

/* ─── About/FAQ Section ─── */
.about-section {
  padding: 0;
}

.about-hero {
  text-align: center;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.about-hero .about-logo { font-size: 36px; margin-bottom: 8px; }
.about-hero .about-logo svg { width: 48px; height: 48px; }
.about-hero .about-version { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::after {
  /* alt text empty string prevents AT from reading the character */
  content: '+' / '';
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  content: '\2212' / '';
}

.faq-item .faq-answer {
  padding: 0 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}


/* ─── Goal Cards (enhanced) ─── */
.goal-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.goal-card:hover { border-color: var(--accent); }

.goal-card .goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.goal-card .goal-name { font-weight: 700; font-size: 14px; }

.goal-card .goal-target {
  font-size: 12px;
  color: var(--text-secondary);
}

.goal-card .goal-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.goal-card .goal-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.goal-card .goal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.goal-card .goal-complete-badge {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 11px;
}

.goal-card .goal-deadline-near {
  color: var(--warning);
  font-weight: 600;
}

/* ─── Weekly/Monthly Summary Card ─── */
.summary-card {
  padding: 16px;
  margin-top: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.summary-stat {
  text-align: center;
  padding: 10px 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.summary-stat .stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.summary-stat .stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-stat .stat-delta {
  font-size: 10px;
  margin-top: 2px;
  font-weight: 600;
}

.summary-stat .stat-delta.positive { color: var(--success); }
.summary-stat .stat-delta.negative { color: var(--danger); }

/* ─── Comparison View ─── */
.compare-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compare-col {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.compare-col .compare-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 10px;
  text-align: center;
}

.compare-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.compare-row:last-child { border-bottom: none; }
.compare-row .compare-label { color: var(--text-secondary); }
.compare-row .compare-value { font-weight: 600; color: var(--text-primary); }

.compare-better { color: var(--success) !important; }
.compare-worse { color: var(--danger) !important; }

@media (max-width: 480px) {
  .compare-container { grid-template-columns: 1fr; }
}

/* ─── Wearable Data Section ─── */
.wearable-section {
  margin-top: 16px;
}

.wearable-import-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.wearable-import-btns .btn {
  font-size: 12px;
  padding: 8px 12px;
}

.wearable-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
}

.wearable-indicator .wearable-icon {
  font-size: 10px;
}

.compound-health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}

.compound-health-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
}

.compound-health-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
}

.compound-health-table .on-val { color: var(--accent); font-weight: 600; }
.compound-health-table .off-val { color: var(--text-secondary); }

.wearable-overlay-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.wearable-overlay-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ─── Tab Badge ─── */
.tab-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  pointer-events: none;
  z-index: 1;
  line-height: 1;
}
.tab-badge-lock {
  background: var(--text-muted);
  min-width: 14px;
  height: 14px;
  font-size: 10px;
}

/* ─── More Sheet ─── */
.more-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9000;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.more-sheet-overlay.active {
  display: block;
  opacity: 1;
}
.more-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 9001;
  animation: vlSheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1) both;
}
.more-sheet-overlay.closing .more-sheet {
  animation: vlSheetDown 0.22s cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes vlSheetDown {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}
.more-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 14px;
}
.more-sheet-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.more-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 4px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.more-sheet-item:active {
  background: var(--border);
}
.more-sheet-item .more-item-icon {
  font-size: 22px;
  line-height: 1;
}
.more-sheet-item .more-item-label {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.more-sheet-hint {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 12px;
  margin-bottom: 2px;
}
/* Swap mode — highlight current primary tabs */
.more-sheet-swap-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  border: 1px dashed var(--accent);
}
.more-sheet-swap-bar .swap-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  font-size: 10px;
  color: var(--text-secondary);
  transition: border-color 0.15s;
}
.more-sheet-swap-bar .swap-slot:hover,
.more-sheet-swap-bar .swap-slot:active {
  border-color: var(--accent);
  color: var(--accent);
}
/* Desktop: hide More button, show all tabs */
@media (min-width: 769px) {
  #btn-more-nav { display: none !important; }
  .more-sheet-overlay { display: none !important; }
}

/* ─── Welcome Toast ─── */
.toast-summary {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Modal overlay scroll lock ─── */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ─── Progressive Overload Indicator ─── */
.overload-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
}
.overload-badge.up { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.overload-badge.down { background: rgba(244, 63, 94, 0.15); color: var(--danger); }
.overload-badge.same { background: rgba(139, 148, 158, 0.15); color: var(--text-secondary); }

/* (cost-table — see primary definition at line ~1983) */

/* ─── Protocol Item Mobile Fix ─── */
.protocol-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ─── Water Tracker ─── */
.water-tracker { display: flex; gap: 8px; align-items: center; justify-content: center; }

@media (max-width: 768px) {
  .set-row { grid-template-columns: 30px 1fr 1fr 80px 28px; font-size: 12px; }
  .delta-row { flex-direction: column; align-items: flex-start; }
  .delta-values, .delta-change { text-align: left; min-width: auto; }
  .form-input-sm { max-width: 100%; }
  .macro-ring-container { gap: 12px; }
  .macro-ring-big svg { width: 100px; height: 100px; }
  .meal-section-header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .quick-add-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .compound-health-table { font-size: 11px; }
  .compound-health-table th, .compound-health-table td { padding: 4px 6px; }

  /* Protocol tab mobile */
  .protocol-item { flex-wrap: wrap; gap: 8px; }
  .protocol-info { min-width: 0; flex: 1; }
  .protocol-actions { width: auto; }
  .protocol-schedule { font-size: 11px; word-break: break-word; }
  .cost-table { font-size: 11px; }
  .cost-table th, .cost-table td { padding: 4px 6px; }

  /* Card header mobile */
  .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .card-header > div { width: 100%; }
  .card-header .btn { font-size: 12px; padding: 6px 10px; }

  /* Analytics grid mobile */
  .analytics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 10px 12px; }
  .stat-value { font-size: 18px; }

  /* Today tab mobile */
  .today-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .today-greeting { flex-wrap: wrap; gap: 6px; }
  .greeting-hello { font-size: 20px; }
  .daily-progress-row { gap: 4px; }
  .progress-ring-item { min-width: 50px; padding: 4px 2px; }
  .progress-ring { width: 36px; height: 36px; }
  .quick-action-btn { padding: 8px 2px; min-width: 50px; }
  .feature-discovery-grid { grid-template-columns: repeat(2, 1fr); }
  .dose-item { flex-wrap: wrap; gap: 6px; padding: 10px; }
  .dose-info { min-width: 0; flex: 1; }
  .dose-extra { width: 100%; margin-top: 4px; }

  /* Journal mobile */
  .weekly-overview { gap: 4px; }
  .weekly-day-card { padding: 6px 4px; min-width: 42px; }
  .journal-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Modal mobile */
  .modal { max-height: 85vh; margin: auto 8px; padding: 16px; }
  .modal-form { max-height: 60vh; overflow-y: auto; }

  /* Profile bar mobile */
  .profile-bar { flex-wrap: wrap; gap: 6px; }
  .profile-bar select { max-width: 140px; }

  /* Cardio fields mobile */
  .cardio-fields { grid-template-columns: 1fr 1fr; }

  /* Settings demographics mobile */
  .settings-grid { grid-template-columns: 1fr; }

  /* Streak bar mobile */
  .streak-bar { gap: 12px; }

  /* Advanced features mobile */
  .conflict-matrix { font-size: 10px; }
  .conflict-matrix th, .conflict-matrix td { padding: 3px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .phase-timeline { overflow-x: auto; }
  .serum-controls { flex-direction: column; }
  .ester-checkboxes { grid-template-columns: 1fr 1fr; }
  .risk-gauges { grid-template-columns: 1fr 1fr; }
  .comparison-table { font-size: 10px; }
  .comparison-table th, .comparison-table td { padding: 4px; }
  .meal-prep-grid { grid-template-columns: 1fr; }
  .supplement-grid { grid-template-columns: 1fr; }
  .wearable-cards { grid-template-columns: 1fr; }
  .proportion-chart { grid-template-columns: 1fr; }
  .analytics-cards { grid-template-columns: 1fr; }
  .volume-grid { grid-template-columns: 1fr 1fr; }
  .tdee-result { flex-direction: column; }
  .photo-compare { flex-direction: column; }
  .correlation-matrix { font-size: 10px; overflow-x: auto; }
  .split-preview { grid-template-columns: 1fr; }
  .cycle-comparison-grid { grid-template-columns: 1fr; }
  .export-options { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   ADVANCED FEATURES — New component styles
   ═══════════════════════════════════════════════════════════════ */

/* ─── AMOLED Theme ─── */
[data-theme='amoled'] {
  --bg-primary: #000000;
  --bg-surface: #0a0a0a;
  --bg-elevated: #111111;
  --bg-input: #000000;
  --border: #1a1a1a;
  --border-light: #111111;
  --border-input: #4a4a4a; /* 3.1:1 on #000000 */
  --border-control: #5a5a5a; /* 3.4:1 on #111111 */
  --text-primary: #eceff4;
  --text-secondary: #8c939c;
  --text-muted: #6b727b;
  --accent: #2dd4a8;
  --accent-hover: #5eead4;
  --accent-dim: rgba(45, 212, 168, 0.12);
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #f43f5e;
  --info: #38bdf8;
  --shadow: none;
  --shadow-elevated: none;
  --shadow-float: 0 0 0 1px rgba(255,255,255,0.06);
  --bg-card: #0a0a0a;
  --badge-bg: #1a1a1a;
  --badge-color: #8c939c;
  --bm-skin: #2a2520;
  --bm-muscle: #2dd4a822;
  --bm-muscle-hover: #2dd4a844;
  --bm-gap: #000000;
  --bm-head: #3a3530;
  --bm-hair: #1a1510;
}

[data-theme='amoled'] .card { border-color: #1a1a1a; }
[data-theme='amoled'] .card:hover { box-shadow: none; transform: none; }
[data-theme='amoled'] .header { border-bottom-color: #1a1a1a; }
[data-theme='amoled'] .tab-bar { border-bottom-color: #1a1a1a; }
[data-theme='amoled'] .bottom-nav { border-top-color: #1a1a1a; }

/* ─── Accessibility: Large Text ─── */
.a11y-large-text { font-size: 16px; }
.a11y-large-text .form-input,
.a11y-large-text .form-select { font-size: 16px; min-height: 48px; }
.a11y-large-text .btn { font-size: 15px; min-height: 48px; }
.a11y-large-text .card-title { font-size: 15px; }
.a11y-large-text .stat-value { font-size: 28px; }

/* ─── Accessibility: High Contrast ─── */
.a11y-high-contrast { --border: var(--text-secondary); }
.a11y-high-contrast .card { border-width: 2px; }
.a11y-high-contrast .btn { border-width: 2px; }
.a11y-high-contrast .form-input,
.a11y-high-contrast .form-select { border-width: 2px; }

/* ─── Accessibility: Reduce Animations ─── */
.a11y-no-animations,
.a11y-no-animations * {
  animation-duration: 0s !important;
  transition-duration: 0s !important;
}

/* ─── Sub-tab Navigation ─── */
.sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sub-tab {
  padding: 10px 16px;
  border-radius: 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.sub-tab:hover { background: none; color: var(--text-primary); }
.sub-tab.active { background: none; color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Today View Switcher ─── */
.today-view-switcher {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.view-switch-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.view-switch-btn:hover { color: var(--text-primary); }
.view-switch-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ─── Today Page Redesign ─── */

/* Greeting Header */
/* ── Onboarding Wizard ── */
.onboarding-wizard { padding: 16px 0; max-width: 520px; margin: 0 auto; }
.onboarding-progress { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 24px; }
.onboarding-step-dot {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: var(--bg-card); border: 2px solid var(--border);
  color: var(--text-muted); transition: all 0.2s;
}
.onboarding-step-dot.active { border-color: var(--accent); color: var(--accent); background: rgba(52,211,153,0.1); }
.onboarding-step-dot.complete { background: var(--accent); color: #fff; border-color: var(--accent); }
.onboarding-step-line { flex: 1; max-width: 40px; height: 2px; background: var(--border); transition: background 0.2s; }
.onboarding-step-line.active { background: var(--accent); }
.onboarding-content { padding: 28px 24px; text-align: center; }
.onboarding-title { font-size: 22px; font-weight: 700; margin: 0 0 8px; color: var(--text-primary); }
.onboarding-desc { font-size: 14px; color: var(--text-secondary); margin: 0 0 20px; line-height: 1.5; }
.onboarding-features-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; text-align: left; }
.onboarding-feat { padding: 14px; border-radius: 10px; background: var(--bg-secondary, rgba(128,128,128,0.06)); font-size: 13px; line-height: 1.4; }
.onboarding-feat strong { color: var(--accent); }
.onboarding-goals { display: flex; flex-direction: column; gap: 8px; text-align: left; margin-bottom: 20px; }
.onboarding-goal-option { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--bg-secondary, rgba(128,128,128,0.06)); cursor: pointer; font-size: 14px; transition: background 0.15s; }
.onboarding-goal-option:hover { background: rgba(52,211,153,0.08); }
.onboarding-goal-option input[type="radio"] { accent-color: var(--accent); }
.onboarding-form { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-bottom: 20px; }
.onboarding-form label { font-size: 13px; font-weight: 600; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; }
.onboarding-widgets { display: flex; flex-direction: column; gap: 8px; text-align: left; margin-bottom: 20px; }
.onboarding-widget-option { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--bg-secondary, rgba(128,128,128,0.06)); cursor: pointer; font-size: 13px; }
.onboarding-widget-option input[type="checkbox"] { accent-color: var(--accent); }
.onboarding-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; }
.onboarding-next-steps { display: flex; flex-direction: column; gap: 8px; text-align: left; margin-bottom: 20px; }
.onboarding-next-step { padding: 12px 14px; border-radius: 10px; background: var(--bg-secondary, rgba(128,128,128,0.06)); font-size: 13px; cursor: pointer; transition: background 0.15s; }
.onboarding-next-step:hover { background: rgba(52,211,153,0.1); }
.btn-lg { padding: 12px 32px; font-size: 15px; }
.onboarding-skip { margin-top: 12px; font-size: 12px; }
@media (max-width: 480px) {
  .onboarding-features-grid { grid-template-columns: 1fr; }
  .onboarding-content { padding: 20px 16px; }
}

/* ── Onboarding Wizard V2 — goal/feature cards, consent, preview bar ── */
.ob-goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ob-goal-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: var(--radius); border: 1.5px solid var(--border);
  background: var(--bg-surface); cursor: pointer; transition: all 0.15s;
}
.ob-goal-card:hover { border-color: var(--text-muted); background: var(--bg-elevated); }
.ob-goal-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.ob-feature-list { display: flex; flex-direction: column; gap: 8px; }
.ob-feature-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: var(--radius); border: 1.5px solid var(--border);
  background: var(--bg-surface); cursor: pointer; transition: all 0.15s;
}
.ob-feature-card:hover { border-color: var(--text-muted); background: var(--bg-elevated); }
.ob-feature-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.ob-consent-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border-light); cursor: pointer;
}
.ob-consent-item:last-child { border-bottom: none; }
.ob-consent-item input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.ob-preview-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10002;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--bg-surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  animation: vlSheetUp 0.25s cubic-bezier(0.32,0.72,0,1) both;
}
@media (max-width: 480px) {
  .ob-goal-grid { grid-template-columns: 1fr; }
  .ob-preview-bar { padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom, 10px)); }
}

.today-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 4px 0;
}
.greeting-text { flex: 1; min-width: 0; }
.greeting-hello {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.today-date-line {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.greeting-right { flex-shrink: 0; margin-left: 12px; }

/* ── Streak Card ── */
.streak-card {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 14px 12px;
  margin-bottom: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}
.streak-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 52px;
}
.streak-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  background: var(--bg-elevated);
  transition: border-color 0.2s, color 0.2s;
}
.streak-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
}
@media (max-width: 480px) {
  .streak-card { gap: 14px; padding: 12px 8px; }
  .streak-circle { width: 38px; height: 38px; font-size: 16px; }
}

/* Daily Progress Rings */
.daily-progress-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 0;
}
.daily-progress-row::-webkit-scrollbar { display: none; }
.progress-ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  flex: 1;
  gap: 3px;
  cursor: pointer;
  padding: 6px 2px;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.progress-ring-item:hover { background: var(--bg-surface); }
.progress-ring {
  width: 40px;
  height: 40px;
  transform: rotate(-90deg);
}
.ring-bg {
  fill: none;
  stroke: var(--border-light);
  stroke-width: 3;
}
.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
  animation: ringFillIn 0.8s ease-out forwards;
}
@keyframes ringFillIn {
  from { stroke-dashoffset: 106.8; }
}
.progress-ring-item.completed .ring-fill { stroke: var(--success); }
.progress-ring-item.empty .ring-fill { stroke: var(--text-muted); opacity: 0.3; }
.progress-ring text { transform: rotate(90deg); transform-origin: center; }
.ring-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
}
.ring-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1;
}
.progress-ring-item.completed .ring-value { color: var(--success); }

.ring-trend {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
  margin-top: 2px;
  white-space: nowrap;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ring-trend-up { color: var(--success); }
.ring-trend-down { color: var(--danger); }

.bw-trend-arrow {
  font-size: 11px;
  margin-left: 3px;
  flex-shrink: 0;
}

/* Quick Actions Bar */
.quick-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.quick-actions::-webkit-scrollbar { display: none; }
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 56px;
  padding: 10px 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.quick-action-btn:hover, .quick-action-btn:active {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent);
}
.qa-icon { line-height: 1; }
.qa-icon svg { width: 18px; height: 18px; }
.qa-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.qa-expand-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  animation: fadeSlideIn 0.15s ease;
}
.qa-expand-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}
.qa-mood-btn {
  min-width: 36px;
  text-align: center;
}
.qa-mood-btn.active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
.qa-meal-picker {
  flex-wrap: wrap;
}
.qa-meal-type-btn {
  flex: 1;
  min-width: 70px;
  text-align: center;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Improved Empty State Card */
.today-empty-card {
  padding: 16px;
  margin-bottom: 4px;
}
.today-empty-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.today-empty-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}
.today-empty-icon svg { width: 24px; height: 24px; }

/* Snapshot Cards */
.today-snap-card {
  cursor: pointer;
  padding: 14px 16px;
  margin-top: 10px;
  transition: border-color 0.15s;
}
.today-snap-card:hover { border-color: var(--accent); }
.snap-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.snap-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  line-height: 1;
}
.snap-icon svg { width: 16px; height: 16px; }
.snap-icon.completed { color: var(--success); }
.snap-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(45, 212, 168, 0.12);
  color: var(--accent);
  font-weight: 600;
}
.snap-badge.success {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}
.snap-macros {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}
.snap-empty {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* Streaks & Achievements */
.achievement-banner {
  padding: 8px 12px;
  margin-top: 10px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* ─── VitaScore Card ─── */
.vitascore-card {
  padding: 16px;
  margin-bottom: 12px;
}
.vitascore-top {
  display: flex;
  align-items: center;
  gap: 16px;
}
.vitascore-ring-wrap {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
}
.vitascore-ring { width: 100%; height: 100%; }
.vitascore-info { flex: 1; }
.vitascore-streak {
  flex-shrink: 0;
  text-align: center;
  padding-left: 20px;
  margin-left: auto;
  min-width: 80px;
  position: relative;
}
.vitascore-streak::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10%;
  height: 80%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border), transparent);
}
.vitascore-streak-number {
  font-size: 34px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.5px;
}
.vitascore-streak-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  margin-top: 2px;
}
.vitascore-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.vitascore-rank {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}
.vitascore-averages {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.vitascore-avg {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}
.vitascore-avg-sep {
  font-size: 10px;
  color: var(--border);
}
.vitascore-trend { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
/* ─── Insight Cards ─── */
.insight-cards { margin-bottom: 12px; }
.insight-card {
  padding: 12px 14px;
  margin-bottom: 8px;
}
.insight-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.insight-icon { font-size: 16px; line-height: 1; }
.insight-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.insight-dismiss {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  font-family: inherit;
  opacity: 0.6;
}
.insight-dismiss:hover { opacity: 1; }
.insight-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  padding-left: 24px;
}

/* ─── Accountability Partner Widget ─── */
.partner-widget { padding: 14px; margin-bottom: 12px; }
.partner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.partner-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.partner-stats { display: flex; flex-direction: column; gap: 8px; }
.partner-stat {
  display: flex;
  align-items: center;
  gap: 10px;
}
.partner-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.partner-stat-info { flex: 1; }
.partner-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.partner-status { font-size: 11px; margin-top: 1px; }
.partner-status.logged { color: var(--success); }
.partner-status.not-logged { color: var(--text-muted); }
.partner-streak-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  line-height: 1;
}
.partner-streak-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
}
.partner-shared { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.partner-shared-streak {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

/* ─── Seasonal Challenge Card ─── */
.seasonal-card {
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(255, 215, 0, 0.03) 100%);
}
.seasonal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}
.seasonal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.seasonal-season-badge { font-size: 18px; }
.seasonal-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.seasonal-complete-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  padding: 2px 8px;
  background: rgba(52, 211, 153, 0.12);
  border-radius: 10px;
}
.seasonal-dismiss {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: inherit;
}
.seasonal-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 10px;
}
.seasonal-progress { margin-bottom: 8px; }
.seasonal-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.seasonal-progress-fill {
  height: 100%;
  background: var(--warning, #f0a800);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.seasonal-progress-fill.complete { background: var(--success); }
.seasonal-progress-text {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}
.seasonal-participants {
  font-size: 11px;
  color: var(--text-muted);
}
.seasonal-badge-preview {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
  padding: 6px;
  background: var(--bg-elevated, var(--bg-surface));
  border-radius: var(--radius-sm);
}
.seasonal-join-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ─── Comeback Banner (Re-engagement) ─── */
.comeback-banner {
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(45, 212, 168, 0.06) 100%);
}
.comeback-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.comeback-icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.comeback-text { flex: 1; }
.comeback-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.comeback-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.comeback-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: inherit;
}
.comeback-reward {
  margin-top: 10px;
  padding: 10px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: #a855f7;
  text-align: center;
}
.comeback-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.comeback-actions .btn { flex: 1; }

/* ─── Quest Card ─── */
.quest-card {
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(45, 212, 168, 0.04) 100%);
}
.quest-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.quest-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quest-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.quest-progress-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(45, 212, 168, 0.15);
  color: var(--accent);
}
.quest-dismiss {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: inherit;
}
.quest-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}
.quest-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.quest-steps { display: flex; flex-direction: column; gap: 4px; }
.quest-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.quest-step:not(.done):hover { background: var(--bg-elevated, var(--bg-surface)); }
.quest-step.done { color: var(--text-muted); text-decoration: line-through; opacity: 0.7; }
.quest-check {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--text-muted);
}
.quest-step.done .quest-check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.quest-step-label { flex: 1; }
.quest-reward {
  margin-top: 12px;
  padding: 10px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  text-align: center;
}
.quest-reward-preview {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ─── Streak Hero Card ─── */
.streak-hero-card {
  padding: 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(255, 215, 0, 0.04) 100%);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.streak-hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.streak-tier-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid;
  font-size: 12px;
  font-weight: 700;
}
.streak-tier-icon { font-size: 16px; }
.streak-tier-name { text-transform: uppercase; letter-spacing: 0.5px; font-size: 10px; }
.streak-hero-number {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-left: auto;
}
.streak-big-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.streak-big-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.streak-next-tier {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.streak-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.streak-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.streak-next-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.streak-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.streak-shield-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}
.streak-freeze-btn {
  font-size: 11px;
}
.streak-frozen-badge {
  font-size: 11px;
  color: var(--info, #2dd4a8);
  font-weight: 600;
  padding: 3px 10px;
  background: rgba(45, 212, 168, 0.1);
  border-radius: 10px;
}

/* ─── Quick Check-In Modal ─── */
.quick-checkin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: qciFadeIn 0.25s ease;
  backdrop-filter: blur(4px);
}
.quick-checkin-overlay.closing {
  animation: qciFadeOut 0.25s ease forwards;
}
@keyframes qciFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes qciFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
.quick-checkin-card {
  background: var(--bg-surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom, 20px));
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3);
  animation: qciSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) both;
}
.quick-checkin-overlay.closing .quick-checkin-card {
  animation: qciSlideDown 0.25s ease forwards;
}
@keyframes qciSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes qciSlideDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}
.qci-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.qci-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.qci-dismiss {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  font-family: inherit;
}
.qci-section {
  margin-bottom: 14px;
}
.qci-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.qci-emoji-row {
  display: flex;
  gap: 6px;
}
.qci-emoji-btn {
  flex: 1;
  padding: 10px 4px;
  font-size: 22px;
  background: var(--bg-elevated, var(--bg-surface));
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-align: center;
  line-height: 1;
}
.qci-emoji-btn:hover { border-color: var(--accent); }
.qci-emoji-btn.selected {
  border-color: var(--accent);
  background: rgba(45, 212, 168, 0.1);
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(45, 212, 168, 0.2);
}
.qci-toggle-section { }
.qci-toggle-row {
  display: flex;
  gap: 8px;
}
.qci-toggle-btn {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-elevated, var(--bg-surface));
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.qci-toggle-btn:hover { border-color: var(--accent); }
.qci-toggle-btn.active {
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
}
.qci-save-btn {
  width: 100%;
  margin-top: 6px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
}
.qci-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.qci-expand-link {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}
.qci-expand-link:hover { text-decoration: underline; }
.qci-disable-label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.qci-disable-label input { margin: 0; }
@media (min-width: 641px) {
  .quick-checkin-overlay { align-items: center; }
  .quick-checkin-card { border-radius: var(--radius); max-width: 420px; }
}

/* Onboarding Checklist */
.onboarding-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ob-item {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0;
  transition: color 0.2s;
}
.ob-item.done {
  color: var(--success);
}

/* Feature Discovery Grid */
.feature-discovery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.fd-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
}
.fd-item:hover { border-color: var(--accent); }
.fd-icon { line-height: 1; }
.fd-icon svg { width: 20px; height: 20px; }
.fd-text {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

/* ─── Onboarding Tutorial ─── */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}
.tutorial-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
  margin-bottom: env(safe-area-inset-bottom, 0);
  animation: fadeSlideIn 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.tutorial-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.tutorial-dot {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border-light);
  transition: background 0.2s;
}
.tutorial-dot.active { background: var(--accent); }
.tutorial-dot.done { background: var(--success); }
.tutorial-step-num {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.tutorial-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.tutorial-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}
.tutorial-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tutorial-highlight {
  position: relative;
  z-index: 10001;
  box-shadow: 0 0 0 4px var(--accent), 0 0 0 6px rgba(45, 212, 168, 0.3);
  border-radius: var(--radius);
}
.tutorial-tab-highlight {
  background: var(--accent) !important;
  color: #fff !important;
  border-radius: 6px;
  animation: tutTabPulse 1.2s ease-in-out infinite;
}
@keyframes tutTabPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 168, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(45, 212, 168, 0); }
}

/* ─── Sub-tab Group Divider ─── */
.subtab-group-divider {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ─── Side Effect Sections ─── */
.side-effect-section {
  margin-bottom: 16px;
}

/* ─── Dashboard Grid ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* ── Today Tab Widget Edit Mode ── */
.widget-edit-active .today-widget-wrap {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
  background: var(--bg-surface);
}
.today-widget-wrap.widget-hidden {
  opacity: 0.45;
  border-style: dotted;
}
.today-widget-wrap.dragging {
  opacity: 0.3;
  box-shadow: 0 0 0 2px var(--accent);
}
.today-widget-wrap.drag-over-top {
  border-top: 3px solid var(--accent);
}
.today-widget-wrap.drag-over-bottom {
  border-bottom: 3px solid var(--accent);
}
.widget-edit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  user-select: none;
}
.widget-drag-grip {
  font-size: 16px;
  color: var(--text-muted);
  cursor: grab;
  touch-action: none;
}
.widget-drag-grip:active { cursor: grabbing; }
.widget-edit-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.widget-eye-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.widget-eye-btn:hover {
  background: var(--bg-elevated);
}
.widget-edit-content {
  padding: 4px 0;
}
.widget-edit-placeholder {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.dashboard-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.dashboard-widget:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(45, 212, 168, 0.1);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.widget-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.widget-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.widget-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.widget-icon {
  font-size: 20px;
  opacity: 0.7;
}

/* ─── Conflict Matrix ─── */
.conflict-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.conflict-matrix th,
.conflict-matrix td {
  padding: 6px;
  text-align: center;
  border: 1px solid var(--border-light);
  min-width: 40px;
}

.conflict-matrix th {
  background: var(--bg-elevated);
  font-weight: 600;
  font-size: 10px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  max-width: 40px;
  padding: 8px 4px;
}

.conflict-matrix th.row-header {
  writing-mode: horizontal-tb;
  text-align: right;
  max-width: none;
  padding: 6px 8px;
}

.matrix-cell {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s;
}

.matrix-cell:hover { transform: scale(1.2); }
.matrix-cell.synergy { background: var(--success); opacity: 0.7; }
.matrix-cell.caution { background: var(--warning); opacity: 0.7; }
.matrix-cell.conflict { background: var(--danger); opacity: 0.7; }
.matrix-cell.neutral { background: var(--bg-elevated); }
.matrix-cell.self { background: var(--border-light); }

/* ─── Risk Gauges ─── */
.risk-gauges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.risk-gauge {
  text-align: center;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.gauge-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-ring svg { position: absolute; top: 0; left: 0; }

.gauge-score {
  font-size: 22px;
  font-weight: 700;
  z-index: 1;
}

.gauge-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.gauge-status {
  font-size: 11px;
  margin-top: 4px;
  font-weight: 600;
}

.gauge-good { color: var(--success); }
.gauge-moderate { color: var(--warning); }
.gauge-poor { color: var(--danger); }

/* ─── Serum Level Simulator ─── */
.serum-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.serum-controls .form-group { margin-bottom: 0; flex: 1; min-width: 120px; }

.serum-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.serum-stat {
  text-align: center;
  padding: 8px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.serum-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.serum-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ─── Ester Checkboxes ─── */
.ester-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.ester-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.ester-check:hover { border-color: var(--accent); }
.ester-check.selected { border-color: var(--accent); background: rgba(45, 212, 168, 0.08); }

.ester-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Phase Timeline ─── */
.phase-timeline {
  position: relative;
  padding: 16px 0;
}

.phase-bar {
  height: 28px;
  border-radius: 4px;
  position: relative;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  transition: opacity 0.15s;
}

.phase-bar.blast { background: linear-gradient(135deg, var(--color-blast), #c02020); color: #fff; }
.phase-bar.cruise { background: linear-gradient(135deg, var(--color-cruise), #0284c7); color: #fff; }
.phase-bar.pct { background: linear-gradient(135deg, var(--color-pct), #16a34a); color: #fff; }
.phase-bar.off { background: var(--bg-elevated); color: var(--text-secondary); }

.phase-label {
  position: absolute;
  left: 8px;
  font-size: 10px;
  white-space: nowrap;
}

/* ─── Washout Timeline ─── */
.washout-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.washout-bar-bg {
  flex: 1;
  height: 20px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.washout-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.washout-bar-fill.active { background: var(--danger); }
.washout-bar-fill.declining { background: var(--warning); }
.washout-bar-fill.cleared { background: var(--success); }

/* ─── Comparison Table ─── */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.comparison-table th,
.comparison-table td {
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  text-align: center;
}

.comparison-table th {
  background: var(--bg-elevated);
  font-weight: 600;
}

.comparison-table .delta-good { color: var(--success); font-weight: 600; }
.comparison-table .delta-bad { color: var(--danger); font-weight: 600; }
.comparison-table .delta-neutral { color: var(--warning); }

/* ─── Photo Comparison ─── */
.photo-compare {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.photo-frame {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  min-height: 200px;
}

.photo-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.photo-date-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.photo-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s;
}

.photo-upload-zone:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Supplement Tracker ─── */
.supplement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
}

.supplement-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  transition: border-color 0.15s;
}

.supplement-item.taken { border-color: var(--success); }
.supplement-item.taken::after {
  content: '';
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 14px;
  height: 14px;
  display: inline-block;
  margin-left: auto;
}

.supplement-name { font-size: 13px; font-weight: 600; }
.supplement-dose { font-size: 11px; color: var(--text-muted); }
.supplement-timing {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-secondary);
}

/* ─── TDEE Calculator ─── */
.tdee-result {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.tdee-box {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.tdee-box.primary { border-color: var(--accent); }
.tdee-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.tdee-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-top: 4px; }

/* ─── Fasting Tracker ─── */
.fasting-ring {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  margin: 20px auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.fasting-ring svg {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.fasting-time {
  font-size: 32px;
  font-weight: 700;
  z-index: 1;
}

.fasting-status {
  font-size: 12px;
  color: var(--text-secondary);
  z-index: 1;
}

.fasting-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

/* ─── Meal Prep Planner ─── */
.meal-prep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.meal-prep-day {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px;
}

.meal-prep-day-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.meal-slot {
  padding: 6px;
  border-bottom: 1px solid var(--border-light);
  font-size: 11px;
}

.meal-slot:last-child { border-bottom: none; }
.meal-slot-label { font-weight: 600; color: var(--text-secondary); font-size: 10px; text-transform: uppercase; }

/* ─── Biometric Dashboard ─── */
.biometric-metric-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.biometric-metric-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.biometric-metric-value { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.biometric-metric-unit { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.biometric-metric-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ─── Wearable Integration ─── */
.wearable-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.wearable-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.15s;
}

.wearable-card:hover { border-color: var(--accent); }

.wearable-logo {
  font-size: 28px;
  margin-bottom: 8px;
}

.wearable-name {
  font-size: 14px;
  font-weight: 600;
}

.wearable-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.wearable-status.connected { color: var(--success); }

/* ─── CGM Dashboard ─── */
.cgm-time-in-range {
  display: flex;
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0;
}

.cgm-range-segment { transition: width 0.3s; }
.cgm-range-low { background: var(--danger); }
.cgm-range-normal { background: var(--success); }
.cgm-range-high { background: var(--warning); }

/* ─── Emergency Card ─── */
.emergency-card {
  background: #fff;
  color: #000;
  border: 3px solid #dc2626;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
}

.emergency-card-header {
  text-align: center;
  border-bottom: 2px solid #dc2626;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.emergency-card-title {
  font-size: 18px;
  font-weight: 800;
  color: #dc2626;
  text-transform: uppercase;
}

.emergency-compound-list {
  list-style: none;
  padding: 0;
}

.emergency-compound-list li {
  padding: 6px 0;
  border-bottom: 1px solid #fca5a5;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}

/* ─── Correlation Matrix ─── */
.correlation-matrix {
  border-collapse: collapse;
  font-size: 10px;
}

.correlation-matrix th,
.correlation-matrix td {
  padding: 4px;
  border: 1px solid var(--border-light);
  text-align: center;
  min-width: 36px;
}

.correlation-cell {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}

/* ─── Split Templates ─── */
.split-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.split-day-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px;
}

.split-day-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.split-exercise {
  font-size: 11px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
}

.split-exercise:last-child { border-bottom: none; }

/* ─── Volume Tracker ─── */
.volume-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.volume-item {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.volume-muscle { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.volume-sets { font-size: 20px; font-weight: 700; color: var(--accent); }
.volume-range { font-size: 10px; color: var(--text-muted); }
.volume-bar { height: 4px; background: var(--bg-primary); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.volume-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.volume-bar-fill.under { background: var(--warning); }
.volume-bar-fill.optimal { background: var(--success); }
.volume-bar-fill.over { background: var(--danger); }

/* ─── Rest Timer ─── */
.rest-timer {
  text-align: center;
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.rest-timer-display {
  font-size: 48px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1;
  margin: 12px 0;
}

.rest-timer-display.warning { color: var(--warning); }
.rest-timer-display.done { color: var(--success); animation: pulse-opacity 0.5s ease infinite; }

@keyframes pulse-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.rest-presets {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.rest-preset {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.rest-preset:hover { border-color: var(--accent); color: var(--accent); }
.rest-preset.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── Progress Ring (SVG-based) ─── */
.progress-ring-circle {
  transition: stroke-dashoffset 0.35s;
  transform-origin: center;
}

/* ─── Periodization Planner ─── */
.period-phase {
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 8px;
}

.period-phase.strength { border-left-color: var(--danger); }
.period-phase.hypertrophy { border-left-color: var(--success); }
.period-phase.peak { border-left-color: #a855f7; }
.period-phase.deload { border-left-color: var(--text-muted); }

.period-phase-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.period-phase-detail {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ─── Blend Vial Tracker ─── */
.blend-vial {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.blend-compounds {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.blend-compound-tag {
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--bg-primary);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
}

/* ─── PCT Timeline ─── */
.pct-timeline {
  position: relative;
  padding-left: 20px;
  margin: 16px 0;
}

.pct-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.pct-step {
  position: relative;
  padding: 8px 0 16px 16px;
}

.pct-step::before {
  content: '';
  position: absolute;
  left: -17px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
}

.pct-step.wait::before { background: var(--warning); }
.pct-step.active::before { background: var(--success); }
.pct-step.complete::before { background: var(--text-muted); }

.pct-step-title { font-size: 13px; font-weight: 600; }
.pct-step-detail { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Export Options ─── */
.export-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.export-option {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.export-option:hover { border-color: var(--accent); }
.export-icon { font-size: 28px; margin-bottom: 8px; }
.export-format { font-size: 13px; font-weight: 600; }
.export-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Alcohol Tracker ─── */
.alcohol-warning {
  padding: 10px 14px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--danger);
  margin-top: 10px;
}

/* ─── Gut Health ─── */
.gut-rating {
  display: flex;
  gap: 4px;
  align-items: center;
}

.gut-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.gut-dot:hover { border-color: var(--accent); }
.gut-dot.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── Trend Alerts ─── */
.trend-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border-left: 3px solid var(--warning);
  margin-bottom: 8px;
}

.trend-alert.critical { border-left-color: var(--danger); }
.trend-alert.improving { border-left-color: var(--success); }

.trend-arrow {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.trend-arrow.up { color: var(--danger); }
.trend-arrow.down { color: var(--success); }

/* ─── Encryption Lock Screen ─── */
.lock-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.lock-icon { font-size: 48px; color: var(--accent); }

.pin-input {
  display: flex;
  gap: 8px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all 0.2s;
}

.pin-dot.filled { background: var(--accent); border-color: var(--accent); }

/* ─── Year in Review ─── */
.year-heatmap {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  gap: 2px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--bg-elevated);
  min-width: 8px;
}

.heatmap-cell.level-1 { background: rgba(52, 211, 153, 0.2); }
.heatmap-cell.level-2 { background: rgba(52, 211, 153, 0.4); }
.heatmap-cell.level-3 { background: rgba(52, 211, 153, 0.6); }
.heatmap-cell.level-4 { background: rgba(52, 211, 153, 0.9); }

/* ─── Notification Badges for Analytics Tab ─── */
.analytics-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}

/* ─── QR Code ─── */
.qr-container {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius);
  display: inline-block;
  margin: 12px 0;
}

.qr-container canvas {
  display: block;
}

/* ─── Cycle Comparison Grid ─── */
.cycle-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.cycle-phase-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
}

.cycle-phase-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
}

.cycle-phase-label.baseline { border-bottom-color: var(--text-muted); }
.cycle-phase-label.mid { border-bottom-color: var(--warning); }
.cycle-phase-label.end { border-bottom-color: var(--danger); }
.cycle-phase-label.pct { border-bottom-color: var(--success); }

/* ─── Proportion Chart ─── */
.proportion-chart {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.proportion-item {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.proportion-label { font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.proportion-values { display: flex; justify-content: space-between; margin-top: 4px; }
.proportion-current { font-size: 14px; font-weight: 700; }
.proportion-ideal { font-size: 12px; color: var(--text-muted); }
.proportion-bar { height: 4px; background: var(--bg-primary); border-radius: 2px; margin-top: 6px; overflow: hidden; position: relative; }
.proportion-bar-fill { height: 100%; border-radius: 2px; }
.proportion-bar-target { position: absolute; top: -2px; width: 2px; height: 8px; background: var(--text-secondary); }

/* ─── Analytics Cards ─── */
.analytics-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

/* ─── Superset Grouping ─── */
.superset-group {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin-bottom: 8px;
  background: rgba(45, 212, 168, 0.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.superset-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  padding: 4px 0;
}

/* ─── Cardio Zones ─── */
.hr-zones {
  display: flex;
  gap: 4px;
  margin: 8px 0;
}

.hr-zone {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
}

.hr-zone.z1 { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.hr-zone.z2 { background: rgba(52, 211, 153, 0.2); color: var(--success); }
.hr-zone.z3 { background: rgba(234, 179, 8, 0.2); color: #eab308; }
.hr-zone.z4 { background: rgba(249, 115, 22, 0.2); color: #f97316; }
.hr-zone.z5 { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.hr-zone.active { font-weight: 700; transform: scale(1.05); }

/* ─── Lab Import ─── */
.lab-import-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s;
  margin-bottom: 12px;
}

.lab-import-area:hover { border-color: var(--accent); }
.lab-import-area.dragover { border-color: var(--success); background: rgba(52, 211, 153, 0.05); }

/* ─── Disclaimer Box ─── */
.disclaimer-box {
  padding: 8px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.05);
  font-size: 11px;
  color: var(--danger);
  margin-bottom: 12px;
}

.disclaimer-box strong { font-weight: 700; }

/* ─── Sync Status ─── */
.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sync-dot.synced { background: var(--success); }
.sync-dot.pending { background: var(--warning); animation: pulse 1s infinite; }
.sync-dot.error { background: var(--danger); }

/* ─── Grocery List ─── */
.grocery-list {
  columns: 2;
  column-gap: 16px;
}

.grocery-category {
  break-inside: avoid;
  margin-bottom: 12px;
}

.grocery-category-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.grocery-item {
  font-size: 12px;
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.grocery-check {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  flex-shrink: 0;
}

/* ─── Auth Modal ─── */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px 24px;
  max-width: 380px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.auth-modal-close:hover { color: var(--text-primary); }
.auth-modal-logo {
  text-align: center;
  font-size: 36px;
  margin-bottom: 8px;
}
.auth-modal-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.auth-modal-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}
.auth-modal-error {
  background: rgba(248,81,73,0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-input {
  width: 100%;
  margin-bottom: 14px;
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
}
.auth-oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.auth-oauth-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  text-decoration: none;
}
.auth-oauth-btn--apple { color: var(--text-primary); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-submit {
  width: 100%;
  padding: 11px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 4px;
}
.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 16px 0 0;
}
.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.auth-switch a:hover { text-decoration: underline; }

/* Auth consent checkbox */
.auth-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  cursor: pointer;
  margin: 4px 0 12px;
}
.auth-consent-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.auth-consent-label a {
  color: var(--accent);
  text-decoration: none;
}
.auth-consent-label a:hover { text-decoration: underline; }

/* Forgot password link */
.auth-forgot {
  text-align: right;
  font-size: 12px;
  margin: -4px 0 12px;
}
.auth-forgot a {
  color: var(--text-muted);
  text-decoration: none;
}
.auth-forgot a:hover { color: var(--accent); text-decoration: underline; }

/* Landing legal links */
.landing-legal-links {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}
.landing-legal-links a {
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.8;
}
.landing-legal-links a:hover {
  color: var(--accent);
  text-decoration: underline;
  opacity: 1;
}

/* ─── Legal Modal ─── */
.legal-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.legal-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.legal-modal h2 {
  margin: 0 0 16px;
  font-size: 20px;
  color: var(--text-primary);
}
.legal-modal h3 {
  margin: 20px 0 8px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}
.legal-modal p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── Cloud Account Card (Settings) ─── */
.cloud-account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.cloud-account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.cloud-account-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}
.cloud-account-email {
  font-size: 12px;
  color: var(--text-secondary);
}
.user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: var(--badge-bg);
  color: var(--badge-color);
  border: 1px solid var(--badge-color);
  opacity: 0.9;
}
.user-badge svg {
  flex-shrink: 0;
  vertical-align: middle;
}

/* ─── Sync Status Indicator ─── */
.sync-indicator {
  font-size: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition: opacity 0.3s;
}
.sync-syncing {
  color: var(--accent);
  animation: sync-spin 1s linear infinite;
}
.sync-synced { color: var(--success); }
.sync-error { color: var(--danger); font-weight: 700; }
.sync-conflict { color: var(--warning); }
@keyframes sync-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── Header Auth Avatar ─── */
.header-auth-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover, var(--accent)));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  padding: 0;
  min-width: 36px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  border: 2px solid rgba(255,255,255,0.15);
  transition: box-shadow 0.15s, transform 0.15s;
}
.header-auth-avatar:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transform: scale(1.06);
}
.header-auth-initials {
  line-height: 1;
  letter-spacing: 0.02em;
}
.header-auth-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-level-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 4px 10px;
  background: rgba(45, 212, 168, 0.08);
  border: 1px solid rgba(45, 212, 168, 0.15);
  border-radius: 8px;
  line-height: 1;
  min-width: 56px;
}
.header-level-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.header-level-bar {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.header-level-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}
.header-level-xp {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
@media (max-width: 600px) {
  .header-level-badge { display: none; }
}
.header-signin-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 34px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 17px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE OPTIMIZATION OVERHAUL
   ═══════════════════════════════════════════════════════════════ */

/* Sub-tabs: horizontal scroll instead of wrap on mobile */
@media (max-width: 768px) {
  .sub-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .sub-tabs::-webkit-scrollbar { display: none; }
  .sub-tab {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
  }

  /* Bottom nav: ensure usable with 8 tabs */
  .bottom-nav {
    height: auto;
    min-height: var(--bottom-nav-height);
    padding: 4px 0;
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav-btn {
    flex: 0 0 auto;
    min-width: 56px;
    padding: 4px 6px;
  }
  .bottom-nav-icon { font-size: 20px; }
  .bottom-nav-label { font-size: 10px; white-space: nowrap; }

  /* Tables: horizontal scroll wrapper */
  .cost-table, table.rm-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .cost-table thead, .cost-table tbody,
  table.rm-table thead, table.rm-table tbody {
    display: table;
    width: 100%;
  }

  /* Workout plan items: better mobile layout */
  .workout-plan-item {
    flex-wrap: wrap;
    padding: 12px;
    gap: 8px;
  }
  .workout-plan-item .btn { min-height: 36px; }

  /* Header: compact mobile layout */
  .header-logo { gap: 6px; }
  .header-logo .logo-icon { font-size: 20px; }
  .header-actions {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
  }

  /* Cards: tighter padding on mobile */
  .card { border-radius: 8px; }

  /* Forms: ensure tap-friendly spacing */
  .form-group { margin-bottom: 10px; }
  .form-label { font-size: 12px; margin-bottom: 4px; }

  /* Stat boxes: responsive grid */
  .stat-box {
    min-width: 0;
    padding: 8px 10px;
  }

  /* Auth modal: full-screen on mobile */
  .auth-modal {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    border-radius: 0;
    padding: 24px 20px;
  }

  /* Food search results in modal */
  .food-search-item {
    padding: 10px 8px;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Quick add grid: 3 columns on mobile */
  .quick-add-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px;
  }
  .quick-add-btn {
    padding: 8px 4px;
    font-size: 11px;
    min-height: 40px;
  }

  /* Lock screen: touch-friendly keypad */
  #lock-keypad .lock-key {
    min-height: 52px;
    font-size: 20px;
    border-radius: 8px;
  }

  /* Year review: monthly cards */
  .year-heatmap { margin-left: -8px; margin-right: -8px; padding: 0 8px; }

  /* View switcher buttons */
  .today-view-switcher { justify-content: center; }
  .view-switch-btn {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 36px;
  }

  /* Workout subtabs: horizontal scroll */
  .workout-subtabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .workout-subtabs::-webkit-scrollbar { display: none; }
  .workout-subtab {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
  }

  /* Settings: better input widths */
  .settings-row .form-input,
  .settings-row .form-select,
  .form-input-sm { max-width: 100%; width: 100%; }
}

/* Extra small devices */
@media (max-width: 375px) {
  .bottom-nav-btn { min-width: 48px; padding: 4px 3px; }
  .bottom-nav-label { font-size: 10px; }
  .bottom-nav-icon { font-size: 18px; }
  .sub-tab { padding: 6px 8px; font-size: 11px; }
  .workout-subtab { padding: 6px 8px; font-size: 11px; }
  .card { padding: 10px; }
  .header-actions .btn-ghost { min-width: 36px; min-height: 36px; padding: 6px; }
}

/* ─── GDPR Consent Banner ─── */
.gdpr-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  padding: 16px 20px;
  animation: gdprSlideUp 0.4s ease-out;
}
@keyframes gdprSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.gdpr-banner-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.gdpr-banner-text {
  flex: 1;
}
.gdpr-banner-text strong {
  font-size: 13px;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}
.gdpr-banner-text p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.gdpr-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .gdpr-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .gdpr-banner-actions {
    justify-content: flex-end;
  }
  .gdpr-banner { padding: 12px 16px 20px; }
}

/* ─── Research Program ─── */
.research-program-card {
  background: linear-gradient(135deg, rgba(52,211,153,0.08), rgba(59,130,246,0.08));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.research-program-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.research-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--accent), var(--success));
  color: #fff;
  white-space: nowrap;
}
.research-perks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}
.research-perk-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.research-perk-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}
.research-optin-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  padding: 10px 12px;
  background: rgba(52,211,153,0.1);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  margin-top: 12px;
}
.research-status-card {
  padding: 14px;
  border-radius: var(--radius);
}
.research-status-active {
  background: linear-gradient(135deg, rgba(52,211,153,0.08), rgba(59,130,246,0.06));
  border: 1px solid var(--success);
}
.research-status-inactive {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.research-perks-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.research-perk-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}
@media (max-width: 600px) {
  .research-perks-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── GPS Activity Tracker ─── */
.gps-map-container { background: var(--bg-elevated); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); min-height: 80px; }
.gps-map-container.live { height: 200px; }
.gps-btn-record { background: var(--success) !important; color: #fff !important; }
.gps-btn-record:hover { filter: brightness(1.1); }
@keyframes gpsPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); } 50% { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); } }
.gps-recording .gps-btn-record { animation: gpsPulse 2s infinite; }
.gps-live-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gps-activity-card { transition: border-color 0.15s, background 0.15s; }
.gps-activity-card:hover { border-color: var(--accent); background: var(--bg-elevated); }
.gps-type-btn { border-radius: 20px; padding: 6px 14px; font-size: 12px; border: 1px solid var(--border); transition: all 0.15s; }
.gps-type-btn:hover { border-color: var(--accent); }
/* Leaflet dark mode overrides */
[data-theme="dark"] .leaflet-control-zoom a { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border); }
[data-theme="dark"] .leaflet-control-attribution { background: rgba(13, 17, 23, 0.7); color: var(--text-muted); }
[data-theme="dark"] .leaflet-control-attribution a { color: var(--accent); }
@media (max-width: 768px) {
  .gps-map-container { height: 250px; }
  .gps-map-container.live { height: 200px; }
  .gps-live-stats { grid-template-columns: 1fr 1fr; }
}

/* ─── Gym Tab Improvements ─── */
/* Feature 1: Exercise name link */
.exercise-name-link { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.exercise-name-link:hover { color: var(--accent); }

/* Feature 2: Copy last button */
.btn-copy-last { opacity: 0.5; transition: opacity 0.15s; font-size: 9px !important; padding: 1px 4px !important; min-width: auto !important; }
.btn-copy-last:hover { opacity: 1; }

/* Feature 5: Plate calculator */
.plate-calculator summary { user-select: none; }
.plate-calculator summary:hover { color: var(--accent); }
.plate-calculator[open] summary { margin-bottom: 0; }

/* Feature 6: Exercise notes toggle */
.btn-toggle-notes { opacity: 0.6; transition: opacity 0.15s; }
.btn-toggle-notes:hover { opacity: 1; }

/* Feature 14: Skipped exercise */
.workout-exercise-card.exercise-skipped { opacity: 0.4; }
.workout-exercise-card.exercise-skipped .set-row,
.workout-exercise-card.exercise-skipped .cardio-fields { display: none; }

/* Feature 14: Reorder/skip buttons */
.btn-reorder-ex:hover, .btn-skip-ex:hover { opacity: 1 !important; }
.btn-skip-ex { transition: opacity 0.15s; }

/* Feature 12: Superset suggestion cards */
.superset-suggestion-card:hover { border-color: var(--accent) !important; background: var(--bg-elevated); }

/* Feature 13: Pause state styling */
.workout-session-timer.paused { color: var(--warning); }

/* (stat-box overload — removed, see primary definition at line ~2819) */

/* Library compound cards */
.lib-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* ─── Print Styles ─── */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .header, .bottom-nav, .tab-bar, #desktop-tabs, .floating-action-btn,
  .install-banner, .gdpr-banner, .auth-modal, .feedback-fab { display: none !important; }
  .tab-content-wrapper { padding: 0 !important; }
  .card { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; }
  a { color: #000 !important; text-decoration: underline; }
  .btn { border: 1px solid #999 !important; background: transparent !important; color: #000 !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   Encrypted Vault UI
   ═══════════════════════════════════════════════════════════════════ */

.vault-banner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.vault-banner .vault-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(52,211,153,0.1);
  border-radius: 10px;
  flex-shrink: 0;
}
.vault-banner .vault-info { flex: 1; }
.vault-banner .vault-info h4 { font-size: 14px; margin-bottom: 2px; }
.vault-banner .vault-info p { font-size: 12px; color: var(--text-secondary); margin: 0; }
.vault-status { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 500; }
.vault-status.locked { background: rgba(239,68,68,0.15); color: #ef4444; }
.vault-status.unlocked { background: rgba(52,211,153,0.15); color: var(--success); }

.vault-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.vault-actions .btn-vault {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.vault-actions .btn-vault:hover { border-color: var(--accent); background: rgba(52,211,153,0.1); }
.vault-actions .btn-vault.danger { border-color: #ef4444; }
.vault-actions .btn-vault.danger:hover { background: rgba(239,68,68,0.1); }

.vault-password-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 8px;
}

.vault-recovery-key {
  font-family: monospace;
  font-size: 18px;
  letter-spacing: 2px;
  padding: 12px 16px;
  background: rgba(52,211,153,0.1);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  text-align: center;
  word-break: break-all;
  margin: 12px 0;
  user-select: all;
  color: var(--accent);
}

/* Panic Button */
.btn-panic {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: white !important;
  border: none !important;
  padding: 12px 24px !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  border-radius: 8px !important;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
  transition: all 0.2s;
}
.btn-panic:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239,68,68,0.4); }
.btn-panic:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════════
   Plausible Deniability Mode — Generic "FitTrack" appearance
   ═══════════════════════════════════════════════════════════════════ */

body.deniability-mode {
  --accent: #3b82f6;
  --accent-secondary: #2563eb;
}

/* Hide sensitive elements in deniability mode */
body.deniability-mode .compound-card,
body.deniability-mode .bloodwork-section,
body.deniability-mode .efficacy-section,
body.deniability-mode .injection-site-tracker,
body.deniability-mode .cycle-indicator,
body.deniability-mode [data-tab="protocol"],
body.deniability-mode [data-tab="calculator"],
body.deniability-mode [data-tab="bloodwork"],
body.deniability-mode .vault-banner,
body.deniability-mode .protocol-overlay,
body.deniability-mode .tab-content[id="tab-calculator"],
body.deniability-mode .tab-content[id="tab-protocol"],
body.deniability-mode .tab-content[id="tab-bloodwork"] {
  display: none !important;
}

/* Rename visible elements */
body.deniability-mode .app-header-title::after { content: 'FitTrack'; }
body.deniability-mode .app-header-title { font-size: 0; }
body.deniability-mode .landing-logo::after { content: 'FitTrack — Your Fitness Companion'; }
body.deniability-mode .landing-logo { font-size: 0; }

/* Simplify color scheme */
body.deniability-mode .nav-tab.active { border-color: #3b82f6; color: #3b82f6; }
body.deniability-mode .btn-primary { background: #3b82f6; }

/* ─── Efficacy Data UI ─── */

.efficacy-full-report { padding: 0; }
.efficacy-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.efficacy-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.efficacy-stat .val { font-size: 22px; font-weight: 700; color: var(--accent); }
.efficacy-stat .lbl { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.efficacy-timeline-row {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  margin: 12px 0;
}
.efficacy-timeline-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-width: 6px;
  transition: height 0.3s;
}

.efficacy-condition-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.efficacy-condition-row .improvement {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.efficacy-condition-row .improvement.positive { background: rgba(52,211,153,0.15); color: var(--success); }
.efficacy-condition-row .improvement.negative { background: rgba(239,68,68,0.15); color: #ef4444; }

.interaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin: 2px;
  border: 1px solid var(--border);
}
.interaction-badge.synergistic { background: rgba(52,211,153,0.1); border-color: rgba(52,211,153,0.3); }
.interaction-badge.antagonistic { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }
.interaction-badge.adverse { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); }
.interaction-badge.neutral { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); }

/* New feature cards */
.compliance-streak-banner { border-radius: 12px; }
.missed-dose-card { border-radius: var(--radius); }
.missed-dose-item { border-radius: 8px; }
.fasting-indicator { border-radius: var(--radius); }
.training-preview { border-radius: var(--radius); }
.photo-thumb { border-radius: 8px; overflow: hidden; }
.photo-month-group { margin-bottom: 12px; }

/* Water bar pop animation */
@keyframes waterBarPop {
  0% { transform: scaleX(1); }
  50% { transform: scaleX(1.03); }
  100% { transform: scaleX(1); }
}
.water-bar-fill.pop { animation: waterBarPop 0.3s ease; }

/* ─── Responsive: Mobile fixes for new features ─── */
@media (max-width: 480px) {
  .calc-grid { grid-template-columns: 1fr !important; }
  .form-row-3 { grid-template-columns: 1fr !important; }
  .compliance-streak-banner { padding: 10px !important; }
  .compliance-streak-banner > div { font-size: 22px !important; }
}

/* ─── Accessibility: Focus indicators ─── */
.photo-thumb:focus-visible,
.missed-dose-btn:focus-visible,
.uc-conv-btn:focus-visible,
.photo-cat-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Accessibility: High contrast mode support ─── */
@media (forced-colors: active) {
  .dose-checkbox, .toggle-slider { border: 1px solid ButtonText; }
  .btn-primary { border: 2px solid Highlight; }
  .alert { border: 1px solid CanvasText; }
}

/* ─── Accessibility: Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Calculator-only mode (/calc route) ─── */
/* Shows only the Calculator tab + the login/avatar button. Everything else is hidden. */
.calc-only-mode .tab-bar [data-tab]:not([data-tab="calculator"]),
.calc-only-mode .bottom-nav [data-tab]:not([data-tab="calculator"]),
.calc-only-mode #btn-quick-settings,
.calc-only-mode #btn-undo,
.calc-only-mode #btn-redo,
.calc-only-mode #btn-pdf,
.calc-only-mode #btn-load,
.calc-only-mode #btn-save,
.calc-only-mode #global-search,
.calc-only-mode .offline-banner {
  display: none !important;
}
/* Hide non-calculator tab content completely so nothing leaks through */
.calc-only-mode .tab-content:not(#tab-calculator) {
  display: none !important;
}

/* ─── Glossary Help Tooltips ─── */
.glossary-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  border-radius: 50%;
  transition: color 0.15s, background-color 0.15s;
  opacity: 0.6;
}

.glossary-trigger:hover,
.glossary-trigger-active {
  color: var(--accent);
  opacity: 1;
  background: var(--bg-elevated);
}

.glossary-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.glossary-tooltip {
  position: absolute;
  z-index: var(--z-dropdown);
  max-width: 280px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  pointer-events: auto;
  animation: glossaryFadeIn 0.15s ease;
}

[data-theme='light'] .glossary-tooltip {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.glossary-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 6px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  background: var(--bg-surface);
}

.glossary-tooltip-above::before {
  top: auto;
  bottom: -6px;
  clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

@keyframes glossaryFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.glossary-tooltip-above {
  animation-name: glossaryFadeInAbove;
}

@keyframes glossaryFadeInAbove {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Ensure form-labels can contain the inline ? icon */
.form-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Hide Load/Save buttons on mobile — accessible from Settings tab */
@media (max-width: 640px) {
  #btn-load, #btn-save { display: none !important; }
}

/* ============================================================================
   Hormonal Cycle Intelligence tab
   ============================================================================ */
.cycle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cycle-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.cycle-subtabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  padding-bottom: 1px;
}
.cycle-subtab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.cycle-subtab:hover { color: var(--text-primary); }
.cycle-subtab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.cycle-empty {
  padding: 20px;
  text-align: left;
}

/* Overview */
.cycle-hero {
  padding: 16px 18px;
  margin-bottom: 14px;
}
.cycle-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cycle-hero-phase {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .2px;
}
.cycle-hero-day {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.cycle-hero-headline {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  font-style: italic;
}

.cycle-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.cycle-stat {
  background: var(--bg-secondary, rgba(128,128,128,.04));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.cycle-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.cycle-stat-main {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}
.cycle-stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cycle-guidance {
  padding: 16px;
  margin-bottom: 14px;
}
.cycle-guidance-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cycle-guidance-section ul {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 6px 0 8px;
  padding-left: 20px;
}
.cycle-guidance-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.cycle-guidance-meta {
  font-size: 11px;
  color: var(--text-muted);
}
@media (min-width: 720px) {
  .cycle-guidance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================================
   Calendar (reworked)
   ============================================================================ */
.cycle-cal-card {
  padding: 14px;
}
.cycle-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.cycle-cal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  text-align: center;
}
.cycle-cal-navbtn {
  min-width: 32px;
  padding: 4px 10px;
  font-size: 16px;
  line-height: 1;
}
.cycle-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-secondary, rgba(128,128,128,.04));
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}
.cycle-cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.cycle-cal-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.cycle-cal-legend-icon {
  width: 12px;
  height: 12px;
  fill: #e11d48;
  flex-shrink: 0;
}

.cycle-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
.cycle-cal-head {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 6px 0 4px;
  font-weight: 600;
}
.cycle-cal-cell {
  aspect-ratio: 1/1;
  border-radius: 6px;
  padding: 4px 5px;
  position: relative;
  cursor: pointer;
  font-size: 12px;
  background: rgba(128,128,128,.08);
  border: 1px solid rgba(128,128,128,.10);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 44px;
  overflow: hidden;
  transition: transform .12s ease, border-color .12s ease;
  text-align: left;
  font-family: inherit;
}
.cycle-cal-cell:hover:not(.cycle-cal-blank) {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.25);
}
.cycle-cal-cell.cycle-cal-blank {
  background: transparent;
  border: none;
  cursor: default;
  min-height: 0;
}
.cycle-cal-cell.cycle-cal-blank:hover { transform: none; border: none; }

/* Phase background colors (25% alpha — brighter than the original 12%) */
.cycle-cal-phase-menstrual  { background: rgba(225, 29, 72, 0.18); border-color: rgba(225, 29, 72, 0.35); }
.cycle-cal-phase-follicular { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.32); }
.cycle-cal-phase-ovulatory  { background: rgba(16, 185, 129, 0.22); border-color: rgba(16, 185, 129, 0.55); }
.cycle-cal-phase-luteal     { background: rgba(139, 92, 246, 0.16); border-color: rgba(139, 92, 246, 0.32); }

/* Projected (vs confirmed from logged period) — subtly desaturated */
.cycle-cal-projected { opacity: 0.72; }

/* Logged period days keep the phase background; flow is shown as a
   centered drop icon whose opacity scales with flow intensity (1-4). */
.cycle-cal-has-flow {
  opacity: 1;
}
.cycle-cal-flow-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42%;
  height: 42%;
  transform: translate(-50%, -50%);
  fill: #e11d48;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, .5));
  pointer-events: none;
}
.cycle-cal-flow-1 .cycle-cal-flow-icon { fill: rgba(225, 29, 72, 0.60); }
.cycle-cal-flow-2 .cycle-cal-flow-icon { fill: rgba(225, 29, 72, 0.78); }
.cycle-cal-flow-3 .cycle-cal-flow-icon { fill: rgba(225, 29, 72, 0.92); }
.cycle-cal-flow-4 .cycle-cal-flow-icon { fill: #e11d48; }

/* Ovulation day — always highlighted with solid emerald ring */
.cycle-cal-ov-day {
  box-shadow: inset 0 0 0 2px #10b981;
}
.cycle-cal-ov-label {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 10px;
  font-weight: 800;
  color: #10b981;
  letter-spacing: .5px;
  line-height: 1;
}

/* Today ring — stronger than hover, accent-colored */
.cycle-cal-cell.cycle-cal-today {
  box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(45, 212, 168, 0.25);
  border-color: var(--accent);
}
.cycle-cal-cell.cycle-cal-today.cycle-cal-ov-day {
  box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 2px #10b981, 0 2px 8px rgba(45, 212, 168, 0.25);
}

/* Origin marker: latest logged period's first day */
.cycle-cal-origin::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255, 255, 255, .8);
}

.cycle-cal-dn {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.1;
}
.cycle-cal-cd {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
  line-height: 1;
}
.cycle-cal-dots {
  display: flex;
  gap: 2px;
  position: absolute;
  bottom: 3px;
  left: 4px;
}
.cycle-cal-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.cycle-cal-dot-sym  { background: #fde68a; }
.cycle-cal-dot-note { background: #93c5fd; }

.cycle-cal-upcoming {
  margin-top: 12px;
  padding: 12px 14px;
}
.cycle-upcoming-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
}

/* Compact cells on narrow screens */
@media (max-width: 520px) {
  .cycle-cal-cell { min-height: 40px; padding: 3px 4px; }
  .cycle-cal-dn { font-size: 12px; }
  .cycle-cal-cd { font-size: 10px; }
  .cycle-cal-legend { gap: 8px; font-size: 10px; }
  .cycle-cal-swatch { width: 10px; height: 10px; }
}

/* Daily log */
.cycle-log-section {
  margin-bottom: 14px;
}
.cycle-log-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.cycle-flow-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cycle-flow-btn {
  background: var(--bg-secondary, rgba(128,128,128,.04));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
}
.cycle-flow-btn:hover { color: var(--text-primary); }
.cycle-flow-btn.active {
  background: #e11d4820;
  border-color: #e11d48;
  color: #e11d48;
  font-weight: 600;
}
.cycle-symptom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}
.cycle-symptom-btn {
  background: var(--bg-secondary, rgba(128,128,128,.04));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.cycle-symptom-btn:hover { color: var(--text-primary); }
.cycle-symptom-btn.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: #8b5cf6;
  color: #8b5cf6;
  font-weight: 600;
}
.cycle-slider-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.cycle-slider {
  background: var(--bg-secondary, rgba(128,128,128,.04));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}
.cycle-slider-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.cycle-slider input[type="range"] { width: 100%; }

/* Insights */
.cycle-insight-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cycle-insight-row {
  display: grid;
  grid-template-columns: 90px 1fr 80px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.cycle-insight-label { color: var(--text-secondary); }
.cycle-insight-bar {
  background: var(--bg-secondary, rgba(128,128,128,.08));
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}
.cycle-insight-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s;
}
.cycle-insight-val {
  text-align: right;
  color: var(--text-muted);
  font-size: 11px;
}
.cycle-insight-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.cycle-insight-table th,
.cycle-insight-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.cycle-insight-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .5px;
}
.cycle-phase-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.cycle-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cycle-history-row {
  display: grid;
  grid-template-columns: 12px 1fr auto 24px;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: var(--bg-secondary, rgba(128,128,128,.04));
  border-radius: 6px;
  font-size: 12px;
}
.cycle-history-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.cycle-history-date { color: var(--text-primary); }
.cycle-history-len { color: var(--text-muted); font-size: 11px; }
.cycle-history-del {
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  font-size: 16px;
  color: var(--text-muted);
}

/* Dismiss × on Today-tab cycle nudge (restorable via Settings later) */
.cycle-nudge-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.cycle-nudge-close:hover {
  background: var(--bg-secondary, rgba(128,128,128,.08));
  color: var(--text-primary);
}

/* Settings rows */
.cycle-setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}
.cycle-setting-row label {
  flex: 1;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   BATCH ADDITIONS — Phase 1 of mass-feature rollout
   ═══════════════════════════════════════════════════════════════ */

/* ─── 5 · Trust strip on landing ─── */
.trust-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 24px auto 0;
  max-width: 720px;
  padding: 14px 20px;
  background: rgba(45, 212, 168, 0.04);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-lg);
}
.trust-strip .item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}
.trust-strip .item svg { width: 14px; height: 14px; stroke: var(--accent); flex-shrink: 0; }
.trust-strip .sep { color: var(--text-muted); font-size: 8px; }
@media (max-width: 560px) {
  .trust-strip { gap: 10px; padding: 10px 14px; }
  .trust-strip .item { font-size: 10px; }
  .trust-strip .sep { display: none; }
}

/* ─── 12 · Mobile logo shrink (wordmark hidden <480px) ─── */
@media (max-width: 480px) {
  .header-logo .header-wordmark,
  .header-logo h1 { display: none; }
}

/* ─── 18 · Header height: 52px on mobile ─── */
@media (max-width: 768px) {
  .header { min-height: 52px; padding: 6px 14px; }
}

/* ─── 20 · Active-tab 2px top rail (WCAG 1.4.1 non-color) ─── */
.tab-btn.active, .bottom-nav-btn.active { position: relative; }
.tab-btn.active::before, .bottom-nav-btn.active::before {
  content: '';
  position: absolute;
  left: 12%; right: 12%;
  top: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}
.bottom-nav-btn.active::before {
  top: auto; bottom: 0;
  border-radius: 2px 2px 0 0;
}

/* ─── 25 · Hide bottom-nav on scroll-down (landscape/small height) ─── */
@media (max-height: 600px) {
  .bottom-nav { transition: transform 0.22s cubic-bezier(.32,.72,0,1); will-change: transform; }
  body.nav-hidden .bottom-nav { transform: translateY(100%); pointer-events: none; }
}

/* ─── 36 · Daily wrap overlay ─── */
.daily-wrap-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
  animation: fadeIn 0.25s ease;
}
.daily-wrap-card {
  background: var(--bg-elevated);
  border-radius: 20px 20px var(--radius-lg) var(--radius-lg);
  padding: 24px 22px 20px;
  max-width: 520px; width: 100%;
  box-shadow: var(--shadow-float);
  position: relative;
  animation: vlSheetUp 0.28s cubic-bezier(.32,.72,0,1);
}
@media (min-width: 640px) {
  .daily-wrap-overlay { align-items: center; }
  .daily-wrap-card { border-radius: var(--radius-lg); }
}
.daily-wrap-card .eyebrow { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.daily-wrap-card h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 16px; }
.daily-wrap-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--bg-surface); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.daily-wrap-stat { padding: 12px 10px; text-align: center; background: var(--bg-elevated); }
.daily-wrap-stat .n { font-family: var(--font-mono, monospace); font-size: 22px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.daily-wrap-stat .l { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); margin-top: 4px; }
.daily-wrap-miss { padding: 12px 14px; background: rgba(244, 63, 94, 0.08); border: 1px solid rgba(244, 63, 94, 0.22); border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.daily-wrap-miss .icon { color: var(--danger); font-size: 18px; }
.daily-wrap-actions { display: flex; gap: 8px; }

/* ─── 41 · Error bounds for low-volume draws ─── */
.error-bound {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; font-family: var(--font-mono, monospace);
  font-size: 11px; font-weight: 500; letter-spacing: 0.3px;
  color: var(--warning); background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25); border-radius: 999px;
}
.error-bound::before { content: '±'; font-weight: 700; }
.error-bound.severe { color: var(--danger); background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.25); }

/* ─── 45 · Stack / compound overlap timeline ─── */
.stack-viz { background: var(--bg-elevated); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; overflow-x: auto; }
.stack-viz-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.stack-viz-head h3 { font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); }
.stack-viz-head .range { font-size: 11px; color: var(--text-muted); }
.stack-viz-grid { display: grid; grid-template-columns: 80px 1fr; gap: 4px; }
.stack-viz-label { font-size: 12px; color: var(--text-secondary); padding: 4px 8px 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack-viz-track { position: relative; height: 20px; background: var(--bg-input); border-radius: 4px; margin: 2px 0; }
.stack-viz-bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; opacity: 0.85; transition: opacity 0.15s; }
.stack-viz-bar:hover { opacity: 1; box-shadow: 0 0 0 1px rgba(255,255,255,0.15); }
.stack-viz-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); box-shadow: 0 0 6px var(--accent); pointer-events: none; z-index: 2; }
.stack-viz-axis { display: flex; justify-content: space-between; font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted); margin-top: 8px; letter-spacing: 1px; grid-column: 2; }

/* ─── 52 · Mood slider with morphing emoji ─── */
.mood-slider-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; background: var(--bg-elevated); border-radius: var(--radius-lg); }
.mood-emoji { font-size: 56px; line-height: 1; filter: saturate(1.1); transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1); user-select: none; }
.mood-emoji.pulse { animation: moodPulse 0.4s ease; }
@keyframes moodPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.mood-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; max-width: 300px; height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #f43f5e 0%, #f59e0b 50%, #34d399 100%);
  outline: none; cursor: pointer;
}
.mood-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--bg-elevated); box-shadow: 0 2px 8px rgba(0,0,0,0.3); cursor: grab; }
.mood-slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--bg-elevated); box-shadow: 0 2px 8px rgba(0,0,0,0.3); cursor: grab; }
.mood-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 3px; }
.mood-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ─── 57 · Reference-range horizontal bar ─── */
.ref-range-bar { position: relative; height: 28px; margin: 10px 0; }
.ref-range-track {
  position: absolute; left: 0; right: 0; top: 10px; height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    #f43f5e 0%, #f43f5e 18%,
    #f59e0b 18%, #f59e0b 28%,
    #34d399 28%, #34d399 72%,
    #f59e0b 72%, #f59e0b 82%,
    #f43f5e 82%, #f43f5e 100%);
  opacity: 0.85;
}
.ref-range-marker {
  position: absolute; top: 2px;
  width: 4px; height: 24px;
  background: var(--text-primary);
  border-radius: 2px;
  box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 3px var(--text-primary);
  transform: translateX(-50%);
  transition: left 0.3s ease;
}
.ref-range-labels { display: flex; justify-content: space-between; font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted); letter-spacing: 0.5px; margin-top: 2px; }

/* ─── 63 · Rest-timer floating (persists across tabs) ─── */
#rest-timer-float {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom));
  right: 16px; z-index: var(--z-sticky);
  background: var(--bg-elevated); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); padding: 10px 14px;
  display: none; align-items: center; gap: 10px;
  box-shadow: var(--shadow-elevated);
  font-family: var(--font-mono, monospace); min-width: 130px;
  animation: fadeSlideIn 0.25s ease;
}
#rest-timer-float.active { display: flex; }
#rest-timer-float.done { border-color: var(--success); animation: rtPulseGlow 1.2s infinite; }
#rest-timer-float .rt-time { font-size: 18px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
#rest-timer-float .rt-lbl { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }
#rest-timer-float .rt-stop { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 0 2px; line-height: 1; }
#rest-timer-float .rt-stop:hover { color: var(--text-primary); }
@keyframes rtPulseGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); } 50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); } }

/* ─── 64 · PR celebration toast ─── */
.pr-toast {
  position: fixed; top: 80px; left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  background: linear-gradient(135deg, #2dd4a8, #0d9373);
  color: #131518;
  padding: 14px 22px; border-radius: var(--radius-lg);
  font-weight: 700;
  box-shadow: 0 12px 40px rgba(45, 212, 168, 0.4);
  animation: prPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), prExit 0.3s ease 3.5s forwards;
  display: flex; align-items: center; gap: 10px;
}
.pr-toast .icon { font-size: 22px; }
.pr-toast .title { font-family: var(--font-display); font-size: 14px; letter-spacing: 0.3px; }
.pr-toast .detail { font-family: var(--font-mono, monospace); font-size: 12px; opacity: 0.8; }
@keyframes prPop { from { transform: translateX(-50%) scale(0.8); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes prExit { to { transform: translateX(-50%) scale(0.9); opacity: 0; } }

/* ─── 66 · Superset / circuit grouping ─── */
.superset-group {
  border: 2px solid var(--accent-dim);
  border-radius: var(--radius-lg);
  padding: 10px 12px; margin-bottom: 10px;
  background: rgba(45, 212, 168, 0.03);
  position: relative;
}
.superset-group::before {
  content: 'SUPERSET';
  position: absolute; top: -9px; left: 12px;
  background: var(--bg-elevated); padding: 0 8px;
  font-family: var(--font-mono, monospace); font-size: 10px;
  letter-spacing: 2px; color: var(--accent);
}
.superset-group.circuit::before { content: 'CIRCUIT'; }
.superset-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed rgba(255,255,255,0.04); }
.superset-row:last-child { border-bottom: none; }
.superset-row .idx { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted); width: 18px; }
.superset-row .ex { flex: 1; font-weight: 500; }
.superset-row .sets { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--accent); }

/* ─── 68 · Body-map heat overlay ─── */
.body-map-heat-legend { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); margin: 8px 0; }
.body-map-heat-scale { display: inline-block; width: 100px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, rgba(45,212,168,0.1), rgba(45,212,168,0.4), rgba(245,158,11,0.5), rgba(244,63,94,0.7)); }
path[data-heat="1"] { fill: rgba(45, 212, 168, 0.22) !important; }
path[data-heat="2"] { fill: rgba(45, 212, 168, 0.42) !important; }
path[data-heat="3"] { fill: rgba(245, 158, 11, 0.48) !important; }
path[data-heat="4"] { fill: rgba(245, 158, 11, 0.65) !important; }
path[data-heat="5"] { fill: rgba(244, 63, 94, 0.75) !important; }

/* ─── 73 · Hydration quick-add widget ─── */
.hydration-widget {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(45, 212, 168, 0.06), rgba(56, 189, 248, 0.08));
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}
.hydration-icon { font-size: 28px; line-height: 1; }
.hydration-val { font-family: var(--font-mono, monospace); font-size: 20px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 88px; }
.hydration-val small { font-size: 12px; color: var(--text-muted); margin-left: 2px; }
.hydration-bar { flex: 1; height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.hydration-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--info)); transition: width 0.3s ease; border-radius: 4px; }
.hydration-actions { display: flex; gap: 4px; }
.hydration-btn {
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono, monospace);
  font-size: 11px; font-weight: 600;
  color: var(--accent); cursor: pointer;
  min-height: 32px; min-width: 52px;
}
.hydration-btn:hover { background: var(--accent-dim); border-color: var(--accent); }
.hydration-btn:active { transform: scale(0.95); }

/* ─── 76 · Compound hero card ─── */
.compound-hero {
  background: linear-gradient(135deg, var(--bg-elevated), rgba(45,212,168,0.04));
  border: 1px solid var(--accent-dim);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.compound-hero::before {
  content: ''; position: absolute; top: 0; right: 0;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(45,212,168,0.1), transparent 70%);
  pointer-events: none;
}
.compound-hero .class-tag {
  display: inline-block; padding: 3px 10px;
  font-family: var(--font-mono, monospace); font-size: 10px;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-dim);
  border-radius: 4px; margin-bottom: 8px;
}
.compound-hero h2 { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 4px; }
.compound-hero .subtitle { font-size: 14px; color: var(--text-secondary); font-style: italic; margin-bottom: 16px; }
.compound-hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 12px; position: relative; }
.compound-hero-stat { padding: 10px 12px; background: var(--bg-surface); border-radius: var(--radius); }
.compound-hero-stat .k { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.compound-hero-stat .v { font-family: var(--font-mono, monospace); font-size: 14px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ─── 77 · Related compounds ─── */
.related-compounds { margin-top: 20px; }
.related-compounds h3 { font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.related-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.related-chip {
  padding: 8px 14px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; color: var(--text-primary); cursor: pointer;
  transition: all 0.15s; font-weight: 500;
}
.related-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ─── 78 · PubMed citation link ─── */
.cite-ref {
  display: inline-flex; align-items: center;
  padding: 1px 6px; margin: 0 2px;
  font-family: var(--font-mono, monospace);
  font-size: 10px; font-weight: 600;
  color: var(--info); background: rgba(56, 189, 248, 0.1);
  border-radius: 3px; text-decoration: none;
  vertical-align: baseline; letter-spacing: 0.3px;
  transition: background 0.15s;
}
.cite-ref:hover { background: rgba(56, 189, 248, 0.2); text-decoration: none; }
.cite-ref::before { content: '#'; opacity: 0.6; }

/* ─── 84 · Club discovery ─── */
.club-discovery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.club-discovery-card {
  padding: 14px; background: var(--bg-elevated);
  border-radius: var(--radius-lg); border: 1px solid transparent;
  cursor: pointer; transition: all 0.15s;
}
.club-discovery-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-elevated); }
.club-discovery-card .cat { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.club-discovery-card h4 { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.club-discovery-card .desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 10px; min-height: 34px; }
.club-discovery-card .meta { display: flex; gap: 10px; font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted); letter-spacing: 0.5px; }
.club-category-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; overflow-x: auto; padding-bottom: 4px; }
.club-cat-chip { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 11px; font-weight: 500; background: transparent; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.club-cat-chip.active { background: var(--accent); border-color: var(--accent); color: #131518; font-weight: 700; }

/* ─── 85 · Settings search ─── */
.settings-search { position: sticky; top: 0; z-index: 10; background: var(--bg-primary); padding: 10px 0 14px; margin-bottom: 10px; }
.settings-search-wrap { position: relative; }
.settings-search-wrap::before {
  content: ''; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c939c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; pointer-events: none;
}
.settings-search input {
  width: 100%; padding: 10px 14px 10px 38px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-primary); font-size: 14px;
}
.settings-section.hidden-by-search,
.settings-row.hidden-by-search { display: none; }

/* ─── 86 · Settings section icons ─── */
.settings-section-title { display: flex; align-items: center; gap: 8px; }
.settings-section-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--accent); opacity: 0.8; }
.settings-section-actions { margin-left: auto; font-size: 11px; }
.settings-section-reset {
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted); background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 4px;
  font-family: var(--font-mono, monospace);
}
.settings-section-reset:hover { color: var(--danger); background: rgba(244, 63, 94, 0.08); }

/* ─── 91 · Skeleton loaders ─── */
.skel { background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%); background-size: 200% 100%; animation: vlSkeletonShimmer 1.5s ease-in-out infinite; border-radius: var(--radius-sm); }
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-line.lg { height: 18px; }
.skel-line.short { width: 40%; }
.skel-line.med { width: 70%; }
.skel-card { height: 100px; border-radius: var(--radius-lg); margin-bottom: 12px; }
.skel-chip { width: 90px; height: 28px; border-radius: 999px; display: inline-block; margin-right: 6px; }

/* ─── 92 · Unified toast queue ─── */
#vl-toast-queue {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; max-width: 90vw;
}
.vl-toast {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow-float);
  font-size: 13px; color: var(--text-primary);
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
  animation: toastIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vl-toast.out { animation: toastOut 0.2s ease forwards; }
.vl-toast.success { border-left-color: var(--success); }
.vl-toast.danger  { border-left-color: var(--danger); }
.vl-toast.warning { border-left-color: var(--warning); }
.vl-toast.info    { border-left-color: var(--info); }
.vl-toast .body { flex: 1; }
.vl-toast .action { color: var(--accent); font-weight: 600; background: none; border: none; cursor: pointer; font-size: 12px; padding: 4px 8px; border-radius: 4px; }
.vl-toast .action:hover { background: var(--accent-dim); }
.vl-toast .close { color: var(--text-muted); background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ─── 93 · Inline form validation ─── */
.form-input.invalid,
.form-select.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(244,63,94,0.12); }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; display: none; align-items: center; gap: 4px; }
.form-error.visible { display: flex; }
.form-error::before { content: '!'; font-weight: 700; width: 14px; height: 14px; border-radius: 50%; background: var(--danger); color: #fff; text-align: center; line-height: 14px; font-size: 10px; }

/* ─── 95 · Motion-reduce comprehensive ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .landing-logo,
  .sync-dot.pending,
  .gps-recording-indicator,
  #rest-timer-float.done,
  .pr-toast { animation: none !important; }
  .mood-emoji { transition: none !important; }
}

/* ─── 98 · 404 / crash screen ─── */
.crash-screen {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: var(--bg-primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.crash-icon { font-size: 56px; color: var(--danger); margin-bottom: 16px; line-height: 1; }
.crash-screen h1 { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.crash-screen p { color: var(--text-secondary); max-width: 420px; font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.crash-screen .ref { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 20px; padding: 6px 12px; background: var(--bg-elevated); border-radius: 4px; }
.crash-screen-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ─── 100 · Normalized empty states ─── */
.empty-v2 { text-align: center; padding: 48px 20px 32px; animation: fadeSlideIn 0.25s ease; }
.empty-v2 .empty-v2-icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--text-muted); opacity: 0.5; }
.empty-v2 h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.empty-v2 p { font-size: 13px; color: var(--text-secondary); max-width: 280px; margin: 0 auto 16px; line-height: 1.5; }
.empty-v2 .btn { margin-top: 8px; }
