/* ═══════════════════════════════════════════════════════════════
   Metabolic Intelligence Platform — Design System
   Premium health-tech aesthetic: warm neutrals, clinical accents
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Outfit:wght@300;400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg:          #0D1117;
  --bg-elev:     #161B22;
  --bg-raised:   #1C2129;
  --bg-glass:    rgba(22, 27, 34, 0.72);
  --fg:          #E6EDF3;
  --fg-soft:     rgba(230, 237, 243, 0.72);
  --fg-muted:    rgba(230, 237, 243, 0.42);
  --border:      rgba(230, 237, 243, 0.08);
  --border-soft: rgba(230, 237, 243, 0.04);
  --border-glow: rgba(230, 237, 243, 0.12);

  --sidebar-bg:  #0A0E13;
  --sidebar-fg:  #E6EDF3;
  --sidebar-muted: rgba(230, 237, 243, 0.42);
  --sidebar-active: rgba(255, 255, 255, 0.06);

  --glucose-low:   #3B82F6;
  --glucose-ok:    #10B981;
  --glucose-high:  #F59E0B;
  --glucose-crit:  #EF4444;

  --primary:     #F472B6;
  --primary-dim: rgba(244, 114, 182, 0.12);
  --primary-fg:  #0D1117;
  --accent:      #A78BFA;
  --accent-dim:  rgba(167, 139, 250, 0.12);
  --green:       #10B981;
  --green-dim:   rgba(16, 185, 129, 0.12);
  --amber:       #F59E0B;
  --amber-dim:   rgba(245, 158, 11, 0.12);
  --red:         #EF4444;
  --red-dim:     rgba(239, 68, 68, 0.12);
  --rose:        #F472B6;
  --rose-dim:    rgba(244, 114, 182, 0.12);

  --shadow-card: 0 1px 2px rgba(0,0,0,0.24), 0 0 1px rgba(0,0,0,0.16);
  --shadow-glow: 0 0 32px rgba(244, 114, 182, 0.06);
  --radius:      12px;
  --radius-lg:   16px;
  --radius-sm:   8px;
  --font-display: "DM Serif Display", Georgia, serif;
  --font-body:    "Outfit", system-ui, sans-serif;
  --font-mono:    "Space Mono", ui-monospace, monospace;

  --grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  /* Paint the device safe areas (notch, home indicator) in the app background
     so a standalone / App Store wrapped install never shows a white seam. */
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Native-app feel: no tap flash. */
  -webkit-tap-highlight-color: transparent;
  /* NOTE: overscroll-behavior-y intentionally NOT set on body — in iOS
     WKWebView (used by the Pepper GLP-1 native wrapper) `none` on the
     root scroller silently kills touch-scroll of the whole document.
     If we ever need to suppress rubber-band, do it on a specific inner
     scroll container, never on body. */
}
/* Chrome (nav, buttons, badges) should not be text-selectable — that's what
   makes a web app feel like a toy. Body copy stays selectable for sharing. */
.sidebar, .menu-toggle, .btn, .nav-link, .badge, .brand { -webkit-user-select: none; user-select: none; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* Grain overlay */
.grain-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background-image: var(--grain);
  background-repeat: repeat;
  opacity: 0.5;
}

/* ─── Layout ─── */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── Sidebar ─── */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: max(24px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-right: 1px solid var(--border);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; margin-bottom: 8px;
}
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  box-shadow: 0 0 24px rgba(244, 114, 182, 0.2);
}
.brand-icon svg { width: 20px; height: 20px; stroke: var(--primary-fg); fill: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text .row1 {
  font-family: var(--font-display);
  font-size: 17px; letter-spacing: -0.02em;
}
.brand-text .row2 {
  font-family: var(--font-body);
  font-size: 9px; letter-spacing: 0.2em;
  color: var(--primary);
  text-transform: uppercase; margin-top: 3px;
  font-weight: 500;
}

.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 20px 12px 6px;
  font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; font-size: 13px;
  color: var(--fg-soft); transition: all 0.2s; font-weight: 400;
  position: relative;
}
.nav-link:hover { background: rgba(255,255,255,0.03); color: var(--fg); }
.nav-link.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 500;
}
.nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--primary); border-radius: 0 2px 2px 0;
}
.nav-link svg { width: 16px; height: 16px; stroke: currentColor; opacity: 0.7; flex-shrink: 0; }
.nav-link.active svg { opacity: 1; }
.nav-link .nav-badge {
  margin-left: auto; font-size: 9px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px;
  background: var(--primary-dim); color: var(--primary);
  letter-spacing: 0.04em;
}

.sidebar-foot {
  margin-top: auto; padding: 16px 12px 4px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--sidebar-muted); line-height: 1.5;
}
.sidebar-foot-links {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.sidebar-foot-links a {
  color: var(--sidebar-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.sidebar-foot-links a:hover {
  color: var(--sidebar-fg);
}

/* ─── Main content ─── */
.main {
  padding: 32px 44px 56px;
  padding-right: max(44px, env(safe-area-inset-right));
  padding-bottom: max(56px, calc(40px + env(safe-area-inset-bottom)));
  max-width: 1280px; width: 100%;
  position: relative;
}

.eyebrow {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 600; margin-bottom: 8px;
}
h1.page-title {
  font-family: var(--font-display);
  font-size: 30px; letter-spacing: -0.02em; line-height: 1.15;
  margin: 0 0 6px;
  background: linear-gradient(135deg, var(--fg) 0%, var(--fg-soft) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-sub { color: var(--fg-soft); margin: 0 0 20px; max-width: 760px; font-weight: 300; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 12.5px; font-weight: 500;
  border-radius: var(--radius-sm); border: 1px solid var(--border-glow);
  background: var(--bg-raised); color: var(--fg); transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.16); }
.btn.primary {
  background: var(--primary); color: var(--primary-fg);
  border-color: var(--primary); font-weight: 600;
  box-shadow: 0 0 20px rgba(244, 114, 182, 0.15);
}
.btn.primary:hover { background: #EC4899; box-shadow: 0 0 28px rgba(244, 114, 182, 0.25); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,0.04); }
.btn.sm { padding: 5px 10px; font-size: 11px; }
.btn.accent { background: var(--accent-dim); color: var(--accent); border-color: rgba(167,139,250,0.2); }
.btn.green { background: var(--green-dim); color: var(--green); border-color: rgba(16,185,129,0.2); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Cards ─── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--border-glow); }
.card.tight { padding: 16px; }
.card.glow {
  border-color: rgba(244, 114, 182, 0.15);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}
.card-grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.card h3 {
  font-family: var(--font-body); margin: 0;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 600;
}
.card h2.card-title {
  font-family: var(--font-display); margin: 0;
  font-size: 18px; letter-spacing: -0.01em;
}
.card .value {
  font-family: var(--font-mono);
  font-size: 36px; line-height: 1; font-weight: 700;
  font-variant-numeric: tabular-nums; margin: 10px 0 6px;
}
.card .value.lg { font-size: 52px; }
.card .unit {
  font-family: var(--font-body);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-muted); margin-left: 6px; font-weight: 400;
}
.card .meta { font-size: 12.5px; color: var(--fg-soft); font-weight: 300; }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

/* Score ring */
.score-ring {
  position: relative; width: 160px; height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.score-ring svg { position: absolute; inset: 0; }
.score-ring .score-value {
  font-family: var(--font-mono); font-size: 42px; font-weight: 700;
  line-height: 1; text-align: center;
}
.score-ring .score-label {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--fg-muted); text-align: center; margin-top: 4px;
}

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; line-height: 1.4;
  border: 1px solid transparent;
}
.badge.cyan { background: var(--primary-dim); color: var(--primary); border-color: rgba(34,211,238,0.15); }
.badge.green { background: var(--green-dim); color: var(--green); border-color: rgba(16,185,129,0.15); }
.badge.amber { background: var(--amber-dim); color: var(--amber); border-color: rgba(245,158,11,0.15); }
.badge.red { background: var(--red-dim); color: var(--red); border-color: rgba(239,68,68,0.15); }
.badge.purple { background: var(--accent-dim); color: var(--accent); border-color: rgba(167,139,250,0.15); }
.badge.rose { background: var(--rose-dim); color: var(--rose); border-color: rgba(244,114,182,0.15); }
.badge.muted { background: rgba(255,255,255,0.04); color: var(--fg-muted); border-color: var(--border); }
.badge.dot::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: currentColor; }

/* ─── Banner ─── */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-raised);
}
.banner svg { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; color: var(--fg-muted); }
.banner .copy { font-size: 13px; color: var(--fg-soft); font-weight: 300; }
.banner .copy strong { color: var(--fg); font-weight: 500; }

/* ─── Progress ─── */
.progress { height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.progress .cyan { background: var(--primary); box-shadow: 0 0 8px rgba(34,211,238,0.3); }
.progress .green { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,0.3); }
.progress .amber { background: var(--amber); }
.progress .red { background: var(--red); }

/* ─── Glucose zone bar ─── */
.glucose-zone-bar {
  display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px;
}
.glucose-zone-bar span { flex: 1; border-radius: 2px; }

/* ─── Metric stat ─── */
.stat-block { text-align: center; padding: 8px; }
.stat-block .stat-value {
  font-family: var(--font-mono); font-size: 24px; font-weight: 700;
  line-height: 1;
}
.stat-block .stat-label {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg-muted); margin-top: 6px; font-weight: 500;
}

/* ─── Phase strip ─── */
.phase-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.phase {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; background: var(--bg-elev);
  transition: all 0.2s;
}
.phase.active { border-color: rgba(34,211,238,0.3); box-shadow: 0 0 0 1px rgba(34,211,238,0.1) inset, var(--shadow-glow); }
.phase .num { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--fg-muted); text-transform: uppercase; }
.phase h4 { margin: 6px 0 4px; font-family: var(--font-display); font-size: 16px; }
.phase p { margin: 0; color: var(--fg-soft); font-size: 12.5px; font-weight: 300; }
.phase ul { margin: 8px 0 0; padding-left: 16px; font-size: 12px; color: var(--fg-soft); }

/* ─── Tick list ─── */
.tick-list { list-style: none; padding: 0; margin: 0; }
.tick-list li {
  padding: 8px 0 8px 24px; position: relative;
  border-bottom: 1px solid var(--border-soft); font-size: 13px; color: var(--fg-soft);
  font-weight: 300;
}
.tick-list li:last-child { border-bottom: 0; }
.tick-list li::before {
  content: ""; position: absolute; left: 6px; top: 14px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); opacity: 0.5;
}

/* ─── Forms ─── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 500;
}
.field select, .field input, .field textarea {
  background: var(--bg-raised); border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%; color: var(--fg);
}
.field select:focus, .field input:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.1);
}
.field select option { background: var(--bg-raised); }

.checkbox-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; }
@media (max-width: 720px) { .checkbox-grid { grid-template-columns: 1fr; } }
.chk {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised); transition: all 0.2s;
  cursor: pointer; text-align: center; position: relative;
  min-height: 44px;
}
.chk:hover { border-color: rgba(34,211,238,0.25); background: rgba(34,211,238,0.04); }
.chk input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.chk input:checked + span { color: var(--primary); }
.chk input:checked ~ span { color: var(--primary); }
.chk:has(input:checked) {
  border-color: var(--primary); background: var(--primary-dim);
  box-shadow: 0 0 0 1px rgba(34,211,238,0.15);
}
.chk span { font-size: 13px; color: var(--fg); line-height: 1.35; }
.chk small { display: block; color: var(--fg-muted); font-size: 11px; margin-top: 2px; }

.segments {
  display: inline-flex; flex-wrap: wrap; gap: 4px;
  padding: 3px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-raised);
}
.segments .seg {
  padding: 6px 14px; border-radius: 999px; font-size: 12px; color: var(--fg-soft);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  transition: all 0.2s; font-weight: 400;
}
.segments .seg.active { background: var(--primary); color: var(--primary-fg); font-weight: 600; }
.segments .seg:hover:not(.active) { color: var(--fg); background: rgba(255,255,255,0.04); }

/* ─── Tabs ─── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 10px 14px; border: none; background: transparent;
  font-size: 12.5px; color: var(--fg-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.2s; font-weight: 400;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab:hover:not(.active) { color: var(--fg-soft); }

/* ─── Output cards ─── */
.output-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; background: var(--bg-elev);
}
.output-card.helpful { border-left: 3px solid var(--green); }
.output-card.neutral { border-left: 3px solid var(--fg-muted); }
.output-card.caution { border-left: 3px solid var(--amber); }
.output-card.clinician { border-left: 3px solid var(--red); }
.output-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600;
}
.output-card.helpful .output-tag { color: var(--green); }
.output-card.neutral .output-tag { color: var(--fg-muted); }
.output-card.caution .output-tag { color: var(--amber); }
.output-card.clinician .output-tag { color: var(--red); }

/* ─── Metric rows ─── */
.metric-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
.metric-row:last-child { border-bottom: 0; }
.metric-row .k { color: var(--fg-muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 10px; font-weight: 600; }
.metric-row .v { color: var(--fg); font-weight: 500; font-family: var(--font-mono); font-size: 13px; }

/* ─── Charts ─── */
.chart-wrap { position: relative; padding-top: 8px; }
.chart-wrap svg { width: 100% !important; display: block; }
.chart-wrap.h-sm { height: 100px; }
.chart-wrap.h-md { height: 140px; }
.chart-wrap.h-lg { height: 200px; }
.chart-wrap svg { height: 100% !important; }
.grid-line { stroke: rgba(255,255,255,0.04); }
.axis-label { font-family: var(--font-mono); font-size: 9px; fill: var(--fg-muted); stroke: none; }

/* ─── Glucose chart specifics ─── */
.line-glucose { stroke: var(--primary); fill: none; stroke-width: 2; }
.area-glucose { fill: url(#glucoseGrad); opacity: 0.3; }
.zone-low { fill: var(--glucose-low); opacity: 0.06; }
.zone-ok { fill: var(--glucose-ok); opacity: 0.04; }
.zone-high { fill: var(--glucose-high); opacity: 0.06; }
.dot-reading { fill: var(--primary); stroke: var(--bg-elev); stroke-width: 2; }
.line-dose { stroke: var(--accent); stroke-dasharray: 4 3; stroke-width: 1.5; }

/* ─── Legend ─── */
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--fg-muted); margin-top: 8px; font-weight: 400; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ─── Integration cards ─── */
.integration-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; background: var(--bg-elev);
  display: flex; align-items: center; gap: 16px;
  transition: all 0.2s;
}
.integration-card:hover { border-color: var(--border-glow); transform: translateY(-1px); }
.integration-card .int-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.integration-card .int-info { flex: 1; }
.integration-card .int-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.integration-card .int-desc { font-size: 12px; color: var(--fg-muted); font-weight: 300; }
.integration-card .int-status {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 600; padding: 4px 10px; border-radius: 999px;
}
.int-status.connected { background: var(--green-dim); color: var(--green); }
.int-status.ready { background: var(--primary-dim); color: var(--primary); }
.int-status.coming { background: rgba(255,255,255,0.04); color: var(--fg-muted); }

/* ─── Tiles ─── */
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tile {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  background: var(--bg-elev); display: flex; flex-direction: column; gap: 6px;
  transition: all 0.25s;
}
.tile:hover { border-color: rgba(34,211,238,0.2); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.tile .top { display: flex; align-items: center; justify-content: space-between; color: var(--fg-muted); }
.tile h4 { margin: 4px 0 2px; font-family: var(--font-display); font-size: 16px; }
.tile p { margin: 0; font-size: 12px; color: var(--fg-muted); font-weight: 300; }
@media (max-width: 980px) { .tile-grid { grid-template-columns: 1fr; } }

/* ─── Summary grid ─── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; margin: 12px 0 14px;
}
.summary-grid > div {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg-raised);
  color: var(--fg-soft); font-size: 12.5px;
}
.summary-grid strong {
  display: block; color: var(--fg-muted);
  font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 4px;
}

/* ─── Subsystem scores ─── */
.subsystem-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border-soft);
}
.subsystem-bar:last-child { border-bottom: 0; }
.subsystem-bar .sb-label { font-size: 12px; color: var(--fg-soft); width: 160px; flex-shrink: 0; font-weight: 400; }
.subsystem-bar .sb-track { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.subsystem-bar .sb-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }
.subsystem-bar .sb-val { font-family: var(--font-mono); font-size: 13px; font-weight: 700; width: 40px; text-align: right; }

/* ─── Disclaimer ─── */
.disclaimer {
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border);
  color: var(--fg-muted); font-size: 11px; line-height: 1.6; max-width: 920px; font-weight: 300;
}

/* ─── Form entry panels ─── */
.entry-panel {
  background: var(--bg-raised); border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg); padding: 24px;
  margin-bottom: 16px;
}
.entry-panel .ep-title {
  font-family: var(--font-display); font-size: 18px;
  margin: 0 0 16px;
}

/* ─── Meal response card ─── */
.meal-response {
  display: grid; grid-template-columns: 1fr 140px; gap: 16px;
  align-items: start;
}
.meal-response .mr-chart {
  background: var(--bg-raised); border-radius: var(--radius-sm);
  padding: 12px; text-align: center;
}
.meal-response .mr-delta {
  font-family: var(--font-mono); font-size: 28px; font-weight: 700;
}

/* ─── Cannabinoid module ─── */
.cn-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 18px; }
@media (max-width: 1080px) { .cn-grid { grid-template-columns: 1fr; } }
.cn-section-title {
  font-family: var(--font-display); font-size: 14.5px; margin: 6px 0 10px;
  letter-spacing: -0.005em;
}

/* ─── Misc ─── */
.muted { color: var(--fg-muted); }
.fineprint { font-size: 11px; color: var(--fg-muted); line-height: 1.55; margin-top: 10px; font-weight: 300; }
.kbd {
  font-family: var(--font-mono); font-size: 10px; padding: 2px 6px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-raised); color: var(--fg-muted);
}
section { scroll-margin-top: 12px; }
svg { stroke: currentColor; width: 16px; height: 16px; flex-shrink: 0; }

/* ─── Phase track ─── */
.phase-track { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; color: var(--fg-soft); }
.phase-track .dot { width: 7px; height: 7px; border-radius: 999px; background: rgba(255,255,255,0.1); }
.phase-track .dot.on { background: var(--primary); box-shadow: 0 0 8px rgba(34,211,238,0.3); }

/* ─── Sparkline in cards ─── */
.sparkline-wrap { height: 36px; margin-top: 8px; }
.sparkline-wrap svg { width: 100%; height: 100%; }

/* ─── Mobile ─── */
.menu-toggle { display: none; }
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px;
    transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 30;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle {
    display: inline-flex;
    position: fixed;
    top: max(14px, calc(env(safe-area-inset-top) + 8px));
    right: max(14px, calc(env(safe-area-inset-right) + 4px));
    z-index: 40; background: var(--bg-glass);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border: 1px solid var(--border-glow);
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  }
  .main {
    padding: max(64px, calc(env(safe-area-inset-top) + 60px)) 16px 40px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(40px, calc(28px + env(safe-area-inset-bottom)));
  }
  h1.page-title { font-size: 24px; }
  .phase-strip { grid-template-columns: 1fr; }
}
.backdrop { display: none; }
.backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 25; backdrop-filter: blur(4px); }

/* ─── Animations ─── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.fade-in { animation: fadeIn 0.4s ease both; }
.pulse { animation: pulse 2s ease-in-out infinite; }

/* Stagger children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* ─── Oura Integration ─── */
.oura-connect-card {
  background: linear-gradient(135deg, var(--bg-elev) 0%, rgba(167, 139, 250, 0.04) 100%);
  border-color: rgba(167, 139, 250, 0.12);
}
.oura-connect-card:hover {
  border-color: rgba(167, 139, 250, 0.25);
  box-shadow: var(--shadow-card), 0 0 32px rgba(167, 139, 250, 0.06);
}
.int-status.ready.oura {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ─── Onboarding Hero Banner ─── */
.onboarding-hero {
  position: relative;
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.08) 0%, rgba(167, 139, 250, 0.06) 50%, rgba(16, 185, 129, 0.04) 100%);
  border: 1px solid rgba(244, 114, 182, 0.2);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  margin-bottom: 24px;
  overflow: hidden;
  animation: fadeIn 0.5s ease both;
}
.onboarding-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.onboarding-hero::after {
  content: "";
  position: absolute;
  bottom: -40%;
  left: 20%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.06) 0%, transparent 70%);
  pointer-events: none;
}
.onboarding-hero .hero-eyebrow {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 10px;
  position: relative;
}
.onboarding-hero .hero-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 10px;
  background: linear-gradient(135deg, var(--fg) 0%, var(--fg-soft) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}
.onboarding-hero .hero-desc {
  color: var(--fg-soft);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.6;
  margin: 0 0 20px;
  max-width: 600px;
  position: relative;
}
.onboarding-hero .hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
}
.onboarding-hero .hero-actions .btn-begin {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  background: linear-gradient(135deg, var(--primary), #EC4899);
  color: var(--primary-fg);
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 0 24px rgba(244, 114, 182, 0.2), 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: pulse 2.5s ease-in-out infinite;
}
.onboarding-hero .hero-actions .btn-begin:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 36px rgba(244, 114, 182, 0.3), 0 6px 16px rgba(0, 0, 0, 0.3);
  animation: none;
}
.onboarding-hero .hero-actions .btn-begin svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary-fg);
}
.onboarding-hero .hero-steps {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  position: relative;
}
.onboarding-hero .hero-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 400;
}
.onboarding-hero .hero-step .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glow);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--fg-soft);
  flex-shrink: 0;
}
.onboarding-hero .hero-time {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 300;
}
@media (max-width: 780px) {
  .onboarding-hero { padding: 24px 20px; }
  .onboarding-hero .hero-title { font-size: 22px; }
  .onboarding-hero .hero-steps { flex-direction: column; gap: 8px; }
}

/* ─── Intake Wizard ─── */
.intake-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 0 4px;
}
.intake-progress .ip-step {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  position: relative;
}
.intake-progress .ip-step:last-child {
  flex: 0;
}
.intake-progress .ip-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 2px solid var(--border-glow);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  flex-shrink: 0;
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}
.intake-progress .ip-step.active .ip-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 0 16px rgba(244, 114, 182, 0.3);
}
.intake-progress .ip-step.done .ip-dot {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.intake-progress .ip-line {
  flex: 1;
  height: 2px;
  background: var(--border-glow);
  transition: background 0.3s;
}
.intake-progress .ip-step.done .ip-line {
  background: var(--green);
}
.intake-progress .ip-label {
  position: absolute;
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
  font-weight: 500;
}
.intake-progress .ip-step.active .ip-label {
  color: var(--primary);
}
.intake-progress .ip-step.done .ip-label {
  color: var(--green);
}
@media (max-width: 780px) {
  .intake-progress .ip-label { display: none; }
  .intake-progress .ip-dot { width: 26px; height: 26px; font-size: 10px; }
}

.intake-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 780px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease both;
}
.intake-card .step-header {
  margin-bottom: 24px;
}
.intake-card .step-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.intake-card .step-header p {
  color: var(--fg-soft);
  font-size: 13px;
  font-weight: 300;
  margin: 0;
}
.intake-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.intake-nav .step-count {
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}

/* Sidebar onboarding link */
.nav-link.onboarding-link {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.08), rgba(167, 139, 250, 0.06));
  border: 1px solid rgba(244, 114, 182, 0.15);
  margin: 4px 0;
  font-weight: 500;
  color: var(--primary);
}
.nav-link.onboarding-link:hover {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.14), rgba(167, 139, 250, 0.1));
  border-color: rgba(244, 114, 182, 0.25);
}
.nav-link.onboarding-link .nav-badge {
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 700;
}

/* ─── Protocol Results ─── */
.protocol-result {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--bg-elev);
  margin-bottom: 14px;
}
.protocol-result .pr-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.protocol-result .pr-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.protocol-result .pr-icon svg {
  width: 20px;
  height: 20px;
}
.protocol-result .pr-title {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0;
}
.protocol-result .pr-body {
  font-size: 13px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.6;
}

/* ─── Mental Health Support ─── */
.mh-intro-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.08), rgba(244, 114, 182, 0.06));
  border: 1px solid rgba(167, 139, 250, 0.15);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 28px;
}
.mh-intro-banner > svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}
.mh-intro-banner .copy {
  font-size: 13.5px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.65;
}
.mh-intro-banner .copy strong {
  color: var(--fg);
  font-weight: 500;
}

.mh-section-title {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.mh-section-sub {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 300;
  margin: 0 0 16px;
}

.mh-card-grid { margin-bottom: 8px; }

.mh-tip-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px !important;
}
.mh-tip-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.mh-tip-icon svg {
  width: 18px;
  height: 18px;
}
.mh-tip-title {
  font-family: var(--font-body) !important;
  font-size: 14px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--fg) !important;
  font-weight: 600 !important;
  margin: 0;
}
.mh-tip-body {
  font-size: 13px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.6;
  margin: 0;
}

.mh-feel-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px !important;
}
.mh-feel-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mh-feel-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.mh-feel-icon svg {
  width: 17px;
  height: 17px;
}
.mh-feel-title {
  font-family: var(--font-display) !important;
  font-size: 16px !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
  color: var(--fg) !important;
  font-weight: 400 !important;
  margin: 0;
}
.mh-feel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mh-feel-list li {
  font-size: 12.5px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.55;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  padding-left: 14px;
}
.mh-feel-list li:last-child {
  border-bottom: none;
}
.mh-feel-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg-muted);
}

.mh-clinician-note {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(244, 114, 182, 0.06);
  border: 1px solid rgba(244, 114, 182, 0.12);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-top: 32px;
  margin-bottom: 20px;
}
.mh-clinician-note > svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--rose);
}
.mh-clinician-note .copy {
  font-size: 13px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.65;
}

/* ─── Assessment: Do I Need More Support? ─── */
.assess-intro-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.08), rgba(244, 114, 182, 0.06));
  border: 1px solid rgba(244, 114, 182, 0.15);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 28px;
}
.assess-intro-banner > svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--rose);
}
.assess-intro-banner .copy {
  font-size: 13.5px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.65;
}
.assess-intro-banner .copy strong {
  color: var(--fg);
  font-weight: 500;
}

.assess-crisis {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 24px;
}
.assess-crisis > svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
  color: #ef4444;
}
.assess-crisis .copy {
  font-size: 13.5px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.65;
}
.assess-crisis .copy strong {
  color: #ef4444;
  font-weight: 600;
}
.assess-crisis-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 6px;
}
.assess-crisis-list li {
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(239, 68, 68, 0.1);
  color: var(--fg-soft);
}
.assess-crisis-list li:last-child {
  border-bottom: none;
}

.assess-questions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.assess-q-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px !important;
}
.assess-q-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  flex-shrink: 0;
}
.assess-q-text {
  flex: 1;
  font-size: 14px;
  color: var(--fg);
  font-weight: 400;
  line-height: 1.5;
}
.assess-q-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.assess-btn {
  padding: 7px 20px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--bg-raised);
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.assess-btn:hover {
  border-color: var(--fg-muted);
  color: var(--fg);
}
.assess-btn.selected-yes {
  background: rgba(244, 114, 182, 0.12);
  border-color: var(--rose);
  color: var(--rose);
  font-weight: 600;
}
.assess-btn.selected-no {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--green);
  color: var(--green);
  font-weight: 600;
}

.assess-submit {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #0d1117;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 24px;
}
.assess-submit:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}
.assess-submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.assess-result-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.assess-result-card > svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.assess-result-card .copy {
  font-size: 13.5px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.65;
}
.assess-result-card .copy strong {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}
.assess-result-card .copy p {
  margin: 0;
}
.assess-result-crisis {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.assess-result-crisis > svg { color: #ef4444; }
.assess-result-crisis .copy strong { color: #ef4444; }
.assess-result-moderate {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.assess-result-moderate > svg { color: var(--amber); }
.assess-result-moderate .copy strong { color: var(--amber); }
.assess-result-mild {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.assess-result-mild > svg { color: var(--green); }
.assess-result-mild .copy strong { color: var(--green); }
.assess-result-contact {
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.2);
}
.assess-result-contact > svg { color: var(--accent); }
.assess-result-contact .copy strong { color: var(--accent); }

.assess-note {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(244, 114, 182, 0.05);
  border: 1px solid rgba(244, 114, 182, 0.1);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-top: 24px;
  margin-bottom: 20px;
}
.assess-note > svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--primary);
}
.assess-note .copy {
  font-size: 13px;
  color: var(--fg-soft);
  font-weight: 300;
  line-height: 1.65;
}

@media (max-width: 780px) {
  .assess-q-card {
    flex-wrap: wrap;
  }
  .assess-q-text {
    flex: 1 1 calc(100% - 48px);
  }
  .assess-q-btns {
    width: 100%;
    margin-left: 48px;
  }
}

/* ─── Pepper — Journey Coach floating assistant ─── */
#jc-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.jc-fab-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff5f7 0%, #ffe0e8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(244, 168, 189, 0.35), 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  user-select: none;
  border: 1.5px solid rgba(244, 168, 189, 0.4);
  overflow: hidden;
  animation: pepperFloat 3s ease-in-out infinite;
}
.jc-fab-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(244, 168, 189, 0.45), 0 3px 12px rgba(0,0,0,0.3);
  border-color: rgba(244, 168, 189, 0.55);
}
.jc-fab-btn.active {
  transform: scale(0.95);
  box-shadow: 0 2px 12px rgba(244, 168, 189, 0.25);
}

.pepper-fab-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pepper-fab-img .pepper-signal { width: 100%; height: 100%; }

.jc-fab-btn::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(244, 168, 189, 0.35);
  animation: pepperPulse 3s ease-in-out infinite;
}
.jc-fab-btn.active::before {
  animation: none;
  opacity: 0;
}

@keyframes pepperFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes pepperPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.18); opacity: 0; }
}

/* ─── Pepper Panel ─── */
.jc-panel {
  position: absolute;
  bottom: 82px;
  right: 0;
  width: 370px;
  max-height: 580px;
  height: 580px;
  background: var(--bg-elev);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 48px rgba(0,0,0,0.45), 0 0 32px rgba(244, 168, 189, 0.08);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  overflow: hidden;
}
.jc-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.jc-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(244, 168, 189, 0.08) 0%, rgba(255, 210, 220, 0.06) 100%);
  flex-shrink: 0;
}

.jc-panel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff5f7 0%, #ffe0e8 100%);
  border: 1.5px solid rgba(244, 168, 189, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.pepper-mini-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pepper-mini-img .pepper-signal { width: 100%; height: 100%; }
.jc-msg-avatar .pepper-signal { width: 100%; height: 100%; }

.jc-panel-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 14px;
  color: var(--fg);
}
.jc-panel-title strong {
  color: var(--primary);
}
.jc-panel-sub {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 300;
}

.jc-panel-close {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  color: var(--fg-muted);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.jc-panel-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--fg);
}

/* ─── Pepper Chat Messages Area ─── */
.jc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.jc-chat-messages::-webkit-scrollbar { width: 3px; }
.jc-chat-messages::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 2px; }

/* ─── Message Bubbles ─── */
.jc-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
  animation: jcMsgIn 0.2s ease-out;
}
@keyframes jcMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.jc-msg-user {
  flex-direction: row-reverse;
}
.jc-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 2px;
}
.jc-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.jc-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 85%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.jc-msg-bubble p {
  margin: 0 0 8px 0;
}
.jc-msg-bubble p:last-child {
  margin-bottom: 0;
}
.jc-msg-bubble strong {
  color: var(--primary);
  font-weight: 600;
}
.jc-msg-assistant .jc-msg-bubble {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-soft);
  color: var(--fg-soft);
  border-bottom-left-radius: 4px;
}
.jc-msg-user .jc-msg-bubble {
  background: linear-gradient(135deg, rgba(244, 168, 189, 0.2) 0%, rgba(244, 168, 189, 0.1) 100%);
  border: 1px solid rgba(244, 168, 189, 0.25);
  color: var(--fg);
  border-bottom-right-radius: 4px;
}

/* ─── Typing Indicator ─── */
.jc-typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.jc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-muted);
  animation: jcTypingDot 1.2s ease-in-out infinite;
}
.jc-typing span:nth-child(2) { animation-delay: 0.15s; }
.jc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes jcTypingDot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* ─── Suggestion Chips ─── */
.jc-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}
.jc-suggestion-btn {
  padding: 7px 14px;
  background: rgba(244, 168, 189, 0.08);
  border: 1px solid rgba(244, 168, 189, 0.2);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-soft);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.jc-suggestion-btn:hover {
  background: rgba(244, 168, 189, 0.16);
  border-color: rgba(244, 168, 189, 0.35);
  color: var(--fg);
}

/* ─── Chat Input ─── */
.jc-chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
}
#jc-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--fg);
  resize: none;
  min-height: 20px;
  max-height: 100px;
  line-height: 1.4;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
#jc-input:focus {
  border-color: rgba(244, 168, 189, 0.4);
}
#jc-input::placeholder {
  color: var(--fg-muted);
}
#jc-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(244, 168, 189, 0.6) 0%, rgba(244, 168, 189, 0.35) 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}
#jc-send:hover:not(:disabled) {
  transform: scale(1.08);
}
#jc-send:disabled {
  opacity: 0.35;
  cursor: default;
}
#jc-send svg {
  stroke: currentColor;
}

/* ─── Pepper responsive ─── */
@media (max-width: 780px) {
  #jc-fab { bottom: 16px; right: 16px; }
  .jc-fab-btn { width: 62px; height: 62px; }
  .pepper-fab-img { width: 56px; height: 56px; }
  .jc-panel {
    width: calc(100vw - 32px);
    max-height: 75vh;
    height: 75vh;
    right: 0;
    bottom: 72px;
  }
}

/* ─── Emotional Check-in ─── */
.mh-checkin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}
.mh-checkin-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.mh-checkin-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--fg-soft);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
}
.mh-checkin-btn:hover {
  border-color: var(--primary);
  color: var(--fg);
}
.mh-checkin-btn.selected {
  border-color: var(--primary);
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}
.mh-mood-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
}

/* ─── Referral form card ─── */
.assess-result-referral {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-top: 16px;
}

/* ─── Auth Status (sidebar) ─── */
.auth-status {
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  margin-top: 8px;
}
.auth-status.logged-in {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.auth-info {
  flex: 1;
  min-width: 0;
}
.auth-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-email {
  font-size: 11px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-status.logged-out {
  text-align: center;
}

/* ─── Auth Modal ─── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 9999;
  /* Safe-area aware + scrollable so tall modals (auth, confirm) never clip
     under the notch / home indicator on small iPhones. */
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - max(32px, env(safe-area-inset-top)) - max(32px, env(safe-area-inset-bottom)));
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 48px rgba(0,0,0,0.3);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--fg-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: var(--fg);
}
.auth-modal-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--primary);
}
.auth-modal-icon svg {
  width: 100%;
  height: 100%;
}
.auth-modal-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 4px;
}
.auth-modal-header p {
  font-size: 13px;
  color: var(--fg-soft);
}
.auth-modal-body .field {
  margin-bottom: 12px;
}
.auth-modal-body .field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-soft);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-modal-body .field input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  font-family: var(--font-body);
  box-sizing: border-box;
}
.auth-modal-body .field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-dim);
}
.auth-error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--red-dim, rgba(255,80,80,0.12));
  color: var(--red, #ff5050);
  font-size: 13px;
  margin-bottom: 12px;
}
.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--fg-soft);
}
.auth-switch a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}
.auth-forgot {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
}
.auth-forgot a {
  color: var(--fg-muted);
  text-decoration: underline;
}
.auth-forgot a:hover {
  color: var(--fg-soft);
}

/* ─── Toast Notification ─── */
.toast-message {
  position: fixed;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast-message.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Adaptive Insights ─── */
.insight-card {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.insight-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.insight-status-bar {
  transition: background 0.3s;
}

/* ═══ Pepper Daily Check-In Overlay ═══ */

.checkin-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(6, 4, 12, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.checkin-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.checkin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  padding: 0 16px 24px;
  padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
}
.checkin-overlay.visible {
  pointer-events: auto;
}

.checkin-modal {
  position: relative;
  width: 100%;
  max-width: 340px;
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(165deg, rgba(58, 32, 68, 0.92) 0%, rgba(30, 18, 42, 0.96) 100%);
  border: 1px solid rgba(180, 130, 200, 0.15);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(120, 60, 160, 0.08);
  padding: 20px 18px 20px;
  transform: translateY(40px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}
.checkin-overlay.visible .checkin-modal {
  transform: translateY(0);
  opacity: 1;
}

.checkin-modal::-webkit-scrollbar { width: 4px; }
.checkin-modal::-webkit-scrollbar-track { background: transparent; }
.checkin-modal::-webkit-scrollbar-thumb { background: rgba(180, 130, 200, 0.2); border-radius: 4px; }

.checkin-pepper-wrap {
  display: flex;
  justify-content: center;
  margin-top: 0;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.checkin-pepper-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Removed the hard 1px ring and overflow:hidden — the orb's own outer halo
     now provides the atmospheric edge, and clipping was cutting off the
     rotating ring strokes. The drop-shadow grounds it on the dark modal. */
  filter: drop-shadow(0 6px 24px rgba(184, 132, 136, 0.32));
}
.checkin-pepper-img .pepper-signal { width: 100%; height: 100%; }

/* Fallback orb shimmer — plain compositing, no mix-blend-mode. This keeps
   the highlight visible inside iOS PepperWebView where mix-blend-mode:screen
   often renders washed-out or invisible on dark backgrounds. */
.pepper-signal.pepper-signal-fallback .ps-shimmer {
  mix-blend-mode: normal;
  opacity: 1;
  transform-origin: center;
  animation: pepperSignalShimmer 7s ease-in-out infinite;
}
.pepper-signal.pepper-signal-fallback .ps-core {
  transform-origin: center;
  animation: pepperSignalBreathe 5.6s ease-in-out infinite;
}

.checkin-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(180, 130, 200, 0.2);
  background: rgba(40, 24, 52, 0.6);
  color: rgba(220, 200, 230, 0.7);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}
.checkin-close:hover {
  background: rgba(60, 36, 72, 0.8);
  color: #fff;
}

.checkin-heading {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #f3e8f9;
  margin: 0 0 4px;
  line-height: 1.3;
}
.checkin-sub {
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: rgba(220, 200, 230, 0.6);
  margin: 0 0 14px;
  line-height: 1.4;
}

.checkin-sliders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.checkin-slider-card {
  background: linear-gradient(180deg, rgba(70, 42, 84, 0.42), rgba(48, 26, 60, 0.38));
  border: 1px solid rgba(200, 150, 230, 0.14);
  border-radius: 14px;
  padding: 12px 16px 14px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.checkin-slider-card:focus-within {
  border-color: rgba(244, 180, 220, 0.42);
  box-shadow: 0 0 0 3px rgba(244, 180, 220, 0.08);
}
.checkin-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.checkin-slider-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: #f3e8f9;
}
.checkin-slider-value {
  font-family: var(--font-body);
  font-size: 0.74rem;
  color: rgba(247, 229, 212, 0.85);
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* Range track — the fill % is driven inline from JS (--checkin-fill) so the
   warm gradient progressively reveals as the user drags. Falls back gracefully
   when the var is missing (renders the flat track only). */
.checkin-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #e9b9a7 0%, #f4b4dc var(--checkin-fill, 44%), transparent var(--checkin-fill, 44%)),
    rgba(180, 130, 200, 0.18);
  background-blend-mode: normal;
  outline: none;
  cursor: pointer;
  transition: background 0.18s ease;
}
.checkin-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}
.checkin-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #ffffff 0%, #fbeede 32%, #e9b9a7 70%, #b88488 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.28),
    0 0 0 0 rgba(244, 180, 220, 0);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.22s ease;
}
.checkin-range::-webkit-slider-thumb:hover {
  transform: scale(1.06);
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.32),
    0 0 0 6px rgba(244, 180, 220, 0.12);
}
.checkin-range:active::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.4),
    0 0 0 10px rgba(244, 180, 220, 0.18);
}
.checkin-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #e9b9a7 0%, #f4b4dc var(--checkin-fill, 44%), rgba(180, 130, 200, 0.18) var(--checkin-fill, 44%));
}
.checkin-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #ffffff 0%, #fbeede 32%, #e9b9a7 70%, #b88488 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 0.16s ease;
}
.checkin-range:active::-moz-range-thumb {
  transform: scale(1.12);
}
.checkin-range:focus-visible {
  outline: none;
}
.checkin-range:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.32),
    0 0 0 6px rgba(244, 180, 220, 0.22);
}

.checkin-submit {
  display: block;
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(200, 140, 220, 0.25), rgba(160, 100, 200, 0.3));
  border: 1px solid rgba(200, 150, 230, 0.2);
  color: #f3e8f9;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  letter-spacing: 0.01em;
}
.checkin-submit:hover {
  background: linear-gradient(135deg, rgba(200, 140, 220, 0.35), rgba(160, 100, 200, 0.4));
  box-shadow: 0 4px 20px rgba(180, 120, 220, 0.15);
}
.checkin-submit:active {
  transform: scale(0.98);
}

@media (max-width: 374px) {
  .checkin-pepper-img {
    width: 76px;
    height: 76px;
  }
  .checkin-pepper-wrap {
    margin-top: 0;
  }
}

@media (min-width: 768px) {
  .checkin-overlay {
    align-items: center;
    padding: 24px;
  }
  .checkin-modal {
    max-height: 85vh;
  }
  .checkin-heading { font-size: 1.25rem; }
}

/* ═══════════════════════════════════════════════════════════════
   Stripe Paywall Overlay Styles
   ═══════════════════════════════════════════════════════════════ */

.paywall-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(6, 4, 12, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 1;
  transition: opacity 0.35s ease;
}

.paywall-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  /* Top-align (not center): a paywall taller than the viewport must keep its
     top reachable. Centering hides the top behind the scroll origin on small
     screens. */
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.paywall-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: auto;
  max-height: calc(100dvh - max(32px, env(safe-area-inset-top)) - max(32px, env(safe-area-inset-bottom)));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(165deg, rgba(42, 22, 54, 0.95) 0%, rgba(20, 10, 32, 0.98) 100%);
  border: 1px solid rgba(224, 180, 245, 0.2);
  border-radius: 24px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.7), 0 0 80px rgba(244, 114, 182, 0.15);
  padding: 32px 24px;
  text-align: center;
  transform: translateY(0);
  opacity: 1;
  animation: paywall-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes paywall-pop {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.paywall-pepper-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.paywall-pepper-img {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(247, 229, 212, 0.2);
  box-shadow: 0 6px 24px rgba(28, 7, 22, 0.35);
}
.paywall-pepper-img .pepper-signal { width: 100%; height: 100%; }

.paywall-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: #f3e8f9;
  margin: 0 0 8px;
  line-height: 1.3;
}

.paywall-sub {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: rgba(220, 200, 230, 0.7);
  margin: 0 0 24px;
  line-height: 1.5;
}

.paywall-benefits {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  border: 1px solid rgba(220, 200, 250, 0.08);
  padding: 16px;
  margin-bottom: 24px;
}

.paywall-benefit-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.82rem;
  color: rgba(220, 200, 230, 0.85);
  line-height: 1.4;
}
.paywall-benefit-item:not(:last-child) {
  margin-bottom: 12px;
}

.paywall-benefit-icon {
  font-size: 1rem;
  line-height: 1;
}

.paywall-btn-premium {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #F472B6 0%, #FFB6C1 100%);
  border: none;
  border-radius: 12px;
  color: #0D1117;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 4px 24px rgba(244, 114, 182, 0.3);
}

.paywall-btn-premium:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 6px 28px rgba(244, 114, 182, 0.4);
}

.paywall-btn-premium:active {
  transform: translateY(1px);
}

/* Legacy class kept so any external references still render. */
.paywall-restore-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.78rem;
  color: rgba(220, 200, 230, 0.5);
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.paywall-restore-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ─── In-page restore banner (used by /upgrade and any other gating page) ─── */
.page-restore-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 14px 16px;
  margin: 0 0 20px;
  background: linear-gradient(135deg, var(--primary-dim, rgba(244,114,182,0.14)) 0%, rgba(244, 114, 182, 0.04) 100%);
  border: 1px solid var(--primary, #F472B6);
  border-radius: 14px;
  box-shadow: 0 4px 20px -10px rgba(244, 114, 182, 0.4);
}

.page-restore-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  color: var(--fg);
  line-height: 1.45;
}

.page-restore-banner-text strong {
  font-size: 0.95rem;
  color: var(--fg);
  font-weight: 700;
}

.page-restore-banner-text span {
  color: var(--fg-soft);
}

.page-restore-banner-cta {
  flex-shrink: 0;
  padding: 10px 16px;
  background: var(--primary, #F472B6);
  border: 1px solid var(--primary, #F472B6);
  border-radius: 10px;
  color: var(--primary-fg, #0D1117);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.2s, transform 0.15s;
  white-space: nowrap;
}

.page-restore-banner-cta:hover { filter: brightness(1.05); }
.page-restore-banner-cta:active { transform: translateY(1px); }

@media (max-width: 520px) {
  .page-restore-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .page-restore-banner-cta { text-align: center; }
}

/* ─── Top-of-modal returning-member banner ──────────────────────────
   The published version of the app shipped without a discoverable
   restore path; returning users couldn't find any "log back in"
   affordance. This banner sits ABOVE the benefits + Stripe CTA so it
   is the first interactive element a returning user sees. */
.paywall-returning-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  margin: 0 0 18px;
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.16) 0%, rgba(244, 114, 182, 0.06) 100%);
  border: 1px solid rgba(244, 114, 182, 0.45);
  border-radius: 14px;
  box-shadow: 0 4px 20px -10px rgba(244, 114, 182, 0.45);
}

.paywall-returning-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
  color: rgba(243, 232, 249, 0.92);
  line-height: 1.45;
}

.paywall-returning-text strong {
  font-size: 0.92rem;
  color: #fff;
  font-weight: 700;
}

.paywall-returning-text span {
  color: rgba(243, 232, 249, 0.78);
}

.paywall-returning-cta {
  flex-shrink: 0;
  padding: 9px 14px;
  background: rgba(13, 17, 23, 0.55);
  border: 1px solid rgba(244, 168, 189, 0.7);
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.paywall-returning-cta:hover {
  background: rgba(244, 114, 182, 0.18);
  border-color: rgba(244, 114, 182, 0.95);
}
.paywall-returning-cta:active { transform: translateY(1px); }

@media (max-width: 420px) {
  .paywall-returning-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .paywall-returning-cta { width: 100%; }
}

/* ─── "Already a paying member?" — inline beneath the Stripe CTA ─── */
.paywall-already-line {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: rgba(220, 200, 230, 0.65);
  text-align: center;
}

.paywall-already-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: rgba(244, 114, 182, 0.95);
  text-decoration: underline;
  cursor: pointer;
}

.paywall-already-link:hover { color: var(--primary); }

.paywall-btn-premium.is-checking {
  opacity: 0.85;
  pointer-events: none;
}

/* ─── Intake step 1: first-class physiology cards ─── */
.intake-physiology-headline {
  display: block;
  font-family: var(--font-display, inherit);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  margin: 4px 0 2px;
  letter-spacing: 0.005em;
}

.intake-physiology-sub {
  font-size: 12px;
  color: var(--fg-soft);
  line-height: 1.5;
  margin-bottom: 12px;
}

.intake-physiology-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.intake-physiology-card {
  appearance: none;
  cursor: pointer;
  background: var(--bg-raised, rgba(255,255,255,0.03));
  border: 1px solid var(--border-soft, rgba(255,255,255,0.1));
  border-radius: 14px;
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-family: inherit;
  color: var(--fg);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease,
              box-shadow 0.2s ease,
              background 0.2s ease;
}

.intake-physiology-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary, #F472B6);
}

.intake-physiology-card:focus-visible {
  outline: 2px solid var(--primary, #F472B6);
  outline-offset: 2px;
}

.intake-physiology-card.is-selected {
  border-color: var(--primary, #F472B6);
  background: linear-gradient(160deg, var(--primary-dim, rgba(244,114,182,0.14)), rgba(255,255,255,0.02));
  box-shadow: 0 6px 20px -10px rgba(244, 114, 182, 0.5);
}

.intake-physiology-emblem {
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 300;
  line-height: 1;
}

.intake-physiology-emblem--female {
  color: #F472B6;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.16), rgba(244, 114, 182, 0.02) 70%);
  border-color: rgba(244, 114, 182, 0.35);
}
.intake-physiology-emblem--male {
  color: #60A5FA;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.16), rgba(96, 165, 250, 0.02) 70%);
  border-color: rgba(96, 165, 250, 0.35);
}
.intake-physiology-emblem--prefer-not-to-say {
  color: var(--fg-soft, rgba(255,255,255,0.55));
  font-size: 14px;
}

.intake-physiology-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.intake-physiology-sub2 {
  font-size: 11px;
  color: var(--fg-muted, rgba(255,255,255,0.45));
  font-weight: 300;
  line-height: 1.4;
}

.intake-physiology-foot {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 4px;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .intake-physiology-grid {
    grid-template-columns: 1fr;
  }
  .intake-physiology-card {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    gap: 12px;
    padding: 14px 14px;
  }
  .intake-physiology-emblem {
    margin-bottom: 0;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }
}

/* ─── Returning-purchaser restore block (prominent secondary action) ─── */
.paywall-restore-block {
  margin-top: 14px;
  text-align: left;
}

.paywall-restore-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(244, 168, 189, 0.35);
  border-radius: 12px;
  color: #f3e8f9;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.paywall-restore-btn:hover {
  background: rgba(244, 114, 182, 0.1);
  border-color: rgba(244, 114, 182, 0.6);
}

.paywall-restore-btn:active {
  transform: translateY(1px);
}

.paywall-restore-icon {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-1px);
}

.paywall-restore-panel {
  margin-top: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(220, 200, 250, 0.1);
  border-radius: 12px;
}

.paywall-restore-help,
.paywall-preview-help {
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(220, 200, 230, 0.75);
  margin: 0 0 10px;
}

.paywall-restore-field {
  display: block;
  margin-bottom: 10px;
  text-align: left;
}

.paywall-restore-field > span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(220, 200, 230, 0.55);
  margin-bottom: 4px;
}

.paywall-restore-field input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid rgba(220, 200, 250, 0.18);
  border-radius: 10px;
  color: #f3e8f9;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.paywall-restore-field input:focus {
  border-color: rgba(244, 114, 182, 0.55);
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.15);
}

.paywall-restore-submit {
  width: 100%;
  padding: 11px 16px;
  background: linear-gradient(135deg, #F472B6 0%, #FFB6C1 100%);
  border: none;
  border-radius: 10px;
  color: #0D1117;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s, transform 0.15s;
}

.paywall-restore-submit:hover { filter: brightness(1.05); }
.paywall-restore-submit:active { transform: translateY(1px); }
.paywall-restore-submit:disabled { opacity: 0.6; cursor: wait; }

.paywall-restore-submit.ghost {
  background: transparent;
  color: #f3e8f9;
  border: 1px solid rgba(244, 168, 189, 0.45);
}

.paywall-restore-fallback {
  font-size: 0.72rem;
  color: rgba(220, 200, 230, 0.55);
  margin: 10px 0 0;
  line-height: 1.5;
}
.paywall-restore-fallback a {
  color: rgba(244, 114, 182, 0.95);
  text-decoration: underline;
}

.paywall-restore-msg {
  font-size: 0.78rem;
  line-height: 1.4;
  margin-top: 10px;
  min-height: 1.1em;
  color: rgba(220, 200, 230, 0.85);
}
/* Legacy plain-text tones kept for the preview-code line (which still
   uses the simple setMsg helper). The restore form now renders a full
   .restore-banner inside this same slot. */
.paywall-restore-msg[data-tone="error"]   { color: #ffb4b4; }
.paywall-restore-msg[data-tone="success"] { color: #b4f3c8; }
.paywall-restore-msg[data-tone="info"]    { color: rgba(220, 200, 230, 0.85); }

/* ─── Restore-form status banner (used in both /restore page and the
       paywall modal restore form). Designed to be impossible to miss
       — bordered, padded, with an icon and bold title. ──────────── */
.restore-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  line-height: 1.5;
}

.restore-banner-icon {
  font-size: 1.05rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.restore-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.restore-banner-text strong {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--fg, #f3e8f9);
}

.restore-banner-text span {
  color: var(--fg-soft, rgba(220, 200, 230, 0.85));
}

.restore-banner-cta {
  display: inline-block;
  margin-top: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: filter 0.2s, transform 0.15s;
  width: fit-content;
}
.restore-banner-cta:hover  { filter: brightness(1.07); }
.restore-banner-cta:active { transform: translateY(1px); }

/* Error — pink/red, bold, the "no purchase found" case the QA missed. */
.restore-banner--error {
  background: linear-gradient(135deg, rgba(255, 110, 110, 0.16), rgba(255, 110, 110, 0.04));
  border-color: rgba(255, 110, 110, 0.55);
  color: #ffe5e5;
}
.restore-banner--error .restore-banner-text strong { color: #ffd2d2; }
.restore-banner--error .restore-banner-cta {
  background: rgba(255, 110, 110, 0.18);
  border: 1px solid rgba(255, 110, 110, 0.65);
  color: #ffe5e5;
}

/* Success — green for the restored-access path. */
.restore-banner--success {
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.16), rgba(110, 231, 183, 0.04));
  border-color: rgba(110, 231, 183, 0.55);
  color: #d6fbe9;
}
.restore-banner--success .restore-banner-text strong { color: #ccfae0; }

/* Info — neutral, for the "Checking your purchase…" interim state. */
.restore-banner--info {
  background: linear-gradient(135deg, rgba(180, 200, 255, 0.12), rgba(180, 200, 255, 0.02));
  border-color: rgba(180, 200, 255, 0.4);
  color: rgba(220, 200, 230, 0.9);
}
.restore-banner--info .restore-banner-text strong { color: #e6ecff; }

/* High-contrast overrides so the banner is unmistakably visible on the
   /restore page card too — regardless of inherited card background. */
.card .restore-banner--error {
  background: #5a1d24 !important;
  border-color: #ffb4b4 !important;
  color: #ffe5e5 !important;
}
.card .restore-banner--error .restore-banner-text strong { color: #fff !important; }
.card .restore-banner--error .restore-banner-text span   { color: #ffe5e5 !important; }
.card .restore-banner--error .restore-banner-cta {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: #fff !important;
  color: #fff !important;
}
.card .restore-banner--success {
  background: #16412a !important;
  border-color: #b4f3d0 !important;
  color: #ccfae0 !important;
}
.card .restore-banner--success .restore-banner-text strong { color: #fff !important; }
.card .restore-banner--success .restore-banner-text span   { color: #d6fbe9 !important; }
.card .restore-banner--info {
  background: #1f2a3c !important;
  border-color: #c0d0ff !important;
  color: #e6ecff !important;
}
.card .restore-banner--info .restore-banner-text strong { color: #fff !important; }
.card .restore-banner--info .restore-banner-text span   { color: #dde3f2 !important; }

/* Plain-text fallback line printed alongside the banner. Always
   visible (high-contrast inline styles also set in JS), but this
   class is here for any CSS-targeted overrides QA might need. */
.restore-banner-fallback {
  /* Inline styles in JS take precedence; keep this rule for any
     future themed customization. */
}

/* Preview block — only shown when the server flags this as a non-prod deploy */
.paywall-preview-block {
  margin-top: 14px;
  text-align: left;
  font-size: 0.8rem;
  color: rgba(220, 200, 230, 0.65);
}
.paywall-preview-block summary {
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 8px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(220, 200, 230, 0.7);
}
.paywall-preview-block summary::before {
  content: "▸";
  font-size: 0.7rem;
  transition: transform 0.2s;
}
.paywall-preview-block details[open] summary::before {
  transform: rotate(90deg);
}
.paywall-preview-inner {
  padding: 12px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(220, 200, 250, 0.18);
  border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   Sex-branch theming — body.pepper-theme-male shifts the accent
   palette to a calm masculine blue. Female keeps the default pink
   palette (Pepper's signature). Both remain warm & premium.
   ═══════════════════════════════════════════════════════════════ */

body.pepper-theme-male {
  --primary:     #60A5FA;
  --primary-dim: rgba(96, 165, 250, 0.14);
  --primary-fg:  #0D1117;
  --accent:      #7DD3FC;
  --accent-dim:  rgba(125, 211, 252, 0.14);
}

body.pepper-theme-male .brand-icon {
  background: linear-gradient(135deg, #60A5FA, #818CF8);
}

body.pepper-theme-female {
  --primary:     #F472B6;
  --primary-dim: rgba(244, 114, 182, 0.14);
  --accent:      #C084FC;
  --accent-dim:  rgba(192, 132, 252, 0.14);
}

/* Subtle Pepper-character tint badge in the sidebar so the user feels
   the personalization without it being loud. */
.pepper-theme-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
}
.pepper-theme-indicator .pti-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

/* ─── Menopause Hub ─── */
.meno-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-bottom: 24px;
}
.meno-card { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.meno-card-wide { grid-column: 1 / -1; }
.meno-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.meno-card-title { display: flex; align-items: center; gap: 12px; }
.meno-card-title h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.meno-card-title .eyebrow { font-size: 10.5px; }
.meno-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.meno-icon svg { width: 18px; height: 18px; stroke: currentColor; }
.meno-icon-rose { background: var(--rose-dim); color: var(--rose); }
.meno-icon-violet { background: var(--accent-dim); color: var(--accent); }
.meno-icon-amber { background: var(--amber-dim); color: var(--amber); }
.meno-icon-cyan { background: rgba(34, 211, 238, 0.12); color: #22D3EE; }
.meno-icon-red { background: var(--red-dim); color: var(--red); }
.meno-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
}
.meno-chip-green { background: var(--green-dim); color: var(--green); }
.meno-chip-amber { background: var(--amber-dim); color: var(--amber); }
.meno-chip-red { background: var(--red-dim); color: var(--red); }
.meno-chip-muted { background: var(--bg-raised); color: var(--fg-soft); }
.meno-row-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.meno-stat {
  background: var(--bg-raised);
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meno-stat-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); }
.meno-stat-v { font-size: 13.5px; font-weight: 600; color: var(--fg); }
.meno-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meno-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.meno-field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--fg-soft); }
.meno-field > span { font-weight: 500; color: var(--fg-soft); }
.meno-field input, .meno-field select, .meno-field textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  color: var(--fg);
  font-family: inherit;
  transition: border 0.15s ease, background 0.15s ease;
}
.meno-field input:focus, .meno-field select:focus, .meno-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg);
}
.meno-edit-panel {
  margin-top: 4px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.meno-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-soft);
  cursor: pointer;
}
.meno-toggle input { accent-color: var(--primary); width: 16px; height: 16px; }
.meno-symptom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
}
.meno-symptom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--fg);
  cursor: pointer;
  border: 1px solid var(--border-soft);
  transition: border 0.15s ease, background 0.15s ease;
}
.meno-symptom:hover { border-color: var(--primary); }
.meno-symptom input { accent-color: var(--primary); }
.meno-context-copy {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg-soft);
  margin: 0;
}
.meno-context-list {
  margin: 4px 0 0;
  padding: 0 0 0 18px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--fg-soft);
}
.meno-context-list li { margin-bottom: 4px; }
.meno-safety-block { display: flex; flex-direction: column; gap: 8px; }
.meno-safety-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  font-weight: 600;
}
.meno-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 6px;
}
.meno-check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 8px 10px;
  background: var(--bg-raised);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--fg);
  line-height: 1.45;
  cursor: pointer;
  border: 1px solid var(--border-soft);
  transition: border 0.15s ease;
}
.meno-check:hover { border-color: var(--rose); }
.meno-check input { accent-color: var(--rose); margin-top: 2px; flex-shrink: 0; }
.meno-check-high {
  background: linear-gradient(to right, rgba(239,68,68,0.06), var(--bg-raised) 60%);
  border-color: rgba(239,68,68,0.18);
}
.meno-check-high:hover { border-color: var(--red); }
.meno-check-high input { accent-color: var(--red); }
.meno-tag-high {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  background: var(--red-dim);
  border-radius: 999px;
  vertical-align: middle;
}
.meno-flag-banner {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--amber-dim);
  border-left: 3px solid var(--amber);
  font-size: 13px;
  color: var(--fg);
  line-height: 1.55;
}
.meno-flag-banner-high {
  background: var(--red-dim);
  border-left-color: var(--red);
}
.meno-summary-pre {
  margin: 0;
  padding: 14px 16px;
  background: var(--bg-raised);
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow-y: auto;
}
.meno-fineprint {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin: 4px 0 0;
}

@media (max-width: 560px) {
  .meno-card-head { flex-direction: column; align-items: stretch; }
  .meno-card-head .meno-chip,
  .meno-card-head .meno-toggle,
  .meno-card-head .meno-actions { align-self: flex-start; }
  .meno-row-2 { grid-template-columns: 1fr 1fr; }
  .meno-symptom-grid { grid-template-columns: 1fr 1fr; }
  .meno-check-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   Native-app finish — standalone install / App Store wrapper polish
   ═══════════════════════════════════════════════════════════════ */

/* Tactile press feedback on every interactive control. On a touch device a
   button that visibly depresses is the single biggest "this feels native"
   signal — the web default (nothing) reads as a website. */
.btn:active,
.nav-link:active,
.tile:active,
button:active {
  transform: scale(0.97);
}
.btn, .nav-link, .tile, button { transition: transform 0.08s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s; }

/* Comfortable, accessible touch targets on phones (Apple HIG ≥ 44pt). */
@media (max-width: 880px) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.sm { min-height: 38px; }
  .nav-link { padding-top: 11px; padding-bottom: 11px; }
}

/* Keyboard focus ring that matches the brand, only when keyboard-navigating
   (focus-visible) so pointer users never see an outline. */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Momentum scrolling inside actual inner scroll regions only. `.main` is
   NOT itself scrollable (the document scrolls), so applying
   `-webkit-overflow-scrolling` to it is a no-op at best and on some iOS
   WKWebView versions confuses the touch scroll handler. Keep it scoped
   to the overlays that really do scroll internally. */
.modal-overlay, .paywall-overlay { -webkit-overflow-scrolling: touch; }

/* iOS WKWebView scroll insurance — make sure the document itself can
   always touch-scroll when the app is wrapped in a native shell.
   The `-webkit-touch-callout` feature query is iOS-only. */
@supports (-webkit-touch-callout: none) {
  html, body {
    /* Let the document scroll naturally; never trap it at viewport height. */
    height: auto;
    min-height: 100%;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  /* Belt-and-suspenders: the app grid must never become a non-scrolling
     fixed-height box on mobile. */
  .app {
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
  }
}

/* Honour the system "Reduce Motion" setting across the whole app, not just
   onboarding — required for a clean accessibility / App Store review. */
@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;
  }
  .grain-overlay { display: none; }
}
