/* ============================================================
   KINDNESS · Warm & Soft theme
   ============================================================ */

/* ---------- THEME VARIABLES ---------- */
[data-theme="sage"] {
  --bg-start: #f6f4ee;
  --bg-mid: #f0eee5;
  --bg-end: #ece9dd;
  --bg: var(--bg-mid);
  --card-bg: #ffffff;
  --text-primary: #3a3a36;
  --text-secondary: #7a7569;
  --text-muted: #a8a298;
  --accent: #87a37b;
  --accent-soft: #e8efde;
  --accent-deep: #5e8050;
  --warn: #d9a44d;
  --warn-soft: #f9eed7;
  --danger: #c87060;
  --danger-soft: #f7dfd9;
  --soft-bg: #f5f2e9;
  --border: rgba(0,0,0,0.06);
}

[data-theme="peach"] {
  --bg-start: #fbf3eb;
  --bg-mid: #f5e7d8;
  --bg-end: #edd9c4;
  --bg: var(--bg-mid);
  --card-bg: #ffffff;
  --text-primary: #4a2f22;
  --text-secondary: #8e6a55;
  --text-muted: #b59982;
  --accent: #d68859;
  --accent-soft: #fbe6d3;
  --accent-deep: #b06535;
  --warn: #d4a02a;
  --warn-soft: #fbeacb;
  --danger: #c87060;
  --danger-soft: #f7dfd9;
  --soft-bg: #faeede;
  --border: rgba(0,0,0,0.06);
}

[data-theme="ocean"] {
  --bg-start: #eef4f6;
  --bg-mid: #dde8ec;
  --bg-end: #c6d8df;
  --bg: var(--bg-mid);
  --card-bg: #ffffff;
  --text-primary: #2e3e44;
  --text-secondary: #6c7f87;
  --text-muted: #97a8ae;
  --accent: #5f95ad;
  --accent-soft: #d8e7ee;
  --accent-deep: #4a7c92;
  --warn: #d9a44d;
  --warn-soft: #f9eed7;
  --danger: #c87060;
  --danger-soft: #f7dfd9;
  --soft-bg: #ecf1f3;
  --border: rgba(0,0,0,0.06);
}

[data-theme="rose"] {
  --bg-start: #fbeff0;
  --bg-mid: #f5dee0;
  --bg-end: #edcace;
  --bg: var(--bg-mid);
  --card-bg: #ffffff;
  --text-primary: #4a2d31;
  --text-secondary: #8b5e64;
  --text-muted: #b08e92;
  --accent: #c87584;
  --accent-soft: #f9dde2;
  --accent-deep: #a25467;
  --warn: #d9a44d;
  --warn-soft: #f9eed7;
  --danger: #c87060;
  --danger-soft: #f7dfd9;
  --soft-bg: #f9e5e8;
  --border: rgba(0,0,0,0.06);
}

[data-theme="dusk"] {
  --bg-start: #f4f0f7;
  --bg-mid: #ebe4f0;
  --bg-end: #ddd2e6;
  --bg: var(--bg-mid);
  --card-bg: #ffffff;
  --text-primary: #382c44;
  --text-secondary: #6f6280;
  --text-muted: #9e93ad;
  --accent: #9a82bd;
  --accent-soft: #ece2f4;
  --accent-deep: #7a5fa0;
  --warn: #d9a44d;
  --warn-soft: #f9eed7;
  --danger: #c87060;
  --danger-soft: #f7dfd9;
  --soft-bg: #efe9f3;
  --border: rgba(0,0,0,0.06);
}

[data-theme="midnight"] {
  --bg-start: #1d1f26;
  --bg-mid: #232730;
  --bg-end: #2a2e38;
  --bg: var(--bg-mid);
  --card-bg: #2d323e;
  --text-primary: #e8ebef;
  --text-secondary: #a8aeb8;
  --text-muted: #6d747f;
  --accent: #d9b384;
  --accent-soft: #3a3328;
  --accent-deep: #c0996a;
  --warn: #e8c578;
  --warn-soft: #3d3220;
  --danger: #e08878;
  --danger-soft: #3d2828;
  --soft-bg: #353a47;
  --border: rgba(255,255,255,0.06);
}

/* ---------- BASE ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { overscroll-behavior-y: none; }
body {
  font-family: 'DM Sans', sans-serif;
  background: linear-gradient(170deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; transition: transform 0.12s, opacity 0.15s, background 0.2s, color 0.2s; }
button:active { transform: scale(0.96); }
input, select, textarea { font-family: inherit; }

/* ---------- LOGIN SCREEN ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--card-bg); border-radius: 28px; padding: 32px 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.06); max-width: 420px; width: 100%;
}
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo h1 {
  font-family: 'Playfair Display', serif; font-size: 40px; font-weight: 700;
  color: var(--accent); margin-bottom: 4px;
}
.login-logo p { color: var(--text-secondary); font-size: 13px; font-style: italic; }
.profile-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.profile-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--soft-bg); padding: 14px 16px; border-radius: 14px;
  cursor: pointer; transition: background 0.15s;
}
.profile-item:hover { background: var(--accent-soft); }
.profile-name { font-weight: 600; font-size: 15px; }
.profile-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.profile-delete {
  background: none; border: none; color: var(--text-muted);
  font-size: 14px; padding: 4px 8px; opacity: 0.5;
}
.profile-delete:hover { opacity: 1; color: var(--danger); }
.login-divider {
  text-align: center; position: relative; margin: 16px 0;
  font-size: 11px; text-transform: uppercase; letter-spacing: 2px;
  color: var(--text-muted);
}
.login-divider span { background: var(--card-bg); padding: 0 12px; position: relative; z-index: 1; }
.login-divider::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px;
  background: var(--border);
}
.new-profile-form { display: flex; flex-direction: column; gap: 10px; }
.new-profile-form input {
  padding: 14px 16px; border-radius: 14px; border: none;
  background: var(--soft-bg); font-size: 14px; color: var(--text-primary);
}
.new-profile-form input:focus { outline: 2px solid var(--accent); }
.new-profile-form button {
  padding: 14px; border-radius: 14px; border: none;
  background: var(--accent); color: white;
  font-weight: 600; font-size: 14px; margin-top: 4px;
}
.password-prompt input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: none; background: var(--card-bg); font-size: 14px;
}
.login-note {
  text-align: center; font-size: 11px; color: var(--text-muted);
  margin-top: 18px;
}

/* ---------- APP SHELL ---------- */
.app { min-height: 100vh; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

/* ---------- PAGE SYSTEM ---------- */
.page {
  display: none;
  padding: calc(20px + env(safe-area-inset-top)) 18px 12px;
  animation: pageFade 0.3s ease;
}
.page.active { display: block; }
@keyframes pageFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- PAGE HEADER ---------- */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px; gap: 14px;
}
.page-greeting {
  font-family: 'Playfair Display', serif;
  font-size: 32px; font-weight: 700;
  color: var(--text-primary); line-height: 1.1;
  letter-spacing: -0.5px;
}
.page-date {
  color: var(--text-secondary); font-size: 12.5px;
  margin-top: 4px; font-weight: 500;
}
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px; font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.3px;
}
.head-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--card-bg); border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  flex-shrink: 0;
}
.head-btn:active { background: var(--soft-bg); }

/* ---------- SECTION HEADING ---------- */
.section-heading {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700;
  color: var(--text-primary);
  margin: 22px 4px 12px;
}

/* ---------- CARD BASE ---------- */
.card, .next-up, .quote-card, .brain-dump, .calendar-section, .kindness-entry, .profile-card {
  background: var(--card-bg);
  border-radius: 22px;
  padding: 18px 20px;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
  margin-bottom: 14px;
  border: none;
}

/* ---------- QUOTE CARD ---------- */
.quote-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 20px;
}
.quote-mark {
  font-family: 'Playfair Display', serif;
  font-size: 42px; line-height: 0.7;
  color: var(--accent); font-weight: 700;
  margin-top: 6px;
}
.quote-text {
  font-style: italic; font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55; flex: 1;
}

/* ---------- BRAIN DUMP ---------- */
.brain-dump-label {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.brain-dump-input {
  width: 100%; padding: 14px 16px;
  border-radius: 14px; border: none;
  background: var(--soft-bg); font-size: 14px;
  color: var(--text-primary);
}
.brain-dump-input::placeholder { color: var(--text-muted); font-size: 13px; }
.brain-dump-input:focus { outline: 2px solid var(--accent); }
.brain-dump-hint {
  font-size: 11.5px; color: var(--text-muted);
  margin: 10px 2px 14px; line-height: 1.4;
}
.brain-dump-btn {
  width: 100%; padding: 14px;
  border-radius: 14px; border: none;
  background: var(--text-primary); color: var(--card-bg);
  font-weight: 600; font-size: 14px;
}
.brain-dump-result {
  display: none; margin-top: 12px; padding: 12px 14px;
  border-radius: 12px; background: var(--accent-soft);
  font-size: 12.5px; color: var(--text-primary); line-height: 1.5;
}
.brain-dump-result.show { display: block; }
.brain-dump-result.error { background: var(--danger-soft); }

/* ---------- NEXT UP ---------- */
.next-up {
  position: relative; padding: 18px 20px 16px;
}
.next-up::before {
  content: ""; position: absolute; left: 0; top: 18px; bottom: 18px;
  width: 4px; border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.next-up.urgent::before { background: var(--warn); }
.next-up.very-urgent::before { background: var(--danger); }
.next-up.done::before { display: none; }
.section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); margin-bottom: 8px;
}
.next-up-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
.next-up-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700; color: var(--text-primary);
  line-height: 1.2;
}
.next-up-date {
  color: var(--text-secondary); font-size: 13px;
  margin-top: 3px; font-weight: 500;
}
.countdown {
  background: var(--accent-soft); color: var(--accent-deep);
  padding: 8px 14px; border-radius: 14px;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.countdown.warn { background: var(--warn-soft); color: var(--warn); }
.countdown.danger { background: var(--danger-soft); color: var(--danger); }
.countdown.done { background: var(--accent-soft); color: var(--accent-deep); }

/* ---------- CARD INTERNALS ---------- */
.card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 8px;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 19px; font-weight: 700;
  color: var(--text-primary); line-height: 1.2;
}
.card-title.struck { text-decoration: line-through; opacity: 0.55; }
.card-date {
  font-size: 12px; color: var(--text-muted);
  margin-top: 3px; font-weight: 500;
}
.card-gift {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding: 10px 14px;
  background: var(--soft-bg); border-radius: 12px;
  font-size: 13px; gap: 10px;
}
.card-gift-text { color: var(--text-primary); font-weight: 500; }
.card-gift-budget { color: var(--text-muted); margin-left: 4px; font-size: 12px; }
.badge {
  font-size: 10px; font-weight: 700;
  padding: 5px 10px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
  flex-shrink: 0;
}
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.ordered { background: var(--accent-soft); color: var(--accent-deep); }
.badge.done { background: var(--accent-soft); color: var(--accent-deep); }
.tip {
  margin-top: 10px; padding: 10px 14px;
  background: var(--warn-soft); border-radius: 12px;
  font-size: 12px; color: var(--text-primary); line-height: 1.5;
}
.card-reminder {
  font-size: 11px; color: var(--text-muted);
  margin-top: 10px; font-style: italic;
}

/* ---------- LIKES LINE (replaces star sign card) ---------- */
.likes-line {
  margin-top: 12px; padding: 12px 14px;
  background: var(--soft-bg); border-radius: 12px;
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
}
.likes-line strong {
  color: var(--text-primary); font-weight: 700; margin-right: 4px;
}
.likes-line .likes-year {
  display: inline-block; margin-left: 6px; font-size: 11px;
  color: var(--text-muted); font-weight: 500;
}

/* ---------- CARD ACTIONS ---------- */
.card-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 14px;
}
.action-btn {
  padding: 9px 14px; border-radius: 12px;
  border: none; background: var(--soft-bg);
  font-size: 12.5px; font-weight: 600;
  color: var(--text-primary);
  display: inline-flex; align-items: center; gap: 5px;
}
.action-btn:active { background: var(--accent-soft); }
.action-btn.tick { background: var(--accent-soft); color: var(--accent-deep); }
.action-btn.danger { color: var(--danger); background: transparent; }

/* ---------- PASSED EVENTS ---------- */
.card.passed { opacity: 0.55; }
.card.passed.hide-passed { display: none; }
.card.done .card-title { text-decoration: line-through; opacity: 0.65; }
.passed-toggle {
  width: 100%; padding: 12px; border-radius: 12px;
  border: none; background: transparent;
  font-size: 12px; color: var(--text-muted); font-weight: 600;
  margin-top: 6px;
}

/* ---------- CALENDAR ---------- */
.calendar-section { padding: 14px 12px; }
.calendar-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding: 0 6px;
}
.calendar-month {
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 700; color: var(--text-primary);
}
.month-nav { display: flex; gap: 6px; }
.month-nav button {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--soft-bg);
  font-size: 16px; color: var(--text-primary);
  line-height: 1;
}
.calendar {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  width: 100%;
}
.cal-day-header {
  text-align: center; font-size: 9px; font-weight: 700;
  color: var(--text-muted); padding: 4px 0 8px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 12px; position: relative;
  color: var(--text-secondary); min-width: 0;
}
.cal-day.has-event {
  background: var(--accent-soft); color: var(--accent-deep); font-weight: 700;
}
.cal-day.has-event::after {
  content: ""; position: absolute; bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--accent);
}
.cal-day.today {
  background: var(--accent); color: #ffffff; font-weight: 800;
  box-shadow: 0 0 0 3px var(--card-bg), 0 0 0 5px var(--accent),
              0 4px 14px rgba(0,0,0,0.12);
  transform: scale(1.04); z-index: 2;
}
.cal-day.has-event.today::after { background: #ffffff; }
.cal-day.empty { visibility: hidden; }

/* ---------- FILTER CHIPS ---------- */
.filter-chips {
  display: flex; gap: 8px;
  margin-bottom: 18px; overflow-x: auto;
  scrollbar-width: none; padding-bottom: 2px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 9px 16px; border-radius: 18px;
  background: var(--card-bg); border: none;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary); white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.chip.active { background: var(--accent); color: white; }

/* ---------- KINDNESS ENTRIES ---------- */
.kindness-entry {
  position: relative;
}
.kindness-entry.done .kindness-entry-who { opacity: 0.6; }
.kindness-entry-who {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 700;
  color: var(--text-primary);
}
.kindness-entry-what {
  font-size: 13px; color: var(--text-secondary);
  margin-top: 3px; line-height: 1.4;
}
.kindness-entry-suggestion {
  margin-top: 12px; padding: 12px 14px;
  background: var(--warn-soft); border-radius: 12px;
  font-size: 12.5px; color: var(--text-primary); line-height: 1.5;
}

/* ---------- BOTTOM NAV ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card-bg);
  display: flex; justify-content: space-around;
  padding: 10px 4px calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -2px 24px rgba(0,0,0,0.06);
  border-top: 1px solid var(--border);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 6px 4px;
  background: none; border: none;
  color: var(--text-muted);
  transition: color 0.18s, transform 0.12s;
  min-width: 0;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item span {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.3px;
}
.nav-item.active { color: var(--accent); }
.nav-item:active { transform: scale(0.9); }

/* ---------- EMPTY STATES ---------- */
.empty {
  text-align: center; padding: 40px 24px;
  color: var(--text-muted); font-size: 13px;
  line-height: 1.6;
}
.calendar-hint {
  padding: 12px 14px; background: var(--accent-soft);
  border-radius: 12px; font-size: 12px;
  color: var(--text-primary); line-height: 1.5;
  margin-bottom: 14px;
}

/* ---------- MODAL ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(6px);
}
.modal-card {
  background: var(--card-bg);
  border-radius: 28px 28px 0 0;
  padding: 24px 22px calc(28px + env(safe-area-inset-bottom));
  max-width: 480px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  animation: modalSlide 0.3s ease;
}
@keyframes modalSlide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700; color: var(--text-primary);
}
.icon-btn {
  background: var(--soft-bg); border: none;
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 14px; color: var(--text-secondary);
}
.settings-section {
  margin-bottom: 22px; padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; padding-bottom: 0; }
.settings-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); margin-bottom: 10px;
}
.settings-info {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: 12px;
}

/* Theme picker */
.theme-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.theme-option {
  padding: 12px 8px; border-radius: 14px;
  background: var(--soft-bg);
  font-size: 12px; font-weight: 600;
  text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px solid transparent;
}
.theme-option.active { border-color: var(--accent); }
.theme-swatch {
  width: 26px; height: 26px; border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4);
}

/* Settings legacy buttons */
.quick-add-btn {
  padding: 12px; border-radius: 12px; border: none;
  background: var(--accent); color: white;
  font-weight: 600; font-size: 13px;
}
.danger-btn {
  width: 100%; padding: 12px; border-radius: 12px;
  border: none; background: transparent;
  color: var(--danger); font-weight: 600; font-size: 13px;
  margin-top: 4px;
}
.danger-btn:active { background: var(--danger-soft); }

/* ---------- EDIT MODAL FIELDS ---------- */
.edit-field { margin-bottom: 14px; }
.edit-field label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin-bottom: 6px;
}
.edit-field input, .edit-field select, .edit-field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: none; background: var(--soft-bg); font-size: 14px;
  color: var(--text-primary);
}
.edit-field textarea { resize: vertical; min-height: 60px; }
.edit-error {
  font-size: 12px; color: var(--danger);
  margin-bottom: 6px; min-height: 16px;
}

/* ---------- RESEARCH MODAL CARDS ---------- */
.modal-card .card { box-shadow: none; background: var(--soft-bg); }

/* ============================================================
   v2 ADDITIONS — welcome, auth, ideas tab, account, add person
   ============================================================ */

/* ---------- WELCOME ---------- */
.welcome-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  background: var(--bg);
}
.welcome-card {
  width: 100%; max-width: 380px;
  text-align: center;
}
.welcome-logo { margin-bottom: 40px; }
.welcome-logo h1 {
  font-family: "Playfair Display", serif;
  font-size: 52px; font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
  letter-spacing: -1px;
}
.welcome-logo p {
  font-size: 15px; color: var(--text-muted);
  margin: 0;
}
.legacy-banner {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--soft-bg);
  border-radius: 14px;
  font-size: 13px; color: var(--text-secondary);
  text-align: left; line-height: 1.5;
}
.legacy-banner strong { color: var(--accent-deep); }

/* ---------- AUTH SCREENS ---------- */
.auth-screen {
  min-height: 100vh; min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 24px 28px;
  background: var(--bg);
  display: flex; flex-direction: column;
}
.back-btn {
  align-self: flex-start;
  background: transparent; border: none;
  color: var(--text-secondary);
  font-size: 16px; font-weight: 500;
  padding: 8px 12px 8px 0;
  cursor: pointer;
  margin-bottom: 12px;
}
.back-btn:active { color: var(--accent-deep); }
.auth-card {
  width: 100%; max-width: 420px;
  margin: 0 auto;
  flex: 1;
  display: flex; flex-direction: column;
  justify-content: center;
  padding-bottom: 40px;
}
.auth-title {
  font-family: "Playfair Display", serif;
  font-size: 32px; font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 28px;
  letter-spacing: -0.5px;
}
.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-form label {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 14px; margin-bottom: 6px;
}
.auth-form input {
  width: 100%; padding: 14px 16px;
  border-radius: 14px; border: none;
  background: var(--card-bg);
  font-size: 16px; color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  -webkit-appearance: none; appearance: none;
}
.auth-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.auth-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 12px 0 6px;
  text-align: center;
}
.auth-form button { margin-top: 20px; }
.auth-note {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin: 22px 0 0;
}
.auth-note a {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
}
.auth-fineprint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 16px 0 0;
  line-height: 1.5;
}

/* ---------- PRIMARY / SECONDARY BUTTONS ---------- */
.primary-btn {
  width: 100%;
  padding: 16px 20px;
  border-radius: 16px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 15px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  -webkit-tap-highlight-color: transparent;
}
.primary-btn:active {
  transform: scale(0.98);
  background: var(--accent-deep);
}
.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.secondary-btn {
  width: 100%;
  padding: 16px 20px;
  border-radius: 16px;
  border: none;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 15px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  -webkit-tap-highlight-color: transparent;
}
.secondary-btn:active {
  transform: scale(0.98);
  background: var(--soft-bg);
}

/* ---------- ADD PERSON BUTTON ---------- */
.add-person-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1.5px dashed var(--accent);
  background: transparent;
  color: var(--accent-deep);
  font-size: 14px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 16px;
  -webkit-tap-highlight-color: transparent;
}
.add-person-btn:active {
  background: var(--soft-bg);
  transform: scale(0.99);
}

/* ---------- IDEAS TAB ---------- */
.ideas-tabs {
  display: flex; gap: 8px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.ideas-tab {
  flex: 1;
  padding: 10px 14px;
  border-radius: 11px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ideas-tab.active {
  background: var(--accent);
  color: white;
}
.idea-cat {
  background: var(--card-bg);
  border-radius: 18px;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.idea-cat summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex; align-items: center;
  gap: 12px;
  -webkit-tap-highlight-color: transparent;
}
.idea-cat summary::-webkit-details-marker { display: none; }
.idea-cat-icon {
  font-size: 24px; line-height: 1;
}
.idea-cat-title {
  flex: 1;
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
}
.idea-cat-arrow {
  font-size: 20px; color: var(--text-muted);
  transition: transform 0.2s ease;
}
.idea-cat[open] .idea-cat-arrow { transform: rotate(90deg); }
.idea-cat-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--soft-bg);
  padding-top: 14px;
}
.idea-section { margin-bottom: 14px; }
.idea-section:last-child { margin-bottom: 0; }
.idea-section-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}
.idea-list {
  margin: 0; padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
}
.idea-list li {
  margin-bottom: 4px;
}

/* ---------- SPINNER FOR RESEARCH BUTTON ---------- */
.spin {
  display: inline-block;
  animation: spinAnim 1s linear infinite;
}
@keyframes spinAnim {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---------- SETTINGS account block ---------- */
.settings-info {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

/* ============================================================
   v3 ADDITIONS — cloud auth, event cards, research, account
   ============================================================ */

/* Welcome / auth tabs */
.auth-tabs {
  display: flex; gap: 6px; padding: 4px;
  background: var(--card-bg); border-radius: 14px;
  margin-bottom: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.auth-tab {
  flex: 1; padding: 12px 14px; border: none;
  background: transparent; color: var(--text-secondary);
  font-size: 14px; font-weight: 600; border-radius: 11px;
  font-family: inherit;
}
.auth-tab.active { background: var(--accent); color: white; }
.auth-form { display: none; flex-direction: column; gap: 12px; }
.auth-form.active { display: flex; }
.auth-form input {
  padding: 14px 16px; border-radius: 14px; border: none;
  background: var(--card-bg); font-size: 16px; color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  -webkit-appearance: none;
}
.auth-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-submit {
  padding: 14px 20px; border-radius: 14px; border: none;
  background: var(--accent); color: white;
  font-size: 15px; font-weight: 600; font-family: inherit;
  margin-top: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.auth-submit:disabled { opacity: 0.6; }
.welcome-note {
  font-size: 12px; color: var(--text-muted);
  margin: 16px 4px 0; line-height: 1.5;
  text-align: center;
}

/* Section heading utility */
.section-heading {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700;
  color: var(--text-primary);
  margin: 22px 4px 12px;
}

/* Next-up card (new layout) */
.next-up-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); margin-bottom: 8px;
}
.next-up-event {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px;
}
.next-up-main { flex: 1; min-width: 0; }
.next-up-name {
  font-family: 'Playfair Display', serif;
  font-size: 21px; font-weight: 700;
  color: var(--text-primary); line-height: 1.2;
}
.next-up-date {
  color: var(--text-secondary); font-size: 13px;
  margin-top: 4px; font-weight: 500;
}
.next-up-pill {
  background: var(--accent-soft); color: var(--accent-deep);
  padding: 8px 14px; border-radius: 14px;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.next-up-actions { display: flex; gap: 8px; }
.next-up-actions .primary-btn { margin-bottom: 0; }
.next-up-empty { text-align: center; padding: 14px 12px; }
.next-up-empty-icon { font-size: 32px; margin-bottom: 8px; }
.next-up-empty-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
}
.next-up-empty-sub { font-size: 13px; color: var(--text-muted); }

/* Brain dump feedback */
.brain-dump-ok {
  margin-top: 12px; padding: 10px 14px;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 12px; font-size: 13px; font-weight: 600;
}
.brain-dump-err {
  margin-top: 12px; padding: 10px 14px;
  background: var(--danger-soft); color: var(--danger);
  border-radius: 12px; font-size: 12.5px; line-height: 1.5;
}

/* Event cards (new) */
.event-card {
  background: var(--card-bg); border-radius: 22px;
  padding: 18px 20px; margin-bottom: 14px;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
}
.event-card.passed { opacity: 0.6; }
.event-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 12px;
}
.event-title {
  font-family: 'Playfair Display', serif;
  font-size: 19px; font-weight: 700;
  color: var(--text-primary); line-height: 1.2;
}
.event-date {
  font-size: 12px; color: var(--text-muted);
  margin-top: 3px; font-weight: 500;
}
.event-pill {
  padding: 6px 12px; border-radius: 12px;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.event-pill.soon { background: var(--warn-soft); color: var(--warn); }
.event-pill.month { background: var(--accent-soft); color: var(--accent-deep); }
.event-pill.ok { background: var(--soft-bg); color: var(--text-secondary); }
.event-pill.passed { background: var(--danger-soft); color: var(--danger); }
.event-status-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 12px 14px;
  background: var(--soft-bg); border-radius: 12px; margin-bottom: 12px;
}
.status-text { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.status-badge {
  font-size: 10px; font-weight: 700;
  padding: 5px 10px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
  flex-shrink: 0;
}
.status-badge.needs { background: var(--warn-soft); color: var(--warn); }
.status-badge.sorted { background: var(--accent-soft); color: var(--accent-deep); }
.event-likes {
  padding: 10px 14px; background: var(--soft-bg);
  border-radius: 12px; font-size: 13px;
  color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px;
}
.event-likes strong { color: var(--text-primary); font-weight: 700; margin-right: 4px; }
.event-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.action-btn.good { background: var(--accent-soft); color: var(--accent-deep); }
.action-btn.accent { background: var(--accent); color: white; }
.action-btn.delete { background: transparent; color: var(--danger); }

/* Calendar (new class names) */
.cal-head {
  text-align: center; font-size: 9px; font-weight: 700;
  color: var(--text-muted); padding: 4px 0 8px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 12px; position: relative;
  color: var(--text-secondary); min-width: 0;
}
.cal-cell.has-event {
  background: var(--accent-soft); color: var(--accent-deep); font-weight: 700;
}
.cal-dot {
  position: absolute; bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--accent);
}
.cal-cell.today {
  background: var(--accent); color: #ffffff; font-weight: 800;
  box-shadow: 0 0 0 3px var(--card-bg), 0 0 0 5px var(--accent);
  transform: scale(1.04); z-index: 2;
}
.cal-cell.today .cal-dot { background: #ffffff; }
.cal-cell.empty { visibility: hidden; }

/* People cards */
.person-card {
  background: var(--card-bg); border-radius: 22px;
  padding: 18px 20px; margin-bottom: 12px;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
}
.person-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 6px;
}
.person-name {
  font-family: 'Playfair Display', serif;
  font-size: 19px; font-weight: 700;
  color: var(--text-primary);
}
.person-relation {
  font-size: 12px; color: var(--text-muted);
  text-transform: capitalize; font-weight: 500;
}
.person-meta {
  font-size: 12.5px; color: var(--text-secondary); margin-bottom: 10px;
}
.person-events {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px; font-size: 12px; color: var(--text-muted);
}
.person-event-chip {
  background: var(--soft-bg); color: var(--text-primary);
  padding: 4px 10px; border-radius: 10px; font-size: 11.5px; font-weight: 600;
}

/* Kindness cards (new) */
.kindness-card {
  background: var(--card-bg); border-radius: 22px;
  padding: 18px 20px; margin-bottom: 12px;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
}
.kindness-card.done { opacity: 0.6; }
.kindness-card.done .kindness-name { text-decoration: line-through; }
.kindness-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 4px;
}
.kindness-name {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 700; color: var(--text-primary);
}
.kindness-type {
  font-size: 10px; font-weight: 700;
  background: var(--soft-bg); color: var(--text-secondary);
  padding: 3px 8px; border-radius: 8px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.kindness-what {
  font-size: 13px; color: var(--text-secondary);
  margin-top: 4px; line-height: 1.5;
}
.kindness-sugg {
  margin-top: 12px; padding: 12px 14px;
  background: var(--warn-soft); border-radius: 12px;
  font-size: 12.5px; color: var(--text-primary); line-height: 1.5;
}
.kindness-actions { display: flex; gap: 6px; margin-top: 12px; }

/* Ideas — new layout uses .idea-item (not .idea-list ul/li) */
.idea-item {
  padding: 12px 14px; border-radius: 12px;
  background: var(--soft-bg);
  font-size: 13.5px; color: var(--text-primary);
  line-height: 1.55; margin-bottom: 8px;
}
.idea-item:last-child { margin-bottom: 0; }

/* Filter chips on ideas page */
#ideas-filters .chip { font-size: 13px; }

/* Research modal */
.research-intro {
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--soft-bg); border-radius: 12px;
}
.research-list { display: flex; flex-direction: column; gap: 12px; }
.research-item {
  padding: 14px 16px; border-radius: 14px;
  background: var(--soft-bg);
}
.research-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 700;
  color: var(--text-primary); line-height: 1.3;
}
.research-price {
  font-size: 13px; color: var(--accent-deep);
  font-weight: 700; margin-top: 4px;
}
.research-why {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.5; margin-top: 8px;
}
.research-link {
  display: inline-block; margin-top: 10px;
  font-size: 13px; font-weight: 600;
  color: var(--accent-deep); text-decoration: none;
  padding: 8px 14px; border-radius: 10px;
  background: var(--card-bg);
}
.research-refresh { margin-top: 18px; }

/* Account block */
.account-card {
  padding: 14px 16px; border-radius: 14px;
  background: var(--soft-bg); margin-bottom: 12px;
}
.account-name {
  font-weight: 700; font-size: 15px; color: var(--text-primary);
}
.account-email {
  font-size: 13px; color: var(--text-secondary); margin-top: 2px;
}
.account-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
}

/* Theme grid (new with label below dot) */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-grid .theme-swatch {
  width: auto; height: auto; border-radius: 14px;
  background: var(--soft-bg); border: 2px solid transparent;
  padding: 12px 8px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; box-shadow: none;
  font-family: inherit; cursor: pointer;
}
.theme-grid .theme-swatch.active { border-color: var(--accent); }
.theme-dot {
  width: 26px; height: 26px; border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4);
}
.theme-name {
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
}

/* Empty card */
.empty-card {
  text-align: center; padding: 40px 24px;
  background: var(--card-bg); border-radius: 22px;
  color: var(--text-muted); font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinAnim 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* ============================================================
   v3 — onboarding, person editor, inbox, header actions
   ============================================================ */

.header-actions { display: flex; gap: 8px; align-items: center; }
.header-add {
  background: var(--accent);
  color: white;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

/* Onboarding */
.onboarding-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.onboarding-screen.hidden { display: none; }
.onboarding-card {
  width: 100%; max-width: 480px;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.06);
}
.onboarding-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.onboarding-step {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 700;
}
.onboarding-skip {
  background: transparent;
  border: none;
  font-size: 13px;
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
}
.onboarding-progress {
  height: 4px;
  background: var(--soft-bg);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 24px;
}
.onboarding-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 20%;
  transition: width 0.3s ease;
}
.onboarding-prompt {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.25;
}
.onboarding-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
}
.onboarding-options {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 24px;
}
.onboarding-option {
  padding: 16px 18px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--soft-bg);
  text-align: left;
  font-size: 14.5px;
  color: var(--text-primary);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.4;
}
.onboarding-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}
.onboarding-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.onboarding-nav .primary-btn {
  margin-bottom: 0;
  flex: 1;
  max-width: 200px;
}
.onboarding-nav .primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Inbox (questions on Home) */
.inbox-card {
  padding: 18px 20px;
  margin-bottom: 12px;
  background: var(--card-bg);
  border-radius: 22px;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
}
.inbox-prompt {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 14px;
}
.inbox-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.inbox-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inbox-input-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  background: var(--soft-bg);
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  -webkit-appearance: none;
}
.inbox-input-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.inbox-input-row .primary-btn {
  margin-bottom: 0;
  padding: 12px 18px;
  font-size: 13px;
}
.inbox-skip-row {
  margin-top: 10px;
  text-align: right;
}
.action-btn.small {
  padding: 6px 12px;
  font-size: 11px;
}

/* Person editor form */
.form-row {
  margin-bottom: 18px;
}
.form-row label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.form-row input[type="text"],
.form-row textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  background: var(--soft-bg);
  font-size: 14.5px;
  color: var(--text-primary);
  font-family: inherit;
  -webkit-appearance: none;
  box-sizing: border-box;
}
.form-row textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}
.form-row input:focus,
.form-row textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: var(--soft-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.pill.active {
  background: var(--accent);
  color: white;
}

.pe-event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--soft-bg);
  margin-bottom: 6px;
}
.pe-event-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}
.pe-event-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.empty-card-small {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--soft-bg);
  border-radius: 12px;
  margin-bottom: 10px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--soft-bg);
}
.modal-footer .primary-btn { margin-bottom: 0; flex: 1; max-width: 200px; }

/* Person card extras */
.person-card { cursor: pointer; }
.person-card:active { transform: scale(0.99); }
.person-wishlist {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 6px;
  margin-bottom: 4px;
  line-height: 1.4;
  font-style: italic;
}

/* Research modal content */
.research-headline {
  padding: 12px 16px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 14px;
}
.research-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 16px 4px 8px;
}
.research-item.top {
  border: 2px solid var(--accent);
  background: var(--card-bg);
}
.research-item.local {
  background: var(--accent-soft);
}
.research-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--soft-bg);
  border-radius: 12px;
}

/* ============================================================
   v3 fixes — calendar grid, brain dump, page headers
   ============================================================ */

/* Calendar */
.calendar-card {
  padding: 14px 12px 18px;
  background: var(--card-bg);
  border-radius: 22px;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
  margin-bottom: 18px;
}
.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.month-name {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  flex: 1;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* Brain dump */
.brain-dump-card {
  padding: 18px 20px;
  background: var(--card-bg);
  border-radius: 22px;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
  margin-bottom: 18px;
}
.brain-dump-help {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.brain-dump-help em {
  font-style: italic;
  color: var(--text-secondary);
  font-weight: 500;
}
.brain-dump-card textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  background: var(--soft-bg);
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
  -webkit-appearance: none;
  box-sizing: border-box;
  margin-bottom: 12px;
}
.brain-dump-card textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.brain-dump-card .primary-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 0;
}
#quick-result {
  margin-top: 10px;
}

/* Page header with title */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-top: env(safe-area-inset-top, 0);
  gap: 12px;
}
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.greeting {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.today-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--soft-bg);
  color: var(--text-primary);
  font-size: 18px;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-btn:active { background: var(--accent-soft); }

/* Quote card */
.quote-card {
  padding: 16px 20px;
  background: var(--card-bg);
  border-radius: 22px;
  box-shadow: 0 2px 18px rgba(0,0,0,0.04);
  margin-bottom: 22px;
}
.quote-card em {
  font-style: italic;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Info bar */
.info-bar {
  padding: 12px 16px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.info-bar strong {
  font-weight: 700;
}

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal.hidden { display: none; }
.modal-card {
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--card-bg);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 24px 20px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card-bg);
  border-top: 1px solid var(--soft-bg);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 4px;
  cursor: pointer;
}
.nav-item svg {
  width: 22px; height: 22px;
}
.nav-item.active {
  color: var(--accent);
}

/* Section heading */
.section-heading {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 22px 4px 12px;
}

/* Page layout */
.page { display: none; padding: 20px 18px 100px; }
.page.active { display: block; }

/* Filter chips */
.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 8px 16px;
  border-radius: 14px;
  border: none;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.chip.active {
  background: var(--accent);
  color: white;
}

/* Welcome screen */
.welcome-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  padding-top: env(safe-area-inset-top);
}
.welcome-screen.hidden { display: none; }
.welcome-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.06);
}
.welcome-logo {
  text-align: center;
  margin-bottom: 30px;
}
.welcome-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 6px;
}
.welcome-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

/* App + hidden helper */
.app.hidden { display: none; }
.hidden { display: none !important; }


/* ============================================================
   DISCOVER TAB
   ============================================================ */
.page-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: -6px 4px 16px;
  line-height: 1.5;
}
.discover-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--soft-bg);
  padding: 4px;
  border-radius: 14px;
}
.discover-tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: 11px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.discover-tab.active {
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.discover-stat {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 4px 4px 12px;
}
.discover-q-card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 18px 18px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.discover-q-prompt {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 14px;
}
.discover-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.discover-opt {
  padding: 9px 14px;
  border-radius: 12px;
  border: none;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.discover-opt:active {
  transform: scale(0.97);
}
.discover-text-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.discover-text-row input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 12px;
  border: none;
  background: var(--soft-bg);
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  -webkit-appearance: none;
}
.discover-text-row input:focus {
  outline: 2px solid var(--accent);
}
.discover-text-row .primary-btn {
  width: auto;
  padding: 11px 18px;
  margin-bottom: 0;
  font-size: 13px;
}
.discover-skip {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: underline;
}
.discover-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--soft-bg);
  border-radius: 14px;
  line-height: 1.5;
}
.discover-answered {
  margin-top: 24px;
  background: var(--soft-bg);
  border-radius: 14px;
  padding: 14px 16px;
}
.discover-answered summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}
.discover-answered summary::-webkit-details-marker {
  display: none;
}
.discover-answered[open] summary {
  margin-bottom: 12px;
}
.discover-answered-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.discover-answered-item:last-child {
  border-bottom: none;
}
.discover-answered-q {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.discover-answered-a {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Person list inside Discover */
.discover-person-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.discover-person-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 14px 16px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}
.discover-person-row:active {
  transform: scale(0.99);
}
.discover-person-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.discover-person-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.discover-person-count {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.discover-person-count.done {
  background: var(--soft-bg);
  color: var(--text-muted);
}
.discover-back {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 0;
  margin-bottom: 8px;
  cursor: pointer;
}
.discover-person-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.discover-person-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 18px;
}
