/* ===========================================================
   Student Planner — Design System
   Palette: tan/beige (#CEAF6E), white, black. Minimal, rounded, calm.
   =========================================================== */

:root {
  --tan: #CEAF6E;
  --tan-dark: #B8944A;
  --tan-light: #F3E9D2;
  --tan-lighter: #FAF5E9;
  --white: #FFFFFF;
  --black: #1A1A1A;
  --ink: #2A2A28;
  --ink-soft: #6b6862;
  --line: #E7E0D2;
  --bg: #FBF9F4;
  --card: #FFFFFF;
  --danger: #C4573B;
  --success: #6E8B5A;
  --warning: #C99A3A;
  --info: #7891A8;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(26,26,26,0.06), 0 1px 1px rgba(26,26,26,0.04);
  --shadow-md: 0 6px 18px rgba(26,26,26,0.08);
  --shadow-lg: 0 12px 32px rgba(26,26,26,0.14);

  --sidebar-w: 240px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark theme — only the neutral canvas (background/surface/border/text)
   repaints; the tan accent family and semantic colors (danger/success/etc.)
   stay the same in both themes since they're used as small, self-contained
   highlights (badges, active chips) rather than full-page surfaces. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F1EADC;
    --ink-soft: #B7AC96;
    --line: #362F22;
    --bg: #17140F;
    --card: #211D16;
  }
}
:root[data-theme="dark"] {
  --ink: #F1EADC;
  --ink-soft: #B7AC96;
  --line: #362F22;
  --bg: #17140F;
  --card: #211D16;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  height: 100%;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}
button, .nav-item, .tab-btn, .chip, .icon-btn, .btn, .day-cell,
.note-card, .goal-card, .project-card, .habit-check {
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

h1, h2, h3, h4 { margin: 0 0 4px 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; }

::selection { background: var(--tan); color: var(--black); }

/* ---------- App shell ---------- */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: calc(22px + env(safe-area-inset-top)) 16px 22px calc(16px + env(safe-area-inset-left));
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 22px 10px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--tan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--black);
  font-size: 15px;
}
.brand-name {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.1;
}
.brand-sub {
  font-size: 11px;
  color: var(--ink-soft);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--tan-lighter); color: var(--black); }
.nav-item.active { background: var(--tan-light); color: var(--black); }

.sidebar-footer {
  margin-top: auto;
  font-size: 11px;
  color: var(--ink-soft);
  padding: 10px;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: calc(28px + env(safe-area-inset-top)) calc(32px + env(safe-area-inset-right)) 90px calc(32px + env(safe-area-inset-left));
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; }
.page-header .page-date { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

/* Bottom nav (mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 50;
  padding: 6px calc(4px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left));
  justify-content: space-between;
}
.bottom-nav .nav-item {
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 6px 4px;
  flex: 1;
}
.bottom-nav .nav-item svg { width: 20px; height: 20px; }

/* ---------- Cards & layout helpers ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title .link-btn { text-transform: none; letter-spacing: 0; }

.grid {
  display: grid;
  gap: 18px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.dashboard-grid .span-2 { grid-column: span 2; }
.dashboard-grid .span-3 { grid-column: span 3; }

.empty-state {
  color: var(--ink-soft);
  font-size: 13px;
  padding: 18px 4px;
  text-align: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: #000; opacity: .9; }
.btn-tan { background: var(--tan); color: var(--black); }
.btn-tan:hover { background: var(--tan-dark); }
.btn-secondary { background: var(--tan-lighter); color: var(--black); }
.btn-secondary:hover { background: var(--tan-light); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--tan-lighter); color: var(--black); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { background: #fbe9e5; color: var(--danger); }

.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 26px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
input[type="text"], input[type="date"], input[type="time"], input[type="number"],
input[type="search"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
  transition: border-color .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--tan-dark);
}
textarea { resize: vertical; min-height: 70px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--tan-dark); }
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent;
}
.color-swatch.selected { border-color: var(--black); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.modal-actions-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ---------- Modal ---------- */
#modal-root { position: relative; z-index: 100; }
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,26,26,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  width: 440px;
  max-width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: popIn .15s ease;
}
.modal-wide { width: 620px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 17px; }
.modal-close { font-size: 20px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--black);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 200;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Badges / tags / progress ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.badge-tan { background: var(--tan-light); color: #6a5423; }
.badge-danger { background: #fbe9e5; color: var(--danger); }
.badge-success { background: #e8efe3; color: var(--success); }
.badge-warning { background: #faf0d9; color: #8a6413; }
.badge-info { background: #e9eef2; color: var(--info); }
.badge-gray { background: #eee; color: #666; }

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--tan-lighter);
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--tan);
  border-radius: 10px;
  transition: width .3s ease;
}
.progress-fill.thin { }
.progress-track.sm { height: 6px; }
.progress-fill.black { background: var(--black); }
.progress-fill.success { background: var(--success); }
.progress-fill.danger { background: var(--danger); }

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-value { font-size: 22px; font-weight: 800; }
.stat-label { font-size: 11.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--tan-lighter);
  color: var(--black);
}
.list-item .list-item-main { flex: 1; min-width: 0; }
.list-item .list-item-title { font-weight: 700; font-size: 13.5px; }
.list-item .list-item-sub { font-size: 12px; color: #6b6862; margin-top: 1px; }
.list-item-actions { display: flex; gap: 2px; flex-shrink: 0; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ---------- Tabs / subnav ---------- */
.tab-row {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 5px;
  border-radius: var(--radius-md);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn.active { background: var(--black); color: var(--white); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}
.chip.active { background: var(--tan); border-color: var(--tan); color: var(--black); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ink-soft);
  letter-spacing: .03em;
  padding: 8px 10px;
  border-bottom: 1.5px solid var(--line);
}
.table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ---------- Calendar ---------- */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cal-nav h2 { font-size: 18px; min-width: 170px; }

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.weekday-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  padding-bottom: 4px;
}
.day-cell {
  min-height: 96px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color .15s ease;
}
.day-cell:hover { border-color: var(--tan-dark); }
.day-cell.other-month { opacity: .4; }
.day-cell.today { border-color: var(--tan-dark); border-width: 2px; background: var(--tan-lighter); color: var(--black); }
.day-num { font-size: 12px; font-weight: 700; }
.day-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.day-event-pill {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--tan-light);
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.day-event-pill.type-exam { background: #fbe9e5; color: var(--danger); }
.day-event-pill.type-deadline { background: #faf0d9; color: #8a6413; }
.day-event-pill.type-appointment { background: #e9eef2; color: var(--info); }

/* Priority top3 inputs on daily planner / dashboard */
.top3-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.top3-item { display: flex; align-items: center; gap: 10px; }
.top3-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--tan); color: var(--black);
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Habit grid */
.habit-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.habit-row:last-child { border-bottom: none; }
.habit-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--tan-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.habit-info { flex: 1; min-width: 0; }
.habit-name { font-weight: 700; font-size: 13.5px; }
.habit-check {
  width: 30px; height: 30px; border-radius: 9px;
  border: 2px solid var(--line);
  background: var(--card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: transparent;
}
.habit-check.checked { background: var(--tan); border-color: var(--tan-dark); color: var(--black); }
.habit-month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); gap: 3px; margin-top: 8px; }
.habit-day-box { aspect-ratio: 1; border-radius: 3px; background: var(--tan-lighter); }
.habit-day-box.on { background: var(--tan-dark); }
.habit-day-box.future { background: transparent; }

/* Notes */
.notes-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.note-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
  margin-bottom: 10px;
}
.note-card.active { border-color: var(--tan-dark); background: var(--tan-lighter); color: var(--black); }
.note-card .nc-title { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.note-card .nc-preview { font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-card .nc-meta { font-size: 10.5px; color: var(--ink-soft); margin-top: 6px; }
.note-card.active .nc-preview, .note-card.active .nc-meta { color: #6b6862; }
.lined-paper {
  background-image: repeating-linear-gradient(var(--card), var(--card) 27px, var(--line) 28px);
  line-height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 10px 16px 10px 16px;
  font-size: 14.5px;
  width: 100%;
  min-height: 400px;
  resize: vertical;
}

/* Goals */
.goal-card { border-radius: var(--radius-md); border: 1px solid var(--line); padding: 16px; background: var(--card); }
.goal-card .goal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.goal-card h4 { font-size: 14.5px; margin-bottom: 4px; }
.goal-meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; }
.goal-next { font-size: 12.5px; margin-top: 10px; background: var(--tan-lighter); color: var(--black); border-radius: 8px; padding: 8px 10px; }

/* Money */
.expense-cat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.expense-cat-row .cat-name { width: 110px; font-size: 12.5px; font-weight: 700; flex-shrink: 0; }
.expense-cat-row .cat-amt { width: 80px; font-size: 12px; color: var(--ink-soft); text-align: right; flex-shrink: 0; }

/* Projects */
.project-card { border-radius: var(--radius-md); border: 1px solid var(--line); padding: 16px; background: var(--card); }
.task-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.task-row.done .task-text { text-decoration: line-through; color: var(--ink-soft); }
.task-text { flex: 1; font-size: 13px; }

/* Utility */
.text-soft { color: var(--ink-soft); }
.text-sm { font-size: 12.5px; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
.w-full { width: 100%; }

/* ---------- Callout banner (e.g. notification permission prompt) ---------- */
.callout-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--tan-lighter);
  border: 1px solid var(--tan-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
  color: var(--black);
}
.callout-banner.denied { background: #fbe9e5; border-color: #f3cfc5; color: var(--danger); }

/* ---------- Auth (login / register / forgot password) ---------- */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 30px 28px;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  text-align: center;
}
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 19px; }
.auth-brand h1 { font-size: 19px; }
.auth-brand p { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }

.auth-message {
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.auth-message.error { background: #fbe9e5; color: var(--danger); }
.auth-message.success { background: #e8efe3; color: var(--success); }

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 18px;
}
.auth-switch a, .auth-link {
  color: var(--tan-dark);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.auth-switch a:hover, .auth-link:hover { text-decoration: underline; }
.auth-forgot-row { text-align: right; margin: -6px 0 16px; }
.auth-forgot-row .auth-link { font-size: 12.5px; }

.auth-setup-note {
  font-size: 12px;
  color: #6b6862;
  background: var(--tan-lighter);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 18px;
  line-height: 1.5;
}
.auth-setup-note code { font-family: monospace; background: var(--tan-light); padding: 1px 5px; border-radius: 4px; }

/* Profile page */
.profile-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: var(--tan); color: var(--black);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px; overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-header-info { flex: 1; min-width: 160px; }
.profile-header-name { font-weight: 800; font-size: 17px; }

.theme-toggle { display: flex; border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.theme-opt {
  flex: 1; border: none; background: var(--card); color: var(--ink-soft);
  padding: 9px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  border-right: 1px solid var(--line);
}
.theme-opt:last-child { border-right: none; }
.theme-opt.active { background: var(--tan); color: var(--black); }

.danger-zone { border-color: #f3cfc5; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid .span-3 { grid-column: span 2; }
  .notes-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .main-content {
    padding: calc(18px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right))
      calc(90px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  }
  .bottom-nav { display: flex; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid .span-2, .dashboard-grid .span-3 { grid-column: span 1; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .month-grid { gap: 4px; }
  .day-cell { min-height: 64px; padding: 4px; }
  .day-event-pill { font-size: 9px; }
  .form-row { flex-direction: column; gap: 0; }
  .modal { width: 100%; }
  .fab { right: 16px; bottom: 76px; }
}
