:root {
  --bg: #0A0C10;
  --bg-elevated: #10131A;
  --card: #141822;
  --card-hover: #181D29;
  --line: #242B38;
  --line-soft: #1B212C;

  --ink: #F3F4F6;
  --ink-dim: #AEB4C0;
  --ink-faint: #6B7280;

  /* Neon-on-black: saturated cores, heavy coloured halos. The glow is
     what makes the data feel alive, so every accent ships with one. */
  --forge: #FF7518;
  --forge-hot: #FFA23D;
  --forge-deep: #D4500F;
  --forge-glow: rgba(255, 117, 24, 0.55);
  --success: #2BFF9B;
  --success-dim: rgba(43, 255, 155, 0.14);
  --success-glow: rgba(43, 255, 155, 0.5);
  --sleep: #B06BFF;
  --sleep-dim: rgba(176, 107, 255, 0.16);
  --sleep-glow: rgba(176, 107, 255, 0.5);
  --hydro: #27D7FF;
  --hydro-dim: rgba(39, 215, 255, 0.16);
  --hydro-glow: rgba(39, 215, 255, 0.5);
  --danger: #FF5F4F;
  --warn: #FFC24B;
  --warn-dim: rgba(255, 194, 75, 0.16);
  --missed: #3A4152;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --font-display: "Archivo Black", "Impact", "Arial Black", "Helvetica Neue", sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; overscroll-behavior-y: contain; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* A card can never widen its grid column past the screen. */
.grid > * { min-width: 0; }

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

::selection { background: var(--forge-glow); }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
  padding: 0 24px;
  background: rgba(10, 12, 16, 0.86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  padding-top: env(safe-area-inset-top);
  height: calc(64px + env(safe-area-inset-top));
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.brand-mark { width: 28px; height: 28px; color: var(--forge); flex-shrink: 0; filter: drop-shadow(0 0 8px var(--forge-glow)); }
.brand .xxi { color: var(--forge); text-shadow: 0 0 16px var(--forge-glow); }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-link {
  position: relative;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.nav-link:hover { color: var(--ink); background: var(--card); }
.nav-link.active { color: var(--forge); }
.nav-link.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  background: var(--forge); border-radius: 2px; box-shadow: 0 0 10px var(--forge-glow);
}

.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.icon-btn {
  position: relative;
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-dim); background: transparent;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--card); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--forge); box-shadow: 0 0 8px var(--forge-glow);
}

.upload-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.4px;
  padding: 8px 14px; border-radius: 999px;
  color: var(--forge); background: rgba(255,117,24,0.1);
  border: 1px solid rgba(255,117,24,0.3);
  white-space: nowrap;
  transition: background .15s ease, box-shadow .15s ease;
}
.upload-btn:hover { background: rgba(255,117,24,0.18); box-shadow: 0 0 16px rgba(255,117,24,0.25); }
.upload-btn svg { width: 14px; height: 14px; }
.upload-btn.busy { opacity: 0.6; pointer-events: none; }

.user-wrap { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 4px 4px; border-radius: 999px;
  border: 1px solid transparent; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left;
}
.user-chip:hover, .user-chip[aria-expanded="true"] { border-color: var(--line-soft); background: var(--card); }
.user-caret { display: flex; color: var(--ink-faint); }
.user-caret svg { width: 14px; height: 14px; }
.user-chip[aria-expanded="true"] .user-caret { transform: rotate(180deg); }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 300;
  background: linear-gradient(180deg, #151A24, #0E1219); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; box-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.4);
}
.um-label { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-faint); }
.um-email { font-size: 13px; font-weight: 700; color: var(--ink); margin-top: 3px; word-break: break-all; }
.um-role { display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--forge); border: 1px solid rgba(255,117,24,0.4); border-radius: 999px; padding: 2px 8px; }
.um-note { margin-top: 10px; font-size: 12px; color: var(--ink-dim); }
.um-logout {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 12px; border-radius: 10px;
  background: rgba(255,117,24,0.1); border: 1px solid rgba(255,117,24,0.35); color: var(--forge-hot); font-weight: 700; font-size: 13px; text-decoration: none;
}
.um-logout:hover { background: rgba(255,117,24,0.2); box-shadow: 0 0 14px rgba(255,117,24,0.25); }
.um-logout svg { width: 16px; height: 16px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 12px; color: #1A0A00;
  background: linear-gradient(150deg, var(--forge-hot), var(--forge-deep));
  box-shadow: 0 0 14px var(--forge-glow), inset 0 0 0 2px rgba(255,255,255,0.15);
}
.user-name { font-size: 13px; font-weight: 700; line-height: 1.1; }
.user-sub { font-size: 11px; color: var(--forge); font-weight: 600; margin-top: 2px; }

@media (max-width: 860px) {
  .user-name, .user-sub, .user-caret { display: none; }
  .upload-btn span { display: none; }
  .upload-btn { padding: 8px 10px; }
  .topbar { gap: 12px; padding: 0 14px; }
}

/* ---------- Layout ---------- */

.page { max-width: 1480px; margin: 0 auto; padding: 20px 24px 40px; }

.grid { display: grid; gap: 16px; }
.g-7 { grid-template-columns: repeat(7, 1fr); }
.g-6 { grid-template-columns: repeat(6, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-2-1-1 { grid-template-columns: 1.3fr 1fr 1fr; }
.g-1-1-1 { grid-template-columns: 1fr 1fr 1fr; }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.mt { margin-top: 16px; }

@media (max-width: 1180px) {
  .g-7 { grid-template-columns: repeat(4, 1fr); }
  .g-6, .g-5 { grid-template-columns: repeat(3, 1fr); }
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-1-1-1, .g-3 { grid-template-columns: 1fr 1fr; }
  /* three unequal cards: stack rather than leave one dangling in a half column */
  .g-2-1-1, .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .g-7, .g-6, .g-5, .g-4, .g-3, .g-2, .g-1-1-1 { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 14px 14px 32px; }
}
@media (max-width: 460px) {
  .g-7, .g-6, .g-5, .g-4, .g-3, .g-2, .g-2-1-1, .g-1-1-1 { grid-template-columns: 1fr; }
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0) 60%),
    var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 14%; right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  pointer-events: none;
}
.card:hover {
  border-color: rgba(255,117,24,0.28);
  box-shadow: var(--shadow-card), 0 0 28px rgba(255,117,24,0.1);
  transform: translateY(-1px);
}

/* A card with a photo backdrop fading into the card colour. */
.card.photo { overflow: hidden; }
.card.photo > .photo-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center right;
  opacity: 0.55;
}
.card.photo > .photo-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--card) 0%, rgba(20,24,34,0.85) 45%, rgba(20,24,34,0.35) 100%);
}
.card.photo > * { position: relative; z-index: 1; }
.card.photo > .photo-bg { z-index: 0; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink);
}
.card-title svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--forge); filter: drop-shadow(0 0 6px var(--forge-glow)); }
.card-title .sub { font-family: var(--font-body); font-size: 11px; letter-spacing: 0.4px; text-transform: none; color: var(--ink-faint); font-weight: 500; margin-left: 4px; }
.card-action { font-size: 12px; font-weight: 600; color: var(--forge); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.card-action svg { width: 13px; height: 13px; }

.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 26px 0 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.section-title svg { width: 16px; height: 16px; color: var(--forge); filter: drop-shadow(0 0 6px var(--forge-glow)); }
.section-title .sub { font-family: var(--font-body); font-size: 11px; letter-spacing: 0.4px; text-transform: none; color: var(--ink-faint); font-weight: 500; margin-left: 6px; }

/* ---------- KPI cards ---------- */

.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-top { display: flex; align-items: center; gap: 12px; }
.kpi-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: inset 0 0 0 1.5px currentColor, 0 0 16px -4px currentColor;
}
.kpi-icon svg { width: 18px; height: 18px; filter: drop-shadow(0 0 5px currentColor); }
.kpi-label { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--ink-dim); }
.kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.2px;
  margin-top: 4px;
  text-shadow: 0 0 22px var(--glow, rgba(255,117,24,0.45));
}
.kpi-value .unit { font-size: 14px; color: var(--ink-dim); font-family: var(--font-body); font-weight: 600; margin-left: 4px; text-shadow: none; }
.kpi-value.small { font-size: 18px; }
.kpi-sub { font-size: 12px; color: var(--ink-dim); }
.kpi-sub .status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.kpi-sub .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.kpi-bar-row { display: flex; align-items: center; gap: 10px; }
.kpi-bar {
  flex: 1; height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.kpi-bar > span {
  display: block; height: 100%; border-radius: inherit;
  box-shadow: 0 0 12px -1px currentColor, 0 0 20px -4px currentColor;
  filter: saturate(1.2) brightness(1.08);
}
.kpi-pct { font-size: 12px; font-weight: 700; color: var(--ink-dim); min-width: 34px; text-align: right; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge.up { color: var(--success); background: var(--success-dim); box-shadow: 0 0 12px rgba(43,255,155,0.22), inset 0 0 0 1px rgba(43,255,155,0.28); }
.badge.down { color: var(--danger); background: rgba(255,95,79,0.14); box-shadow: 0 0 12px rgba(255,95,79,0.2), inset 0 0 0 1px rgba(255,95,79,0.28); }
.badge.warn { color: var(--warn); background: var(--warn-dim); box-shadow: 0 0 12px rgba(255,194,75,0.2), inset 0 0 0 1px rgba(255,194,75,0.3); }
.badge.forge { color: var(--forge-hot); background: rgba(255,117,24,0.12); box-shadow: inset 0 0 0 1px rgba(255,117,24,0.35); }
.badge.neutral { color: var(--ink-dim); background: var(--line-soft); }
.badge.muted { color: var(--ink-faint); background: var(--line-soft); font-weight: 600; }
.badge svg { width: 11px; height: 11px; }

/* An estimated value must never read as a measured one. */
.est { position: relative; color: var(--warn); text-shadow: 0 0 16px rgba(255,194,75,0.45); }
.est-mark, .confirmed-mark, .proxy-mark {
  font-size: 0.6em; font-family: var(--font-body); font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; opacity: 0.85; margin-left: 6px; text-shadow: none; vertical-align: middle;
}
.est-mark { color: var(--warn); }
/* A total the user confirmed: firmer than an estimate, softer than a label. */
.confirmed { color: var(--hydro); text-shadow: 0 0 16px rgba(39,215,255,0.4); }
.confirmed-mark { color: var(--hydro); }
/* A proxy measurement (CPAP usage standing in for sleep). */
.proxy-mark { color: var(--sleep); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line-soft);
  padding: 36px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 210px;
  background: #0D0F14;
}
.hero-photo {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center right; background-repeat: no-repeat;
}
.hero-scrim {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(90deg, rgba(10,12,16,0.97) 0%, rgba(10,12,16,0.9) 28%, rgba(10,12,16,0.45) 50%, rgba(10,12,16,0.05) 75%),
    linear-gradient(0deg, rgba(10,12,16,0.55), transparent 35%);
}
.hero-copy { max-width: 600px; position: relative; z-index: 2; }
.hero-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 3.5px; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 10px; line-height: 1.7;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.8vw, 64px);
  line-height: 0.95;
  margin: 0 0 14px;
  text-transform: uppercase;
  text-shadow: 0 2px 30px rgba(0,0,0,0.6);
}
.hero-title .accent {
  color: var(--forge);
  text-shadow: 0 0 22px var(--forge-glow), 0 0 50px rgba(255,117,24,0.45);
}
.hero-sub { color: var(--ink-dim); font-size: 14px; line-height: 1.6; max-width: 470px; margin: 0; }
.hero-cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.cta-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--forge); color: #1A0A00;
  font-weight: 800; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  padding: 11px 20px; border-radius: 6px;
  box-shadow: 0 6px 20px var(--forge-glow);
  transition: transform .12s ease, box-shadow .12s ease;
  cursor: pointer;
}
.cta-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 26px var(--forge-glow); }
.cta-btn svg { width: 14px; height: 14px; }
.cta-btn.ghost { background: rgba(10,12,16,0.5); color: var(--ink); border: 1px solid rgba(255,255,255,0.2); box-shadow: none; backdrop-filter: blur(4px); }
.cta-btn.ghost:hover { border-color: var(--ink-dim); }
.cta-btn.sm { padding: 8px 14px; font-size: 11px; }

.hero-side {
  position: relative; z-index: 2;
  background: rgba(10, 12, 16, 0.62);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: flex; align-items: center; gap: 20px; flex-shrink: 0;
}
.ring-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--ink-dim); text-transform: uppercase; margin-bottom: 8px; }
.ring-stats { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.ring-stats b { font-family: var(--font-display); font-size: 18px; color: var(--ink); font-weight: 400; margin-right: 8px; }
.ring-mini { width: 96px; height: 96px; flex-shrink: 0; }

.quote-block {
  position: relative; z-index: 2;
  background: rgba(10,12,16,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  padding: 16px 20px 18px;
  font-size: 12.5px; letter-spacing: 1px; text-transform: uppercase; line-height: 1.7;
  color: var(--ink);
  border-radius: var(--radius-md);
  max-width: 300px;
  flex-shrink: 0;
}
.quote-block::before { content: "\201C"; color: var(--forge); font-size: 26px; font-family: Georgia, serif; line-height: 0; margin-right: 6px; }
.quote-block::after { content: ""; position: absolute; left: 20px; bottom: 0; width: 44px; height: 3px; background: var(--forge); box-shadow: 0 0 10px var(--forge-glow); }
.quote-block .hl { color: var(--forge); }

@media (max-width: 900px) {
  .hero { flex-direction: column; align-items: stretch; padding: 26px 20px; min-height: 0; }
  .hero-photo { background-position: 70% center; }
  .hero-scrim { background: linear-gradient(90deg, rgba(10,12,16,0.92), rgba(10,12,16,0.7)); }
  .hero-side, .quote-block { max-width: none; }
}

/* ---------- 21-day timeline ---------- */

.timeline-card { margin-bottom: 16px; }
.timeline-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.timeline-head h2 { font-family: var(--font-display); font-size: 14px; letter-spacing: 2px; text-transform: uppercase; margin: 0; }
.timeline-pct { font-size: 12px; color: var(--ink-dim); letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.timeline-pct b { color: var(--forge); font-family: var(--font-display); font-size: 18px; margin-left: 10px; text-shadow: 0 0 14px var(--forge-glow); }

.timeline-track { position: relative; display: flex; justify-content: space-between; gap: 2px; padding-top: 4px; }
.timeline-rail { position: absolute; top: 20px; left: 20px; right: 20px; height: 2px; background: var(--line); z-index: 0; }
.timeline-rail-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: linear-gradient(90deg, var(--forge-deep), var(--forge), var(--forge-hot));
  border-radius: 2px;
  box-shadow: 0 0 10px var(--forge-glow), 0 0 22px rgba(255,117,24,0.35);
}
.day-node { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 0; cursor: pointer; }
.day-node-circle {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  border: 2px solid var(--line); background: var(--bg-elevated); color: var(--ink-faint);
  transition: transform .12s ease;
}
.day-node-circle svg { width: 16px; height: 16px; }
.day-node:hover .day-node-circle { transform: scale(1.08); }
.day-node.selected .day-node-circle { outline: 2px solid var(--ink); outline-offset: 2px; }
.day-node-label { font-size: 10px; color: var(--ink-faint); letter-spacing: 0.3px; }
.day-node.complete .day-node-circle, .day-node.recovery .day-node-circle {
  background: linear-gradient(160deg, var(--forge-hot), var(--forge));
  border-color: var(--forge-hot); color: #1A0A00;
  box-shadow: 0 0 16px var(--forge-glow), 0 0 34px rgba(255,117,24,0.4);
}
.day-node.recovery .day-node-circle { background: linear-gradient(160deg, #FFB864, var(--forge)); }
.day-node.active .day-node-circle {
  border-color: var(--forge-hot); color: var(--forge-hot);
  text-shadow: 0 0 12px var(--forge-glow);
  box-shadow: 0 0 0 4px rgba(255,117,24,0.2), 0 0 26px rgba(255,117,24,0.45);
  animation: pulse 2s ease-in-out infinite;
}
.day-node.missed .day-node-circle { border-color: var(--danger); color: var(--danger); background: rgba(255,95,79,0.08); }
.day-node.future .day-node-circle { opacity: 0.45; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255,117,24,0.2), 0 0 26px rgba(255,117,24,0.45); }
  50% { box-shadow: 0 0 0 8px rgba(255,117,24,0.09), 0 0 38px rgba(255,117,24,0.6); }
}
@media (max-width: 900px) {
  .day-node-label { display: none; }
  .day-node-circle { width: 30px; height: 30px; font-size: 11px; }
  .day-node-circle svg { width: 12px; height: 12px; }
  .timeline-rail { top: 15px; }
}
/* Phones: three rows of seven, no rail, full-size nodes with labels. */
@media (max-width: 600px) {
  .timeline-track { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 14px; column-gap: 4px; justify-items: center; }
  .timeline-rail { display: none; }
  .day-node-label { display: block; }
  .day-node-circle { width: 38px; height: 38px; font-size: 12px; }
  .day-node-circle svg { width: 16px; height: 16px; }
  .day-node.lit .day-node-circle svg { width: 20px; height: 20px; }
  .nav-link { padding: 9px 10px; font-size: 11.5px; letter-spacing: 0.5px; }
  .page { padding: 12px 12px 32px; }
}

/* ---------- Charts ---------- */

.chart-card canvas { width: 100%; display: block; }
.chart-stat-value { font-family: var(--font-display); font-size: 22px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--ink-dim); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.chart-legend .off { opacity: 0.5; }
.chart-range-toggle { display: flex; gap: 2px; background: var(--line-soft); border-radius: 8px; padding: 3px; }
.chart-range-toggle span { font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 6px; color: var(--ink-faint); }
.chart-range-toggle span.active { background: var(--bg-elevated); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.stat-big { font-family: var(--font-display); font-size: 30px; line-height: 1; text-shadow: 0 0 20px rgba(255,255,255,0.12); }
.stat-big .unit { font-size: 15px; color: var(--ink-dim); font-family: var(--font-body); font-weight: 600; margin-left: 4px; }
.stat-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.delta.up { color: var(--success); text-shadow: 0 0 10px var(--success-glow); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--ink-faint); }
.delta svg { width: 13px; height: 13px; }

/* ---------- Lists / image rows ---------- */

.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.list-row:last-child { border-bottom: none; }
.list-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--line-soft); flex-shrink: 0; }
.list-icon svg { width: 17px; height: 17px; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 13px; font-weight: 700; }
.list-sub { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }
.list-meta { font-size: 12px; color: var(--ink-dim); text-align: right; white-space: nowrap; }
.list-meta .m { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; }
.list-meta .m svg { width: 12px; height: 12px; color: var(--forge); }

.thumb {
  width: 56px; height: 56px; border-radius: 10px; flex-shrink: 0;
  background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 4px 12px rgba(0,0,0,0.4);
}
.thumb.wide { width: 96px; height: 56px; }

.img-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--bg-elevated); border: 1px solid var(--line-soft); border-radius: var(--radius-md);
  margin-bottom: 10px;
}
.img-row:last-child { margin-bottom: 0; }
.img-row .chev { color: var(--ink-faint); margin-left: 4px; }
.img-row .chev svg { width: 14px; height: 14px; }
.img-row .pill { font-size: 11px; font-weight: 700; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }

.done-check {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--success); color: #06120B; box-shadow: 0 0 12px var(--success-glow);
}
.done-check svg { width: 12px; height: 12px; }

/* Roadmap weeks: scenic row with a status ring. */
.week-row {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin-bottom: 10px;
  border-radius: var(--radius-md); border: 1px solid var(--line-soft);
  background: var(--bg-elevated);
}
.week-row:last-child { margin-bottom: 0; }
.week-row .bg { position: absolute; inset: 0; background-size: cover; background-position: right center; opacity: 0.7; }
.week-row .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg-elevated) 30%, rgba(16,19,26,0.75) 60%, rgba(16,19,26,0.25)); }
.week-row > *:not(.bg) { position: relative; z-index: 1; }
.week-status {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); color: var(--ink-faint);
}
.week-status svg { width: 15px; height: 15px; }
.week-status.done { border-color: var(--success); background: var(--success-dim); color: var(--success); box-shadow: 0 0 14px rgba(43,255,155,0.35); }
.week-status.live { border-color: var(--forge); color: var(--forge); box-shadow: 0 0 14px var(--forge-glow); }
.week-status.locked { border-style: dashed; }
.week-kicker { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ink); }
.week-kicker .phase { color: var(--forge); margin-left: 6px; }
.week-title { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }
.week-count { font-family: var(--font-display); font-size: 15px; color: var(--ink); white-space: nowrap; }

/* ---------- Checklists ---------- */

.check-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.check-row:last-child { border-bottom: none; }
.check-row.manual { cursor: pointer; }
.check-row.manual:hover .check-circle { border-color: var(--ink-dim); }
.check-circle {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); color: transparent; transition: all .15s ease;
}
.check-circle svg { width: 12px; height: 12px; }
.check-circle.hit { background: var(--success); border-color: var(--success); color: #06120B; box-shadow: 0 0 14px var(--success-glow); }
.check-circle.partial { border-color: var(--warn); color: var(--warn); background: linear-gradient(90deg, var(--warn) 50%, transparent 50%); box-shadow: 0 0 12px rgba(255,194,75,0.4); }
.check-circle.miss { border-color: var(--danger); }
.check-main { flex: 1; min-width: 0; }
.check-label { font-weight: 600; }
.check-label.na { color: var(--ink-faint); font-weight: 500; }
.check-sub { font-size: 11px; color: var(--ink-faint); margin-top: 2px; line-height: 1.4; }
.check-row .chev { color: var(--ink-faint); }
.check-row .chev svg { width: 14px; height: 14px; }

/* ---------- Gamification ---------- */

.game-card .level-badge {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid rgba(255,117,24,0.3);
  border-radius: var(--radius-md); padding: 16px;
  background: var(--bg-elevated);
}
.level-badge .bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.6; }
.level-badge .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(16,19,26,0.92) 0%, rgba(16,19,26,0.65) 60%, rgba(16,19,26,0.35)); }
.level-badge > *:not(.bg) { position: relative; z-index: 1; }
.hex {
  width: 76px; height: 76px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--forge-hot);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: linear-gradient(160deg, var(--forge-hot), var(--forge-deep));
  position: relative;
}
.hex::before { content: ""; position: absolute; inset: 3px; clip-path: inherit; background: #15181F; }
.hex svg { position: relative; width: 32px; height: 32px; filter: drop-shadow(0 0 8px var(--forge-glow)); }
.hex-wrap { filter: drop-shadow(0 0 14px var(--forge-glow)); animation: hex-pulse 2.6s ease-in-out infinite; }
@keyframes hex-pulse { 0%, 100% { filter: drop-shadow(0 0 10px var(--forge-glow)); } 50% { filter: drop-shadow(0 0 24px var(--forge)) drop-shadow(0 0 40px var(--forge-glow)); } }
.level-kicker { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--forge); }
.level-title { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.8px; margin-top: 2px; text-transform: uppercase; }
.level-sub { font-size: 12px; color: var(--ink-dim); margin-top: 4px; }
.level-sub b { color: var(--forge-hot); font-weight: 800; }
.xp-track { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); margin-top: 8px; overflow: hidden; }
.xp-track > span { display: block; height: 100%; background: linear-gradient(90deg, var(--forge-deep), var(--forge), var(--forge-hot)); box-shadow: 0 0 12px var(--forge-glow); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.tiles.t-3 { grid-template-columns: repeat(3, 1fr); }
.tile {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015)); border: 1px solid var(--line-soft); border-radius: var(--radius-md);
  padding: 16px 8px 14px; text-align: center; position: relative; overflow: hidden; transition: transform .15s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.14); }
.tile .ic { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: var(--forge-hot) !important; background: linear-gradient(160deg, rgba(255,117,24,0.24), rgba(255,117,24,0.04)) !important; box-shadow: inset 0 0 0 1px rgba(255,150,50,0.35), 0 0 18px rgba(255,117,24,0.22); }
.tile .ic svg { width: 25px; height: 25px; filter: drop-shadow(0 0 6px rgba(255,150,50,0.85)); }
.tile .n { font-family: var(--font-display); font-size: 24px; color: var(--ink); line-height: 1; white-space: nowrap; }
.tile .l { font-size: 10.5px; color: var(--ink-dim); margin-top: 7px; line-height: 1.3; font-weight: 600; }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

.flames { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.flames span { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; color: var(--line); }
.flames span.lit { color: var(--forge); filter: drop-shadow(0 0 8px var(--forge-glow)); }
.flames span svg { width: 20px; height: 20px; }

/* ---------- Weekly tiles ---------- */

.weekly-tile { display: flex; flex-direction: column; gap: 6px; min-height: 128px; }
.weekly-tile .wt-head { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--ink-dim); }
.weekly-tile .wt-head svg { width: 14px; height: 14px; filter: drop-shadow(0 0 6px currentColor); }
.weekly-tile .wt-val { font-family: var(--font-display); font-size: 20px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.weekly-spark { height: 40px; margin-top: auto; }
.weekly-bars { display: flex; align-items: flex-end; gap: 4px; height: 40px; margin-top: auto; }
.weekly-bars span { flex: 1; border-radius: 3px 3px 0 0; min-height: 3px; background: var(--line); }
.weekly-bars span.on { box-shadow: 0 0 10px -2px currentColor; background: currentColor; }

/* ---------- Meters ---------- */

.meter { display: flex; align-items: center; gap: 10px; }
.meter-track { flex: 1; height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04); }
.meter-fill { height: 100%; border-radius: inherit; box-shadow: 0 0 14px -2px currentColor, 0 0 26px -6px currentColor; filter: saturate(1.25) brightness(1.1); }
.meter-value { font-size: 12px; color: var(--ink-dim); min-width: 32px; text-align: right; }
.target-row { display: grid; grid-template-columns: 22px 1fr 64px 1.2fr 40px; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.target-row:last-child { border-bottom: none; }
.target-row svg { width: 15px; height: 15px; }
.target-row .goal { color: var(--ink-dim); }
.target-row .pct { text-align: right; font-weight: 700; color: var(--ink-dim); }
.target-row.na { color: var(--ink-faint); }

/* ---------- Measurements ---------- */

.measure-row { display: grid; grid-template-columns: 22px 1fr auto 14px auto auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.measure-row:last-child { border-bottom: none; }
.measure-row svg { width: 15px; height: 15px; color: var(--forge); }
.measure-row .from { color: var(--ink-dim); }
.measure-row .arrow { color: var(--ink-faint); }
.measure-row .to { font-weight: 700; }
.measure-row.na .to, .measure-row.na .from { color: var(--ink-faint); font-weight: 500; }
.body-fig { width: 110px; align-self: stretch; border-radius: var(--radius-md); background-size: cover; background-position: center; flex-shrink: 0; min-height: 180px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }

/* ---------- Photos ---------- */

.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-placeholder {
  aspect-ratio: 3/4;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-faint); background: var(--bg-elevated); cursor: pointer;
  transition: border-color .15s ease;
  text-align: center; padding: 10px;
}
.photo-placeholder:hover { border-color: var(--forge); color: var(--forge); }
.photo-placeholder svg { width: 26px; height: 26px; }
.photo-placeholder .lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; }
.photo-placeholder .hint { font-size: 10px; }

/* ---------- Banner ---------- */

.banner { display: flex; align-items: center; gap: 18px; padding: 0; overflow: hidden; }
.banner .banner-img { width: 190px; align-self: stretch; background-size: cover; background-position: center; flex-shrink: 0; min-height: 86px; }
.banner .banner-body { padding: 14px 18px 14px 0; flex: 1; min-width: 0; }
.banner-kicker { font-family: var(--font-display); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--forge); }
.banner-text { font-size: 12px; color: var(--ink-dim); margin-top: 4px; line-height: 1.5; }
.banner-list { display: flex; gap: 22px; flex-wrap: wrap; padding: 14px 18px; border-left: 1px solid var(--line-soft); }
.banner-list div { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.banner-list div span { display: block; font-size: 10.5px; color: var(--ink-faint); font-weight: 500; }
.banner-list svg { width: 16px; height: 16px; color: var(--forge); }
@media (max-width: 900px) { .banner { flex-direction: column; align-items: stretch; } .banner .banner-img { width: auto; height: 90px; } .banner .banner-body { padding: 14px 18px; } .banner-list { border-left: none; border-top: 1px solid var(--line-soft); } }

/* ---------- Big ring card ---------- */

.ring-card { display: flex; align-items: center; gap: 24px; }
.ring-big { width: 170px; height: 170px; flex-shrink: 0; }
.ring-copy .headline { font-family: var(--font-display); font-size: 22px; line-height: 1.05; text-transform: uppercase; }
.ring-copy .headline .accent { color: var(--success); text-shadow: 0 0 16px var(--success-glow); }
.ring-copy .headline .accent.warn { color: var(--warn); text-shadow: 0 0 16px rgba(255,194,75,0.5); }
.ring-copy .body { font-size: 12.5px; color: var(--ink-dim); margin-top: 8px; line-height: 1.55; }
.ring-facts { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.ring-facts div { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; }
.ring-facts svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--forge); margin-top: 1px; }
.ring-facts b { display: block; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; }
.ring-facts span { color: var(--ink-faint); }
@media (max-width: 720px) { .ring-card { flex-direction: column; } }

/* ---------- Today card ---------- */

.today-card { display: grid; grid-template-columns: 1fr 190px; gap: 16px; align-items: stretch; }
.today-card .today-img { border-radius: var(--radius-md); background-size: cover; background-position: center; min-height: 160px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); position: relative; overflow: hidden; }
.today-card .today-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--card), transparent 40%); }
.today-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.today-head .kpi-icon { width: 42px; height: 42px; }
.today-title { font-family: var(--font-display); font-size: 17px; text-transform: uppercase; letter-spacing: 0.4px; }
.today-sub { font-size: 12px; color: var(--ink-dim); }
@media (max-width: 1180px) { .today-card { grid-template-columns: 1fr; } .today-card .today-img { min-height: 120px; } }

/* ---------- Misc ---------- */

.empty-note { font-size: 12px; color: var(--ink-faint); font-style: italic; }
.note { font-size: 12px; color: var(--ink-dim); line-height: 1.5; }
.chip { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--forge); }

.confidence-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.confidence-tag.exact { color: var(--success); background: var(--success-dim); }
.confidence-tag.estimated { color: var(--warn); background: rgba(240,177,61,0.14); }
.confidence-tag.unknown { color: var(--ink-faint); background: var(--line-soft); }

.source-note { font-size: 11px; color: var(--ink-faint); margin-top: 3px; line-height: 1.45; max-width: 52ch; }

.loading-skel {
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 50%, var(--line-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Uploads ---------- */

.upload-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.upload-row:last-child { border-bottom: none; }
.upload-kind {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--line-soft); color: var(--ink-dim);
}
.upload-kind svg { width: 16px; height: 16px; }
.upload-kind.parsed { color: var(--success); background: var(--success-dim); }
.upload-kind.failed { color: var(--danger); background: rgba(255,95,79,0.12); }
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius-md); padding: 16px;
  text-align: center; color: var(--ink-faint); font-size: 12px; cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.over { border-color: var(--forge); color: var(--forge); background: rgba(255,117,24,0.05); }
.dropzone b { color: var(--ink); display: block; font-size: 13px; margin-bottom: 4px; }

/* ---------- Toasts ---------- */

.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  background: #141822; border: 1px solid var(--line); border-left: 3px solid var(--forge);
  border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: toast-in .2s ease;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast b { display: block; margin-bottom: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.pwa-icon-bg { fill: #0A0C10; }

.station-line { text-align: left; margin-top: 2px; font-size: 11px; color: var(--ink-faint); }

/* Compact chart cards: four or more to a row, short canvas, one-line head. */
.chart-card.compact { padding: 12px 14px 10px; }
.chart-card.compact .card-head { margin-bottom: 6px; }
.chart-card.compact .card-title { font-size: 11px; }
.chart-card.compact .card-title .sub { display: none; }
.chart-card.compact canvas { height: 120px; }
.chart-card.compact .chart-stat-value { font-size: 15px; }
.chart-card.compact .chart-legend { margin-top: 6px; font-size: 10px; gap: 10px; }
.chart-avg { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; padding: 3px 8px; border-radius: 999px;
  background: rgba(255,117,24,0.10); box-shadow: inset 0 0 0 1px rgba(255,117,24,0.28); color: var(--ink); }
.chart-avg small { font-size: 9px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-faint); }
.chart-avg b { font-family: var(--font-display); font-size: 14px; font-weight: 400; color: var(--forge-hot); text-shadow: 0 0 10px rgba(255,162,61,0.45); }
.chart-avg em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--ink-dim); }
.chart-card.compact .chart-range-toggle span { padding: 3px 7px; font-size: 10px; }
.chart-card.mid canvas { height: 150px; }

/* ---------- Milestone badges, current focus, week recap ---------- */
.milestones { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin-top: 14px; }
.ms { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-faint); font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px; }
.ms .ms-ic { width: 16px; height: 16px; display: inline-flex; flex: none; }
.ms .ms-ic svg { width: 14px; height: 14px; }
.ms.earned { color: var(--ink); border-color: rgba(255,194,75,0.45); background: rgba(255,194,75,0.08); }
.ms.earned .ms-ic { color: var(--warn); filter: drop-shadow(0 0 6px rgba(255,194,75,0.6)); }
.plan-card .plan-headline { font-family: var(--font-display); font-size: 20px; line-height: 1.15; color: var(--ink); margin: 2px 0 10px; }
.plan-card .plan-list { margin: 0; padding-left: 18px; color: var(--ink-dim); font-size: 12.5px; line-height: 1.55; }
.plan-card .plan-list li { margin-bottom: 4px; }
.recap-card { position: relative; overflow: hidden; }
.recap-card .photo-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.22; }
.recap-card .photo-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,19,26,0.6), rgba(16,19,26,0.95)); }
.recap-card > *:not(.photo-bg) { position: relative; z-index: 1; }
.recap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 8px; }
.recap-stat { background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.recap-stat .n { font-family: var(--font-display); font-size: 22px; line-height: 1; color: var(--ink); }
.recap-stat .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); margin-top: 6px; }
.recap-stat .s { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }
@media (max-width: 720px) { .recap-grid { grid-template-columns: repeat(2, 1fr); } }

/* Nutrition trend tiles as a 2x2 block; wide rewards card on the dashboard */
.trend-2x2 { grid-template-columns: 1fr 1fr; align-content: start; }
.game-card.wide .tiles { grid-template-columns: repeat(8, 1fr); }
.game-card.wide .tile .n { font-size: 24px; }
.game-card.wide .milestones { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.game-card.wide .ms { padding: 9px 10px; font-size: 11.5px; }
.game-card.wide .level-badge { padding: 22px 24px; }
@media (max-width: 1000px) { .game-card.wide .tiles { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 720px) { .game-card.wide .tiles { grid-template-columns: repeat(2, 1fr); } .trend-2x2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Timeline flames: each logged day burns, hotter along the streak ---------- */
.day-node.lit .day-node-circle {
  background: radial-gradient(circle at 50% 65%, #4A1608 0%, #2A0D06 55%, #160805 100%);
  border-color: rgba(255,170,70,0.85); color: #FFF4D6;
  box-shadow: 0 0 calc(10px + 14px * var(--heat)) rgba(255,160,40,calc(0.45 + 0.4 * var(--heat))), 0 0 calc(22px + 24px * var(--heat)) rgba(255,117,24,calc(0.25 + 0.35 * var(--heat)));
}
.day-node.lit .day-node-circle svg { width: 22px; height: 22px; transform-origin: 50% 90%; }
.day-node.lit:hover .day-node-circle { transform: scale(1.14); }
.day-node.active .day-node-circle { position: relative; overflow: visible; }
.day-node.active .ember { position: absolute; inset: -3px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--forge-hot); border-right-color: rgba(255,117,24,0.35); animation: ember-spin 1.6s linear infinite; }
@keyframes flame-flicker {
  0%, 100% { transform: scaleY(1) scaleX(1) rotate(0deg); opacity: 1; }
  30% { transform: scaleY(1.12) scaleX(0.94) rotate(-3deg); opacity: 0.92; }
  60% { transform: scaleY(0.94) scaleX(1.06) rotate(2deg); opacity: 1; }
  80% { transform: scaleY(1.08) scaleX(0.97) rotate(-1deg); opacity: 0.95; }
}
@keyframes ember-spin { to { transform: rotate(360deg); } }
.timeline-rail-fill { animation: rail-glow 2.6s ease-in-out infinite; }
@keyframes rail-glow { 0%, 100% { box-shadow: 0 0 10px var(--forge-glow), 0 0 22px rgba(255,117,24,0.35); } 50% { box-shadow: 0 0 16px var(--forge-glow), 0 0 34px rgba(255,117,24,0.6); } }

/* ---------- Gamification chips: gold, shine sweep, glowing trophy ---------- */
.milestones .ms { position: relative; overflow: hidden; align-items: flex-start; }
.milestones .ms .ms-l small { display: block; font-weight: 500; font-size: 10px; color: var(--ink-dim); letter-spacing: 0; margin-top: 2px; }
.milestones .ms.earned { border-color: rgba(255,194,75,0.55); background: linear-gradient(135deg, rgba(255,194,75,0.18) 0%, rgba(255,117,24,0.10) 45%, rgba(16,19,26,0) 100%); color: #FFE9B8; box-shadow: 0 6px 18px -10px rgba(255,160,40,0.6); }
.milestones .ms.earned .ms-ic { width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 30%, #FFE08A, #FF9A1F 70%); color: #2A1600; filter: none; box-shadow: 0 0 12px rgba(255,194,75,0.55); animation: ms-glow 2.4s ease-in-out infinite; }
.milestones .ms.earned .ms-ic svg { width: 12px; height: 12px; }
.milestones .ms .ms-shine { position: absolute; top: -40%; bottom: -40%; width: 40px; left: -70px; background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,240,200,0.28) 50%, rgba(255,255,255,0) 100%); transform: skewX(-18deg); animation: ms-shine 5s ease-in-out infinite; pointer-events: none; }
.milestones .ms:nth-child(2n) .ms-shine { animation-delay: 1.3s; } .milestones .ms:nth-child(3n) .ms-shine { animation-delay: 2.4s; } .milestones .ms:nth-child(5n) .ms-shine { animation-delay: 3.6s; }
.milestones .ms:not(.earned) { opacity: 0.7; border-style: dashed; }
@keyframes ms-shine { 0%, 70% { left: -70px; } 100% { left: 120%; } }
@keyframes ms-glow { 0%, 100% { box-shadow: 0 0 10px rgba(255,194,75,0.4); } 50% { box-shadow: 0 0 20px rgba(255,194,75,0.85); } }

/* ---------- Hero progress ring ---------- */
.hero-side.glow-side { gap: 22px; padding: 18px 24px; border-color: rgba(255,117,24,0.35); background: linear-gradient(135deg, rgba(16,19,26,0.78), rgba(10,12,16,0.62)); box-shadow: 0 0 0 1px rgba(255,117,24,0.08) inset, 0 10px 40px -18px rgba(255,117,24,0.7); }
.ring-wrap { position: relative; width: 112px; height: 112px; flex-shrink: 0; display: grid; place-items: center; }
.ring-wrap .ring-orbit { position: absolute; inset: -6px; border-radius: 50%; border: 1px dashed rgba(255,117,24,0.35); animation: ring-spin 18s linear infinite; }
.ring-wrap .ring-fill { position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from -90deg, #FFE08A 0%, #FF9A1F calc(var(--pct) * 0.6%), #FF7518 calc(var(--pct) * 1%), rgba(255,255,255,0.07) calc(var(--pct) * 1%), rgba(255,255,255,0.07) 100%);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%); mask: radial-gradient(circle, transparent 60%, #000 61%);
  filter: drop-shadow(0 0 8px rgba(255,150,40,0.7)); animation: ring-breathe 3s ease-in-out infinite; }
.ring-wrap .ring-core { position: relative; text-align: center; line-height: 1; }
.ring-wrap .ring-core b { display: block; font-family: var(--font-display); font-size: 26px; color: #FFF1D6; text-shadow: 0 0 16px rgba(255,160,40,0.8); }
.ring-wrap .ring-core span { display: block; margin-top: 4px; font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-dim); }
.ring-copy .ring-stats { gap: 8px; }
.ring-stats .rs { display: grid; grid-template-columns: 18px auto 1fr; align-items: center; gap: 8px; }
.ring-stats .rs svg { width: 14px; height: 14px; }
.ring-stats .rs b { margin: 0; font-size: 20px; }
.ring-stats .rs.done svg { color: var(--success); filter: drop-shadow(0 0 6px var(--success-glow)); }
.ring-stats .rs.done b { color: var(--success); }
.ring-stats .rs.left svg { color: var(--hydro); }
.ring-stats .rs.streak svg { color: var(--forge-hot); filter: drop-shadow(0 0 6px var(--forge-glow)); transform-origin: 50% 90%; animation: flame-flicker 1.4s ease-in-out infinite; }
.ring-stats .rs.streak b { color: var(--forge-hot); text-shadow: 0 0 12px var(--forge-glow); }
@keyframes ring-spin { to { transform: rotate(360deg); } }
@keyframes ring-breathe { 0%, 100% { filter: drop-shadow(0 0 6px rgba(255,150,40,0.55)); } 50% { filter: drop-shadow(0 0 14px rgba(255,150,40,0.95)); } }
.day-node.active.lit .day-node-circle { border-color: rgba(255,200,120,0.9); animation: pulse 2s ease-in-out infinite; }
.day-node.active.lit .ember { border-top-color: #FFE08A; border-right-color: rgba(255,224,138,0.4); }

/* ---------- The fire glyph: every flame in the app glows and flickers ---------- */
svg.fire { filter: drop-shadow(0 0 3px rgba(255,150,40,0.9)) drop-shadow(0 0 8px rgba(255,117,24,0.55)); transform-origin: 50% 92%; animation: fire-glow 1.6s ease-in-out infinite; }
@keyframes fire-glow {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(255,150,40,0.9)) drop-shadow(0 0 8px rgba(255,117,24,0.55)); transform: scaleY(1) scaleX(1) rotate(0deg); }
  28% { filter: drop-shadow(0 0 5px rgba(255,200,80,1)) drop-shadow(0 0 14px rgba(255,140,30,0.8)); transform: scaleY(1.07) scaleX(0.96) rotate(-2deg); }
  55% { filter: drop-shadow(0 0 3px rgba(255,150,40,0.85)) drop-shadow(0 0 9px rgba(255,117,24,0.5)); transform: scaleY(0.96) scaleX(1.04) rotate(1.5deg); }
  78% { filter: drop-shadow(0 0 6px rgba(255,220,120,1)) drop-shadow(0 0 16px rgba(255,160,40,0.85)); transform: scaleY(1.05) scaleX(0.98) rotate(-1deg); }
}
/* Unlit slots (streak rows): the same glyph, cold and grey, no animation. */
.flames span:not(.lit) svg.fire { filter: grayscale(1) brightness(0.55) opacity(0.55); animation: none; }
.day-node.lit .day-node-circle svg.fire { animation: fire-glow 1.6s ease-in-out infinite; animation-delay: var(--flick); }
@media (prefers-reduced-motion: reduce) { svg.fire { animation: none; } }

/* Guests read everything and change nothing. The write controls are hidden
   for them; the server refuses their writes regardless. */
html[data-viewer="guest"] .upload-btn,
html[data-viewer="guest"] .dropzone,
html[data-viewer="guest"] #meal-form,
html[data-viewer="guest"] .meal-remove,
html[data-viewer="guest"] .card-action[onclick="openUpload()"] { display: none !important; }
html[data-viewer="guest"] .check-row.manual { cursor: default; pointer-events: none; }
