/* ---------- Tokens ----------
   Aligned with mobile MVP (DINO Stats) — see /index.html
   Mobile palette: --ink #f5ecdc, --bg-0 #0a0718, --lavender #b8a9ff, --coral #ff8a7a, --mint #8fe3b8
*/
:root {
  /* Surfaces — match mobile bg-0 / bg-1 / glass surfaces */
  --bg: #0a0718;
  --bg-2: #140e2a;
  --surface: rgba(40, 28, 72, 0.55);
  --surface-2: rgba(20, 14, 40, 0.75);
  --surface-3: rgba(60, 42, 102, 0.65);
  --border: rgba(255, 255, 255, 0.14);
  --border-soft: rgba(255, 255, 255, 0.08);

  /* Text — match mobile ink / ink-dim / muted */
  --text: #f5ecdc;
  --text-2: #c8bed2;
  --text-3: #8a829a;
  --text-4: #5e576b;

  /* Primary = mobile lavender */
  --primary: #b8a9ff;
  --primary-2: #8b78f0;
  --primary-soft: rgba(184, 169, 255, 0.15);
  --primary-glow: rgba(184, 169, 255, 0.4);

  /* Accents from mobile palette */
  --accent-coral: #ff8a7a;
  --accent-coral-deep: #ff6b6b;
  --accent-pink: #ff8a7a;
  --accent-amber: #fcd34d;
  --accent-mint: #8fe3b8;
  --accent-peach: #ffb896;
  --accent-cyan: #7ad8e0;

  /* Status — semantic from mobile */
  --good: #8fe3b8;
  --warn: #fcd34d;
  --bad: #ff8a7a;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 0 0 rgba(255, 255, 255, 0.04) inset, 0 24px 60px -20px rgba(0, 0, 0, 0.55);

  /* Type stack — keep Geist as web brand display, fall back to mobile system stack */
  --font-sans: 'Geist', -apple-system, "SF Pro Display", "Avenir Next", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-serif: 'Instrument Serif', 'Times New Roman', serif;

  /* Easings — match mobile */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.005em;
}

/* Ambient gradients removed — keep page background perfectly flat */

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.mono { font-family: var(--font-mono); font-feature-settings: 'tnum'; letter-spacing: -0.02em; }
.serif { font-family: var(--font-serif); letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(20, 14, 40, 0.7), rgba(10, 7, 24, 0.6));
  backdrop-filter: blur(12px);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 14px;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: radial-gradient(circle at 30% 30%, var(--primary), var(--primary-2) 70%);
  box-shadow: 0 0 24px var(--primary-glow), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.5), transparent 55%);
}
.brand-name {
  font-weight: 600; font-size: 14px; letter-spacing: 0.02em;
}
.brand-name b { font-weight: 700; }
.brand-name span { color: var(--text-3); font-size: 11px; display: block; letter-spacing: 0.18em; text-transform: uppercase; margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, var(--primary-soft), rgba(184, 169, 255, 0.05));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(184, 169, 255, 0.3);
}
.nav-item .ico { width: 16px; height: 16px; opacity: .85; flex: 0 0 16px; }
.nav-item.active .ico { color: var(--primary); opacity: 1; }

.sidebar-spacer { flex: 1; }

.stake-card {
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(184, 169, 255, 0.08), rgba(184, 169, 255, 0.02));
  border-radius: 14px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.stake-card .label { font-size: 11px; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }
.stake-card .balance { font-family: var(--font-mono); font-size: 20px; font-weight: 600; }
.stake-card .balance b { color: var(--primary); font-weight: 600; }

/* ---------- Main ---------- */
.main {
  min-width: 0;
  padding: 22px 32px 60px;
  display: flex; flex-direction: column; gap: 22px;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.topbar .title-block h1 { margin: 0; font-family: var(--font-serif); font-size: 30px; font-weight: 400; letter-spacing: -0.01em; }
.topbar .title-block p { margin: 4px 0 0; color: var(--text-3); font-size: 13px; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.token-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
}
.token-pill .coin {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--primary), var(--primary-2));
  color: white; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}
.token-pill .amt { font-family: var(--font-mono); font-size: 13px; font-weight: 600; line-height: 1; }
.token-pill .sub { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.04em; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-soft);
  display: grid; place-items: center;
  color: var(--text-2);
  transition: background .15s, color .15s;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 9px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-coral);
  box-shadow: 0 0 0 2px var(--bg-2);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-coral), var(--primary));
  color: white; display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* ---------- Cards ----------
   Flat dark surface with glass blur. No gradients, no glows.
*/
.card {
  position: relative;
  background: rgba(20, 14, 40, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  overflow: hidden;
}

/* Variant cards by accent — soft solid tint, no gradient, no halo */
.card.mint     { background: rgba(40, 60, 50, 0.75); border-color: rgba(143, 227, 184, 0.20); }
.card.amber    { background: rgba(50, 42, 28, 0.75); border-color: rgba(252, 211, 77, 0.20); }
.card.peach    { background: rgba(56, 36, 32, 0.75); border-color: rgba(255, 184, 150, 0.20); }
.card.coral    { background: rgba(58, 30, 32, 0.75); border-color: rgba(255, 138, 122, 0.20); }
.card.violet   { background: rgba(36, 30, 64, 0.75); border-color: rgba(184, 169, 255, 0.22); }

.card.flat { box-shadow: none; }

.card-title { font-size: 11px; color: var(--text-3); margin: 0 0 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.card-title.lg { font-size: 16px; color: var(--text); font-weight: 600; letter-spacing: -0.01em; text-transform: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }

.section-title {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3);
  margin: 0 0 10px;
  font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  border-color: rgba(184, 169, 255, 0.5);
  color: #1a0f2b;
  box-shadow: 0 6px 20px -6px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: var(--border-soft); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.04); }
.btn.sm { padding: 7px 12px; font-size: 12px; }
.btn.xs { padding: 5px 10px; font-size: 11.5px; border-radius: 8px; }

/* ---------- Pills / Tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  letter-spacing: 0.02em;
}
.tag.good { color: var(--good); background: rgba(143, 227, 184, 0.10); border-color: rgba(143, 227, 184, 0.25); }
.tag.warn { color: var(--warn); background: rgba(252, 211, 77, 0.10); border-color: rgba(252, 211, 77, 0.25); }
.tag.bad  { color: var(--bad);  background: rgba(255, 138, 122, 0.10); border-color: rgba(255, 138, 122, 0.25); }
.tag.violet { color: var(--primary); background: var(--primary-soft); border-color: rgba(184, 169, 255, 0.30); }

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex; gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}
.tab {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--primary);
  color: #1a0f2b;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.20) inset;
}

/* ---------- Metric ---------- */
.metric .label { font-size: 10px; color: var(--text-3); margin: 0 0 6px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.metric .value {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.metric .value .unit { font-size: 14px; color: var(--text-2); margin-left: 4px; font-weight: 500; letter-spacing: 0; }
.metric .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.metric .foot .delta.up { color: var(--accent-mint); }
.metric .foot .delta.down { color: var(--accent-coral); }

/* ---------- Sparkline / minimal chart helpers ---------- */
.spark { width: 100%; height: 30px; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(184, 169, 255, 0.20); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(184, 169, 255, 0.35); border: 2px solid transparent; background-clip: padding-box; }

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.muted { color: var(--text-3); }
.muted-2 { color: var(--text-4); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 2, 16, 0.62);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fadeIn .2s ease;
}
.modal {
  background: #160F2C;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  animation: pop .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ---------- Mascot ---------- */
.mascot-wrap {
  position: relative;
  display: grid; place-items: center;
  width: 100%;
  height: 100%;
}
.mascot {
  --m-size: 160px;
  width: var(--m-size); height: var(--m-size);
  position: relative;
  display: grid;
  place-items: center;
  animation: float 6s ease-in-out infinite;
}
.mascot::before {
  /* lavender glow under the dino */
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 169, 255, 0.32), transparent 60%);
  filter: blur(6px);
  z-index: 0;
  animation: breathe 4s ease-in-out infinite;
}
.mascot .dino-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  /* drop pixel-art crispness */
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.5));
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.06); opacity: 1; }
}

.zzz {
  position: absolute;
  font-family: var(--font-serif);
  font-size: 22px;
  color: rgba(255, 255, 255, 0.5);
  animation: zzz-float 3s ease-out infinite;
}
.zzz.z1 { top: 0; right: -6px; animation-delay: 0s; }
.zzz.z2 { top: 14px; right: 8px; font-size: 16px; animation-delay: 1s; }
.zzz.z3 { top: 26px; right: -2px; font-size: 12px; animation-delay: 2s; }
@keyframes zzz-float {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-30px) translateX(8px); opacity: 0; }
}

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border-soft); margin: 14px 0; }
.kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-3); }

.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-3);
}
.empty-state h3 { color: var(--text); font-size: 18px; margin: 12px 0 6px; font-weight: 600; }

/* Group label — between groups of cards on Sleep screen */
.group-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 4px 2px -2px;
}
.group-label h2 { margin: 0; font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: 0.14em; text-transform: uppercase; }
.group-label small { color: var(--text-3); font-size: 11px; }

/* Tweak panel overrides (light tone) — none needed */

/* ============================================================
   Sleep Coach — "coach, not dashboard" layout (May refresh)
   Left column = coach (mascot + verdict + one action).
   Right column = evidence (score, biometrics, stages, trend).
   ============================================================ */
.sl-grid { display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 16px; align-items: stretch; }
@media (max-width: 980px) { .sl-grid { grid-template-columns: 1fr; } }

/* --- Coach panel (left) --- */
.sl-coach {
  background: linear-gradient(180deg, rgba(60,42,102,0.45), rgba(20,14,40,0.72));
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 34px 32px 30px; position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
.sl-dino-stage { display: flex; flex-direction: column; align-items: center; text-align: center; }
.sl-verdict-tag {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 4px; padding: 6px 13px; border-radius: 999px;
  background: rgba(143,227,184,0.14); color: var(--good);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.sl-verdict-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px var(--good); }
.sl-verdict { font-family: var(--font-serif); font-size: clamp(32px, 4vw, 46px); line-height: 1.05; letter-spacing: -0.01em; margin: 14px 0 14px; max-width: 18ch; }
.sl-verdict em { font-style: italic; color: var(--primary); }
.sl-coach-body { color: var(--text-2); font-size: 15px; line-height: 1.6; max-width: 46ch; margin: 0 auto; }
.sl-coach-body b { color: var(--text); font-weight: 600; }

.sl-action-label { margin-top: auto; padding-top: 28px; margin-bottom: 11px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.sl-action-label::before { content: '▶'; color: var(--good); font-size: 10px; }
.sl-action {
  display: flex; align-items: center; gap: 16px; text-align: left;
  background: rgba(143,227,184,0.10); border: 1px solid rgba(143,227,184,0.38);
  border-radius: var(--radius-md); padding: 18px; cursor: pointer; transition: transform 0.2s var(--ease-out);
}
.sl-action:hover { transform: translateY(-2px); }
.sl-action .emoji { font-size: 30px; width: 54px; height: 54px; display: grid; place-items: center; background: rgba(143,227,184,0.16); border-radius: 14px; flex: none; }
.sl-action h3 { font-size: 17px; font-weight: 700; margin: 0 0 3px; }
.sl-action p { color: var(--text-2); font-size: 13.5px; line-height: 1.45; margin: 0; }
.sl-action .check { margin-left: auto; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(143,227,184,0.5); flex: none; }

.sl-rest-label { margin: 22px 0 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-4); }
.sl-rest { display: flex; flex-direction: column; gap: 8px; }
.sl-rest-item { display: flex; align-items: center; gap: 13px; padding: 11px 13px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.sl-rest-item .em { font-size: 18px; width: 34px; height: 34px; display: grid; place-items: center; background: rgba(255,255,255,0.04); border-radius: 9px; flex: none; }
.sl-rest-item .t { font-size: 14px; font-weight: 600; }
.sl-rest-item .s { font-size: 12.5px; color: var(--text-3); }
.sl-rest-item .cat { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--text-4); }

/* --- Evidence panel (right) --- */
.sl-evidence { display: flex; flex-direction: column; gap: 16px; }
.sl-card { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 20px; }
.sl-label { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.sl-label .muted { color: var(--text-4); font-weight: 600; letter-spacing: 0; font-family: var(--font-mono); }

/* score */
.sl-score-row { display: flex; align-items: center; gap: 20px; }
.sl-ring { position: relative; width: 108px; height: 108px; flex: none; }
.sl-ring svg { transform: rotate(-90deg); }
.sl-ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.sl-score-meta .big { font-size: 14px; color: var(--text-2); }
.sl-score-meta .delta { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; color: var(--good); font-size: 13px; font-weight: 600; }
.sl-score-meta .word { font-size: 13px; color: var(--text-3); margin-top: 10px; line-height: 1.5; }
.sl-score-meta .word b { color: var(--good); }

/* biometrics */
.sl-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sl-metric { background: rgba(255,255,255,0.03); border: 1px solid var(--border-soft); border-radius: 12px; padding: 13px; }
.sl-metric .mk { font-size: 10px; color: var(--text-4); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.3; min-height: 24px; }
.sl-metric .mv { font-size: 21px; font-weight: 700; margin-top: 5px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sl-metric .mv u { font-size: 11px; font-weight: 600; color: var(--text-3); text-decoration: none; margin-left: 3px; }
.sl-metric .md { font-size: 10.5px; font-weight: 600; margin-top: 5px; }
.sl-metric .md.good { color: var(--good); }
.sl-metric .md.warn { color: var(--warn); }
.sl-metric .md.bad { color: var(--bad); }

/* stages (compact) */
.sl-stage { display: flex; align-items: center; gap: 12px; margin: 11px 0; }
.sl-stage .nm { width: 52px; font-size: 12.5px; color: var(--text-2); }
.sl-stage .bar { flex: 1; height: 7px; border-radius: 99px; background: rgba(255,255,255,0.06); overflow: hidden; }
.sl-stage .bar span { display: block; height: 100%; border-radius: 99px; }
.sl-stage .amt { width: 54px; text-align: right; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ribbon */
.sl-ribbon { display: flex; gap: 7px; }
.sl-rib { flex: 1; text-align: center; padding: 10px 0 11px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.sl-rib.today { border-color: rgba(184,169,255,0.55); background: rgba(184,169,255,0.10); }
.sl-rib .d { font-size: 10px; color: var(--text-4); font-weight: 600; letter-spacing: 0.04em; }
.sl-rib .dot { width: 9px; height: 9px; border-radius: 50%; margin: 7px auto 6px; }
.sl-rib .sc { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sl-legend { display: flex; gap: 16px; margin-top: 13px; font-size: 11px; color: var(--text-3); }
.sl-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* recovery */
.sl-recov { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sl-rc { background: rgba(255,255,255,0.03); border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px; }
.sl-rc .k { font-size: 10.5px; color: var(--text-4); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.sl-rc .v { font-size: 20px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.sl-rc .h { font-size: 12px; color: var(--text-3); margin-top: 4px; }
/* Mascot is already "alive": .mascot has float + glow breathe (see above). */

/* ============================================================
   Dashboard — "morning briefing + hub" (May refresh)
   ============================================================ */
.dash-hero {
  display: flex; align-items: center; gap: 28px;
  background: linear-gradient(180deg, rgba(60,42,102,0.45), rgba(20,14,40,0.72));
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 26px 32px;
}
@media (max-width: 760px) { .dash-hero { flex-direction: column; text-align: center; } }
.dash-hero .mascot { flex: none; }
.dash-hero-text { flex: 1; min-width: 0; }
.dash-hero h1 { font-family: var(--font-serif); font-size: 34px; font-weight: 400; letter-spacing: -0.01em; margin: 0 0 8px; }
.dash-hero .synth { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.dash-hero .focus { font-size: 14.5px; line-height: 1.55; color: var(--text-2); margin: 0; max-width: 62ch; }
.dash-hero .focus b { color: var(--text); }
.dash-hero-cta { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.dash-insight { background: linear-gradient(180deg, rgba(184,169,255,0.12), rgba(20,14,40,0.4)); border-color: rgba(184,169,255,0.30); }
.dash-insight-avatar { width: 40px; height: 40px; border-radius: 12px; background: rgba(184,169,255,0.18); display: grid; place-items: center; font-size: 18px; flex: none; }

.dash-rec { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border-soft); cursor: pointer; transition: background 0.15s; }
.dash-rec:hover { background: var(--surface-3); }
.dash-rec .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; flex: none; }
.dash-rec .t { font-weight: 500; font-size: 14px; }
.dash-rec .s { font-size: 12px; color: var(--text-3); }

.dash-qa { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.dash-qa .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }

/* ============================================================
   AI Agent — active agent identity (the Dino IS the coach)
   ============================================================ */
.agent-id { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border-soft); }
.agent-id-avatar { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; flex: none; overflow: hidden; }
.agent-id-avatar .mascot { width: 56px; height: 56px; }
.agent-id-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.agent-id-name .online { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.agent-id-tag { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* ============================================================
   Pillar hero — Activity / Nutrition / Mind & Body coach band
   ============================================================ */
.pillar-hero {
  display: flex; align-items: center; gap: 24px;
  background: linear-gradient(180deg, rgba(60,42,102,0.45), rgba(20,14,40,0.72));
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 24px 30px;
}
@media (max-width: 760px) { .pillar-hero { flex-direction: column; text-align: center; } }
.pillar-hero .mascot { flex: none; }
.pillar-hero-text { flex: 1; min-width: 0; }
.pillar-tag { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.pillar-verdict { font-family: var(--font-serif); font-size: 30px; font-weight: 400; letter-spacing: -0.01em; margin: 10px 0 8px; }
.pillar-body { font-size: 14.5px; line-height: 1.55; color: var(--text-2); margin: 0; max-width: 62ch; }
.pillar-body b { color: var(--text); }
.pillar-hero .btn { margin-top: 16px; }

/* Mood week — emoji row under the mood chart (Mind & Body) */
.mood-week { display: flex; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.mood-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 0; border-radius: 10px; background: var(--surface-2); }
.mood-day .emoji { font-size: 22px; line-height: 1; }
.mood-day .dl { font-size: 10px; color: var(--text-3); font-weight: 600; letter-spacing: 0.04em; }

/* ============================================================
   Responsive — single codebase. Below the breakpoint the fixed
   240px sidebar collapses into a floating bottom tab bar and the
   card grids reflow. (Replaces the old separate mobile tree.)
   ============================================================ */

/* Dashboard logout is mobile-only; on desktop logout lives in the sidebar.
   Declared before the media query so the @media `display: flex` wins on mobile. */
.dash-logout-mobile { display: none; }

/* Activity screen: Weekly Activity + HR side by side on desktop. */
.activity-split { grid-template-columns: 2fr 1fr; }

@media (max-width: 900px) {
  /* Drop the sidebar column; content takes the full width. */
  .app { grid-template-columns: 1fr; }

  /* Sidebar → floating bottom tab bar. */
  .sidebar {
    position: fixed;
    top: auto;
    left: 12px; right: 12px; bottom: 12px;
    height: auto;
    flex-direction: row;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
    border-radius: 18px;
    background: rgba(20, 14, 40, 0.92);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
  }
  .sidebar .brand,
  .sidebar .sidebar-spacer { display: none; }
  .sidebar .nav { flex-direction: row; flex: 1; gap: 4px; }

  /* Tabs: stacked icon + label, evenly spread. Targets both the nav
     buttons and the standalone logout button (a direct .sidebar child). */
  .sidebar .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 8px 4px;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
    justify-content: center;
    border-radius: 12px;
    margin-top: 0 !important;
  }
  .sidebar .nav-item .ico { width: 20px; height: 20px; flex: 0 0 20px; }

  /* Logout moves out of the tab bar to the bottom of the dashboard. */
  .sidebar .sidebar-logout { display: none; }
  .dash-logout-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    border-radius: 14px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.08);
    color: #ff6b6b;
    font-size: 14px;
    font-weight: 600;
  }

  /* Room so page content isn't hidden behind the floating bar. */
  .main { padding: 20px 16px 100px; }

  /* Card grids reflow. */
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Activity screen: HR drops onto its own row below Weekly Activity. */
  .activity-split { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 16px 12px 100px; }
}
