/* ============================================================
   Caaby Carpool — mobile-first styles
   ============================================================ */

:root {
  --teal-900: #134e4a;
  --teal-700: #0f766e;
  --teal-600: #0d9488;
  --teal-100: #ccfbf1;
  --teal-50: #f0fdfa;
  --ink: #1f2937;
  --ink-soft: #6b7280;
  --ink-faint: #9ca3af;
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e5e7eb;
  --amber-100: #fef3c7;
  --amber-800: #92400e;
  --red-100: #fee2e2;
  --red-700: #b91c1c;
  --green-100: #dcfce7;
  --green-800: #166534;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --nav-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ---------- Header ---------- */
.app-header {
  background: linear-gradient(135deg, var(--teal-900), var(--teal-700));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow);
}
.app-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.brand[data-action] { cursor: pointer; }
.brand-logo { font-size: 30px; line-height: 1; }
.brand-text h1 { margin: 0; font-size: 19px; letter-spacing: .2px; }
.brand-text p { margin: 0; font-size: 11.5px; opacity: .82; }

/* ---------- Header profile menu ---------- */
.header-actions { position: relative; flex: none; display: flex; align-items: center; gap: 6px; }
.profile-btn {
  background: rgba(255, 255, 255, .14);
  border: none;
  border-radius: 999px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  transition: background .15s;
}
.profile-btn:hover, .profile-btn.active { background: rgba(255, 255, 255, .3); }
.profile-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55);
}
.profile-avatar-anon { background: rgba(255, 255, 255, .22); font-size: 17px; box-shadow: none; }

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 264px;
  max-width: 82vw;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 70;
  padding: 6px;
  animation: menu-pop .15s ease-out;
}
@keyframes menu-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.profile-menu-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.profile-menu-head .fam-swatch { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
.profile-menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.profile-menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 1px 9px;
  background: none;
  border: none;
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.profile-menu-item:hover { background: var(--bg); }
.profile-menu-item.active { background: var(--teal-50); color: var(--teal-700); }
.profile-menu-item.danger { color: var(--red-700); }
.profile-menu-item .pm-icon { font-size: 17px; text-align: center; grid-row: span 2; }
.profile-menu-item .pm-sub { grid-column: 2; font-size: 11.5px; font-weight: 500; color: var(--ink-faint); }

/* ---------- Notification center ---------- */
.notif-wrap { display: flex; }
.notif-btn {
  position: relative;
  background: rgba(255, 255, 255, .14);
  border: none;
  border-radius: 999px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px; line-height: 1;
  transition: background .15s;
}
.notif-btn:hover, .notif-btn.active { background: rgba(255, 255, 255, .3); }
.notif-badge {
  position: absolute; top: -1px; right: -1px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 800; line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--teal-700);
}
.notif-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 328px;
  max-width: 90vw;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 70;
  padding: 6px;
  animation: menu-pop .15s ease-out;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  font-weight: 800; font-size: 14px;
}
.notif-count {
  background: var(--teal-50); color: var(--teal-700);
  border-radius: 999px; padding: 1px 9px;
  font-size: 12px; font-weight: 800;
}
.notif-list { max-height: min(64vh, 440px); overflow-y: auto; }
.notif-item {
  width: 100%;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 9px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  padding: 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.35;
}
.notif-item:hover { background: var(--bg); }
.notif-item .ni-icon { font-size: 16px; text-align: center; }
.notif-item.tone-red { border-left-color: #ef4444; }
.notif-item.tone-amber { border-left-color: #f59e0b; }
.notif-item.tone-teal { border-left-color: var(--teal-600); }
.notif-item.tone-slate { border-left-color: #94a3b8; }
.notif-empty {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 14px;
}

/* ---------- Navigation ---------- */
.top-nav { display: none; gap: 4px; }
.top-nav .nav-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, .85);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background .15s;
}
.top-nav .nav-btn:hover { background: rgba(255, 255, 255, .12); }
.top-nav .nav-btn.active { background: rgba(255, 255, 255, .22); color: #fff; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
}
.bottom-nav .nav-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 2px;
  position: relative;
}
.bottom-nav .nav-btn .nav-icon { font-size: 21px; line-height: 1; }
.bottom-nav .nav-btn.active { color: var(--teal-700); }
.bottom-nav .nav-btn .nav-badge {
  position: absolute;
  top: 5px;
  right: 50%;
  margin-right: -22px;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  font-size: 9.5px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ---------- Layout ---------- */
.view-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 14px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}

.view-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 14px;
  flex-wrap: wrap;
}
.view-title-row h2 { margin: 0; font-size: 21px; }
.view-sub { margin: 2px 0 0; color: var(--ink-soft); font-size: 13.5px; }

.section-label {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-soft);
  margin: 22px 0 10px;
}
.section-label:first-child { margin-top: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card-grid .card { margin-bottom: 0; }

.empty-state {
  text-align: center;
  padding: 36px 18px;
  color: var(--ink-soft);
  background: var(--card);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
}
.empty-state .empty-icon { font-size: 38px; display: block; margin-bottom: 8px; }
.empty-state p { margin: 4px 0 14px; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn-primary { background: var(--teal-600); color: #fff; }
.btn-secondary { background: var(--teal-50); color: var(--teal-700); border: 1px solid var(--teal-100); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-danger { background: var(--red-100); color: var(--red-700); }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }

.icon-btn {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--ink-soft);
  padding: 6px;
  border-radius: 8px;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* ---------- Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.cal-header .filter-chips { flex: 1 1 auto; min-width: 0; padding: 2px 0; }
.cal-header .cal-switch { flex: none; margin: 0; }
.filter-chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: none;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.filter-chip.active {
  background: var(--teal-700);
  border-color: var(--teal-700);
  color: #fff;
}
.filter-chip .dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- Week schedule ---------- */
.week-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }

.day-col { min-width: 0; }
.day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 4px 8px;
}
.day-head .day-name { font-weight: 700; font-size: 15px; }
.day-head .day-date { color: var(--ink-soft); font-size: 12.5px; }
.today-pill {
  background: var(--teal-600);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.day-empty { color: var(--ink-faint); font-size: 13px; padding: 8px 4px 2px; }

.event-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal-600);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 11px 12px;
  margin-bottom: 8px;
}
.event-top { display: flex; align-items: flex-start; gap: 9px; }
.event-icon { font-size: 21px; line-height: 1.2; }
.event-main { min-width: 0; flex: 1; }
.event-name { font-weight: 700; font-size: 14.5px; }
.event-meta { color: var(--ink-soft); font-size: 12.5px; margin-top: 1px; }
.event-kids { margin-top: 8px; }
.event-kids .chip { font-size: 11.5px; padding: 3px 9px; }
.driver-line {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--teal-50);
  color: var(--teal-700);
}
.driver-line.you { background: var(--green-100); color: var(--green-800); }
.driver-line.none { background: var(--amber-100); color: var(--amber-800); }
.driver-line.hired { background: #eef2ff; color: #4338ca; }

/* ---------- Carpool cards ---------- */
.opportunity-card { border-left: 4px solid #f59e0b; }
.carpool-card { border-left: 4px solid var(--teal-600); }
.conflict-card { border-left: 4px solid #ef4444; }
.driver-card { border-left: 4px solid #6366f1; }
.chip-driver { background: #eef2ff; color: #4338ca; border-color: #e0e7ff; font-weight: 700; }

/* ---------- Dashboard ---------- */
.dash-none {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-none strong { font-size: 15px; }

.up-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 9px;
}
.up-row + .up-row { border-top: 1px solid var(--line); }
.up-date {
  flex: none;
  width: 62px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.2;
}
.up-icon { font-size: 20px; flex: none; }
.up-main { min-width: 0; flex: 1; }
.up-name { font-weight: 700; font-size: 14px; }
.up-driver {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-700);
  background: var(--teal-50);
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}
.up-driver.you { background: var(--green-100); color: var(--green-800); }

.alert-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-faint);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  margin-bottom: 8px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}
.alert-row:hover { background: var(--bg); }
.alert-row .al-icon { font-size: 18px; flex: none; }
.alert-row .al-text { flex: 1; min-width: 0; }
.alert-row .al-go { flex: none; color: var(--ink-faint); font-size: 20px; font-weight: 700; }
.alert-red { border-left-color: #ef4444; }
.alert-amber { border-left-color: #f59e0b; }
.alert-teal { border-left-color: var(--teal-600); }

/* Week navigation */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 14px;
}
.week-nav .btn { border: 1px solid var(--line); }
.week-nav .btn:first-child, .week-nav .btn:last-child { font-size: 18px; line-height: 1; padding: 6px 14px; }
.week-nav .week-now { font-weight: 700; color: var(--teal-700); }

/* Week/Month toggle */
.cal-switch {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  margin: 2px 0 10px;
}
.cal-tab {
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.cal-tab.active { background: var(--card); color: var(--teal-700); box-shadow: var(--shadow); }

/* Month grid */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.mo-headrow { display: contents; }
.mo-head {
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-faint);
  padding: 2px 0 4px;
}
.mo-cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 58px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.mo-cell.mo-out { background: transparent; border-color: transparent; }
.mo-cell.mo-out .mo-date { color: var(--ink-faint); opacity: .5; }
.mo-cell.mo-today { border-color: var(--teal-600); box-shadow: inset 0 0 0 1px var(--teal-600); }
.mo-date { font-size: 12px; font-weight: 700; color: var(--ink); }
.mo-today .mo-date { color: var(--teal-700); }
.mo-events { display: flex; flex-wrap: wrap; gap: 1px; align-items: center; line-height: 1; }
.mo-ev { font-size: 13px; }
.mo-more { font-size: 9.5px; font-weight: 700; color: var(--ink-soft); }

@media (min-width: 760px) {
  .month-grid { gap: 6px; }
  .mo-cell { min-height: 92px; padding: 6px; }
  .mo-ev { font-size: 16px; }
}

/* Per-occurrence exceptions */
.event-card.event-changed { border-left-style: dashed; background: #fffdf7; }
.event-edit-btn { flex: none; margin: -2px -4px 0 auto; font-size: 13px; }
.event-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--amber-800);
  background: var(--amber-100);
  border-radius: 7px;
  padding: 4px 8px;
}

.cp-head { display: flex; align-items: flex-start; gap: 10px; }
.cp-icon { font-size: 26px; line-height: 1.15; }
.cp-title { font-weight: 700; font-size: 15.5px; }
.cp-sub { color: var(--ink-soft); font-size: 13px; margin-top: 1px; }
.cp-actions { margin-left: auto; display: flex; gap: 4px; flex: none; }

.drive-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13.5px; }
.drive-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-soft);
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
.drive-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.drive-table tr:last-child td { border-bottom: none; }

.fair-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.callout {
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  color: var(--teal-900);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13.5px;
  margin-bottom: 12px;
}
.callout.warn { background: var(--amber-100); border-color: #fde68a; color: var(--amber-800); }

/* ---------- Family / activity lists ---------- */
.fam-head { display: flex; align-items: center; gap: 10px; }
.fam-swatch {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px;
  flex: none;
}
.fam-name { font-weight: 700; font-size: 15.5px; }
.fam-meta { color: var(--ink-soft); font-size: 12.5px; }
.kid-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.fam-subhead {
  margin-top: 14px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.block-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.block-row .chip { flex: 1; min-width: 0; }
.block-add {
  margin-top: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.block-add input[type="time"] {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
.kid-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 14px;
}
.kid-row .kid-acts { color: var(--ink-soft); font-size: 12px; margin-left: auto; text-align: right; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 13px; }
.form-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.form-field input[type="text"],
.form-field input[type="tel"],
.form-field input[type="time"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}
.form-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.check-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.check-pill { position: relative; }
.check-pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.check-pill span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px;
  font-weight: 600;
  background: #fff;
  color: var(--ink);
  user-select: none;
}
.check-pill input:checked + span {
  background: var(--teal-700);
  border-color: var(--teal-700);
  color: #fff;
}
.check-pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(13, 148, 136, .3); }

.color-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.color-pick .check-pill span { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 3px solid transparent; }
.color-pick .check-pill input:checked + span { border-color: var(--ink); background: none; }
.color-pick .swatch-inner { width: 100%; height: 100%; border-radius: 50%; display: block; }

.form-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 4px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--card);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slide-up .22s ease-out;
}
@keyframes slide-up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 18px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
.hidden { display: none !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  max-width: 92vw;
  text-align: center;
}

/* ---------- Sync view ---------- */
.sync-links { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sync-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
}
.sync-link-row .grow { flex: 1; min-width: 0; }
.sync-link-row a { color: var(--teal-700); font-weight: 600; text-decoration: none; white-space: nowrap; }
.sync-link-row a:hover { text-decoration: underline; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 5px;
}
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-tile {
  flex: 1 1 calc(50% - 5px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}
.stat-tile .stat-num { font-size: 22px; font-weight: 800; color: var(--teal-700); }
.stat-tile .stat-label { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }

/* ---------- Connect view ---------- */
.context-banner {
  position: sticky;
  top: 0;
  z-index: 35;
  background: #7c3aed;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
#context-banner:empty { display: none; }
.btn-banner { background: rgba(255, 255, 255, .2); color: #fff; flex: none; }
.btn-banner:hover { background: rgba(255, 255, 255, .32); }

.hero-card { text-align: center; padding: 24px 18px; }

.auth-buttons { max-width: 360px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.auth-buttons .btn { justify-content: center; padding: 12px 16px; font-size: 15px; }
.btn-google { background: #fff; color: #3c4043; border: 1px solid #dadce0; }
.btn-google:hover { background: #f7f8f8; filter: none; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-faint);
  font-size: 12.5px;
  font-weight: 600;
  margin: 4px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-email { display: flex; flex-direction: column; gap: 9px; text-align: left; }
.auth-email input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}
.auth-email input:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}

.chip-public { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.chip-private { background: var(--amber-100); color: var(--amber-800); border-color: #fde68a; }
.chip-sample { background: var(--bg); color: var(--ink-faint); font-size: 10.5px; padding: 2px 8px; }

.code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13.5px;
}
.code-big { font-size: 15px; font-weight: 800; letter-spacing: .12em; color: var(--teal-700); }

.setup-steps { margin: 0 0 12px; padding-left: 20px; font-size: 13.5px; color: var(--ink-soft); }
.setup-steps li { margin-bottom: 6px; }

.privacy-list { margin: 0 0 4px; padding-left: 20px; font-size: 13.5px; color: var(--ink); }
.privacy-list li { margin-bottom: 7px; }
.privacy-list strong { color: var(--ink); }
.landing-footer a { color: var(--teal-700); font-weight: 600; text-decoration: none; }
.landing-footer a:hover { text-decoration: underline; }

.form-field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}

/* ---------- Landing page ---------- */
body.landing .bottom-nav,
body.landing .top-nav { display: none !important; }
body.landing .view-container { padding-bottom: 40px; }
body.landing .brand { cursor: default; }
.brand { cursor: pointer; }

/* Hide the nav menus until signed in (no empty bottom bar) */
body.no-tabs .bottom-nav,
body.no-tabs .top-nav { display: none !important; }
body.no-tabs .view-container { padding-bottom: 40px; }

.landing-hero { text-align: center; padding: 26px 4px 8px; }
.hero-badge {
  display: inline-block;
  background: var(--teal-100);
  color: var(--teal-900);
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.landing-hero h1 {
  margin: 0 auto 12px;
  font-size: clamp(27px, 6vw, 42px);
  line-height: 1.15;
  letter-spacing: -.02em;
  max-width: 720px;
}
.hero-br { display: none; }
.hero-sub {
  margin: 0 auto 20px;
  max-width: 560px;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.55;
}
.hero-ctas { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-lg { padding: 13px 22px; font-size: 15.5px; border-radius: 12px; }

.hero-mock { max-width: 420px; margin: 28px auto 0; text-align: left; }
.hero-mock .event-card { box-shadow: var(--shadow-lg); }
.hero-mock-note {
  text-align: center;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--amber-800);
  background: var(--amber-100);
  border-radius: 999px;
  padding: 7px 14px;
  display: inline-block;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.landing-section { padding: 26px 0 4px; }
.landing-h2 {
  text-align: center;
  font-size: clamp(21px, 4.5vw, 28px);
  margin: 0 0 18px;
  letter-spacing: -.01em;
}

.steps-grid, .feature-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.step-card, .feature-card { margin-bottom: 0; position: relative; padding: 18px 16px; }
.step-card h3, .feature-card h3 { margin: 8px 0 6px; font-size: 16px; }
.step-card p, .feature-card p { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; }
.step-icon, .feature-icon { font-size: 28px; display: block; }
.step-num {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--teal-50);
  color: var(--teal-700);
  font-weight: 800;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

.landing-cta-card { text-align: center; padding: 28px 18px; background: linear-gradient(160deg, var(--teal-50), #fff); }
.landing-footer { text-align: center; color: var(--ink-faint); font-size: 12.5px; margin: 22px 0 8px; }

/* ============================================================
   Desktop / tablet
   ============================================================ */
@media (min-width: 760px) {
  .bottom-nav { display: none; }
  .top-nav { display: flex; }
  .view-container { padding: 24px 20px 60px; }
  .toast { bottom: 28px; }

  .week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .day-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 130px; }
  .day-head { flex-direction: column; gap: 1px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
  .event-card { box-shadow: none; padding: 9px 10px; }
  .event-icon { font-size: 17px; }
  .event-name { font-size: 13px; }
  .event-meta { font-size: 11.5px; }
  .event-kids .chip { font-size: 10.5px; padding: 2px 7px; }
  .driver-line { font-size: 11.5px; padding: 4px 8px; }

  .card-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .stat-tile { flex: 1; }

  .hero-br { display: block; }
  .landing-hero { padding-top: 44px; }
  .steps-grid { grid-template-columns: repeat(3, 1fr); }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .modal { border-radius: 18px; align-self: center; }
  .modal-overlay { align-items: center; padding: 20px; }
}
