/* ════════════════════════════════════════════════════════════════
   RENAISSANCE v2 — Premium Dark Design System
   ════════════════════════════════════════════════════════════════ */

:root {
  /* Core palette — deeper, richer */
  --bg: #05050a;
  --bg2: #0a0a14;
  --surface: rgba(14, 13, 26, .85);
  --surface-hover: rgba(24, 22, 42, .9);
  --glass: rgba(10, 9, 20, .78);
  --glass-border: rgba(255, 255, 255, .06);
  --glass-border-hover: rgba(255, 255, 255, .12);

  /* Accent colors — refined */
  --gold: #f0b429;
  --gold2: #ffd166;
  --gold-dim: rgba(240, 180, 41, .14);
  --purple: #9b72f5;
  --purple2: #b999ff;
  --purple-dim: rgba(155, 114, 245, .12);
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, .1);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, .1);
  --orange: #fb923c;
  --orange-dim: rgba(251, 146, 60, .1);
  --cyan: #5eead4;
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, .1);
  --pink: #f472b6;

  /* Text */
  --text: #e8e5f0;
  --text-dim: #77718a;
  --text-muted: #3d3850;

  /* Geometry */
  --r: 10px;
  --r-sm: 6px;
  --r-lg: 16px;
  --r-pill: 100px;

  /* Typography */
  --fd: 'DM Serif Display', serif;
  --fb: 'Sora', sans-serif;
  --fm: 'JetBrains Mono', monospace;

  /* Effects */
  --shadow: 0 8px 40px rgba(0, 0, 0, .65);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, .4);
  --glow-gold: 0 0 40px rgba(240, 180, 41, .06);
  --glow-purple: 0 0 40px rgba(155, 114, 245, .07);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

/* ── Custom scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.15); }

/* ── Selection ── */
::selection { background: rgba(240,180,41,.25); color: var(--gold); }

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--fb);
  font-size: 14px;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Background ambience ── */
body::before {
  content: ''; position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 15% -5%, rgba(155, 114, 245, .04) 0%, transparent 60%),
    radial-gradient(ellipse 500px 350px at 85% 105%, rgba(240, 180, 41, .03) 0%, transparent 60%),
    radial-gradient(ellipse 300px 300px at 50% 50%, rgba(155, 114, 245, .015) 0%, transparent 100%);
  pointer-events: none; z-index: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 2px; height: 2px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(155, 114, 245, .25); border-radius: 2px; }

/* ═══════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════ */
.app { display: flex; flex-direction: column; min-height: 100dvh; position: relative; z-index: 1; }
.main {
  flex: 1;
  padding: 14px 14px calc(72px + var(--safe-bot));
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════ */
.header {
  padding: calc(10px + var(--safe-top)) 14px 10px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(5, 5, 10, .92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky; top: 0; z-index: 200;
}
.hdr-brand {
  font-family: var(--fd); font-size: 15px; letter-spacing: .06em;
  background: linear-gradient(135deg, var(--gold), #fff8d6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  flex-shrink: 0;
}
.hdr-char { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.hdr-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(240, 180, 41, .15), rgba(155, 114, 245, .12));
  border: 1.5px solid rgba(240, 180, 41, .3);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.hdr-info { flex: 1; min-width: 0; }
.hdr-name-row { display: flex; align-items: center; gap: 6px; }
.hdr-username { font-size: 12px; font-weight: 600; }
.lvl-pill {
  font-family: var(--fm); font-size: 6px; letter-spacing: .06em;
  padding: 1px 6px; border-radius: var(--r-pill);
  background: var(--gold-dim); color: var(--gold);
  border: 1px solid rgba(240, 180, 41, .15);
}
.xp-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.xp-track { flex: 1; height: 3px; background: rgba(255,255,255,.05); border-radius: 3px; overflow: hidden; }
.xp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--purple), var(--gold)); border-radius: 3px; transition: width .6s ease; }
.xp-label { font-family: var(--fm); font-size: 6px; color: var(--text-muted); white-space: nowrap; }
.hdr-date { font-family: var(--fm); font-size: 7px; color: var(--text-dim); flex-shrink: 0; }
.hdr-settings-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--glass-border); background: var(--surface);
  color: var(--text-dim); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: .2s; flex-shrink: 0;
}
.hdr-settings-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ═══════════════════════════════════════════════
   VIEW SYSTEM
   ═══════════════════════════════════════════════ */
.view { display: none; animation: fadeUp .35s cubic-bezier(.16,1,.3,1); }
.view.active { display: block; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 20px rgba(155,114,245,.06); } 50% { box-shadow: 0 0 40px rgba(155,114,245,.14); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes countUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Skeleton loading state ── */
.skeleton { background: linear-gradient(90deg,var(--surface2) 25%,rgba(255,255,255,.03) 50%,var(--surface2) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease infinite; border-radius: var(--r-sm); pointer-events: none; }
.skeleton-text { height: 10px; margin-bottom: 6px; width: 60%; }
.skeleton-block { height: 40px; width: 100%; }
.skeleton-circle { height: 36px; width: 36px; border-radius: 50%; }

/* ═══════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════ */
.page-title {
  font-family: var(--fd); font-size: 24px; line-height: 1.15; margin-bottom: 3px;
}
.page-sub { font-size: 11px; color: var(--text-dim); font-weight: 400; margin-bottom: 16px; }
.section-label {
  font-family: var(--fm); font-size: 6.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px;
}
.greeting-wrap { margin-bottom: 14px; }
.greeting-h1 { font-family: var(--fd); font-size: 26px; line-height: 1.15; margin-bottom: 1px; }
.name-hi { background: linear-gradient(135deg, var(--gold), #fff8d6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.greeting-sub { font-size: 11px; color: var(--text-dim); font-weight: 400; }
.panel-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-title { font-size: 12px; font-weight: 600; }
.panel-meta { font-family: var(--fm); font-size: 6.5px; color: var(--text-dim); letter-spacing: .06em; }

/* ═══════════════════════════════════════════════
   GLASS CARDS
   ═══════════════════════════════════════════════ */
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  transition: all .3s ease;
}
.glass-card:hover { border-color: var(--glass-border-hover); }

.card {
  background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  transition: all .3s cubic-bezier(.22,1,.36,1);
}
.card:hover { border-color: var(--glass-border-hover); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.card-pad { padding: 14px 16px; }
.card-solid {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  transition: all .3s ease;
}

/* ═══════════════════════════════════════════════
   QUICK STATS ROW
   ═══════════════════════════════════════════════ */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.qs-item {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  padding: 8px 4px;
  text-align: center;
  transition: all .25s ease;
}
.qs-item:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-1px);
}
.qs-label {
  font-family: var(--fm); font-size: 5.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 2px;
}
.qs-value { font-family: var(--fd); font-size: 15px; line-height: 1.2; }
.qs-sub {
  font-family: var(--fm); font-size: 5.5px;
  color: var(--text-muted); margin-top: 1px;
}
.qs-hours .qs-value { color: var(--gold); }
.qs-earn .qs-value { color: var(--green); }
.qs-spent .qs-value { color: var(--red); }
.qs-domains .qs-value { color: var(--purple); }
.qs-xp .qs-value { color: var(--gold2); }
.qs-streak .qs-value { color: var(--orange); }

/* ═══════════════════════════════════════════════
   MOOD + WATER (quick row)
   ═══════════════════════════════════════════════ */
.quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.mood-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
}
.mood-emojis { display: flex; justify-content: space-between; gap: 3px; margin-top: 6px; }
.mood-btn {
  background: var(--bg2); border: 1px solid transparent;
  border-radius: var(--r); padding: 6px 2px; text-align: center;
  cursor: pointer; flex: 1; transition: all .2s ease;
  font-family: var(--fb); color: var(--text-dim); font-size: 10px;
}
.mood-btn div:first-child { font-size: 18px; margin-bottom: 1px; }
.mood-btn:hover { background: var(--surface-hover); border-color: var(--glass-border); }
.mood-btn.sel {
  background: var(--gold-dim); border-color: rgba(240,180,41,.35);
  color: var(--gold); transform: scale(1.03);
}
.mood-lbl { font-family: var(--fm); font-size: 5px; letter-spacing: .04em; text-transform: uppercase; }

.water-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
}
.water-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.water-title { font-size: 12px; font-weight: 600; }
.water-val { font-family: var(--fm); font-size: 11px; color: var(--blue); }
.water-track { height: 4px; background: rgba(255,255,255,.04); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.water-fill { height: 100%; width: 0%; border-radius: 4px; transition: width .5s ease; }
.water-btns { display: flex; gap: 4px; }
.water-btn {
  flex: 1; padding: 5px 0; background: var(--bg2);
  border: 1px solid var(--glass-border); border-radius: var(--r-sm);
  font-family: var(--fb); font-size: 9px; font-weight: 600;
  color: var(--blue); cursor: pointer; transition: all .2s;
}
.water-btn:hover { background: var(--surface-hover); border-color: rgba(96,165,250,.25); }
.water-btn:active { transform: scale(.95); }

/* ═══════════════════════════════════════════════
   GOALS + HABITS
   ═══════════════════════════════════════════════ */
.goals-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 8px;
}
.goals-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.goals-summary { font-family: var(--fm); font-size: 8px; color: var(--gold); }
.goal-input-row { display: flex; gap: 5px; margin-bottom: 8px; }
.goal-input {
  flex: 1; background: var(--bg2); border: 1px solid var(--glass-border);
  border-radius: var(--r-sm); padding: 7px 10px; font-family: var(--fb);
  font-size: 11px; color: var(--text); outline: none; transition: border-color .2s;
}
.goal-input:focus { border-color: rgba(240,180,41,.25); }
.goal-input::placeholder { color: var(--text-muted); }
.goal-add-btn {
  background: var(--gold-dim); border: 1px solid rgba(240,180,41,.2);
  border-radius: var(--r-sm); padding: 7px 12px; font-family: var(--fb);
  font-size: 10px; font-weight: 600; color: var(--gold); cursor: pointer; transition: .2s;
}
.goal-add-btn:hover { background: rgba(240,180,41,.22); }
.goals-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.goal-item {
  display: flex; align-items: center; gap: 7px; padding: 5px 7px;
  background: var(--bg2); border-radius: var(--r-sm); font-size: 11px; animation: slideIn .2s ease;
}
.goal-cb {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--glass-border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s; flex-shrink: 0;
  font-size: 8px; font-weight: 700; color: transparent;
}
.goal-item.done .goal-cb { background: var(--green); border-color: var(--green); color: #05050a; }
.goal-txt { flex: 1; }
.goal-item.done .goal-txt { text-decoration: line-through; color: var(--text-dim); }
.goal-del { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 11px; padding: 2px; transition: color .2s; }
.goal-del:hover { color: var(--red); }
.goals-bar-row { display: flex; align-items: center; gap: 6px; }
.goals-track { flex: 1; height: 2.5px; background: rgba(255,255,255,.04); border-radius: 2.5px; overflow: hidden; }
.goals-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), var(--green)); border-radius: 2.5px; transition: width .4s ease; }
.goals-pct { font-family: var(--fm); font-size: 7px; color: var(--text-dim); min-width: 26px; text-align: right; }

.habits-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 8px;
}
.habit-list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.habit-item {
  display: flex; align-items: center; gap: 7px; padding: 4px 7px;
  background: var(--bg2); border-radius: var(--r-sm); font-size: 11px; animation: slideIn .2s ease;
}
.habit-check { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--glass-border); cursor: pointer; flex-shrink: 0; transition: all .25s; }
.habit-item.done .habit-check { background: var(--purple); border-color: var(--purple); box-shadow: 0 0 6px rgba(155,114,245,.25); }
.habit-name { flex: 1; }
.habit-item.done .habit-name { text-decoration: line-through; color: var(--text-dim); }
.habit-streak { font-family: var(--fm); font-size: 6.5px; color: var(--gold); margin-right: 4px; }
.habit-del { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 9px; padding: 2px; transition: color .2s; }
.habit-del:hover { color: var(--red); }
.habit-add-row { display: flex; gap: 5px; }
.habit-input { flex: 1; background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r-sm); padding: 6px 9px; font-family: var(--fb); font-size: 10px; color: var(--text); outline: none; }
.habit-input:focus { border-color: rgba(155,114,245,.25); }
.habit-input::placeholder { color: var(--text-muted); }
.habit-add-btn { background: var(--purple-dim); border: 1px solid rgba(155,114,245,.18); border-radius: var(--r-sm); padding: 6px 10px; font-family: var(--fb); font-size: 9px; font-weight: 600; color: var(--purple2); cursor: pointer; transition: .2s; }
.habit-add-btn:hover { background: rgba(155,114,245,.18); }

/* ── Dual column (Goals + Habits side by side) ── */
.dual-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════
   AI SCORE RING
   ═══════════════════════════════════════════════ */
.score-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.score-hero { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.score-top {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.score-badge {
  font-family: var(--fm); font-size: 6.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--gold);
}
.score-gen-btn {
  background: var(--gold-dim); border: 1px solid rgba(240,180,41,.2);
  border-radius: var(--r-pill); padding: 4px 10px;
  font-family: var(--fm); font-size: 6.5px; color: var(--gold);
  cursor: pointer; transition: all .2s; letter-spacing: .04em;
  text-transform: uppercase; min-height: 28px;
}
.score-gen-btn:hover { background: rgba(240,180,41,.22); }
.score-body { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.score-ring-wrap { position: relative; width: 90px; height: 90px; flex-shrink: 0; }
.score-ring-svg { filter: drop-shadow(0 0 8px rgba(240,180,41,.12)); }
.score-ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-num { font-family: var(--fd); font-size: 24px; line-height: 1; color: var(--gold); }
.score-grade { font-family: var(--fm); font-size: 6px; color: var(--text-dim); }
.score-info { flex: 1; min-width: 0; font-size: 11px; color: var(--text-dim); line-height: 1.6; }
.score-detail { margin-top: 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.score-cat { text-align: center; padding: 6px 4px; background: var(--bg2); border-radius: var(--r-sm); }
.score-cat-val { font-family: var(--fd); font-size: 13px; }
.score-cat-lbl { font-family: var(--fm); font-size: 5.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.score-recs { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.score-rec { font-size: 10px; color: var(--text-dim); padding: 5px 8px; background: var(--bg2); border-radius: var(--r-sm); border-left: 2px solid var(--gold); }

/* ═══════════════════════════════════════════════
   PULSE CHART (via Chart.js)
   ═══════════════════════════════════════════════ */
.pulse-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.pulse-chart-container { position: relative; height: 90px; margin-top: 4px; width: 100%; }
.pulse-chart-container canvas { width: 100% !important; height: 100% !important; }

/* ═══════════════════════════════════════════════
   DOMAIN TRACKER (Time Tracking)
   ═══════════════════════════════════════════════ */
.cat-group {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  margin-bottom: 6px;
  overflow: hidden;
  transition: all .3s ease;
}
.cat-header {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; cursor: pointer; transition: background .2s;
}
.cat-header:hover { background: var(--surface-hover); }
.cat-icon { width: 32px; height: 32px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.cat-info { flex: 1; min-width: 0; }
.cat-name { font-size: 12px; font-weight: 600; }
.cat-summary { font-family: var(--fm); font-size: 6px; color: var(--text-dim); margin-top: 1px; }
.cat-hrs { font-family: var(--fm); font-size: 9px; flex-shrink: 0; }
.cat-chevron { font-size: 9px; color: var(--text-muted); transition: transform .3s; flex-shrink: 0; }
.cat-group.closed .cat-chevron { transform: rotate(-90deg); }
.cat-body { display: block; }
.cat-group.closed .cat-body { display: none; }

.domain-panel { border-top: 1px solid var(--glass-border); }
.dp-header {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; cursor: pointer; transition: background .2s;
}
.dp-header:hover { background: var(--surface-hover); }
.dp-icon-wrap { width: 26px; height: 26px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.dp-info { flex: 1; min-width: 0; }
.dp-name { font-size: 10px; font-weight: 600; }
.dp-realm { font-family: var(--fm); font-size: 5.5px; color: var(--text-muted); }
.dp-hrs { font-family: var(--fm); font-size: 8px; flex-shrink: 0; }
.dp-chevron { font-size: 7px; color: var(--text-muted); transition: transform .3s; flex-shrink: 0; }
.dp-body { padding: 0 14px 14px; display: none; }
.dp-open .dp-body { display: block; }
.dp-open .dp-chevron { transform: rotate(180deg); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 8px; }
.field label { display: block; font-family: var(--fm); font-size: 5.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 2px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--glass-border);
  border-radius: var(--r-sm); padding: 6px 9px; font-family: var(--fb);
  font-size: 11px; color: var(--text); outline: none; transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(255,255,255,.12); }
.field textarea { resize: vertical; min-height: 50px; }

/* ── Buttons ── */
.btn {
  border: none; padding: 7px 14px; border-radius: var(--r-sm);
  font-family: var(--fb); font-size: 10px; font-weight: 600;
  cursor: pointer; transition: all .2s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 34px;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(135deg, var(--purple), #825ee4); color: white; }
.btn-primary:hover { box-shadow: 0 3px 16px rgba(155,114,245,.25); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #05050a; }
.btn-gold:hover { box-shadow: 0 3px 16px rgba(240,180,41,.25); }
.btn-green { background: linear-gradient(135deg, var(--green), #22c55e); color: #05050a; }
.btn-red { background: linear-gradient(135deg, var(--red), #ef4444); color: white; }
.btn-blue { background: linear-gradient(135deg, var(--blue), #3b82f6); color: white; }
.btn-ghost { background: var(--surface-hover); color: var(--text-dim); border: 1px solid var(--glass-border); }
.btn-ghost:hover { background: rgba(30,28,52,.9); color: var(--text); }
.btn-purple { background: var(--purple-dim); color: var(--purple2); border: 1px solid rgba(155,114,245,.18); }
.btn-purple:hover { background: rgba(155,114,245,.18); }
.btn-row { display: flex; gap: 7px; }

/* ── Sleep ── */
.sleep-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.sleep-stat { background: var(--bg2); border-radius: var(--r-sm); padding: 7px; text-align: center; }
.sleep-stat-val { font-family: var(--fd); font-size: 16px; color: var(--purple); }
.sleep-stat-lbl { font-family: var(--fm); font-size: 5.5px; color: var(--text-dim); letter-spacing: .06em; text-transform: uppercase; margin-top: 1px; }
.sq-btns { display: flex; gap: 3px; margin-top: 4px; }
.sq-btn { flex: 1; padding: 5px 0; background: var(--bg2); border: 1px solid transparent; border-radius: var(--r-sm); font-family: var(--fb); font-size: 10px; color: var(--text-dim); cursor: pointer; text-align: center; transition: all .2s; }
.sq-btn.active { background: var(--purple-dim); border-color: rgba(155,114,245,.25); color: var(--purple2); }

/* ── Log lists ── */
.log-list { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.log-item {
  display: flex; align-items: center; gap: 6px; padding: 5px 7px;
  background: var(--bg2); border-radius: var(--r-sm); font-size: 10px;
  animation: slideIn .25s ease both;
  transition: background .2s, transform .2s;
}
.log-item:hover { background: var(--surface-hover); transform: translateX(2px); }
.log-time { font-family: var(--fm); font-size: 6px; color: var(--text-muted); min-width: 36px; }
.log-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.log-desc { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-hrs { font-family: var(--fm); font-size: 7px; color: var(--text-dim); flex-shrink: 0; }
.log-xp { font-family: var(--fm); font-size: 6px; color: var(--gold); flex-shrink: 0; }

/* ── Spinner ── */
.spinner { width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.06); border-top-color: var(--purple); border-radius: 50%; animation: spin .6s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Score breakdown (JS-generated) ── */
.score-summary { font-family: var(--fb); font-size: 11px; color: var(--text-dim); font-style: italic; line-height: 1.5; margin-bottom: 10px; }
.score-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.scat { text-align: center; padding: 6px 4px; background: var(--bg2); border-radius: var(--r-sm); }
.scat-name { font-family: var(--fm); font-size: 5.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 2px; }
.scat-bar { height: 3px; background: rgba(255,255,255,.03); border-radius: 3px; overflow: hidden; margin-bottom: 2px; }
.scat-fill { height: 100%; border-radius: 3px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.scat-val { font-family: var(--fd); font-size: 10px; }

/* ── AI box ── */
.ai-box { background: rgba(155,114,245,.04); border: 1px solid rgba(155,114,245,.1); border-radius: var(--r); padding: 10px 12px; margin-top: 6px; }
.ai-box-hdr { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.ai-box-title { font-size: 10px; color: var(--text-dim); }

/* ── Confetti / celebration ── */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 600; overflow: hidden; }
.cfp { position: absolute; top: -10px; animation: cfpFall 2.5s ease-in forwards; }
@keyframes cfpFall { to { transform: translateY(100vh) rotate(720deg); opacity: 0; } }
.celebrate-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 601; background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 24px 32px; text-align: center; animation: scaleIn .3s ease; box-shadow: var(--shadow); }

/* ── Goals empty state ── */
.goals-empty { font-family: var(--fm); font-size: 10px; color: var(--text-muted); font-style: italic; padding: 10px 0; text-align: center; }

/* ── Income / Expense rows ── */
.income-row { background: var(--green-dim); border: 1px solid rgba(74,222,128,.1); border-radius: var(--r); padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; }
.income-label { font-family: var(--fm); font-size: 5.5px; color: var(--text-dim); letter-spacing: .06em; text-transform: uppercase; }
.income-val { font-family: var(--fd); font-size: 14px; color: var(--green); }
.expense-row { background: var(--red-dim); border: 1px solid rgba(248,113,113,.1); border-radius: var(--r); padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; }

/* ── Pill log (supplements) ── */
.pill-log { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pill-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; background: var(--bg2); border: 1px solid var(--glass-border);
  border-radius: var(--r-pill); font-size: 8px; font-family: var(--fm);
}

/* ── AI elements ── */
.ai-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; background: var(--purple-dim); border: 1px solid rgba(155,114,245,.2); border-radius: var(--r-pill); font-family: var(--fm); font-size: 5.5px; color: var(--purple2); letter-spacing: .06em; text-transform: uppercase; }
.ai-loading { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-dim); }

/* ── Exercise rows ── */
.ex-headers { display: grid; grid-template-columns: 1fr 40px 40px 50px 20px; gap: 4px; padding: 4px 4px 2px; font-family: var(--fm); font-size: 5.5px; color: var(--text-muted); letter-spacing: .06em; text-transform: uppercase; }
.ex-row { display: grid; grid-template-columns: 1fr 40px 40px 50px 20px; gap: 4px; margin-bottom: 4px; align-items: center; }
.ex-row input, .ex-row select { width: 100%; background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r-sm); padding: 4px 6px; font-family: var(--fb); font-size: 9px; color: var(--text); outline: none; }
.row-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 2px; text-align: center; }
.row-remove:hover { color: var(--red); }

/* ═══════════════════════════════════════════════
   WEEKLY VIEW
   ═══════════════════════════════════════════════ */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.week-day { text-align: center; padding: 8px 2px; border-radius: var(--r-sm); font-size: 9px; transition: all .35s cubic-bezier(.22,1,.36,1); cursor: default; border: 1px solid transparent; }
.week-day:hover { transform: scale(1.07); border-color: rgba(240,180,41,.15); box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.wd-name { font-family: var(--fm); font-size: 5.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 1px; }
.wd-hrs { font-family: var(--fd); font-size: 13px; display: block; }
.wd-mood { font-size: 12px; display: block; margin-top: 1px; }

.domain-breakdown { display: flex; flex-direction: column; gap: 5px; }
.domain-row { display: flex; align-items: center; gap: 7px; }
.domain-row-icon { font-size: 11px; width: 18px; text-align: center; flex-shrink: 0; }
.domain-row-name { font-size: 9px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.domain-bar-wrap { flex: 2; height: 3.5px; background: rgba(255,255,255,.03); border-radius: 3.5px; overflow: hidden; position: relative; }
.domain-bar-fill { height: 100%; border-radius: 3.5px; transition: width .8s cubic-bezier(.4,0,.2,1); position:relative;z-index:1; }
.domain-bar-prev { position: absolute; top: 0.75px; left: 0; height: 2px; border-radius: 2px; opacity: .25; z-index:0; }
.domain-hrs { font-family: var(--fm); font-size: 6.5px; color: var(--text-dim); width: 26px; text-align: right; }
.stat-box { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r-sm); padding: 7px 9px; }
.btn-sm { font-size: 9px; padding: 4px 10px; min-height: unset; }
.btn-ghost.active { background: var(--glass-border); color: var(--gold); }

/* ── Weekly metrics tiles ── */
.metric-tile { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 8px 10px; transition: border-color .25s, transform .25s; }
.metric-tile:hover { border-color: var(--glass-border-hover); transform: translateY(-1px); }
.metric-tile .metric-val { font-family: var(--fd); font-size: 18px; line-height: 1; }
.metric-tile .metric-lbl { font-family: var(--fm); font-size: 5.5px; color: var(--text-dim); letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }

/* ── Journal history ── */
.journal-entry { padding: 8px 10px; background: var(--bg2); border-radius: var(--r-sm); margin-bottom: 5px; font-size: 10px; line-height: 1.6; }
.journal-date { font-family: var(--fm); font-size: 6px; color: var(--text-dim); margin-bottom: 3px; }
.journal-text { margin-bottom: 2px; }
.journal-ai { font-size: 9px; color: var(--purple2); padding: 4px 6px; background: var(--purple-dim); border-radius: var(--r-sm); margin-top: 4px; border-left: 2px solid var(--purple); }

/* ── Weekly layout helpers ── */
.mb-10 { margin-bottom: 10px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.insights-text { font-size: 12px; color: var(--text-dim); font-style: italic; line-height: 1.8; }
.chart-container-sm { position: relative; height: 80px; width: 100%; margin-top: 4px; }
.chart-container-sm canvas { width: 100% !important; height: 100% !important; }

/* ═══════════════════════════════════════════════
   HEALTH VIEW
   ═══════════════════════════════════════════════ */
.gfit-chart-canvas { width: 100% !important; border-radius: var(--r-sm); }

/* ── Health view layout helpers ── */
.flex-sb { display: flex; align-items: center; justify-content: space-between; }
.flex-ac { display: flex; align-items: center; }
.gap-7 { gap: 7px; }
.gap-9 { gap: 9px; }
.flex-1 { flex: 1; }
.btn-full { width: 100%; }

.sleep-hist { display: flex; align-items: flex-end; gap: 4px; height: 42px; }
.sh-grp { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sh-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .5s ease; }
.sh-bar:hover { opacity: .8; }
.sh-val { font-family: var(--fm); font-size: 7px; color: var(--text-dim); }
.sh-lbl { font-family: var(--fm); font-size: 5.5px; color: var(--text-muted); letter-spacing: .04em; margin-top: 1px; }

.health-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 8px; }
.health-tile { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 7px; text-align: center; transition: border-color .25s, transform .25s; }
.health-tile:hover { border-color: var(--glass-border-hover); transform: translateY(-1px); }
.health-tile .health-tile-val { font-family: var(--fd); font-size: 14px; }
.health-tile .health-tile-lbl { font-family: var(--fm); font-size: 5px; color: var(--text-dim); letter-spacing: .04em; text-transform: uppercase; margin-top: 1px; }

/* ── Meal tracker ── */
.meal-card { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 8px; }
.meal-daily-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.meal-daily-total .total-label { font-family: var(--fm); font-size: 5.5px; color: var(--text-dim); letter-spacing: .08em; text-transform: uppercase; }
.meal-daily-total .total-val { font-family: var(--fd); font-size: 20px; color: var(--orange); }
.meal-daily-total .total-goal { font-family: var(--fm); font-size: 7px; color: var(--text-dim); }
.meal-upload-btn { border: 1.5px dashed var(--glass-border); border-radius: var(--r); padding: 16px; text-align: center; cursor: pointer; transition: all .3s; font-size: 11px; color: var(--text-dim); }
.meal-upload-btn:hover { border-color: var(--purple); background: var(--purple-dim); }
.upload-icon { font-size: 24px; margin-bottom: 4px; }

/* ═══════════════════════════════════════════════
   GYM VIEW
   ═══════════════════════════════════════════════ */
.hof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 5px; }
.hof-card { background: linear-gradient(135deg, rgba(240,180,41,.06), rgba(155,114,245,.04)); border: 1px solid rgba(240,180,41,.12); border-radius: var(--r); padding: 8px; text-align: center; transition: border-color .25s, transform .25s, box-shadow .25s; }
.hof-card:hover { border-color: rgba(240,180,41,.3); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(240,180,41,.08); }
.hof-card .hof-exercise { font-family: var(--fm); font-size: 6px; color: var(--gold); letter-spacing: .04em; text-transform: uppercase; }
.hof-card .hof-pr { font-family: var(--fd); font-size: 14px; margin: 1px 0; }
.hof-card .hof-date { font-family: var(--fm); font-size: 5.5px; color: var(--text-muted); }
.gym-hof-count { font-family: var(--fm); font-size: 7px; color: var(--text-dim); }

/* ═══════════════════════════════════════════════
   RESELL VIEW
   ═══════════════════════════════════════════════ */
.buy-row, .sell-row { display: grid; grid-template-columns: 1fr 80px 24px; gap: 5px; margin-bottom: 4px; }
.flip-card { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 10px 12px; margin-bottom: 5px; }
.flip-date { font-family: var(--fm); font-size: 6px; color: var(--text-dim); margin-bottom: 3px; }
.flip-items { font-size: 10px; margin-bottom: 3px; }
.flip-profit { font-family: var(--fd); font-size: 14px; }
.flip-profit.pos { color: var(--gold); }
.flip-profit.neg { color: var(--red); }

/* ── Resell layout ── */
.resell-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.resell-card { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; transition: transform .25s, border-color .25s; }
.resell-card:hover { transform: translateY(-1px); border-color: var(--glass-border-hover); }
.resell-card.spent { background: var(--red-dim); border-color: rgba(248,113,113,.1); }
.resell-card.rev { background: var(--green-dim); border-color: rgba(74,222,128,.1); }
.resell-card.profit { background: rgba(240,180,41,.04); border-color: rgba(240,180,41,.1); }
.resell-val { font-family: var(--fd); font-size: 18px; }
.resell-val.red { color: var(--red); }
.resell-val.green { color: var(--green); }
.resell-val.gold { color: var(--gold); }
.flip-add-indicator { font-family: var(--fm); font-size: 9px; color: rgba(34,197,94,.5); }
.resell-header-row { display: grid; grid-template-columns: 2fr 1fr 30px; gap: 6px; margin-bottom: 5px; }
.resell-header-row span { font-family: var(--fm); font-size: 6px; color: var(--text-dim); }
.resell-divider { border: none; border-top: 1px solid var(--border); margin-bottom: 12px; }

/* ═══════════════════════════════════════════════
   RECOVERY VIEW
   ═══════════════════════════════════════════════ */
.rec-hero { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 18px; margin-bottom: 8px; }
.rec-score-row { display: flex; align-items: center; gap: 14px; }
.rec-ring-wrap { position: relative; width: 90px; height: 90px; flex-shrink: 0; }
.rec-ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rec-score-num { font-family: var(--fd); font-size: 22px; line-height: 1; }
.rec-status-badge { display: inline-block; font-family: var(--fm); font-size: 6.5px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--r-pill); margin-bottom: 4px; }
.rec-status-text { font-size: 10px; color: var(--text-dim); line-height: 1.5; }
.rec-factors { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; }
.rec-factor { display: grid; grid-template-columns: 150px 80px 1fr; gap: 8px; align-items: center; min-width: 0; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.03); }
.rec-factor:last-child { border-bottom: none; }
.rec-factor-label { font-family: var(--fm); font-size: 7px; color: var(--text-dim); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-factor-val { font-family: var(--fd); font-size: 12px; text-align: right; }
.rec-factor-bar { height: 3px; background: rgba(255,255,255,.04); border-radius: 3px; overflow: hidden; }
.rec-factor-bar:has(.rec-factor-bar-inner) { display: flex; align-items: center; height: auto; background: none; overflow: visible; }
.rec-factor-bar-inner { height: 3px; background: rgba(255,255,255,.04); border-radius: 3px; overflow: hidden; flex: 1; }
.rec-factor-fill { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(.4,0,.2,1); }

/* ── Pattern insights (JS-generated) ── */
.pattern-card { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; background: var(--bg2); border-radius: var(--r-sm); margin-bottom: 4px; border-left: 2px solid var(--purple); }
.pattern-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.pattern-title { font-size: 10px; font-weight: 600; margin-bottom: 2px; }
.pattern-desc { font-family: var(--fm); font-size: 7px; color: var(--text-dim); line-height: 1.5; }

/* ── Recovery week breakdown ── */
.rec-week-breakdown { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.rec-week-row { display: grid; grid-template-columns: 28px 1fr 34px 22px; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 6px; transition: background .15s; }
.rec-week-row:hover { background: rgba(255,255,255,.015); }
.rec-week-row.is-today { background: rgba(255,255,255,.025); }
.rec-week-day { font-family: var(--fm); font-size: 7px; color: var(--text-dim); text-align: center; }
.rec-week-day.is-today { color: var(--gold); font-weight: 700; }
.rec-week-bar { height: 8px; background: rgba(255,255,255,.04); border-radius: 4px; overflow: hidden; flex: 1; }
.rec-week-fill { height: 100%; border-radius: 4px; opacity: .8; transition: width .5s ease; }
.rec-week-score { font-family: var(--fm); font-size: 8px; text-align: right; }
.rec-week-mood { font-size: 11px; text-align: center; }

.stress-btns { display: flex; gap: 4px; }
.stress-btn { flex: 1; padding: 7px 3px; text-align: center; background: var(--bg2); border: 1px solid transparent; border-radius: var(--r); cursor: pointer; transition: all .2s; font-family: var(--fb); color: var(--text-dim); font-size: 14px; }
.stress-btn:hover { background: var(--surface-hover); }
.stress-btn.sel { background: var(--purple-dim); border-color: rgba(155,114,245,.25); }

.debt-meter { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 8px; }
.debt-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.debt-num { font-family: var(--fd); font-size: 20px; color: var(--red); }
.debt-track { height: 5px; background: rgba(255,255,255,.03); border-radius: 5px; overflow: hidden; }
.debt-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--green), var(--orange), var(--red)); transition: width 1s ease; }
.debt-labels { display: flex; justify-content: space-between; font-family: var(--fm); font-size: 5.5px; color: var(--text-muted); margin-top: 2px; }
.debt-title { font-family: var(--fm); font-size: 7px; letter-spacing: .16em; text-transform: uppercase; color: rgba(248,113,113,.7); margin-bottom: 3px; }
.debt-sub { font-size: 11px; color: var(--text-dim); }

/* ── Timeline ── */
.timeline-wrap { margin-top: 6px; }
.timeline-bar { display: flex; height: 14px; border-radius: var(--r-sm); overflow: hidden; margin-bottom: 3px; }
.timeline-segment { height: 14px; display: flex; align-items: center; justify-content: center; font-size: 6px; font-family: var(--fm); letter-spacing: .04em; transition: width .5s ease; white-space: nowrap; overflow: hidden; }
.timeline-segment:hover { opacity: .85; }
.timeline-hour-lbl { font-family: var(--fm); font-size: 5.5px; color: var(--text-muted); min-width: 0; }
.timeline-hours { display: flex; justify-content: space-between; font-family: var(--fm); font-size: 5px; color: var(--text-muted); margin-bottom: 6px; }
.timeline-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-legend-item { display: flex; align-items: center; gap: 3px; font-size: 7px; color: var(--text-dim); }
.tl-legend-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

/* ── Chart containers ── */
.chart-container { position: relative; width: 100%; }
.chart-container canvas { width: 100% !important; }

/* ═══════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════ */
.toast-container {
  position: fixed; top: calc(56px + var(--safe-top));
  left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; gap: 5px;
  pointer-events: none;
}
.toast {
  background: var(--surface-hover); border: 1px solid var(--glass-border);
  border-radius: var(--r-pill); padding: 8px 14px; font-size: 11px; font-weight: 500;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
  pointer-events: auto; text-align: center; white-space: nowrap;
  position: relative; cursor: default;
}
.toast .toast-dismiss { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: pointer; padding: 4px; line-height: 1; display: none; opacity: .5; }
.toast:hover .toast-dismiss { display: block; }
.toast:hover .toast-dismiss:hover { opacity: 1; }
.toast.dismissed { animation: toastOut .2s ease forwards !important; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(.95); } }

/* ═══════════════════════════════════════════════
   SETTINGS MODAL
   ═══════════════════════════════════════════════ */
.settings-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 400; display: none; animation: fadeIn .2s; }
.settings-overlay.open { display: block; }
.settings-modal {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 360px; max-width: 90vw;
  background: var(--bg); border-left: 1px solid var(--glass-border);
  z-index: 401; display: none; flex-direction: column;
  animation: slideInRight .3s cubic-bezier(.16,1,.3,1);
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.settings-modal.open { display: flex; }
.settings-hdr { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--glass-border); }
.settings-hdr-title { font-size: 14px; font-weight: 600; }
.settings-close { background: none; border: none; color: var(--text-dim); font-size: 16px; cursor: pointer; padding: 4px; }
.settings-close:hover { color: var(--text); }
.settings-scroll { flex: 1; overflow-y: auto; padding: 18px; }
.settings-section { margin-bottom: 20px; }
.settings-section-title { font-family: var(--fm); font-size: 6.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--glass-border); }

.badge-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.badge-item { text-align: center; padding: 6px 3px; border-radius: var(--r); transition: .2s; }
.badge-item.locked { opacity: .2; }
.badge-item.unlocked { background: rgba(240,180,41,.05); border: 1px solid rgba(240,180,41,.12); }
.badge-item .badge-icon { font-size: 20px; display: block; margin-bottom: 1px; }
.badge-item .badge-name { font-family: var(--fm); font-size: 4.5px; color: var(--text-dim); letter-spacing: .02em; }
.badge-count { display: block; font-family: var(--fm); font-size: 6px; color: var(--text-muted); margin-top: 5px; text-align: center; }

.theme-selector { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.theme-opt { padding: 8px 5px; text-align: center; background: var(--bg2); border: 1px solid transparent; border-radius: var(--r); cursor: pointer; transition: .2s; font-family: var(--fb); color: var(--text-dim); font-size: 9px; }
.theme-opt:hover { background: var(--surface-hover); }
.theme-opt.sel { border-color: var(--gold); color: var(--gold); }
.theme-opt .theme-dot { width: 18px; height: 18px; border-radius: 50%; margin: 0 auto 3px; }

.sync-area { }
.sync-actions { display: flex; gap: 6px; }
.sync-status { font-family: var(--fm); font-size: 6px; color: var(--text-dim); margin-top: 5px; }

.cdom-list { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.cdom-item { display: flex; align-items: center; gap: 6px; padding: 5px 7px; background: var(--bg2); border-radius: var(--r-sm); font-size: 10px; }

/* ── Auth overlay ── */
.auth-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 500; display: none; align-items: center; justify-content: center; }
.auth-modal { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 24px; width: 340px; max-width: 90vw; }
.auth-brand { font-family: var(--fd); font-size: 22px; text-align: center; margin-bottom: 2px; background: linear-gradient(135deg, var(--gold), #fff8d6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-tagline { text-align: center; font-size: 11px; color: var(--text-dim); margin-bottom: 18px; }
.auth-form { }
.auth-tabs { display: flex; gap: 0; margin-bottom: 14px; }
.auth-tab { flex: 1; padding: 7px; background: var(--bg2); border: 1px solid var(--glass-border); cursor: pointer; font-family: var(--fb); font-size: 10px; color: var(--text-dim); transition: .2s; }
.auth-tab:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.auth-tab:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.auth-tab.active { background: var(--purple-dim); color: var(--purple2); border-color: rgba(155,114,245,.2); }
.auth-input { width: 100%; background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r-sm); padding: 8px 10px; font-family: var(--fb); font-size: 12px; color: var(--text); outline: none; margin-bottom: 6px; }
.auth-input:focus { border-color: rgba(155,114,245,.25); }
.auth-btn { width: 100%; padding: 9px; background: linear-gradient(135deg, var(--purple), #825ee4); border: none; border-radius: var(--r-sm); color: white; font-family: var(--fb); font-size: 12px; font-weight: 600; cursor: pointer; transition: .2s; margin-top: 4px; }
.auth-btn:hover { box-shadow: 0 3px 16px rgba(155,114,245,.25); }
.auth-btn:disabled { opacity: .5; cursor: default; }
.auth-error { font-size: 10px; color: var(--red); text-align: center; margin-top: 6px; }
.auth-loading { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 10px; color: var(--text-dim); margin-top: 8px; }
.auth-skip { text-align: center; margin-top: 12px; font-size: 10px; color: var(--text-muted); cursor: pointer; }
.auth-skip:hover { color: var(--text-dim); }

/* ── Auth user info ── */
.auth-user-info { display: flex; align-items: center; gap: 7px; padding: 6px 8px; background: var(--bg2); border-radius: var(--r-sm); }
.auth-user-email { font-family: var(--fm); font-size: 7px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════════
   BOTTOM NAV
   ═══════════════════════════════════════════════ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 300;
  background: rgba(5, 5, 10, .95);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  padding: 6px 4px calc(6px + var(--safe-bot));
  display: flex; align-items: center; justify-content: space-around; gap: 2px;
}
.bnav-btn {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 1px; padding: 3px 5px; min-width: 44px;
  position: relative; transition: color .25s; font-family: var(--fb);
}
.bnav-btn.active { color: var(--text); }
.bnav-btn .bnav-icon {
  font-size: 16px; transition: all .3s cubic-bezier(.34,1.56,.64,1);
  width: 28px; height: 28px; display: flex; align-items: center;
  justify-content: center; border-radius: var(--r);
}
.bnav-btn.active .bnav-icon {
  background: var(--gold-dim); color: var(--gold);
  transform: scale(1.1);
}
.bnav-label {
  font-size: 6px; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 600;
}
.bnav-dot {
  position: absolute; top: -1px; right: 2px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--gold); display: none;
}
.bnav-btn.active .bnav-dot { display: block; }

/* ═══════════════════════════════════════════════
   COLLAPSIBLE
   ═══════════════════════════════════════════════ */
.collapsible { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 8px; }
.collapsible-hdr { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; cursor: pointer; transition: background .2s; }
.collapsible-hdr:hover { background: var(--surface-hover); }
.collapsible-title { font-size: 12px; font-weight: 600; }
.collapsible-chevron { font-size: 9px; color: var(--text-muted); transition: transform .3s; }
.collapsible.open .collapsible-chevron { transform: rotate(180deg); }
.collapsible-body { display: none; padding: 0 14px 14px; }
.collapsible.open .collapsible-body { display: block; }

/* ═══════════════════════════════════════════════
   VERSION INDICATOR
   ═══════════════════════════════════════════════ */
.version-indicator { font-family: var(--fm); font-size: 5px; color: var(--text-muted); text-align: center; padding: 4px; }

/* ═══════════════════════════════════════════════
   ADDITIONAL UI ELEMENTS (from today.js)
   ═══════════════════════════════════════════════ */
.gym-log-entry { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 8px 10px; margin-bottom: 5px; font-size: 10px; }
.gym-log-hdr { display: flex; justify-content: space-between; margin-bottom: 3px; }
.gym-log-split { font-family: var(--fm); font-size: 6.5px; color: var(--text-dim); }
.gym-log-meta { font-family: var(--fm); font-size: 6px; color: var(--text-muted); }
.gym-log-exercises { font-size: 9px; }
.gym-ai-box { background: var(--purple-dim); border: 1px solid rgba(155,114,245,.1); border-radius: var(--r); padding: 8px 10px; margin-top: 6px; font-size: 10px; color: var(--text-dim); line-height: 1.6; }
.gym-hist-entry { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 8px 10px; margin-bottom: 6px; transition: border-color .25s, box-shadow .25s, transform .25s; animation: fadeUp .35s ease both; }
.gym-hist-entry:hover { border-color: rgba(240,180,41,.15); box-shadow: 0 2px 16px rgba(0,0,0,.25); transform: translateY(-1px); }
.gym-hist-date { font-family: var(--fm); font-size: 6px; color: var(--text-dim); margin-bottom: 2px; }
.gym-hist-split { font-size: 11px; font-weight: 700; margin-bottom: 3px; }
.gym-hist-ex { font-family: var(--fm); font-size: 8px; color: var(--text-dim); line-height: 1.8; }
.gym-warn { display: flex; align-items: center; gap: 7px; padding: 7px 9px; background: rgba(251,146,60,.06); border: 1px solid rgba(251,146,60,.15); border-radius: var(--r-sm); margin-bottom: 5px; font-size: 10px; color: var(--text-dim); }
.ex-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; min-height: 40px; }
.ex-remove:hover { color: var(--red); }
.suggestion-card { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r-sm); padding: 7px 9px; margin-bottom: 4px; cursor: pointer; transition: border-color .2s; }
.suggestion-card:hover { border-color: var(--purple); }
.suggestion-name { font-size: 10px; font-weight: 600; margin-bottom: 2px; }
.suggestion-desc { font-family: var(--fm); font-size: 7px; color: var(--text-dim); }
.gym-suggest-add { font-family: var(--fm); font-size: 5.5px; color: var(--purple2); margin-top: 3px; }
.hof-weight { font-family: var(--fd); font-size: 14px; margin: 1px 0; }

/* ── Meal tracker elements ── */
.meal-name { font-size: 11px; font-weight: 600; }
.meal-meta { font-family: var(--fm); font-size: 6px; color: var(--text-muted); }
.meal-cal { font-family: var(--fd); font-size: 14px; color: var(--orange); }
.meal-analyzing { display: flex; align-items: center; gap: 7px; padding: 12px; font-size: 11px; color: var(--text-dim); }
.meal-log-btn { flex: 1; padding: 7px; background: rgba(251,146,60,.1); border: 1px solid rgba(251,146,60,.2); border-radius: var(--r-sm); cursor: pointer; font-family: var(--fb); font-size: 9px; font-weight: 600; color: var(--orange); text-align: center; transition: .2s; }
.meal-log-btn:hover { background: rgba(251,146,60,.18); }

/* ── Pill entry (supplements) ── */
.pill-entry { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: var(--r-pill); font-size: 8px; font-family: var(--fm); background: rgba(96,165,250,.08); border: 1px solid rgba(96,165,250,.25); color: var(--blue); }

/* ── Insight banner ── */
.insight-banner { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px; animation: fadeUp .3s ease; }
.ib-icon { font-size: 20px; flex-shrink: 0; }
.ib-title { font-size: 11px; font-weight: 600; }
.ib-text { font-family: var(--fm); font-size: 7px; color: var(--text-dim); margin-top: 1px; }

.reflection-saved { padding: 8px; background: var(--bg2); border-radius: var(--r-sm); font-size: 10px; line-height: 1.5; }

/* ── Widget Builder ── */
.widget-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.widget-card { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 10px; }
.widget-actions { display: flex; gap: 4px; margin-top: 6px; }
.widget-actions button { flex: 1; }

/* ── Chat modal ── */
.chat-fab { position: fixed; bottom: 80px; right: 16px; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--purple), var(--gold)); border: none; color: white; font-size: 18px; cursor: pointer; box-shadow: 0 4px 20px rgba(155,114,245,.3); z-index: 250; transition: transform .2s; display: flex; align-items: center; justify-content: center; }
.chat-fab:hover { transform: scale(1.08); }
.chat-modal { position: fixed; bottom: 80px; right: 16px; width: 340px; max-width: calc(100vw - 32px); max-height: 60vh; background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r-lg); display: none; flex-direction: column; z-index: 260; overflow: hidden; box-shadow: var(--shadow); }
.chat-modal.open { display: flex; }
.chat-hdr { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--glass-border); font-size: 11px; font-weight: 600; }
.chat-close { background: none; border: none; color: var(--text-dim); font-size: 14px; cursor: pointer; }
.chat-messages { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; max-height: 40vh; }
.chat-msg { padding: 6px 10px; border-radius: var(--r); font-size: 10px; max-width: 85%; line-height: 1.5; }
.chat-msg.user { align-self: flex-end; background: var(--purple-dim); color: var(--purple2); }
.chat-msg.bot { align-self: flex-start; background: var(--bg2); color: var(--text-dim); }
.chat-input-row { display: flex; gap: 5px; padding: 8px 10px; border-top: 1px solid var(--glass-border); }
.chat-input { flex: 1; background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r-sm); padding: 6px 9px; font-family: var(--fb); font-size: 10px; color: var(--text); outline: none; }
.chat-send { background: linear-gradient(135deg, var(--purple), #825ee4); border: none; border-radius: var(--r-sm); padding: 6px 12px; color: white; font-size: 14px; cursor: pointer; }

/* ── Study view elements ── */
.study-card { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 8px; }
.study-record { display: flex; align-items: center; gap: 8px; padding: 5px 7px; background: var(--bg2); border-radius: var(--r-sm); margin-bottom: 3px; font-size: 10px; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .main { padding: 10px 10px calc(68px + var(--safe-bot)); }
  .quick-stats { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .quick-row { grid-template-columns: 1fr; }
  .dual-col { grid-template-columns: 1fr; }
  .health-tiles { grid-template-columns: repeat(2, 1fr); }
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
  .settings-modal { width: 100vw; max-width: 100vw; }
  .greeting-h1 { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .score-detail { grid-template-columns: repeat(2, 1fr); }
  .score-hero { flex-direction: column; text-align: center; }
  .score-body { flex-direction: column; align-items: center; }
}

/* ═══════════════════════════════════════════════
   MUSCLE DIAGRAM
   ═══════════════════════════════════════════════ */
.muscle-diagram-wrap { border-top: 1px solid var(--glass-border); padding-top: 4px; }
.md-layout { display: flex; gap: 10px; margin-bottom: 4px; align-items: flex-start; }
.md-flip-container { flex: 1; perspective: 1200px; max-width: 100px; margin: 0 auto; }
.md-flip-inner { display: grid; grid-template-areas: "same"; transition: transform .65s cubic-bezier(.22,1,.36,1); transform-style: preserve-3d; }
.md-flip-container:hover .md-flip-inner { transform: rotateY(180deg); }
.md-flip-front, .md-flip-back { grid-area: same; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.md-flip-back { transform: rotateY(180deg); }
.md-flip-front .md-svg, .md-flip-back .md-svg { width: 100%; max-width: 80px; height: auto; display: block; margin: 0 auto; }
.md-flip-front .md-svg path, .md-flip-back .md-svg path { transition: fill .3s ease, stroke .3s ease; cursor: default; }
.md-flip-front .md-svg path:hover, .md-flip-back .md-svg path:hover { opacity: .85; }
.md-label { font-family: var(--fm); font-size: 5.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; text-align: center; }
.md-legend { font-family: var(--fm); font-size: 6px; color: var(--text-dim); line-height: 1.6; padding: 3px 0; flex: 1; }

/* ── Exercise fast-add button ── */
.ex-fast-add {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 13px; width: 20px; height: 20px; display: flex;
  align-items: center; justify-content: center; border-radius: 50%;
  transition: color .2s, background .2s;
}
.ex-fast-add:hover { color: var(--green); background: rgba(74,222,128,.1); }

@media (max-width: 480px) {
  .md-layout { gap: 4px; }
  .md-flip-container { max-width: 72px; }
}

/* ── Responsive: Tablet (768px) ── */
@media (max-width: 768px) {
  .quick-stats { grid-template-columns: repeat(3, 1fr); }
  .quick-row { grid-template-columns: 1fr; }
  .dual-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Responsive: Small Tablet (640px) ── */
@media (max-width: 640px) {
  .main { padding: 10px 12px calc(68px + var(--safe-bot)); }
  .quick-stats { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .form-grid { grid-template-columns: 1fr; }
  .health-tiles { grid-template-columns: repeat(2, 1fr); }
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
  .settings-modal { width: 100vw; max-width: 100vw; }
  .greeting-h1 { font-size: 22px; }
  .score-hero { flex-direction: column; text-align: center; }
  .score-body { flex-direction: column; align-items: center; }
  .score-detail { grid-template-columns: repeat(2, 1fr); }
}

/* ── Responsive: Small Phone (360px) ── */
@media (max-width: 360px) {
  .greeting-h1 { font-size: 19px; }

/* ═══════════════════════════════════════════════
   SMMA VIEW
   ═══════════════════════════════════════════════ */
.smma-stat { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 8px 4px; text-align: center; }
.smma-stat-val { font-family: var(--fd); font-size: 20px; line-height: 1.2; }
.smma-stat-lbl { font-family: var(--fm); font-size: 5.5px; color: var(--text-dim); letter-spacing: .06em; text-transform: uppercase; margin-top: 1px; }

.smma-client-card { background: var(--bg2); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 10px 12px; margin-bottom: 6px; }
.smma-client-name { font-size: 12px; font-weight: 600; }
.smma-status-badge { font-family: var(--fm); font-size: 6px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid currentColor; }

.smma-rev-item { display: flex; flex-direction: column; gap: 1px; background: var(--surface); border-radius: var(--r-sm); padding: 4px 6px; text-align: center; }
.smma-rev-lbl { font-family: var(--fm); font-size: 5.5px; color: var(--text-dim); letter-spacing: .04em; text-transform: uppercase; }
.smma-rev-val { font-family: var(--fd); font-size: 12px; line-height: 1.2; }
  .qs-value { font-size: 13px; }
  .water-btns { gap: 3px; }
  .water-btn { font-size: 8px; padding: 5px 6px; min-width: 0; }
  .cat-header { padding: 8px 10px; }
  .mood-emojis { gap: 2px; }
  .mood-btn { min-width: 44px; padding: 6px 0; }
  .resell-grid { grid-template-columns: 1fr; }
}
