/*
 * ════════════════════════════════════════════════════════════════
 *   SUPERHUMAN CODE — DESIGN SYSTEM
 *   Version: 1.0.0  |  Palette: Editorial Contrast (Gold)
 *
 *   Pattern: Cream body · Dark AI hero card · Gold accent · Dark nav
 *   Mirrors the landing page's editorial rhythm.
 *
 *   Usage:
 *     <link rel="stylesheet" href="/assets/design-system.css">
 *     <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet">
 * ════════════════════════════════════════════════════════════════
 */

/* ── Global text-selection lock ──────────────────────────────────
   Disable native iOS text-selection on the entire app. Was making
   onboarding / nutrition / training screens look like editable text
   when the user accidentally long-pressed (Copy / Writing Tools menu
   appearing over a question label).
   Re-enabled only on:
     • <input>, <textarea>, [contenteditable] — typing/editing
     • .selectable — opt-in marker for any surface that should allow
       copy (chat messages, code blocks, etc.)
   ───────────────────────────────────────────────────────────────── */
html, body {
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}
input, textarea, [contenteditable], [contenteditable="true"], .selectable, .selectable *,
.msg, .msg-group, .chat-msg, .chat-bubble, .message-bubble {
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  user-select: text;
}


/* ═══════════════════════════════════════════
   0. ACCESSIBILITY — Focus visible styles
═══════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid #7eb8d4;
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════
   1. TOKENS  (CSS Custom Properties)
   Source of truth — change here, changes everywhere.
═══════════════════════════════════════════ */
:root {

  /* ── Core Palette ── */
  --sc-deep:          #1A1714;          /* main dark bg — landing hero */
  --sc-black:         #252525;          /* elevated dark — cards, nav */
  --sc-amber:         #443A35;          /* warm dark — deep cards, muted */
  --sc-dune:          #E4DDCC;          /* primary light text on dark */
  --sc-cream:         #FAF8F4;          /* light page background */
  --sc-white:         #FEFEFE;          /* pure white — card surfaces */

  /* ── Gold System ── */
  --sc-gold:          #C9A96E;          /* primary accent — replaces all greens */
  --sc-gold-light:    #D4B87A;          /* lighter gold — gradients, highlights */
  --sc-gold-dark:     #9A7040;          /* darker gold — pressed states */
  --sc-gold-dim:      rgba(201,169,110,0.10);   /* subtle gold bg */
  --sc-gold-border:   rgba(201,169,110,0.22);   /* gold outline */
  --sc-gold-glow:     rgba(201,169,110,0.18);   /* gold shadow/glow */

  /* ── Text Hierarchy ── */
  --sc-text-primary:  #252525;          /* main text on light bg */
  --sc-text-secondary:#6B6560;          /* muted text on light bg */
  --sc-text-subtle:   #9B958E;          /* very muted on light bg */
  --sc-text-on-dark:  #E4DDCC;          /* primary text on dark card */
  --sc-text-dim-dark: rgba(228,221,204,0.52);  /* muted on dark card */

  /* ── Semantic / UI ── */
  --sc-bg-page:       var(--sc-cream);
  --sc-bg-card:       var(--sc-white);
  --sc-bg-card-dark:  var(--sc-black);
  --sc-bg-hero:       var(--sc-deep);
  --sc-bg-nav:        var(--sc-deep);
  --sc-border-card:   #EDE6DA;          /* warm cream border */
  --sc-border-dark:   rgba(228,221,204,0.06);  /* subtle border on dark */

  /* ── Typography ── */
  --sc-font-display:  'Libre Baskerville', 'Baskerville', Georgia, serif;
  --sc-font-body:     'Montserrat', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

  /* ── Border Radius ── */
  --sc-radius-xs:     8px;
  --sc-radius-sm:     12px;
  --sc-radius-md:     16px;
  --sc-radius-lg:     24px;
  --sc-radius-xl:     32px;
  --sc-radius-pill:   999px;

  /* ── Shadows ── */
  --sc-shadow-card:   0 2px 12px rgba(0,0,0,0.05);
  --sc-shadow-dark:   0 2px 10px rgba(0,0,0,0.35);
  --sc-shadow-gold:   0 4px 20px rgba(201,169,110,0.25);

  /* ── Transitions ── */
  --sc-transition:    0.2s ease;
  --sc-transition-slow: 0.4s ease;

  /* ── Spacing Scale ── */
  --sc-space-xs:  6px;
  --sc-space-sm:  12px;
  --sc-space-md:  18px;
  --sc-space-lg:  24px;
  --sc-space-xl:  36px;

  /* ─────────────────────────────────────────────────────────
     Un-prefixed aliases — lets landing.html + onboarding.html
     use short names (--deep, --gold …) without re-declaring them.
     App pages can use either set interchangeably.
  ───────────────────────────────────────────────────────── */
  --deep:         var(--sc-deep);
  --black:        var(--sc-black);
  --amber:        var(--sc-amber);
  --dune:         var(--sc-dune);
  --cream:        var(--sc-cream);
  --white:        var(--sc-white);
  --gold:         var(--sc-gold);
  --gold-light:   var(--sc-gold-light);
  --gold-dark:    var(--sc-gold-dark);
  --gold-dim:     rgba(201,169,110,0.15);   /* slightly richer than --sc-gold-dim for landing */
  --gray-600:     var(--sc-text-secondary);
  --gray-400:     var(--sc-text-subtle);
  --font-display: var(--sc-font-display);   /* 'Libre Baskerville', Georgia, serif */
  --sc-space-2xl: 56px;

}


/* ═══════════════════════════════════════════
   1b. CROSS-DOCUMENT PAGE TRANSITIONS
   Eliminates the white flash when switching tabs.
   Native: iOS 18+ / Chrome 126+ via @view-transition.
   Fallback: JS adds .sc-leaving for older browsers (see nav-shared.js).
═══════════════════════════════════════════ */

/* Native cross-document transition — browser handles page swap */
@view-transition {
  navigation: auto;
}

/* Content fades out on the old page */
::view-transition-old(root) {
  animation: _sc-fade-out 0.14s ease forwards;
}

/* Content fades in on the new page */
::view-transition-new(root) {
  animation: _sc-fade-in 0.14s ease forwards;
}

@keyframes _sc-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes _sc-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* JS fallback for older browsers: fade out before navigate */
body.sc-leaving {
  opacity: 0;
  transition: opacity 0.1s ease;
}

/* Fallback fade-in on page load */
@media (prefers-reduced-motion: no-preference) {
  body {
    animation: _sc-fade-in 0.14s ease forwards;
  }
  /* Suppress the load animation when native view transitions handle it */
  @supports (view-transition-name: none) {
    body { animation: none; }
  }
}


/* ═══════════════════════════════════════════
   2. BASE RESET
═══════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sc-font-body);
  background: var(--sc-bg-page);
  color: var(--sc-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img, svg { display: block; }
input, textarea, select { font-family: inherit; }


/* ═══════════════════════════════════════════
   3. TYPOGRAPHY
═══════════════════════════════════════════ */

/* Display / Brand headings */
.sc-display {
  font-family: var(--sc-font-display);
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sc-display-xl { font-size: 32px; line-height: 1.2; }
.sc-display-lg { font-size: 24px; line-height: 1.25; }
.sc-display-md { font-size: 20px; line-height: 1.3; }
.sc-display-sm { font-size: 16px; line-height: 1.35; }

/* Body type */
.sc-body-lg { font-size: 15px; font-weight: 500; line-height: 1.65; }
.sc-body-md { font-size: 13px; font-weight: 500; line-height: 1.6; }
.sc-body-sm { font-size: 12px; font-weight: 500; line-height: 1.6; }

/* Labels / UI text */
.sc-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.sc-label-sm {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Color utilities */
.sc-text-gold    { color: var(--sc-gold); }
.sc-text-dune    { color: var(--sc-dune); }
.sc-text-muted   { color: var(--sc-text-subtle); }
.sc-text-on-dark { color: var(--sc-text-on-dark); }


/* ═══════════════════════════════════════════
   4. PAGE SHELLS
═══════════════════════════════════════════ */

/* Standard light page */
.sc-page {
  min-height: 100vh;
  background: var(--sc-bg-page);
  color: var(--sc-text-primary);
  padding-bottom: 90px; /* bottom nav clearance */
}

/* Dark page (full dark mode) */
.sc-page-dark {
  min-height: 100vh;
  background: var(--sc-deep);
  color: var(--sc-dune);
  padding-bottom: 90px;
}


/* ═══════════════════════════════════════════
   5. CARDS
═══════════════════════════════════════════ */

/* Standard light card */
.sc-card {
  background: var(--sc-white);
  border-radius: var(--sc-radius-lg);
  box-shadow: var(--sc-shadow-card);
  padding: var(--sc-space-md);
}

/* Dark card (AI hero pattern) */
.sc-card-dark {
  background: linear-gradient(155deg, #1A1714 0%, #252525 55%, #2D2823 100%);
  border-radius: var(--sc-radius-lg);
  padding: var(--sc-space-md) var(--sc-space-md) 22px;
  position: relative;
  overflow: hidden;
}
.sc-card-dark::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,169,110,0.14) 0%, transparent 68%);
  pointer-events: none;
}

/* Elevated dark card */
.sc-card-elevated {
  background: var(--sc-black);
  border-radius: var(--sc-radius-md);
  box-shadow: var(--sc-shadow-dark);
  padding: var(--sc-space-md);
}

/* Warm cream card (soft warm bg) */
.sc-card-warm {
  background: #F5F0E8;
  border-radius: var(--sc-radius-md);
  padding: var(--sc-space-md);
}

/* Gold tinted card */
.sc-card-gold {
  background: var(--sc-gold-dim);
  border: 1px solid var(--sc-gold-border);
  border-radius: var(--sc-radius-md);
  padding: var(--sc-space-md);
}


/* ═══════════════════════════════════════════
   6. BUTTONS
═══════════════════════════════════════════ */

/* Primary — gold gradient */
.sc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--sc-radius-pill);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: all var(--sc-transition);
  cursor: pointer;
  border: none;
  font-family: var(--sc-font-body);
}

.sc-btn-primary {
  background: linear-gradient(135deg, var(--sc-gold), var(--sc-gold-dark));
  color: var(--sc-deep);
  box-shadow: 0 4px 16px rgba(201,169,110,0.3);
}
.sc-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(201,169,110,0.4);
}
.sc-btn-primary:active {
  transform: translateY(0);
}

/* Secondary — outlined */
.sc-btn-secondary {
  background: transparent;
  color: var(--sc-gold);
  border: 1.5px solid var(--sc-gold-border);
}
.sc-btn-secondary:hover {
  background: var(--sc-gold-dim);
  border-color: var(--sc-gold);
}

/* Ghost — subtle on light */
.sc-btn-ghost {
  background: transparent;
  color: var(--sc-text-secondary);
  border: 1.5px solid var(--sc-border-card);
}
.sc-btn-ghost:hover {
  color: var(--sc-text-primary);
  border-color: #c8bfb5;
}

/* Icon button */
.sc-btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sc-white);
  box-shadow: var(--sc-shadow-card);
  transition: all var(--sc-transition);
}
.sc-btn-icon:hover {
  background: var(--sc-gold-dim);
}
.sc-btn-icon svg {
  width: 16px; height: 16px;
  stroke: var(--sc-text-secondary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}


/* ═══════════════════════════════════════════
   7. PILLS & BADGES
═══════════════════════════════════════════ */

/* Live badge — AI is active */
.sc-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sc-gold-dim);
  border: 1px solid var(--sc-gold-border);
  border-radius: var(--sc-radius-pill);
  padding: 4px 12px;
}
.sc-badge-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--sc-gold);
  flex-shrink: 0;
}
.sc-badge-live-txt {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sc-gold);
}

/* Level badge (XP system) */
.sc-badge-level {
  font-size: 9px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--sc-radius-pill);
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--sc-gold), var(--sc-gold-dark));
  color: var(--sc-deep);
}

/* Streak pill */
.sc-pill-streak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--sc-white);
  border: 1px solid var(--sc-gold-border);
  border-radius: var(--sc-radius-pill);
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--sc-gold);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Tag pills (mission categories) */
.sc-tag {
  padding: 4px 9px;
  border-radius: var(--sc-radius-pill);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.sc-tag-body { background: rgba(201,169,110,0.10); color: var(--sc-gold-dark); }
.sc-tag-biz  { background: #EDE6DA; color: #6B6560; }
.sc-tag-mind { background: rgba(212,184,122,0.13); color: var(--sc-gold-dark); }
.sc-tag-rest { background: #EDF4F0; color: #5A897A; }
.sc-tag-gold { background: var(--sc-gold-dim); color: var(--sc-gold); border: 1px solid var(--sc-gold-border); }


/* ═══════════════════════════════════════════
   8. PROGRESS BARS
═══════════════════════════════════════════ */

/* Micro progress bar (vitals cards) */
.sc-bar-track {
  height: 3px;
  border-radius: var(--sc-radius-pill);
  background: var(--sc-border-card);
  overflow: hidden;
}

.sc-bar-fill {
  height: 100%;
  border-radius: var(--sc-radius-pill);
  background: linear-gradient(90deg, var(--sc-gold), var(--sc-gold-light));
  transition: width 0.6s ease;
}

/* XP progress bar */
.sc-xp-track {
  height: 7px;
  border-radius: var(--sc-radius-pill);
  background: var(--sc-border-card);
  overflow: hidden;
}

.sc-xp-fill {
  height: 100%;
  border-radius: var(--sc-radius-pill);
  background: linear-gradient(90deg, var(--sc-gold), var(--sc-gold-light));
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Ring / circular progress — use as CSS custom property */
.sc-ring {
  border-radius: 50%;
  background: conic-gradient(
    var(--sc-gold) calc(var(--pct, 70) * 1%),
    var(--sc-border-card) 0
  );
}


/* ═══════════════════════════════════════════
   9. MISSION / TASK ITEMS
═══════════════════════════════════════════ */

.sc-mission {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--sc-white);
  border-radius: var(--sc-radius-md);
  padding: 13px 14px;
  box-shadow: var(--sc-shadow-card);
  transition: all var(--sc-transition);
}
.sc-mission:active {
  transform: scale(0.99);
}

/* Checkbox */
.sc-check {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--sc-border-card);
  flex-shrink: 0;
  transition: all var(--sc-transition);
}
.sc-check.done {
  background: var(--sc-gold);
  border-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sc-check.done::after {
  content: '';
  width: 11px; height: 7px;
  border-left: 2.2px solid var(--sc-cream);
  border-bottom: 2.2px solid var(--sc-cream);
  transform: rotate(-45deg) translateY(-1px);
}

.sc-mission-body { flex: 1; min-width: 0; }
.sc-mission-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--sc-text-primary);
  margin-bottom: 2px;
  line-height: 1.3;
}
.sc-mission-name.done { text-decoration: line-through; color: var(--sc-text-subtle); }
.sc-mission-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--sc-text-subtle);
}


/* ═══════════════════════════════════════════
   10. VITALS / METRIC CARDS
═══════════════════════════════════════════ */

.sc-vitals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sc-vital {
  background: var(--sc-white);
  border-radius: 18px;
  padding: 14px 12px 13px;
  box-shadow: var(--sc-shadow-card);
}

.sc-vital-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sc-text-subtle);
  margin-bottom: 7px;
}

.sc-vital-value {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.8px;
  line-height: 1;
  color: var(--sc-text-primary);
}

.sc-vital-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--sc-gold);
  margin-top: 3px;
  margin-bottom: 8px;
}


/* ═══════════════════════════════════════════
   11. BOTTOM NAVIGATION
═══════════════════════════════════════════ */

.sc-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 82px;
  background: var(--sc-deep);
  border-top: 1px solid var(--sc-black);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: 16px;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sc-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(228,221,204,0.28);
  text-decoration: none;
  transition: color var(--sc-transition);
}
.sc-nav-item svg {
  width: 22px; height: 22px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  transition: stroke-width var(--sc-transition);
}
.sc-nav-item.active {
  color: var(--sc-gold);
}
.sc-nav-item.active svg {
  stroke-width: 2.3;
}
.sc-nav-item:active { opacity: 0.7; }


/* ═══════════════════════════════════════════
   12. CAPTURE / CTA BANNER
═══════════════════════════════════════════ */

.sc-capture {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--sc-radius-lg);
  padding: 18px;
  background: linear-gradient(135deg, var(--sc-gold) 0%, var(--sc-gold-dark) 100%);
  box-shadow: var(--sc-shadow-gold);
  cursor: pointer;
  transition: all var(--sc-transition);
}
.sc-capture:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(201,169,110,0.35); }
.sc-capture:active { transform: scale(0.99); }

.sc-capture-icon {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: rgba(26,23,20,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.sc-capture-body { flex: 1; }
.sc-capture-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--sc-deep);
  margin-bottom: 3px;
}
.sc-capture-sub {
  font-size: 11px;
  font-weight: 500;
  color: rgba(26,23,20,0.5);
}
.sc-capture-arrow {
  font-size: 22px;
  color: rgba(26,23,20,0.35);
}


/* ═══════════════════════════════════════════
   13. SECTION HEADERS
═══════════════════════════════════════════ */

.sc-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sc-section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--sc-text-primary);
}
.sc-section-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--sc-gold);
}

/* On dark background */
.sc-section-title-light { color: var(--sc-dune); }


/* ═══════════════════════════════════════════
   14. INPUT FIELDS
═══════════════════════════════════════════ */

.sc-input-wrap { display: flex; flex-direction: column; gap: 6px; }
.sc-input-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sc-text-subtle);
}
.sc-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--sc-radius-sm);
  border: 1.5px solid var(--sc-border-card);
  background: var(--sc-white);
  font-size: 14px;
  font-weight: 500;
  color: var(--sc-text-primary);
  font-family: var(--sc-font-body);
  outline: none;
  transition: border-color var(--sc-transition), box-shadow var(--sc-transition);
}
.sc-input:focus {
  border-color: var(--sc-gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.12);
}
.sc-input::placeholder { color: var(--sc-text-subtle); }

.sc-input-dark {
  background: var(--sc-black);
  border-color: rgba(228,221,204,0.08);
  color: var(--sc-dune);
}
.sc-input-dark:focus {
  border-color: var(--sc-gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.1);
}
.sc-input-dark::placeholder { color: var(--sc-amber); }


/* ═══════════════════════════════════════════
   15. AVATAR
═══════════════════════════════════════════ */

.sc-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sc-gold), var(--sc-gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: var(--sc-deep);
  flex-shrink: 0;
}

.sc-avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.sc-avatar-lg { width: 54px; height: 54px; font-size: 20px; }


/* ═══════════════════════════════════════════
   16. DIVIDERS
═══════════════════════════════════════════ */

.sc-divider {
  height: 1px;
  background: var(--sc-border-card);
  margin: var(--sc-space-md) 0;
}
.sc-divider-dark {
  height: 1px;
  background: var(--sc-border-dark);
  margin: var(--sc-space-md) 0;
}


/* ═══════════════════════════════════════════
   17. NOTIFICATION BANNER
═══════════════════════════════════════════ */

.sc-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--sc-gold-dim);
  border: 1px solid var(--sc-gold-border);
  border-radius: var(--sc-radius-md);
  padding: 14px 18px;
  text-decoration: none;
  transition: all var(--sc-transition);
}
.sc-banner:hover {
  background: rgba(201,169,110,0.15);
  border-color: var(--sc-gold);
}
.sc-banner-icon { font-size: 22px; flex-shrink: 0; }
.sc-banner-body { flex: 1; }
.sc-banner-title { font-size: 14px; font-weight: 700; color: var(--sc-gold); margin-bottom: 2px; }
.sc-banner-sub   { font-size: 12px; font-weight: 500; color: var(--sc-text-subtle); }
.sc-banner-arr   { color: var(--sc-gold); font-size: 20px; }


/* ═══════════════════════════════════════════
   18. PAGE HEADER (app top bar)
═══════════════════════════════════════════ */

.sc-app-header {
  padding: 8px var(--sc-space-md) 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--sc-bg-page);
  position: sticky;
  top: 0;
  z-index: 50;
}

.sc-app-logo {
  font-family: var(--sc-font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--sc-gold);
  letter-spacing: 0.04em;
}

.sc-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* ═══════════════════════════════════════════
   19. EMPTY STATE
═══════════════════════════════════════════ */

.sc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}
.sc-empty-icon { font-size: 40px; opacity: 0.4; }
.sc-empty-title {
  font-family: var(--sc-font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--sc-text-primary);
}
.sc-empty-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--sc-text-subtle);
  line-height: 1.6;
  max-width: 260px;
}


/* ═══════════════════════════════════════════
   20. LOADING STATES
═══════════════════════════════════════════ */

@keyframes sc-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.sc-skeleton {
  border-radius: 8px;
  background: var(--sc-border-card);
  animation: sc-pulse 1.8s ease-in-out infinite;
}

@keyframes sc-spin {
  to { transform: rotate(360deg); }
}

.sc-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--sc-gold-border);
  border-top-color: var(--sc-gold);
  border-radius: 50%;
  animation: sc-spin 0.7s linear infinite;
}


/* ═══════════════════════════════════════════
   21. UTILITY CLASSES
═══════════════════════════════════════════ */

/* Layout */
.sc-flex         { display: flex; }
.sc-flex-center  { display: flex; align-items: center; justify-content: center; }
.sc-flex-between { display: flex; align-items: center; justify-content: space-between; }
.sc-flex-col     { display: flex; flex-direction: column; }
.sc-gap-xs  { gap: var(--sc-space-xs); }
.sc-gap-sm  { gap: var(--sc-space-sm); }
.sc-gap-md  { gap: var(--sc-space-md); }

/* Padding */
.sc-px { padding-left: var(--sc-space-md); padding-right: var(--sc-space-md); }
.sc-py { padding-top: var(--sc-space-md); padding-bottom: var(--sc-space-md); }
.sc-p  { padding: var(--sc-space-md); }

/* Truncation */
.sc-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Gold gradient text */
.sc-gold-gradient {
  background: linear-gradient(135deg, var(--sc-gold), var(--sc-gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Hidden until JS sets display */
.sc-hidden { display: none !important; }

/* Tap-safe touch */
.sc-tappable {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
}


/* ═══════════════════════════════════════════
   22. APP SHELL + DRAWER (migrated from nav-shared.js)
═══════════════════════════════════════════ */

      /* ── Overlay ── */
      .drawer-overlay {
        position: fixed; inset: 0;
        background: rgba(26,23,20,0.55);
        z-index: 900;
        opacity: 0; pointer-events: none;
        transition: opacity 0.3s;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
      }
      .drawer-overlay.show { opacity: 1; pointer-events: all; }

      /* ── Side Drawer ── */
      .side-drawer {
        position: fixed; top: 0; right: 0;
        width: 300px; max-width: 90vw;
        height: 100vh;
        height: 100dvh;
        background: #1A1714;
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        overflow-y: auto; overflow-x: hidden;
        display: flex; flex-direction: column;
        box-shadow: -8px 0 40px rgba(0,0,0,0.4);
      }
      .side-drawer.open { transform: translateX(0); }

      /* ── Drawer Header ── */
      .drawer-header {
        display: flex; align-items: center; gap: 12px;
        padding: 52px 20px 20px;
        border-bottom: 1px solid rgba(228,221,204,0.06);
        flex-shrink: 0;
      }
      .drawer-avatar {
        width: 44px; height: 44px; border-radius: 50%;
        background: linear-gradient(135deg, #C9A96E, #9A7040);
        display: flex; align-items: center; justify-content: center;
        font-size: 16px; font-weight: 900; color: #1A1714;
        flex-shrink: 0;
      }
      .drawer-user-info { flex: 1; min-width: 0; }
      .drawer-user-name {
        font-size: 15px; font-weight: 700;
        color: #E4DDCC; margin-bottom: 2px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      }
      .drawer-user-role { font-size: 11px; font-weight: 600; color: #6B6560; }
      .drawer-close-btn {
        width: 34px; height: 34px; border-radius: 50%;
        background: rgba(228,221,204,0.08);
        border: none; cursor: pointer;
        font-size: 13px; color: #6B6560;
        flex-shrink: 0; display: flex; align-items: center; justify-content: center;
        transition: all 0.2s;
      }
      .drawer-close-btn:hover { background: rgba(228,221,204,0.15); color: #E4DDCC; }

      /* ── Drawer Body ── */
      .drawer-body { flex: 1; padding: 12px 12px 40px; overflow-y: auto; }

      .drawer-section-label {
        font-size: 9px; font-weight: 800;
        letter-spacing: 0.2em; text-transform: uppercase;
        color: rgba(201,169,110,0.35);
        padding: 14px 8px 6px;
      }
      .drawer-link {
        display: flex; align-items: center; gap: 12px;
        padding: 11px 12px; border-radius: 12px;
        text-decoration: none;
        font-size: 14px; font-weight: 600; color: #E4DDCC;
        transition: all 0.18s; margin-bottom: 2px;
      }
      .drawer-link:hover, .drawer-link:active {
        background: rgba(228,221,204,0.07);
        color: #C9A96E;
      }
      .drawer-link-icon { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
      .drawer-link-lab { color: rgba(201,169,110,0.8); }
      .drawer-link-lab:hover { color: #C9A96E; }

      .drawer-divider {
        height: 1px; background: rgba(228,221,204,0.06);
        margin: 10px 8px;
      }
      .drawer-signout-btn {
        width: 100%; padding: 12px; border-radius: 12px;
        background: rgba(228,221,204,0.05);
        border: 1px solid rgba(228,221,204,0.08);
        font-size: 13px; font-weight: 700; color: #6B6560;
        cursor: pointer; text-align: left;
        transition: all 0.2s; margin-top: 6px;
      }
      .drawer-signout-btn:hover {
        background: rgba(228,221,204,0.1); color: #E4DDCC;
      }

      /* ── App Shell ── */
      html, body { height: 100%; }
      body {
        margin: 0;
        font-family: 'Montserrat', -apple-system, 'Segoe UI', sans-serif;
        background: #FAF8F4;
        color: #252525;
        -webkit-font-smoothing: antialiased;
      }
      /* Only lock scroll on app tab pages, not landing.html */
      body:has(.app-shell) { overflow: hidden; }
      .app-shell {
        height: 100vh;
        height: 100dvh;
        min-height: 100svh;
        display: flex; flex-direction: column;
        max-width: 480px; margin: 0 auto;
        position: relative;
        background: #FAF8F4;
        overflow: hidden;
      }
      .app-topbar {
        display: flex; align-items: center; justify-content: center;
        padding: max(52px, calc(env(safe-area-inset-top, 0px) + 20px)) 20px 10px;
        min-height: 70px;
        flex-shrink: 0;
        background: #FAF8F4;
        position: relative;
      }
      .app-logo {
        position: relative;
        left: auto; top: auto; transform: none;
        display: flex; align-items: center; gap: 8px;
        font-family: 'Montserrat', -apple-system, 'Segoe UI', sans-serif;
        font-size: 12px; font-weight: 800;
        color: #252525; letter-spacing: 0.13em;
        text-transform: uppercase;
        white-space: nowrap;
        pointer-events: none;
      }
      .app-logo-mark {
        width: 26px; height: 26px; flex-shrink: 0;
      }
      .hamburger-btn {
        width: 38px; height: 38px; border-radius: 50%;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        border: none; cursor: pointer;
        display: flex; align-items: center; justify-content: center;
        flex-direction: column; gap: 4px;
        padding: 0; transition: all 0.2s;
        position: absolute;
        right: 16px;
        top: calc(50% + 14px);
        transform: translateY(-50%);
        z-index: 2;
      }
      .hamburger-btn span {
        display: block; width: 16px; height: 2px;
        background: #6B6560; border-radius: 2px;
        transition: all 0.2s;
      }
      .hamburger-btn:hover { background: #F5F0E8; }
      .hamburger-btn:hover span { background: #C9A96E; }

      .page-scroll {
        flex: 1;
        overflow-y: auto; overflow-x: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 100px;
      }
      .page-scroll::-webkit-scrollbar { display: none; }

      /* ── Bottom Nav ── */
      .sc-bottom-nav {
        position: absolute; bottom: 0; left: 0; right: 0;
        height: 82px;
        background: #1A1714;
        border-top: 1px solid #252525;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        padding-bottom: env(safe-area-inset-bottom, 8px);
        z-index: 100;
      }
      .sc-nav-item {
        display: flex; flex-direction: column;
        align-items: center; justify-content: center;
        gap: 4px; font-size: 10px; font-weight: 600;
        color: rgba(228,221,204,0.28);
        text-decoration: none; transition: color 0.2s;
        -webkit-tap-highlight-color: transparent;
      }
      .sc-nav-item svg {
        width: 22px; height: 22px;
        stroke: currentColor; fill: none;
        stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
        transition: stroke-width 0.2s;
      }
      .sc-nav-item.active { color: #C9A96E; }
      .sc-nav-item.active svg { stroke-width: 2.3; }
      .sc-nav-item:active { opacity: 0.7; }

      /* ── Common card patterns ── */
      .hero-card {
        margin: 0 18px 16px;
        border-radius: 22px; padding: 20px 20px 22px;
        background: linear-gradient(155deg, #1A1714 0%, #252525 55%, #2D2823 100%);
        position: relative; overflow: hidden;
      }
      .hero-card::before {
        content: '';
        position: absolute; top: -40px; right: -40px;
        width: 160px; height: 160px; border-radius: 50%;
        background: radial-gradient(circle, rgba(201,169,110,0.14) 0%, transparent 68%);
        pointer-events: none;
      }
      .live-badge {
        display: inline-flex; align-items: center; gap: 6px;
        background: rgba(201,169,110,0.08);
        border: 1px solid rgba(201,169,110,0.22);
        border-radius: 999px; padding: 4px 12px;
        margin-bottom: 12px;
      }
      .live-dot { width: 6px; height: 6px; border-radius: 50%; background: #C9A96E; flex-shrink: 0; }
      .live-txt { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #C9A96E; }
      .hero-greeting {
        font-family: 'Libre Baskerville', Georgia, serif;
        font-size: 20px; font-weight: 700; letter-spacing: -0.3px;
        color: #E4DDCC; margin-bottom: 8px; position: relative; z-index: 1;
      }
      .hero-msg {
        font-size: 13px; font-weight: 500; line-height: 1.65;
        color: rgba(228,221,204,0.52); position: relative; z-index: 1;
      }
      .hero-msg strong { color: rgba(228,221,204,0.9); }
      .hero-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 14px 0; }
      .hero-next {
        display: flex; align-items: center; gap: 8px;
        font-size: 11px; font-weight: 700; color: #C9A96E;
      }
      .hero-next-dot { width: 4px; height: 4px; border-radius: 50%; background: #C9A96E; }

      /* Metric cards */
      .metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 18px 16px; }
      .metric-card {
        background: #fff; border-radius: 18px;
        padding: 14px 12px 13px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
      }
      .metric-lbl {
        font-size: 9.5px; font-weight: 700;
        letter-spacing: 0.1em; text-transform: uppercase;
        color: #9B958E; margin-bottom: 7px;
      }
      .metric-val {
        font-size: 24px; font-weight: 900;
        letter-spacing: -0.8px; line-height: 1; color: #252525;
      }
      .metric-sub { font-size: 10px; font-weight: 600; color: #C9A96E; margin-top: 3px; margin-bottom: 8px; }
      .bar-track { height: 3px; border-radius: 999px; background: #EDE6DA; overflow: hidden; }
      .bar-fill {
        height: 100%; border-radius: 999px;
        background: linear-gradient(90deg, #C9A96E, #D4B87A);
        transition: width 0.6s ease;
      }

      /* Section header */
      .sec-hd {
        display: flex; align-items: center; justify-content: space-between;
        padding: 4px 22px 12px;
      }
      .sec-title { font-size: 11px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; color: #252525; }
      .sec-link { font-size: 11px; font-weight: 600; color: #C9A96E; text-decoration: none; }

      /* White content card */
      .content-card {
        margin: 0 18px; border-radius: 18px;
        background: #fff; padding: 14px 16px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        margin-bottom: 12px;
      }
      .content-card-title { font-size: 13px; font-weight: 800; color: #252525; margin-bottom: 2px; }
      .content-card-sub { font-size: 11px; color: #9B958E; line-height: 1.55; }

      /* Row divider */
      .card-row {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        padding: 10px 0; border-top: 1px solid #F3EDE7;
      }
      .card-row:first-of-type { border-top: none; }
      .card-row b { font-size: 13px; color: #252525; font-weight: 700; }
      .card-row small { display: block; font-size: 11px; color: #9B958E; margin-top: 2px; }
      .mini-btn {
        border: 1px solid #E6DDD7; border-radius: 999px;
        background: #fff; font-size: 11px; font-weight: 700;
        color: #776961; padding: 6px 12px; white-space: nowrap;
        cursor: pointer; transition: all 0.2s; flex-shrink: 0;
        font-family: inherit;
      }
      .mini-btn:hover { background: rgba(201,169,110,0.08); border-color: #C9A96E; color: #C9A96E; }
      .mini-btn:active { transform: scale(0.97); }

      /* Capture CTA */
      .capture-cta {
        margin: 0 18px 14px;
        display: flex; align-items: center; gap: 14px;
        border-radius: 20px; padding: 18px;
        background: linear-gradient(135deg, #C9A96E 0%, #9A7040 100%);
        box-shadow: 0 4px 20px rgba(201,169,110,0.25);
        text-decoration: none; cursor: pointer;
        transition: all 0.2s;
        -webkit-tap-highlight-color: transparent;
      }
      .capture-cta:active { transform: scale(0.99); }
      .capture-icon {
        width: 44px; height: 44px; border-radius: 13px;
        background: rgba(26,23,20,0.18);
        display: flex; align-items: center; justify-content: center;
        font-size: 20px; flex-shrink: 0;
      }
      .capture-body { flex: 1; }
      .capture-title { font-size: 14px; font-weight: 800; color: #1A1714; margin-bottom: 3px; }
      .capture-sub { font-size: 11px; font-weight: 500; color: rgba(26,23,20,0.5); }
      .capture-arr { font-size: 22px; color: rgba(26,23,20,0.35); }

      /* XP card */
      .xp-card { margin: 0 18px 28px; }
      .xp-inner {
        background: #fff; border-radius: 18px; padding: 14px 16px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
      }
      .xp-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
      .xp-left { display: flex; align-items: center; gap: 8px; }
      .xp-badge {
        font-size: 9px; font-weight: 800; padding: 3px 10px;
        border-radius: 999px; letter-spacing: 0.08em;
        background: linear-gradient(135deg, #C9A96E, #9A7040); color: #1A1714;
      }
      .xp-lvl-name { font-size: 13px; font-weight: 800; color: #252525; }
      .xp-pts { font-size: 11px; font-weight: 600; color: #9B958E; }
      .xp-bar-track { height: 7px; border-radius: 999px; background: #EDE6DA; overflow: hidden; }
      .xp-bar-fill {
        height: 100%; border-radius: 999px;
        background: linear-gradient(90deg, #C9A96E, #D4B87A);
        transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
      }

      /* Date row */
      .date-row { padding: 6px 22px 14px; display: flex; align-items: center; gap: 10px; }
      .date-text { font-size: 12px; font-weight: 600; color: #6B6560; }
      .streak-pill {
        display: inline-flex; align-items: center; gap: 5px;
        background: #fff; border: 1px solid rgba(201,169,110,0.28);
        border-radius: 999px; padding: 4px 12px;
        font-size: 11px; font-weight: 800; color: #C9A96E;
        box-shadow: 0 2px 6px rgba(0,0,0,0.05);
      }

      /* Inner segmented control */
      .seg-control {
        margin: 0 18px 14px;
        padding: 4px; border-radius: 13px;
        background: #EDE7E1;
        display: grid; gap: 4px;
      }
      .seg-control.three { grid-template-columns: repeat(3, 1fr); }
      .seg-control.two { grid-template-columns: repeat(2, 1fr); }
      .seg-btn {
        border: none; border-radius: 10px;
        font-size: 12px; font-weight: 700;
        color: #A4978F; padding: 9px 6px;
        background: transparent; cursor: pointer;
        transition: all 0.2s; font-family: inherit;
      }
      .seg-btn.active {
        background: #fff; color: #252525;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
      }

      /* Empty state */
      .empty-state {
        text-align: center; padding: 40px 24px;
        display: flex; flex-direction: column;
        align-items: center; gap: 10px;
      }
      .empty-icon { font-size: 36px; opacity: 0.4; }
      .empty-title { font-size: 16px; font-weight: 700; color: #252525; }
      .empty-sub { font-size: 12px; color: #9B958E; line-height: 1.6; max-width: 240px; }
      .empty-btn {
        margin-top: 4px;
        padding: 12px 24px; border-radius: 999px;
        background: linear-gradient(135deg, #C9A96E, #9A7040);
        color: #1A1714; font-size: 13px; font-weight: 700;
        border: none; cursor: pointer; font-family: inherit;
        box-shadow: 0 4px 16px rgba(201,169,110,0.3);
        transition: all 0.2s;
      }

      /* Skeleton loader */
      @keyframes sc-pulse { 0%,100%{opacity:.3}50%{opacity:.7} }
      .skeleton {
        border-radius: 8px; background: #EDE6DA;
        animation: sc-pulse 1.8s ease-in-out infinite;
      }
