:root {
  /* Brand colors, from the KiddoCue logo */
  --brand-navy: #0b4ea2;
  --brand-blue: #1e88f5;
  --brand-teal: #12aeb3;
  --brand-orange: #f5a623;
  --bg: #f3f7fd;
  --card: #ffffff;
  --text: #0f2742;
  --muted: #5a6b84;
  --line: #dfe7f3;
  --primary: #1565c0;
  --primary-strong: #0d47a1;
  --primary-soft: #dcebfd;
  --primary-ink: #ffffff;
  --accent: #0b8f94;
  --header-from: #0b4ea2;
  --header-to: #1592c4;
  --sun: #b45309;
  --sun-soft: #fdf0cf;
  --go: #15803d;
  --go-soft: #dcf5e3;
  --danger: #c2410c;
  --danger-soft: #fde6dc;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 39, 66, 0.05), 0 4px 16px rgba(15, 39, 66, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1322;
    --card: #121c2e;
    --text: #e6eef9;
    --muted: #93a3bb;
    --line: #22324c;
    --primary: #60a5fa;
    --primary-strong: #93c5fd;
    --primary-soft: #15294a;
    --primary-ink: #06142b;
    --accent: #3fd0d4;
    --header-from: #0a2f66;
    --header-to: #0b5f86;
    --sun: #fbbf24;
    --sun-soft: #3a2d0d;
    --go: #4ade80;
    --go-soft: #123621;
    --danger: #fb923c;
    --danger-soft: #3b1d10;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.2rem; display: flex; align-items: center; gap: 6px; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
.section-title { font-size: 0.95rem; color: var(--muted); margin-top: 10px; font-weight: 700; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.85rem; }
.center { text-align: center; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(135deg, var(--header-from), var(--header-to));
  color: #fff;
}
.beta-tag {
  font: inherit; font-size: 0.7rem; font-weight: 700; line-height: 1;
  padding: 4px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.18); color: #fff;
}
.beta-tag:hover, .beta-tag:focus-visible { background: rgba(255, 255, 255, 0.32); }
.beta-note { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--bg, #f6f3ff); border: 1px dashed var(--line); }
.whoami { font-size: 0.85rem; opacity: 0.9; text-align: right; }

.screen { max-width: 560px; margin: 0 auto; padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > input { flex: 1; min-width: 0; }
.row.end { justify-content: flex-end; }
.full { flex-basis: 100%; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* ---------- welcome ---------- */

.welcome { text-align: center; padding: 22px 8px 2px; }
.welcome h2 { font-size: 1.9rem; margin: 0 0 6px; letter-spacing: -0.02em; }
.welcome p { color: var(--muted); margin: 0 auto; max-width: 26em; }

/* A tilted peek at a real card, with a "they said yes" note on top. */
.peek { display: flex; flex-direction: column; align-items: flex-end; padding: 14px 6px 6px; margin: 4px 0 2px; }
.peek-card { align-self: stretch; transform: rotate(-1.5deg); pointer-events: none; box-shadow: 0 10px 30px rgba(15, 39, 66, 0.12); }
.peek-toast {
  position: relative; margin-top: -8px; transform: rotate(2deg); max-width: 92%;
  background: var(--go-soft); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px; font-size: 0.9rem; box-shadow: var(--shadow);
}
.trust { text-align: center; color: var(--muted); font-size: 0.92rem; margin: 0 0 4px; }

.form-title { font-size: 1.2rem; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code-input { font: 700 1.2rem ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.15em; text-transform: uppercase; }

/* ---------- forms ---------- */

label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 0.9rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; padding: 0; }

input {
  font: inherit; color: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-weight: 400;
  min-height: 46px;
}
input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }

.btn {
  font: inherit; font-weight: 700;
  border: 0; border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--primary-soft); color: var(--primary-strong); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.accept { background: var(--go); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 7px 14px; font-size: 0.875rem; }
.btn.big { padding: 15px 20px; font-size: 1.05rem; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

.link {
  font: inherit; font-weight: 700; color: var(--primary);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.link.back { align-self: flex-start; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  flex-direction: row; align-items: center; gap: 6px;
  padding: 9px 15px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg);
  font-weight: 500; cursor: pointer;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chip:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.chips.pick { margin-top: 10px; padding: 10px; border: 1px dashed var(--line); border-radius: 14px; }

details summary { cursor: pointer; font-weight: 700; }
details[open] summary { margin-bottom: 12px; }

/* ---------- home ---------- */

.greeting h2 { font-size: 1.5rem; }

.cta {
  display: flex; align-items: center; gap: 14px; width: 100%;
  font: inherit; text-align: left; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--header-from), var(--header-to));
  border: 0; border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.08s;
}
.cta:active { transform: scale(0.98); }
.cta strong { display: block; font-size: 1.15rem; }
.cta small { opacity: 0.9; }
.cta-icon {
  flex: none; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, 0.2); font-size: 28px;
}
.cta-arrow { margin-left: auto; font-size: 2rem; line-height: 1; opacity: 0.8; }

.setup-nudge { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.setup-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; background: var(--sun-soft); font-size: 20px;
}
.setup-text { flex: 1; min-width: 0; }
.setup-text small { display: block; color: var(--muted); font-size: 0.8rem; }
.setup-text strong { display: block; line-height: 1.25; }
.setup-dismiss { color: var(--muted); padding: 4px; }

.first-family { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 18px; }
.first-family-art { font-size: 2rem; letter-spacing: 4px; }
.first-family h3 { margin: 0; font-size: 1.25rem; }
.first-family p { margin: 0; max-width: 28em; }
.first-family .btn { width: 100%; }

.avail { display: flex; flex-direction: column; gap: 8px; }
.avail .who { font-size: 1.1rem; font-weight: 700; }
.avail .meta, .help-item .meta, .carpool .meta { color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.avail .note { margin: 0; font-style: italic; }
.avail.now { border-left: 5px solid var(--go); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.pill.now, .pill.accepted { background: var(--go-soft); color: var(--go); }
.pill.later, .pill.pending { background: var(--sun-soft); color: var(--sun); }
.pill.declined { background: var(--danger-soft); color: var(--danger); }
.pill.invite { background: var(--primary-soft); color: var(--primary-strong); }

.empty { color: var(--muted); text-align: center; padding: 18px 8px; margin: 0; }
.empty-card { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty-card .big-emoji { font-size: 2.2rem; }
.error { color: var(--danger); margin: 0; font-size: 0.9rem; }
.error:empty { display: none; }

/* ---------- family ---------- */

.invite p { margin: 0 0 8px; color: var(--muted); }
.code {
  font: 700 2rem/1.2 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.18em; margin-bottom: 10px; color: var(--primary-strong);
}
.invite-box { background: var(--primary-soft); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.invite-box .code { margin: 4px 0 0; }

.list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.list-item small { color: var(--muted); display: block; }
.list-item .row { flex-wrap: nowrap; }
.person { display: flex; align-items: center; gap: 10px; }
.avatar {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-strong); font-weight: 800;
}

/* ---------- chrome ---------- */

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  position: relative;
  font: inherit; font-size: 0.75rem; color: var(--muted);
  background: none; border: 0; padding: 8px 4px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar button span { font-size: 1.35rem; filter: grayscale(0.6); opacity: 0.8; }
.tabbar button.active { color: var(--primary); font-weight: 700; }
.tabbar button.active span { filter: none; opacity: 1; }
.badge {
  position: absolute; top: 4px; left: calc(50% + 8px);
  background: var(--danger); color: #fff;
  font-size: 0.7rem; min-width: 18px; height: 18px; line-height: 18px;
  border-radius: 9px; padding: 0 5px;
}

dialog {
  border: 0; border-radius: var(--radius);
  background: var(--card); color: var(--text);
  width: min(92vw, 440px); padding: 20px;
}
dialog::backdrop { background: rgba(4, 20, 18, 0.5); }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; z-index: 10; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- free / busy ---------- */

.segmented {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px;
}
.segmented button {
  font: inherit; font-weight: 700; color: var(--muted);
  background: none; border: 0; border-radius: 999px; padding: 10px; cursor: pointer;
}
.segmented button.active { background: var(--primary); color: var(--primary-ink); }
.segmented button.active[data-mode="busy"] { background: var(--muted); color: var(--card); }

.busy-link { align-self: center; font-size: 0.9rem; color: var(--muted); }
.row.two > label { flex: 1; min-width: 130px; }
.row.two input { width: 100%; }
button.chip { font: inherit; color: inherit; }
.chips.days .chip { min-width: 48px; justify-content: center; padding: 9px 10px; }

.busy-list { padding: 4px 16px; }
.busy-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.busy-row + .busy-row { border-top: 1px solid var(--line); }
.busy-row .busy-icon {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line); font-size: 1.1rem;
}
.busy-row .busy-text { flex: 1; min-width: 0; }
.busy-row strong { display: block; }
.busy-row small { color: var(--muted); display: block; }
.busy-row.now small.when { color: var(--danger); font-weight: 600; }

.invite-banner {
  display: flex; gap: 12px; align-items: center;
  background: var(--sun-soft); color: var(--text);
  border-radius: var(--radius); padding: 14px 16px; margin-top: 4px;
}
.invite-banner-icon { font-size: 1.8rem; }
.invite-banner strong { display: block; }
.invite-banner small { color: var(--muted); }

/* ---------- play dates ---------- */

select {
  font: inherit; color: inherit; font-weight: 400;
  padding: 12px 14px; min-height: 46px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.pick-box { margin-top: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; }

.playdate { display: flex; flex-direction: column; gap: 12px; border-top: 5px solid var(--sun); }
.playdate.live { border-top-color: var(--go); }
.playdate .pd-title { font-size: 1.2rem; font-weight: 800; }
.playdate .pd-sub { color: var(--muted); font-size: 0.9rem; }
.plan { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; font-size: 0.95rem; margin: 0; }
.plan dt { color: var(--muted); }
.plan dd { margin: 0; font-weight: 600; }
.plan dd.unset { color: var(--muted); font-weight: 400; font-style: italic; }
.updates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.updates li { display: flex; justify-content: space-between; gap: 8px; }
.updates small { color: var(--muted); white-space: nowrap; }
.status-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-buttons .btn { padding: 10px 8px; font-size: 0.85rem; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumb {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer;
  border-radius: 12px; overflow: hidden; background: var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .stamp {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 4px;
  font-size: 0.7rem; font-weight: 700; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.thumb.more { display: grid; place-items: center; font-weight: 800; color: var(--primary-strong); background: var(--primary-soft); }

.photo-dialog { width: min(96vw, 720px); padding: 12px; }
.photo-frame { position: relative; background: #000; border-radius: 12px; overflow: hidden; }
.photo-frame img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.photo-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 1.6rem; line-height: 1;
}
.photo-nav.prev { left: 8px; }
.photo-nav.next { right: 8px; }
.photo-caption { margin: 10px 2px; font-weight: 600; }
.photo-caption small { display: block; color: var(--muted); font-weight: 400; }

/* ---------- kid avatars ---------- */

.kid-avatar {
  flex: none; display: inline-grid; place-items: center; overflow: hidden;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-soft); font-size: 1.25rem; line-height: 1;
  color: #0f2742; font-weight: 800;
  box-shadow: 0 0 0 2px var(--card);
}
.kid-avatar img { width: 100%; height: 100%; object-fit: cover; }
.kid-avatar.sm { width: 28px; height: 28px; font-size: 1rem; }
.kid-avatar.xs { width: 22px; height: 22px; font-size: 0.8rem; }
.kid-avatar.xl { width: 96px; height: 96px; font-size: 3.2rem; }
.avatar-stack { display: inline-flex; flex: none; }
.avatar-stack .kid-avatar + .kid-avatar { margin-left: -8px; }
.chip .kid-avatar { margin-left: -6px; }
.kid-preview-wrap { display: flex; justify-content: center; }
.center-row { justify-content: center; }
.spacer { flex: 1; }

.emoji-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.emoji-grid button {
  font-size: 1.35rem; aspect-ratio: 1; border-radius: 12px; cursor: pointer;
  padding: 0; min-width: 0; line-height: 1;
  border: 2px solid transparent; background: var(--bg);
}
#kid-dialog { max-height: 92vh; overflow-y: auto; }
.emoji-grid button.selected { border-color: var(--primary); background: var(--primary-soft); }
.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-row button {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--line);
}
.color-row button.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.busy-row .kid-avatar { position: relative; }
.busy-badge { position: absolute; }
.busy-avatar { position: relative; flex: none; }
.busy-avatar .badge-icon { position: absolute; right: -4px; bottom: -4px; font-size: 0.8rem; }

.install-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.install-steps li { padding-left: 4px; }
.install-steps svg { width: 18px; height: 18px; vertical-align: -3px; color: #0a84ff; }

.row.two-buttons > .btn { flex: 1; min-width: 140px; }
.link.small { font-size: 0.85rem; align-self: flex-start; }
#calendar-card .btn:not(.small) { width: 100%; }

/* ---------- messages ---------- */

.tabbar { grid-template-columns: repeat(5, 1fr); }
.tabbar button { font-size: 0.7rem; }
.quick-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }

.chat-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.chat-row .chat-text { flex: 1; min-width: 0; }
.chat-row strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row .preview { color: var(--muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.chat-row.unread strong, .chat-row.unread .preview { color: var(--text); font-weight: 800; }
.chat-row .meta-col { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 0.75rem; color: var(--muted); }
.unread-dot { background: var(--primary); color: var(--primary-ink); border-radius: 999px; min-width: 20px; height: 20px; line-height: 20px; text-align: center; font-size: 0.75rem; font-weight: 800; padding: 0 6px; }

.chat-view { display: flex; flex-direction: column; gap: 8px; }
.chat-header {
  position: sticky; top: 56px; z-index: 3; display: flex; align-items: center; gap: 10px;
  background: var(--bg); padding: 6px 0 10px; border-bottom: 1px solid var(--line);
}
.chat-header .link { font-size: 2rem; line-height: 1; padding: 0 6px; }
.chat-title { flex: 1; min-width: 0; }
.chat-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-messages { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.day-sep { align-self: center; font-size: 0.75rem; color: var(--muted); font-weight: 700; margin: 10px 0 4px; }
.bubble-wrap { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.bubble-wrap.me { align-self: flex-end; align-items: flex-end; }
.bubble-wrap .who { font-size: 0.75rem; color: var(--muted); margin: 0 10px 2px; font-weight: 700; }
.bubble {
  padding: 9px 13px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.35;
}
.bubble-wrap.me .bubble { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.bubble-wrap .time { font-size: 0.7rem; color: var(--muted); margin: 2px 10px 0; }
.system-msg { align-self: center; font-size: 0.8rem; color: var(--muted); text-align: center; padding: 2px 10px; }
.chat-composer {
  position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 3;
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--bg); padding: 8px 0;
}
.chat-composer textarea { flex: 1; resize: none; max-height: 140px; border-radius: 20px; }
.chat-composer .btn { border-radius: 50%; width: 46px; height: 46px; padding: 0; font-size: 1.1rem; }
textarea {
  font: inherit; color: inherit; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--bg); font-weight: 400;
}
textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }

.pick-list .pick-row {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--bg);
}
.pick-row > label { flex-direction: row; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.pick-row > label input { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.pick-row .chips { margin-left: 30px; }
.tall-dialog { max-height: 92vh; overflow-y: auto; }

/* ---------- invites ---------- */

.event-card { display: flex; flex-direction: column; gap: 10px; border-top: 5px solid #e879a6; }
.event-card.canceled { opacity: 0.7; border-top-color: var(--muted); }
.event-card .ev-title { font-size: 1.2rem; font-weight: 800; }
.event-card .ev-line { color: var(--muted); font-size: 0.92rem; }
.event-card .details { margin: 0; white-space: pre-wrap; }
.rsvp-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rsvp-buttons .btn { padding: 10px 4px; font-size: 0.85rem; }
.rsvp-buttons .btn.chosen { background: var(--primary); color: var(--primary-ink); }
.totals { font-weight: 700; font-size: 0.92rem; }
.guest-row { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; }
.guest-row .guest-text { flex: 1; min-width: 0; }
.guest-row small { color: var(--muted); display: block; }
.card.highlight { box-shadow: 0 0 0 3px var(--primary); }
.pill.canceled { background: var(--danger-soft); color: var(--danger); }
.pill.party { background: #fde2ef; color: #b0306a; }
@media (prefers-color-scheme: dark) { .pill.party { background: #4a1d33; color: #f9a8d4; } }

/* ---------- birthdays ---------- */

.bday-row { flex-wrap: nowrap; }
.bday-row select { flex: 1.3; min-width: 0; }
.bday-row input { flex: 1; min-width: 0; width: 80px; }
.check-row { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.check-row input { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.bday-when { color: var(--muted); font-size: 0.85rem; display: block; }
.bday-when.today { color: var(--danger); font-weight: 800; }
.bday-emoji { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--sun-soft); font-size: 1.2rem; }
.bday-item { flex-wrap: wrap; }
.bday-item .busy-text { flex: 1 1 55%; }
.bday-item > .btn { margin-left: auto; }

/* ---------- friends, history, weather, account ---------- */

.pill.friend { background: var(--sun-soft); color: var(--sun); }
.weather { font-size: 0.9rem; color: var(--text); background: var(--bg); border-radius: 10px; padding: 6px 10px; align-self: flex-start; }
.big-code { font-size: 1.6rem; text-align: center; letter-spacing: 0.12em; user-select: all; }
.danger-link { color: var(--danger); }
.history-kids { display: inline-flex; flex: none; }
.history-kids .kid-avatar + .kid-avatar { margin-left: -8px; }
.chip.friend-chip small { color: var(--muted); font-weight: 400; margin-left: 2px; }
.chip.friend-chip:has(input:checked) small { color: inherit; opacity: 0.85; }
.btn.danger-btn { background: var(--danger); color: #fff; }

/* ---------- safety info ---------- */

.care-box { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 0.92rem; }
.care-box.alert { background: var(--danger-soft); color: var(--text); border-left: 4px solid var(--danger); }
.care-box strong { font-size: 0.9rem; }
.care-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.care-row .spacer { flex: 1; }
.btn.tiny { padding: 5px 10px; font-size: 0.8rem; }
.emergency-row { display: grid; grid-template-columns: 1.2fr 1fr; gap: 6px; }
.emergency-row input[name$="phone"] { grid-column: 1 / -1; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.care-row { flex-wrap: nowrap; }
.care-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.care-row .btn { flex: none; }
#kid-edit-form fieldset > input { width: 100%; margin-top: 8px; }

/* ---------- groups ---------- */

.group-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.group-row .group-emoji { font-size: 1.6rem; flex: none; }
.group-row .chat-text { flex: 1; min-width: 0; }
.group-row small { color: var(--muted); display: block; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.member-row .member-text { flex: 1; min-width: 0; }
.member-row small { color: var(--muted); display: block; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill.connected { background: var(--go-soft); color: var(--go); }
.pill.group { background: var(--primary-soft); color: var(--primary-strong); }

/* ---------- help links ---------- */

.info-link {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 4px;
  border-radius: 50%; font-size: 0.85rem; font-weight: 700; text-decoration: none; vertical-align: middle;
  color: var(--primary-strong); background: var(--primary-soft);
}
.help-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.help-card strong { display: block; }
.help-card small { color: var(--muted); }
.help-card-icon { font-size: 1.6rem; }
.help-card .cta-arrow { color: var(--muted); }

/* Report dialog */
.report-quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--muted); background: rgba(127, 127, 127, 0.1); border-radius: 6px; font-style: italic; overflow-wrap: anywhere; }
#report-form hr { border: 0; border-top: 1px solid rgba(127, 127, 127, 0.25); width: 100%; margin: 4px 0; }
#report-form fieldset { border: 0; padding: 0; margin: 0; }
.bubble[role=button] { cursor: pointer; }

/* Pickup help */
.help-item { border-left: 5px solid var(--danger); }
.help-item.taken, .help-item.done { border-left-color: var(--go); }
.help-title { display: block; margin: 6px 0 2px; }

/* Carpools */
.carpool .rides { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.ride-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: var(--bg); }
.ride-row.me { background: var(--primary-soft); }
.ride-row.open { background: var(--sun-soft); }
.ride-day { width: 7.5em; flex: none; font-weight: 700; font-size: 0.9rem; }
.ride-driver { flex: 1; min-width: 0; font-size: 0.92rem; }
.ride-alert { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ride-alert small { display: block; color: var(--muted); }
.ride-alert > span:nth-child(2) { flex: 1; }
.ride-alert.open { border-left: 5px solid var(--sun); }
.ride-alert-icon { font-size: 1.6rem; }
.pill.urgent { background: var(--danger-soft); color: var(--danger); }

/* Kid mode: big, bright, nothing else on screen */
body.in-kid-mode { overflow: hidden; }
.kid-mode {
  position: fixed; inset: 0; z-index: 1000; overflow-y: auto;
  background: linear-gradient(160deg, #fff7d6 0%, #d5f5ee 55%, #dbeafe 100%);
  color: #0f2742; padding: 64px 16px 32px; text-align: center;
}
.kid-mode h2 { font-size: 1.7rem; margin: 0 0 18px; }
.kid-mode p { font-size: 1.1rem; color: #3b5a55; }
.kid-exit {
  position: absolute; top: 12px; right: 12px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.7); color: #3b5a55; padding: 8px 14px; font: inherit; font-size: 0.85rem;
}
.kid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; max-width: 640px; margin: 0 auto; }
.kid-face {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: #fff; border: 0; border-radius: 28px; padding: 18px 8px 14px; font: inherit; color: inherit;
  box-shadow: 0 6px 18px rgba(15, 39, 66, 0.12); cursor: pointer; transition: transform 0.12s;
}
.kid-face:active { transform: scale(0.95); }
.kid-face-name { font-size: 1.25rem; font-weight: 800; }
.kid-badge {
  position: absolute; top: 8px; right: 8px; background: #15803d; color: #fff;
  font-size: 0.75rem; font-weight: 800; padding: 3px 8px; border-radius: 999px;
}
.kid-pair { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 20px 0; }
.kid-heart { font-size: 2.4rem; }
.kid-heart.small { font-size: 1.1rem; }
.kid-yes {
  display: block; width: 100%; max-width: 360px; margin: 10px auto; border: 0; border-radius: 999px;
  background: #15803d; color: #fff; font: inherit; font-size: 1.4rem; font-weight: 800; padding: 20px;
  box-shadow: 0 6px 18px rgba(21, 128, 61, 0.35);
}
.kid-back { border: 0; background: transparent; font: inherit; font-size: 1.1rem; color: #3b5a55; margin-top: 18px; padding: 10px 18px; }
.kid-party { font-size: 5rem; margin: 30px 0 10px; animation: kid-pop 0.5s ease-out; }
@keyframes kid-pop { from { transform: scale(0.3); } to { transform: scale(1); } }
.kid-pin {
  position: fixed; inset: auto 16px 24px; max-width: 360px; margin: 0 auto; z-index: 1001;
  background: #fff; border-radius: 22px; padding: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; gap: 10px; color: #0f2742;
}
.kid-pin[hidden] { display: none; }
.kid-pin h3 { margin: 0; }
.kid-pin input { font-size: 2rem; letter-spacing: 0.5em; text-align: center; padding: 8px; border-radius: 12px; border: 1px solid #dfe7f6; }
.row.center { justify-content: center; }
.kid-ask .who { font-size: 1rem; }

/* Year in review */
.recap { position: fixed; inset: 0; z-index: 1000; background: linear-gradient(160deg, #fff7d6 0%, #d5f5ee 55%, #dbeafe 100%); color: #0f2742; }
.recap-close { position: absolute; top: 12px; right: 12px; z-index: 2; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.8); width: 40px; height: 40px; font-size: 1.1rem; color: #0f2742; }
.recap-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.recap-track::-webkit-scrollbar { display: none; }
.recap-slide {
  flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 60px 24px 60px; text-align: center; overflow: hidden;
}
.recap-kicker { font-size: 1.1rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #1565c0; margin: 0; }
.recap-big { font-size: 7rem; font-weight: 900; line-height: 1; animation: kid-pop 0.5s ease-out; }
.recap-name { font-size: 2.2rem; font-weight: 900; }
.recap-line { font-size: 1.25rem; font-weight: 700; margin: 0; }
.recap-sub { color: #3b5a55; margin: 0; font-size: 1.05rem; }
.recap-pair { display: flex; align-items: center; gap: 10px; }
.recap-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.recap-chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 4px 12px 4px 4px; font-weight: 700; }
.recap-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; max-width: 420px; }
.recap-photos.n1 { grid-template-columns: 1fr; }
.recap-photos.n2, .recap-photos.n4 { grid-template-columns: repeat(2, 1fr); }
.recap-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: rgba(255, 255, 255, 0.6); }
.recap-facts { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; }
.recap-fact { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 20px; padding: 14px 18px; text-align: left; box-shadow: 0 4px 14px rgba(18, 48, 44, 0.08); }
.recap-fact > span { font-size: 2rem; }
.recap-fact small { display: block; color: #3b5a55; }
.recap-fact strong { font-size: 1.2rem; }
.recap-party { font-size: 5rem; animation: kid-pop 0.5s ease-out; }
.recap-dots { position: absolute; bottom: 22px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; pointer-events: none; }
.recap-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(15, 39, 66, 0.25); }
.recap-dots span.on { background: #1565c0; width: 22px; border-radius: 999px; }
.recap-promo { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; background: linear-gradient(120deg, var(--sun-soft), var(--primary-soft)); }
.recap-promo small { display: block; color: var(--muted); }
.recap-promo > span:nth-child(2) { flex: 1; }
.recap-promo-art { display: flex; align-items: center; font-size: 1.4rem; }
.row.wrap { flex-wrap: wrap; }
.card.flash { animation: flash 2s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--primary); } 100% { box-shadow: var(--shadow); } }

/* Family calendar */
.segmented.small { padding: 3px; }
.segmented.small button { padding: 6px 12px; font-size: 0.85rem; }
.cal-card { padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head strong { font-size: 1.05rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-weekdays span { text-align: center; font-size: 0.75rem; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal-day {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 5px; min-height: 46px;
  border: 0; border-radius: 12px; background: transparent; font: inherit; color: inherit; cursor: pointer;
}
.cal-day.other { opacity: 0.4; }
.cal-day.today .cal-num { background: var(--primary-soft); color: var(--primary); }
.cal-day.selected { background: var(--primary); color: var(--primary-ink); }
.cal-day.selected .cal-num { background: transparent; color: inherit; }
.cal-num { font-weight: 700; font-size: 0.92rem; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-dots { display: flex; gap: 2px; height: 6px; }
.cal-dots i, .cal-legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 0.75rem; color: var(--muted); }
.cal-legend i { margin-right: 4px; }
.k-playdate { --k: #0b8f94; } .k-event { --k: #db2777; } .k-carpool { --k: #2563eb; }
.k-free { --k: #16a34a; } .k-busy { --k: #c2410c; } .k-birthday { --k: #d97706; }
.cal-dots i, .cal-legend i { background: var(--k); }
.cal-day.selected .cal-dots i { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8); }
.cal-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; border-left: 5px solid var(--k); padding: 10px 14px; }
.cal-time { width: 4.8em; flex: none; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.cal-text { flex: 1; min-width: 0; }
.cal-text strong, .cal-text small { display: block; }
.cal-text small { color: var(--muted); }

/* Party link landing (not logged in) */
.party-mode #auth-choose, .party-mode #onboarding .welcome { display: none; }
.party-landing { margin-top: 12px; border-top: 5px solid #db2777; }
.party-head { display: flex; align-items: center; gap: 12px; }
.party-head h2 { margin: 2px 0 0; font-size: 1.5rem; }
.party-emoji { font-size: 2.6rem; }
.party-landing .btn small { font-weight: 500; opacity: 0.85; }
.group-row.waiting { opacity: 0.8; cursor: default; }

/* Location + directions */
.location { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: var(--bg); border-radius: 14px; padding: 10px 12px; margin: 4px 0; }
.location-label { color: var(--muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.location strong { font-size: 1.05rem; }
.location .directions { margin-top: 6px; }
.btn.directions { white-space: nowrap; }
dd .directions { margin-left: 4px; padding: 3px 10px; font-size: 0.8rem; }
#maps-apps .btn { text-align: center; }

/* Thank-you notes */
.thanks-box { background: var(--sun-soft); border-radius: 14px; padding: 10px 12px; }
.thanks-box p { margin: 4px 0 0; white-space: pre-wrap; }
.after-party { border-left: 5px solid #db2777; }

/* QR code flyer */
.qr-print { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qr-brand { font-weight: 800; color: var(--primary); }
.qr-print h3 { margin: 0; font-size: 1.3rem; }
.qr-code { width: min(260px, 70vw); background: #fff; padding: 8px; border-radius: 12px; }
.qr-code svg { width: 100%; height: auto; display: block; }
.qr-print p { margin: 0; max-width: 28em; }
.qr-url { color: var(--muted); font-size: 0.8rem; word-break: break-all; }
@media print {
  body * { visibility: hidden !important; }
  #qr-dialog, #qr-print, #qr-print * { visibility: visible !important; }
  #qr-dialog { position: fixed; inset: 0; border: 0; box-shadow: none; max-width: none; width: 100%; background: #fff; color: #000; }
  #qr-dialog::backdrop { background: #fff; }
  .qr-print h3 { font-size: 28pt; }
  .qr-code { width: 9cm; }
  .qr-print p { font-size: 14pt; }
}
.welcome .tagline { color: var(--accent); font-weight: 800; font-size: 1.1rem; margin: 0 0 6px; }

/* ---------- front page: the rest of the website ---------- */
.more-link { display: block; text-align: center; color: var(--primary); font-weight: 700; text-decoration: none; margin: 4px 0 8px; }
.site-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.site-section h2 { text-align: center; margin: 0 0 12px; }
.site-section p { color: var(--muted); margin: 0 0 10px; line-height: 1.5; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.steps small, .feature small { display: block; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.step-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 800; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.feature > span { display: block; font-size: 1.5rem; margin-bottom: 4px; }
@media (max-width: 340px) { .feature-grid { grid-template-columns: 1fr; } }
.check-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { position: relative; padding-left: 26px; line-height: 1.45; }
.check-list li::before { content: "✓"; position: absolute; left: 4px; color: var(--primary); font-weight: 800; }
.privacy-section { text-align: left; }
.maker { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 18px; }
.maker h2 { margin-bottom: 8px; }
.faq { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { margin: 8px 0 0; }
.final-cta { display: flex; flex-direction: column; gap: 10px; }
.final-cta h2 { margin-bottom: 4px; }

/* ---------- logo ---------- */
h1 .logo-tile { width: 30px; height: 30px; border-radius: 8px; display: block; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55); }
.wordmark { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 14px; }
.wordmark img { width: 74px; height: auto; }
.wordmark span { font: 800 2.3rem/1 ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif; letter-spacing: -0.02em; color: var(--brand-navy); }
.wordmark b { color: var(--brand-teal); font-weight: inherit; }
@media (prefers-color-scheme: dark) { .wordmark span { color: #7fb3ff; } .wordmark b { color: var(--accent); } }
