/* ===========================================================
   Home Base — family planner
   Themes set surface colours; JS sets --accent from her colour.
   =========================================================== */

:root {
  --cream: #FBF6EF;
  --cream-2: #F4EADC;
  --card: #FFFDFA;
  --ink: #2F2A26;
  --ink-soft: #574D45;
  --muted: #8A7C70;
  --line: #EADFD2;
  --line-soft: #F1E6D8;
  --surface-2: #FCF7F1;
  --surface-3: #FFF6EF;
  --glow1: #FDF1E2;
  --glow2: #F3F6EE;

  --quote-a: #FFF7EF;
  --quote-b: #F7E7DA;
  --quote-line: #EFDBC9;
  --quote-ink: #4A3B31;
  --quote-num: #A98D77;

  --badge-bg: #FBEDE2;
  --badge-line: #F1DCC9;
  --badge-ink: #A95636;
  --chip-bg: #EFF2EA;
  --chip-line: #E0E7D8;
  --chip-ink: #5C6D57;

  --accent: #C96F4A;
  --accent-dark: #A95636;
  --accent-rgb: 201, 111, 74;
  --on-accent: #FFF6EF;

  --shadow-sm: 0 1px 2px rgba(70, 50, 35, .06), 0 6px 16px -10px rgba(70, 50, 35, .25);
  --shadow-md: 0 2px 4px rgba(70, 50, 35, .05), 0 18px 36px -22px rgba(70, 50, 35, .35);
  --radius: 18px;
  --radius-sm: 11px;
}

[data-theme="sage"] {
  --cream: #F7F6EF;
  --cream-2: #ECEEE2;
  --card: #FFFEF9;
  --line: #E2E4D5;
  --line-soft: #EDEFE1;
  --surface-2: #F7F8F0;
  --surface-3: #F4F7EC;
  --glow1: #EFF4E4;
  --glow2: #F6F2E6;
  --quote-a: #FBFCF3;
  --quote-b: #EEF3E3;
  --quote-line: #DDE5CF;
  --quote-ink: #3C4636;
  --quote-num: #87957B;
  --badge-bg: #ECF1E2;
  --badge-line: #DCE5D0;
  --badge-ink: #5C7050;
  --chip-bg: #F1F4E8;
  --chip-line: #E2E8D4;
  --chip-ink: #5D6B52;
  --accent: #6F8F6B;
  --accent-dark: #55704F;
  --accent-rgb: 111, 143, 107;
}

[data-theme="rose"] {
  --cream: #FCF5F4;
  --cream-2: #F6E7E7;
  --card: #FFFCFC;
  --line: #EFDDDD;
  --line-soft: #F6E8E8;
  --surface-2: #FDF6F6;
  --surface-3: #FCF2F3;
  --glow1: #FBEAEC;
  --glow2: #FBF3E8;
  --quote-a: #FFF7F7;
  --quote-b: #F8E7E9;
  --quote-line: #EFD7DA;
  --quote-ink: #4B3438;
  --quote-num: #A98A90;
  --badge-bg: #FBEBEE;
  --badge-line: #F0D8DD;
  --badge-ink: #A2566A;
  --chip-bg: #F8EFF0;
  --chip-line: #EEDEDF;
  --chip-ink: #7C5F63;
  --accent: #C4778A;
  --accent-dark: #A05B6E;
  --accent-rgb: 196, 119, 138;
}

[data-theme="sky"] {
  --cream: #F6F8F9;
  --cream-2: #E8EFF2;
  --card: #FDFEFF;
  --line: #DDE7EC;
  --line-soft: #E9F0F4;
  --surface-2: #F4F9FB;
  --surface-3: #F1F7FA;
  --glow1: #E6F1F6;
  --glow2: #FAF6E8;
  --quote-a: #F7FCFE;
  --quote-b: #E7F2F7;
  --quote-line: #D6E6EE;
  --quote-ink: #2F4149;
  --quote-num: #8299A4;
  --badge-bg: #EAF3F8;
  --badge-line: #D8E7EF;
  --badge-ink: #3E7288;
  --chip-bg: #EEF4F7;
  --chip-line: #DDE9EF;
  --chip-ink: #4C6773;
  --accent: #5B8DA6;
  --accent-dark: #437187;
  --accent-rgb: 91, 141, 166;
}

[data-theme="midnight"] {
  --cream: #1F1B21;
  --cream-2: #2A242B;
  --card: #292329;
  --ink: #F5EDE7;
  --ink-soft: #D8CBC2;
  --muted: #A89A90;
  --line: #3B333A;
  --line-soft: #463D44;
  --surface-2: #332C33;
  --surface-3: #3A3138;
  --glow1: #33232E;
  --glow2: #232B2C;
  --quote-a: #3A2C32;
  --quote-b: #33262C;
  --quote-line: #4B3B42;
  --quote-ink: #F3E5DC;
  --quote-num: #C1A597;
  --badge-bg: #43323A;
  --badge-line: #533E47;
  --badge-ink: #F0BBA4;
  --chip-bg: #333A34;
  --chip-line: #404A41;
  --chip-ink: #C2D2BC;
  --accent: #D9A07A;
  --accent-dark: #E8B593;
  --accent-rgb: 217, 160, 122;
  --on-accent: #231C18;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 20px -12px rgba(0, 0, 0, .7);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .4), 0 22px 44px -24px rgba(0, 0, 0, .85);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background:
    radial-gradient(1100px 600px at 12% -8%, var(--glow1) 0%, transparent 60%),
    radial-gradient(900px 500px at 92% 0%, var(--glow2) 0%, transparent 55%),
    var(--cream);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background .3s ease, color .3s ease;
}

[hidden] { display: none !important; }

h1, h2, h3, h4, blockquote {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.015em;
  margin: 0;
}

p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 22px 60px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 12px;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 21px;
  border-radius: 13px;
  background: rgba(var(--accent-rgb), .16);
  border: 1px solid var(--line);
  flex: none;
}

.brand-text h1 { font-size: 21px; line-height: 1.1; }
.brand-text p { font-size: 12px; color: var(--muted); letter-spacing: .01em; }

.tabs {
  display: flex;
  gap: 4px;
  flex: 1 1 auto;
  justify-content: center;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.tab-btn:hover { background: var(--cream-2); }
.tab-btn.is-active { background: var(--ink); border-color: var(--ink); color: var(--cream); }

.top-right { display: flex; align-items: center; gap: 10px; }

.today-chip {
  font-size: 12.5px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 14px;
  white-space: nowrap;
}

.gear { font-size: 15px; }

/* ---------- headings ---------- */
h2 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.15; }
h3 { font-size: 17px; }

.eyebrow {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.hint { color: var(--muted); font-size: 13.5px; max-width: 62ch; }
.meta { color: var(--muted); font-size: 12.5px; margin: 14px 0 18px; }
.error { color: #C0492B; font-size: 12.5px; }
[data-theme="midnight"] .error { color: #F09A80; }

.panel { padding-top: 30px; animation: rise .32s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease, filter .18s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(160deg, var(--accent), var(--accent-dark));
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: 0 8px 18px -10px rgba(var(--accent-rgb), .9);
}
.btn.primary:hover { filter: brightness(1.05); }

.btn.ghost { background: transparent; color: var(--ink-soft); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.danger { color: #B0452B; border-color: #EDC9BE; }
[data-theme="midnight"] .btn.danger { color: #F0A28B; border-color: #5B3B36; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #B0452B; }
[data-theme="midnight"] .link-btn.danger { color: #F0A28B; }

.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: grid; place-items: center;
  color: var(--ink-soft);
  flex: none;
}
.icon-btn:hover { background: var(--cream-2); }

input, select, textarea {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
  color: var(--ink);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .18);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }

::selection { background: rgba(var(--accent-rgb), .25); }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ---------- planner ---------- */
.planner-hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy { padding: 8px 4px; }
.hero-title { font-size: clamp(30px, 4vw, 44px); line-height: 1.06; margin-bottom: 10px; }
.hero-sub { color: var(--ink-soft); max-width: 46ch; }

.stat-row { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.stat {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 16px;
  min-width: 116px;
}
.stat span {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: 24px;
  line-height: 1.1;
}
.stat small { font-size: 11.5px; color: var(--muted); }

.quote-card {
  position: relative;
  margin: 0;
  background: linear-gradient(155deg, var(--quote-a), var(--quote-b) 60%, var(--quote-b));
  border: 1px solid var(--quote-line);
  border-radius: var(--radius);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.quote-card::after {
  content: "";
  position: absolute;
  right: -46px; bottom: -60px;
  width: 170px; height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(var(--accent-rgb), .22), transparent 70%);
}

.quote-heart { font-size: 20px; color: var(--accent); margin-bottom: 10px; }

.quote-card blockquote {
  font-size: clamp(17px, 1.9vw, 21px);
  font-style: italic;
  line-height: 1.5;
  color: var(--quote-ink);
  margin: 0 0 18px;
  position: relative;
  z-index: 1;
}

.quote-card figcaption {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.quote-num {
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--quote-num);
  font-weight: 600;
}

.planner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* ---------- lists ---------- */
.stack-list { display: flex; flex-direction: column; gap: 8px; }

.stack-list li, .entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 13.5px;
}

.entry .entry-main { flex: 1; min-width: 0; }
.entry strong { display: block; font-size: 14px; font-weight: 600; }
.entry small { color: var(--muted); font-size: 12px; }

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: transparent !important;
}

.time-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--badge-ink);
  background: var(--badge-bg);
  border: 1px solid var(--badge-line);
  border-radius: 8px;
  padding: 3px 7px;
  white-space: nowrap;
  margin-top: 1px;
}

.who-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-ink);
  border: 1px solid var(--chip-line);
  white-space: nowrap;
}

/* ---------- chore chart ---------- */
.kid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kid-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--kid, var(--accent));
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kid-head { display: flex; align-items: center; gap: 8px; }

.kid-name {
  border: 1px solid transparent;
  background: transparent;
  font-family: "Fraunces", Georgia, serif;
  font-size: 17px;
  padding: 4px 6px;
  border-radius: 8px;
}
.kid-name:hover { border-color: var(--line); }
.kid-name:focus { background: var(--surface-3); border-color: var(--line); }

.kid-count { font-size: 11px; color: var(--muted); white-space: nowrap; margin-left: auto; }

.kid-chores { display: flex; flex-direction: column; gap: 6px; }

.kid-chores li {
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.kid-chores li::before { content: "◦"; color: var(--kid, var(--accent)); font-weight: 700; line-height: 1.2; }

.kid-empty { font-size: 12.5px; color: var(--muted); font-style: italic; }

.inline-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 6px 8px 6px 13px;
  font-size: 13px;
}
.chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 50%;
}
.chip button:hover { color: var(--accent); background: rgba(var(--accent-rgb), .14); }

/* ---------- chore survey ---------- */
.survey-list { display: flex; flex-direction: column; gap: 8px; }

.survey-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.survey-item .survey-text { flex: 1; font-size: 14px; min-width: 0; }
.survey-item .survey-text small { display: block; color: var(--muted); font-size: 11.5px; }

.vote-btn {
  border: 1px solid var(--badge-line);
  background: var(--badge-bg);
  color: var(--badge-ink);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.vote-btn:hover { filter: brightness(.97); }
.vote-btn:active { transform: scale(.97); }

.survey-item .icon-btn { width: 28px; height: 28px; font-size: 14px; }

/* ---------- calendar ---------- */
.calendar-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 22px;
  align-items: start;
  margin-top: 14px;
}

.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-head h3 { flex: 1; font-size: 20px; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-bottom: 6px;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.cal-day {
  position: relative;
  min-height: 74px;
  border: 1px solid transparent;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 6px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background .15s ease, border-color .15s ease;
  overflow: hidden;
}
.cal-day:hover { background: var(--cream-2); }
.cal-day.is-blank { background: transparent; cursor: default; border: 0; }
.cal-day.is-blank:hover { background: transparent; }

.cal-daynum { font-size: 12px; font-weight: 600; color: var(--ink-soft); }

.cal-day.is-today { border-color: var(--badge-line); background: var(--badge-bg); }
.cal-day.is-today .cal-daynum { color: var(--badge-ink); }
.cal-day.is-today .cal-daynum::after {
  content: "today";
  font-size: 8.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-left: 5px;
  color: var(--accent);
}

.cal-day.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--surface-3); }

.cal-pill {
  display: block;
  font-size: 10.5px;
  line-height: 1.25;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--badge-bg);
  color: var(--badge-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-more { font-size: 10px; color: var(--muted); padding-left: 3px; }

.day-card .stack-list { margin-bottom: 18px; }

.form { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- notepad ---------- */
.search { margin: 14px 0 18px; max-width: 340px; }

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
}

.note {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note:nth-child(even) { background: var(--surface-2); }

.note-title {
  border: 0;
  background: transparent;
  font-family: "Fraunces", Georgia, serif;
  font-size: 16px;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
}
.note-title:focus { border-bottom-color: var(--line); box-shadow: none; }

.note textarea {
  border: 0;
  background: transparent;
  resize: vertical;
  min-height: 130px;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 0;
}
.note textarea:focus { box-shadow: none; }

.note footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  flex-wrap: wrap;
}
.note footer small { color: var(--muted); font-size: 11px; }

/* ---------- quote library ---------- */
.quote-lab { margin-top: 22px; padding: 0; overflow: hidden; }
.quote-lab summary {
  cursor: pointer;
  padding: 16px 20px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 15.5px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.quote-lab summary::-webkit-details-marker { display: none; }
.quote-lab summary::before { content: "+"; font-size: 18px; color: var(--accent); width: 16px; }
.quote-lab[open] summary::before { content: "–"; }
.quote-lab .hint { padding: 0 20px; }
#quoteLibrary { padding: 8px 20px 20px; max-height: 420px; overflow: auto; }

.q-group { margin-top: 14px; }
.q-group h4 {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: "Inter", sans-serif;
  font-weight: 700;
  margin-bottom: 6px;
}

.q-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 6px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.q-row:hover { background: var(--surface-2); }
.q-row input { width: 15px; height: 15px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.q-row .q-num { color: var(--quote-num); font-size: 11.5px; padding-top: 2px; min-width: 24px; }

/* ---------- footer & toast ---------- */
.foot {
  margin-top: 46px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--cream);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 120;
  max-width: min(90vw, 460px);
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ===========================================================
   GATE — sign up / sign in / guest
   =========================================================== */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px 18px;
}

.gate-card {
  width: min(470px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px 28px 24px;
  box-shadow: var(--shadow-md);
  animation: rise .35s ease both;
}

.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.gate-brand h1 { font-size: 23px; }
.gate-brand p { font-size: 12.5px; color: var(--muted); }

.gate-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}

.gate-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.gate-tab.is-active { background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink); }

.gate-pane .btn.primary { width: 100%; margin-top: 6px; padding: 11px; }
.gate-pane .hint { margin-bottom: 16px; }

.gate-note {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

/* ===========================================================
   INTRO SURVEY
   =========================================================== */
.intro {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px 18px;
}

.intro-shell {
  width: min(640px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow-md);
  animation: rise .35s ease both;
}

.intro-top { margin-bottom: 22px; }

.intro-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 10px;
}
.intro-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width .3s ease;
}

.intro-count {
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.intro-body { min-height: 230px; }
.intro-step .eyebrow { margin-bottom: 8px; }
.intro-step h2 { font-size: clamp(23px, 3.4vw, 29px); line-height: 1.18; margin-bottom: 8px; }
.intro-step .hint { margin-bottom: 18px; }
.intro-step input[type="text"], .intro-step input[type="time"], .intro-step textarea { max-width: 100%; }
.intro-step textarea { min-height: 110px; resize: vertical; }

.opt-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.opt {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.opt:hover { border-color: var(--accent); }
.opt.is-on {
  background: rgba(var(--accent-rgb), .16);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.kid-name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.color-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.swatch {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.swatch.is-on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--card) inset; }

.intro-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.intro-foot .error { flex: 1; }
.intro-foot .btn.primary { margin-left: auto; }

.intro-skip { margin-top: 14px; text-align: center; }

/* ===========================================================
   SETTINGS DRAWER
   =========================================================== */
.drawer-wrap { position: fixed; inset: 0; z-index: 80; }

.drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 12, .42);
  backdrop-filter: blur(2px);
  animation: bday-in .2s ease both;
}

.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(430px, 100%);
  background: var(--cream);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px -30px rgba(0, 0, 0, .5);
  display: flex;
  flex-direction: column;
  animation: slide-in .26s ease both;
}

@keyframes slide-in {
  from { transform: translateX(24px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.drawer-head h2 { font-size: 21px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 6px 20px 20px; }

.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.drawer-foot .hint { font-size: 11.5px; }

.saved-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .2);
  flex: none;
}

.setting-group { padding: 20px 0; border-bottom: 1px solid var(--line-soft); }
.setting-group:last-child { border-bottom: 0; }
.setting-group h3 { font-size: 15px; margin-bottom: 12px; }
.setting-group .field + .field { margin-top: 10px; }
.setting-group .two-col { margin-top: 10px; }
.setting-group .btn { margin-top: 12px; }
.setting-group .link-btn { display: block; margin-top: 10px; }

.setting-kids { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }

.setting-kid {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--kid, var(--accent));
  border-radius: 10px;
  padding: 6px 8px;
}
.setting-kid input {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 15px;
}
.setting-kid input:focus { box-shadow: none; background: var(--surface-3); }

.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }

.theme-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 9px 11px;
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.theme-swatch .dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--sw);
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.theme-swatch small { width: 100%; padding-left: 24px; font-weight: 400; color: var(--muted); font-size: 10.5px; }
.theme-swatch.is-on { border-color: var(--accent); background: rgba(var(--accent-rgb), .12); color: var(--ink); }

/* ===========================================================
   THE BIRTHDAY SURPRISE
   =========================================================== */
.birthday {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
  background:
    radial-gradient(900px 600px at 20% 0%, #4B2338 0%, transparent 60%),
    radial-gradient(700px 500px at 90% 20%, #6B3348 0%, transparent 55%),
    linear-gradient(165deg, #2E1520 0%, #43202F 45%, #2A141E 100%);
  animation: bday-in .5s ease both;
}

@keyframes bday-in { from { opacity: 0; } to { opacity: 1; } }

.bday-sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.floaty {
  position: absolute;
  bottom: -60px;
  color: #F2C4C0;
  animation-name: float-up;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  filter: drop-shadow(0 0 12px rgba(242, 196, 192, .5));
  will-change: transform;
}

@keyframes float-up {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  12%  { opacity: .9; }
  50%  { transform: translate3d(22px, -48vh, 0) rotate(14deg); }
  88%  { opacity: .75; }
  100% { transform: translate3d(-14px, -108vh, 0) rotate(-10deg); opacity: 0; }
}

.bday-card {
  position: relative;
  width: min(620px, 100%);
  text-align: center;
  padding: 44px 34px 34px;
  border-radius: 26px;
  color: #FFF4EA;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(255, 214, 186, .22), transparent 60%),
    linear-gradient(170deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 214, 186, .3);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .18);
  backdrop-filter: blur(14px);
  animation: card-in .8s cubic-bezier(.2, .8, .2, 1) both;
  margin: auto;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(26px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.bday-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 214, 186, .3);
  background: rgba(255, 255, 255, .08);
  color: #F7DCCB;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.bday-close:hover { background: rgba(255, 255, 255, .16); }

.bday-kicker {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #E9B9A8;
  margin-bottom: 6px;
}

.bday-age {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(74px, 15vw, 116px);
  line-height: .9;
  font-weight: 600;
  background: linear-gradient(170deg, #FFE3C9, #F3B49B 45%, #E39A9A);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 24px rgba(240, 170, 150, .35));
  letter-spacing: -.03em;
}

.bday-card h2 {
  font-size: clamp(26px, 4.6vw, 38px);
  margin: 6px 0 16px;
  font-style: italic;
  color: #FFF3E6;
}

.bday-letter {
  font-size: 15px;
  line-height: 1.75;
  color: #F2DCCF;
  max-width: 46ch;
  margin: 0 auto 14px;
}

.bday-sign {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  color: #E9B9A8;
  font-size: 13.5px;
  margin-bottom: 22px;
}

.bday-wish {
  background: linear-gradient(160deg, #F5C9A8, #E8A184);
  border: 0;
  color: #4A2330;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 14px 30px -14px rgba(245, 201, 168, .9);
}
.bday-wish:hover { filter: brightness(1.05); }

.confetti {
  position: fixed;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  z-index: 160;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--drift, 30px), 105vh, 0) rotate(760deg); opacity: .9; }
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .planner-hero { grid-template-columns: 1fr; }
  .planner-grid { grid-template-columns: 1fr; }
  .calendar-layout { grid-template-columns: 1fr; }
  .today-chip { border-left: 0; padding-left: 0; }
}

@media (max-width: 720px) {
  .app { padding: 14px 13px 46px; }
  .topbar { position: static; padding: 12px; gap: 12px; border-radius: 18px; }
  .tabs { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; width: 100%; }
  .tab-btn { flex: none; padding: 7px 12px; }
  .brand-text p { display: none; }
  .top-right { margin-left: auto; }
  .card { padding: 16px; border-radius: 15px; }
  .cal-day { min-height: 58px; padding: 4px; }
  .cal-pill { font-size: 9.5px; }
  .cal-weekdays span { font-size: 9px; letter-spacing: .02em; }
  .two-col { grid-template-columns: 1fr; }
  .kid-name-grid { grid-template-columns: 1fr; }
  .bday-card { padding: 38px 20px 26px; border-radius: 20px; }
  .gate-card, .intro-shell { padding: 22px 18px; border-radius: 18px; }
  .theme-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .floaty { animation: none; opacity: .35; bottom: auto; top: 20%; }
  .confetti { display: none; }
}
