/* ============================================================
   HABIT TRACKER — style.css
   Design System: CSS Custom Properties for Dark / Light Mode
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── 1. CSS VARIABLES ──────────────────────────────────────── */
:root {
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-med: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Font */
  --font: 'Inter', sans-serif;

  /* Accent gradient */
  --accent-start: #7c3aed;
  --accent-end: #06b6d4;
  --accent-gradient: linear-gradient(135deg, var(--accent-start), var(--accent-end));

  /* Streak fire color */
  --fire: #f97316;
  --gold: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
}

/* ── 2. DARK MODE (default) ────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:    #0f0f13;
  --bg-surface: #17171f;
  --bg-card:    #1e1e2a;
  --bg-hover:   #26263a;
  --bg-input:   #1a1a26;

  --border:     rgba(255,255,255,0.07);
  --border-accent: rgba(124,58,237,0.4);

  --text-primary:   #f0f0f8;
  --text-secondary: #8b8ba8;
  --text-muted:     #55556a;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.45);
  --shadow-glow: 0 0 18px rgba(124,58,237,0.25);
}

/* ── 3. LIGHT MODE ─────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:    #f4f4fb;
  --bg-surface: #ffffff;
  --bg-card:    #ffffff;
  --bg-hover:   #f0effe;
  --bg-input:   #f4f4fb;

  --border:     rgba(0,0,0,0.08);
  --border-accent: rgba(124,58,237,0.3);

  --text-primary:   #16162a;
  --text-secondary: #555575;
  --text-muted:     #aaaacc;

  --shadow-card: 0 4px 20px rgba(100,100,180,0.10);
  --shadow-glow: 0 0 18px rgba(124,58,237,0.12);
}

/* ── 4. RESET & BASE ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  transition: background var(--transition-med), color var(--transition-med);
  overflow-x: hidden;
}

/* ── 5. SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-start); }

/* ── 6. LAYOUT — SIDEBAR + MAIN ─────────────────────────────── */
#app { display: flex; width: 100%; min-height: 100vh; }

/* Sidebar */
#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width var(--transition-med), min-width var(--transition-med);
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.logo-text {
  font-size: 17px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.logo-text span {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
}

/* Nav Links */
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 var(--space-lg) var(--space-xs);
  margin-top: var(--space-sm);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 11px var(--space-lg);
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
  margin: 1px 0;
}

.nav-link .nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }

.nav-link:hover, .nav-link.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent-gradient);
  border-radius: 0 3px 3px 0;
}

.nav-link.active { color: var(--accent-start); font-weight: 600; }

/* Sidebar bottom */
.sidebar-footer {
  margin-top: auto;
  padding: var(--space-md) var(--space-lg) 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Main content */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.topbar-left .date-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Content area */
.content-area {
  padding: var(--space-xl);
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ── 7. VIEW TOGGLE ─────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── 8. BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124,58,237,0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124,58,237,0.45);
}

.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  justify-content: center;
  font-size: 16px;
}

/* Toggle (theme) */
.toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition-fast);
  color: var(--text-primary);
}
.toggle-btn:hover { background: var(--bg-hover); border-color: var(--border-accent); }

/* ── 9. HABIT CARDS ─────────────────────────────────────────── */
.habits-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.habits-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.habit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.habit-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--habit-color, var(--accent-gradient));
  background: linear-gradient(180deg, var(--habit-c1, #7c3aed), var(--habit-c2, #06b6d4));
}

.habit-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.habit-card.completed {
  border-color: rgba(16,185,129,0.3);
}

.habit-card.completed::before {
  background: linear-gradient(180deg, #10b981, #06b6d4);
}

.habit-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  gap: var(--space-sm);
}

.habit-name { font-size: 16px; font-weight: 700; line-height: 1.3; }

.habit-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.5;
}

.habit-actions { display: flex; gap: 4px; opacity: 0.55; transition: opacity var(--transition-fast); flex-shrink: 0; }
.habit-card:hover .habit-actions { opacity: 1; }

.habit-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.stat-item { text-align: center; }

.stat-value {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.stat-value.streak { color: var(--fire); }
.stat-value.rate { color: var(--accent-start); }
.stat-value.longest { color: var(--gold); }

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Mini weekly dots */
.week-dots { display: flex; gap: 4px; margin-bottom: var(--space-md); }

.week-dot {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  transition: background var(--transition-fast);
}

.week-dot.done { background: var(--accent-gradient); background: linear-gradient(90deg, var(--accent-start), var(--accent-end)); }
.week-dot.today-dot { outline: 2px solid var(--accent-start); outline-offset: 1px; }

/* Complete button */
.complete-btn {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.complete-btn:hover {
  border-color: var(--green);
  color: var(--green);
  background: rgba(16,185,129,0.06);
}

.complete-btn.done {
  border: 2px solid var(--green);
  background: rgba(16,185,129,0.1);
  color: var(--green);
}

/* Streak badge */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(249,115,22,0.15);
  color: var(--fire);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 56px; display: block; margin-bottom: var(--space-md); line-height: 1; }
.empty-state h3 { font-size: 20px; color: var(--text-secondary); margin-bottom: var(--space-sm); }
.empty-state p { font-size: 14px; }

/* ── 10. SUMMARY CARDS ──────────────────────────────────────── */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  transition: transform var(--transition-fast);
}

.summary-card:hover { transform: translateY(-2px); }

.summary-card .sc-icon { font-size: 26px; }
.summary-card .sc-value { font-size: 28px; font-weight: 800; }
.summary-card .sc-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ── 11. MODAL ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: scale(0.92) translateY(12px);
  transition: transform var(--transition-med);
}

.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-header h2 { font-size: 18px; font-weight: 700; }

.modal-close {
  background: var(--bg-hover);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--red); color: #fff; }

/* ── 12. FORM ELEMENTS ──────────────────────────────────────── */
.form-group { margin-bottom: var(--space-md); }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-start);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

.form-textarea { resize: vertical; min-height: 80px; }
.form-select option { background: var(--bg-card); color: var(--text-primary); }

.color-row { display: flex; gap: var(--space-sm); flex-wrap: wrap; }

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--transition-fast);
}
.color-swatch:hover, .color-swatch.selected { border-color: var(--text-primary); transform: scale(1.15); }

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
}

/* ── 13. STATS VIEW ─────────────────────────────────────────── */
.stats-habit-selector {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.habit-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.habit-pill:hover { border-color: var(--border-accent); color: var(--text-primary); }
.habit-pill.active { background: var(--accent-gradient); color: #fff; border-color: transparent; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-md);
}

.chart-card h3 { font-size: 15px; font-weight: 700; margin-bottom: var(--space-md); color: var(--text-secondary); }

.chart-wrapper { position: relative; height: 220px; }

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-top: var(--space-sm);
}

.heatmap-day-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding-bottom: 4px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--border);
  transition: background var(--transition-fast), transform var(--transition-fast);
  cursor: default;
  position: relative;
}
.heatmap-cell:hover { transform: scale(1.2); z-index: 2; }
.heatmap-cell[data-level="1"] { background: rgba(124,58,237,0.25); }
.heatmap-cell[data-level="2"] { background: rgba(124,58,237,0.55); }
.heatmap-cell[data-level="3"] { background: var(--accent-start); }
.heatmap-cell.today-cell { outline: 2px solid var(--accent-end); outline-offset: 1px; }

/* ── 14. NOTIFICATIONS SETTINGS ─────────────────────────────── */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-card);
}

.settings-section h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
}

.settings-row:last-child { border-bottom: none; }

.settings-row-label { font-size: 14px; font-weight: 500; }
.settings-row-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Toggle switch */
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-med);
}
.slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  bottom: 3px; left: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-med);
}
.switch input:checked + .slider { background: var(--accent-start); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Status badges */
.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.badge-granted { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-denied  { background: rgba(239,68,68,0.15);  color: var(--red); }
.badge-default { background: rgba(245,158,11,0.15); color: var(--gold); }

/* ── 15. TOAST NOTIFICATIONS ────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  pointer-events: all;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--blue); }
.toast.warning { border-left: 4px solid var(--gold); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}

/* ── 16. HAMBURGER (mobile) ─────────────────────────────────── */
#hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
  margin-right: var(--space-sm);
}

#hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-med);
}

/* ── 17. PROGRESS RING ──────────────────────────────────────── */
.progress-ring { transform: rotate(-90deg); }
.progress-ring-bg { fill: none; stroke: var(--border); }
.progress-ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

/* ── 18. ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.habit-card { animation: fadeIn 0.3s ease both; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.fire-pulse { animation: pulse 1.2s ease-in-out infinite; }

@keyframes confetti-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.check-anim { animation: confetti-pop 0.4s ease; }

/* ── 19. RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -270px;
    top: 0;
    bottom: 0;
    height: 100vh;
    transition: left var(--transition-med);
    box-shadow: 4px 0 30px rgba(0,0,0,0.3);
    z-index: 200;
  }

  #sidebar.open { left: 0; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    display: none;
  }
  .sidebar-overlay.show { display: block; }

  #hamburger { display: flex; }

  .content-area { padding: var(--space-md); }

  .topbar { padding: var(--space-md); }

  .habits-grid { grid-template-columns: 1fr; }

  .summary-row { grid-template-columns: 1fr 1fr; }
}


@media (max-width: 420px) {
  .summary-row { grid-template-columns: 1fr; }
  .modal { padding: var(--space-lg); }
}

/* ── 20. AUTH SCREEN ─────────────────────────────────────────── */
#auth-screen {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--bg-base);
}

/* Left decorative panel */
.auth-panel {
  flex: 1;
  background: var(--accent-gradient);
  background: linear-gradient(145deg, #4c1d95, #7c3aed 45%, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  position: relative;
  overflow: hidden;
}

.auth-panel::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -100px; right: -100px;
}

.auth-panel::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  bottom: -80px; left: -80px;
}

.auth-panel-content {
  position: relative;
  z-index: 1;
  max-width: 380px;
  color: #fff;
}

.auth-panel-logo {
  width: 60px; height: 60px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  margin-bottom: var(--space-xl);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
}

.auth-panel-content h2 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: var(--space-md);
}

.auth-panel-content p {
  font-size: 15px;
  opacity: 0.85;
  line-height: 1.7;
  margin-bottom: var(--space-xl);
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
  background: rgba(255,255,255,0.1);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.15);
}

/* Right: auth card area */
.auth-card-wrap {
  width: 460px;
  min-width: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  background: var(--bg-surface);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

/* Mobile logo (hidden on desktop) */
.auth-logo-mobile {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.auth-logo-icon { font-size: 28px; }
.auth-logo-text {
  font-size: 20px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Headings */
.auth-heading {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.auth-subheading {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

/* Tabs */
.auth-tabs {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: var(--space-lg);
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab:hover { color: var(--text-primary); }

.auth-tab.active {
  background: var(--bg-card);
  color: var(--accent-start);
  box-shadow: var(--shadow-card);
}

/* Auth form */
.auth-form { display: flex; flex-direction: column; }

/* Password field with eye icon */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap .form-input { padding-right: 42px; }

.password-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  line-height: 1;
}
.password-eye:hover { color: var(--text-primary); }

/* Error & success banners */
.auth-error, .auth-success {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: var(--space-md);
  animation: fadeIn 0.2s ease;
}

.auth-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
}

.auth-success {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: #34d399;
}

/* Sidebar user section */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.sidebar-avatar {
  width: 34px; height: 34px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

/* ── Auth responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .auth-panel { display: none; }

  .auth-card-wrap {
    width: 100%;
    min-width: unset;
    align-items: flex-start;
    padding-top: var(--space-xl);
  }

  .auth-logo-mobile { display: flex; }

  .auth-heading { font-size: 20px; }
}

/* ── Forgot password link button ────────────────────────────── */
.forgot-link {
  background: none;
  border: none;
  color: var(--accent-start);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--transition-fast);
}
.forgot-link:hover { opacity: 0.75; }

/* ── Profile Edit Forms (inside settings) ───────────────────── */
.profile-edit-form {
  background: var(--bg-hover);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
  animation: fadeIn 0.2s ease;
}

.profile-edit-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-md);
}
