*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --indigo:        #4f46e5;
  --indigo-dark:   #4338ca;
  --indigo-light:  #eef2ff;
  --indigo-subtle: rgba(79,70,229,.08);
  --gold:          #d97706;
  --gold-bg:       rgba(217,119,6,.08);
  --gold-border:   rgba(217,119,6,.2);
  --red:           #dc2626;
  --red-bg:        rgba(220,38,38,.06);
  --green:         #059669;
  --green-bg:      rgba(5,150,105,.08);
  --purple:        #7c3aed;
  --blue:          #2563eb;
  --slate:         #475569;
  --text-1:        #0f172a;
  --text-2:        #475569;
  --text-3:        #94a3b8;
  --border:        #e2e8f0;
  --bg:            #f8fafc;
  --surface:       #ffffff;
  --surface-2:     #f1f5f9;
  --shadow-xs:     0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 12px rgba(0,0,0,.09), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;
  --sidebar-w: 0px; --top-h: 60px; --tab-h: 68px; --max-w: 428px;
}
[data-theme="dark"] {
  --text-1:        #f1f5f9;
  --text-2:        #94a3b8;
  --text-3:        #475569;
  --border:        #1e293b;
  --bg:            #0a0f1e;
  --surface:       #111827;
  --surface-2:     #1e293b;
  --indigo-light:  rgba(79,70,229,.18);
  --indigo-subtle: rgba(79,70,229,.12);
  --red-bg:        rgba(220,38,38,.1);
  --green-bg:      rgba(5,150,105,.12);
  --gold-bg:       rgba(217,119,6,.12);
  --shadow-sm:     0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:     0 4px 12px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.2);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.5), 0 4px 8px rgba(0,0,0,.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text-1);
  min-height: 100vh; overflow-x: hidden;
  font-size: 14px; line-height: 1.5;
  transition: background .25s, color .25s;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: var(--max-w); margin: 0 auto; min-height: 100vh; position: relative; }

.hidden { display: none !important; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }

.card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; }

/* ── Top Bar ── */
.top-bar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--max-w); height: var(--top-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 100; box-shadow: var(--shadow-xs);
}
.wordmark { display: flex; align-items: center; gap: 9px; }
.logo-mark {
  width: 28px; height: 28px; background: var(--indigo);
  border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-mark svg { width: 14px; height: 14px; color: #fff; }
.logo-label { font-size: 17px; font-weight: 700; letter-spacing: -.4px; color: var(--text-1); }
.top-bar-page-title { font-size: 16px; font-weight: 600; color: var(--text-1); display: none; }
.top-bar-right { display: flex; align-items: center; gap: 8px; }
.btn-icon {
  position: relative; background: none; border: none; cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: background .15s;
}
.btn-icon:hover { background: var(--surface-2); }
.btn-icon svg { width: 20px; height: 20px; }

/* ── Avatars ── */
.avatar {
  border-radius: 50%; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

/* ── Sidebar (always dark) ── */
.sidebar {
  display: none; position: fixed; top: 0; left: 0; bottom: 0;
  width: 240px; z-index: 110; background: #0f172a;
  flex-direction: column; overflow: hidden;
}
.sidebar-logo {
  height: var(--top-h); padding: 0 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0;
}
.sidebar-logo .logo-label { color: #f8fafc; font-size: 16px; }
.sidebar-nav { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.sidebar-section-label {
  padding: 6px 12px 4px; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: #475569;
}
.sidebar-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: var(--r-sm); border: none; background: none;
  color: #94a3b8; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .12s; text-align: left; width: 100%;
}
.sidebar-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-item:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }
.sidebar-item.active { background: rgba(79,70,229,.22); color: #a5b4fc; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,.06); margin: 8px 0; }
.sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; gap: 8px; flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 4px; }
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-sub  { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-dark-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 4px; font-size: 12.5px; color: #64748b; cursor: pointer;
  border-radius: var(--r-sm); transition: background .12s;
}
.sidebar-dark-row:hover { background: rgba(255,255,255,.05); }

/* ── Bottom Tab Bar ── */
.tab-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--max-w); height: var(--tab-h);
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; z-index: 100; box-shadow: 0 -1px 8px rgba(0,0,0,.06);
}
.tab-item {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 10px; font-weight: 500;
  transition: color .12s; position: relative;
}
.tab-item svg { width: 22px; height: 22px; }
.tab-item.active { color: var(--indigo); }
.tab-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 2px; background: var(--indigo); border-radius: 0 0 2px 2px;
}

/* ── Page Content ── */
.page-content { padding: calc(var(--top-h) + 16px) 16px calc(var(--tab-h) + 16px); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section ── */
.section-gap { margin-top: 20px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .07em; text-transform: uppercase; }
.link-action { background: none; border: none; cursor: pointer; color: var(--indigo); font-size: 12.5px; font-weight: 500; }
.link-action:hover { text-decoration: underline; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: none; border-radius: var(--r-sm); cursor: pointer;
  font-size: 13.5px; font-weight: 600; padding: 9px 16px;
  transition: all .15s; white-space: nowrap; line-height: 1;
}
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 1px 3px rgba(79,70,229,.3); }
.btn-primary:hover { background: var(--indigo-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(79,70,229,.35); }
.btn-primary:active { transform: translateY(0); }
.btn-amber { background: var(--gold); color: #fff; box-shadow: 0 1px 3px rgba(217,119,6,.3); }
.btn-amber:hover { background: #b45309; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(217,119,6,.35); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 1px 3px rgba(5,150,105,.3); }
.btn-success:hover { background: #047857; transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600;
}
.cat-health       { background: rgba(5,150,105,.1);  color: #059669; }
.cat-mindfulness  { background: rgba(124,58,237,.1); color: #7c3aed; }
.cat-learning     { background: rgba(37,99,235,.1);  color: #2563eb; }
.cat-sleep        { background: rgba(71,85,105,.12); color: #475569; }
.cat-productivity { background: rgba(217,119,6,.1);  color: #d97706; }
.cat-other        { background: var(--surface-2); color: var(--text-2); }
.who-adult    { background: rgba(124,58,237,.1); color: #7c3aed; }
.who-child    { background: rgba(5,150,105,.1);  color: #059669; }
.who-everyone { background: var(--indigo-light); color: var(--indigo); }
.badge-count  { background: var(--red); color: #fff; font-size: 11px; padding: 1px 5px; border-radius: var(--r-pill); margin-left: 5px; }
.badge-amber  { background: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-border); font-size: 11px; padding: 1px 6px; border-radius: var(--r-pill); margin-left: 5px; }
.badge-grey   { background: var(--surface-2); color: var(--text-3); margin-left: 5px; font-size: 11px; padding: 1px 6px; border-radius: var(--r-pill); }
.badge-indigo { background: var(--indigo-light); color: var(--indigo); font-size: 10.5px; padding: 2px 6px; border-radius: var(--r-pill); }

/* ── Toggle ── */
.toggle {
  position: relative; width: 36px; height: 20px;
  background: var(--text-3); border: none; border-radius: var(--r-pill);
  cursor: pointer; transition: background .2s; flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle.on { background: var(--indigo); }
.toggle.on::after { transform: translateX(16px); }

/* ── Greeting & Stats ── */
.greeting-row { margin-bottom: 16px; }
.greeting-text { font-size: 22px; font-weight: 700; color: var(--text-1); letter-spacing: -.4px; }
.greeting-sub  { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 14px 10px; text-align: center; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text-1); margin-bottom: 4px; }
.stat-value.indigo { color: var(--indigo); }
.stat-value.gold   { color: var(--gold); }
.stat-label { font-size: 10.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }

/* ── Today's Progress Bar ── */
.today-progress { margin-bottom: 4px; }
.today-progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.today-progress-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.today-progress-count { font-size: 12.5px; font-weight: 700; color: var(--indigo); font-variant-numeric: tabular-nums; }
.today-prog-track { height: 6px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.today-prog-fill { height: 100%; background: linear-gradient(90deg, var(--indigo), var(--purple)); border-radius: var(--r-pill); transition: width .5s ease; }

/* ── Habit Cards ── */
.habit-list { display: flex; flex-direction: column; gap: 8px; }
.habit-card {
  background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); padding: 14px;
  transition: transform .15s, box-shadow .15s;
}
.habit-card:not(.completed):hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.habit-card.at-risk   { border-left: 3px solid var(--gold); }
.habit-card.completed { opacity: .75; }
.habit-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.habit-card-name { font-size: 14px; font-weight: 600; color: var(--text-1); }
.habit-card-name.completed-text { text-decoration: line-through; color: var(--text-3); }
.habit-pts { font-size: 12.5px; font-weight: 700; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.habit-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.habit-card-status {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2); margin-bottom: 10px;
  padding: 7px 10px; background: var(--surface-2); border-radius: var(--r-sm);
}
.habit-card-status.status-green { background: var(--green-bg); color: var(--green); }
.habit-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.streak-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--gold-bg); border: 1px solid var(--gold-border);
  font-size: 11.5px; font-weight: 600; color: var(--gold); margin-bottom: 8px;
}
.check-circle {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ── FAB ── */
.fab {
  position: fixed; bottom: calc(var(--tab-h) + 16px);
  right: max(16px, calc(50vw - var(--max-w)/2 + 16px));
  width: 48px; height: 48px; background: var(--indigo); color: #fff;
  border: none; border-radius: 50%; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 90; box-shadow: 0 4px 14px rgba(79,70,229,.45);
  transition: all .15s;
}
.fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 6px 18px rgba(79,70,229,.5); }

/* ── Filter Bar ── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.filter-btn {
  padding: 5px 12px; border-radius: var(--r-pill);
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.filter-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.filter-btn.active { background: var(--indigo); border-color: var(--indigo); color: #fff; }

/* ── Habit Def Cards (Habits tab) ── */
.habit-def-card { padding: 14px; }
.habit-def-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.habit-def-name { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.habit-def-controls { display: flex; align-items: center; gap: 6px; }
.habit-def-edit { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 13px; padding: 2px 4px; transition: color .1s; border-radius: var(--r-xs); }
.habit-def-edit:hover { color: var(--text-2); background: var(--surface-2); }
.habit-def-freq { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.habit-def-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.pts-label { font-size: 11.5px; font-weight: 700; color: var(--gold); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ── Profile tab ── */
.profile-hero {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; background: var(--surface);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.profile-info { min-width: 0; }
.profile-name { font-size: 18px; font-weight: 700; color: var(--text-1); letter-spacing: -.3px; }
.profile-sub  { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.profile-stats { display: flex; gap: 20px; margin-top: 10px; }
.profile-stat-val { font-size: 17px; font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }
.profile-stat-lbl { font-size: 10px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

.settings-list { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 16px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; cursor: pointer; transition: background .1s; }
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-row:hover { background: var(--surface-2); }
.settings-row-left { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-1); font-weight: 500; }
.settings-row-left svg { color: var(--text-3); width: 17px; height: 17px; flex-shrink: 0; }
.settings-chevron { color: var(--text-3); font-size: 18px; }
.logout-btn { width: 100%; padding: 11px; background: none; border: 1.5px solid var(--border); border-radius: var(--r-md); color: var(--red); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all .15s; }
.logout-btn:hover { background: var(--red-bg); border-color: var(--red); }

/* ── Streak list ── */
.streak-list { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 16px; }
.streak-row { padding: 12px 14px; }
.streak-row + .streak-row { border-top: 1px solid var(--border); }
.streak-row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.streak-row-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.streak-row-val  { font-size: 13px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.streak-track { height: 5px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.streak-fill  { height: 100%; background: linear-gradient(90deg, var(--gold), #f59e0b); border-radius: var(--r-pill); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .15s;
}
.modal {
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%; max-width: var(--max-w); padding: 24px 20px 36px;
  animation: slideUp .2s ease-out; box-shadow: 0 -4px 24px rgba(0,0,0,.18);
}
.modal-emoji  { font-size: 40px; text-align: center; margin-bottom: 10px; }
.modal-header { font-size: 20px; font-weight: 700; color: var(--text-1); text-align: center; margin-bottom: 6px; }
.modal-sub    { font-size: 14px; color: var(--text-2); text-align: center; margin-bottom: 16px; }
.modal-note   { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-1); font-size: 13.5px; font-family: inherit; resize: none; margin-bottom: 16px; outline: none; transition: border-color .15s; }
.modal-note:focus { border-color: var(--indigo); }
.modal-actions { display: flex; gap: 10px; }
.modal-form-group { margin-bottom: 12px; }
.modal-form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.modal-input {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: var(--r-md); background: var(--surface-2); color: var(--text-1);
  font-size: 13.5px; font-family: inherit; outline: none; transition: border-color .15s;
}
.modal-input:focus { border-color: var(--indigo); }
.modal-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Toast ── */
.toast-wrap {
  position: fixed; bottom: calc(var(--tab-h) + 12px);
  left: 50%; transform: translateX(-50%); z-index: 400;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast { background: #0f172a; color: #fff; padding: 10px 20px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); white-space: nowrap; animation: toastIn .2s ease-out, toastOut .3s ease-in 2.6s forwards; }
[data-theme="dark"] .toast { background: #334155; }

/* ── Confetti ── */
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 500; overflow: hidden; }
@keyframes confettiDrop { 0% { transform: translateY(-40px) rotate(0deg); opacity: 1; } 100% { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
.confetti-particle { position: absolute; animation: confettiDrop linear both; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }

/* ── Desktop ── */
@media (min-width: 900px) {
  :root { --sidebar-w: 240px; --tab-h: 0px; }
  #app { max-width: none; display: flex; min-height: 100vh; }
  .sidebar { display: flex; }
  .tab-bar { display: none; }
  .top-bar { left: var(--sidebar-w); transform: none; width: calc(100% - var(--sidebar-w)); max-width: none; }
  .wordmark { display: none; }
  .top-bar-page-title { display: block; }
  .page-content { margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w)); max-height: 100vh; overflow-y: auto; padding: calc(var(--top-h) + 28px) 40px 40px; }
  .toast-wrap { left: calc(var(--sidebar-w) / 2 + 50vw); transform: translateX(-50%); bottom: 24px; }
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--r-lg); max-width: 440px; animation: fadeIn .15s; }
  .fab { right: 28px; bottom: 28px; }
  .dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
  .greeting-text { font-size: 26px; }
  .stat-value { font-size: 32px; }
  .stat-cards { gap: 14px; }
  #habit-def-list { display: grid !important; grid-template-columns: 1fr 1fr; }
  #habit-def-list .card { margin: 0; }
  .more-desktop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════════════════════════ */

.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; background: var(--bg);
}
.auth-card {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 32px 28px;
  width: 100%; max-width: 400px;
}
.auth-brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-bottom: 20px;
}
.auth-brand svg { width: 40px; height: 40px; color: var(--indigo); }
.auth-card h1 {
  font-size: 20px; font-weight: 700; color: var(--text-1);
  letter-spacing: -.4px; text-align: center; margin-bottom: 4px;
}
.auth-sub { font-size: 13.5px; color: var(--text-2); text-align: center; margin-bottom: 20px; }
.auth-card label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 14px;
}
.auth-card label input {
  display: block; width: 100%; margin-top: 5px;
  padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: var(--r-md); background: var(--surface);
  color: var(--text-1); font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.auth-card label input:focus { border-color: var(--indigo); }
.auth-remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2); margin-bottom: 16px; cursor: pointer;
}
.auth-remember input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--indigo); margin-top: 0; }
.auth-card .btn-primary {
  display: block; width: 100%; padding: 11px; border: none; border-radius: var(--r-md);
  background: var(--indigo); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .15s;
  box-shadow: 0 1px 3px rgba(79,70,229,.3);
}
.auth-card .btn-primary:hover { background: var(--indigo-dark); transform: translateY(-1px); }
.auth-error {
  background: var(--red-bg); color: var(--red);
  border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; margin-top: 12px;
}
.auth-note {
  background: var(--indigo-subtle); color: var(--indigo);
  border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; margin-top: 12px;
}
.auth-alt { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 16px; }
.auth-alt a, .auth-alt button {
  color: var(--indigo); font-weight: 600; text-decoration: none;
  background: none; border: none; cursor: pointer; font-size: 13px;
}
.auth-alt a:hover, .auth-alt button:hover { text-decoration: underline; }
.auth-alt .dot { margin: 0 6px; color: var(--text-3); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 3px; }
