/* ---------- Design tokens ---------- */
:root {
  --bg: #f3f6fc;
  --hero: #d6e2fa;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --border: #e0e6f2;
  --border-strong: #c9d3e6;
  --text: #111a2e;
  --muted: #5a6a88;
  --primary: #1e4db7;
  --primary-hover: #173d94;
  --primary-soft: #e2eafb;
  --on-primary: #ffffff;
  --danger: #b8342b;
  --danger-soft: #fbe9e7;
  --warn: #9a5f0b;
  --warn-soft: #fdf1d6;
  --ring: rgb(30 77 183 / 0.35);
  --shadow-sm: 0 1px 2px rgb(16 26 52 / 0.07);
  --shadow: 0 1px 2px rgb(16 26 52 / 0.05), 0 12px 32px -16px rgb(16 26 52 / 0.25);
  --success: #16794a;
  --success-soft: #dff3e8;
  --tag-bg: #fff2c9;
  --tag-text: #6b4a00;
  --tag-border: #e3bd52;
  --tag-solid: #f4b400;
  --tag-solid-text: #2d1f00;
  --radius: 18px;
  --radius-sm: 12px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0f1f;
  --hero: #10204a;
  --surface: #111a2f;
  --surface-2: #16213a;
  --border: #22304d;
  --border-strong: #31426a;
  --text: #e6ecf8;
  --muted: #93a2c2;
  --primary: #6ea0ff;
  --primary-hover: #8ab4ff;
  --primary-soft: #15264f;
  --on-primary: #061230;
  --danger: #f28b82;
  --danger-soft: #3a1f1d;
  --warn: #f0b95a;
  --warn-soft: #3a2f16;
  --success: #5fd39a;
  --success-soft: #143526;
  --tag-bg: #3b2f12;
  --tag-text: #f3c65f;
  --tag-border: #7a6224;
  --tag-solid: #f2b91b;
  --tag-solid-text: #1d1400;
  --ring: rgb(110 160 255 / 0.45);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 14px 34px -16px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  line-height: 1.5;
  background:
    radial-gradient(900px 380px at 50% -140px, var(--hero), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
}

h1, h2, h3, h4, p { margin: 0; }

button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.icon { flex-shrink: 0; vertical-align: middle; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 120px;
}

/* ---------- App bar ---------- */
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand h1 {
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.brand-sub {
  font-size: 0.82rem;
  color: var(--muted);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 6px 16px -6px var(--primary);
}

/* ---------- Theme switch (icon only) ---------- */
.theme-switch {
  position: relative;
  flex-shrink: 0;
  width: 66px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.theme-switch .thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  transition: transform 0.28s cubic-bezier(0.4, 0.1, 0.2, 1);
}
:root[data-theme="dark"] .theme-switch .thumb { transform: translateX(30px); }
.theme-switch svg {
  position: absolute;
  top: 9px;
  width: 16px;
  height: 16px;
  transition: color 0.2s ease;
}
.theme-switch .sun { left: 9px; color: var(--on-primary); }
.theme-switch .moon { right: 9px; color: var(--muted); }
:root[data-theme="dark"] .theme-switch .sun { color: var(--muted); }
:root[data-theme="dark"] .theme-switch .moon { color: var(--on-primary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: 0.95rem;
  line-height: 1.2;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 6px 14px -8px var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 30%); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-dashed {
  width: 100%;
  background: transparent;
  color: var(--primary);
  border: 2px dashed var(--border-strong);
  padding: 15px 18px;
  margin-bottom: 18px;
}
.btn-dashed:hover { background: var(--primary-soft); border-color: var(--primary); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.icon-btn.danger-icon:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.card-hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 16px;
}
.card-title + .field { margin-top: 14px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

label.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--text);
}

.input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }

.select-wrap { position: relative; flex: 1; min-width: 0; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  cursor: pointer;
}
.select-wrap .icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
}

/* ---------- Alerts / status ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert[hidden] { display: none; }

.loading, .empty { color: var(--muted); }

/* ---------- Bookmark card ---------- */
.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}
.link-card .link-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--primary);
}
.link-text { flex: 1; min-width: 0; }
.link-text strong { display: block; font-size: 0.95rem; }
.link-url {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Child card ---------- */
.child-card { padding: 0; overflow: hidden; }

.child-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}
.child-head:hover { background: var(--surface-2); }

/* Emoji "character" avatars */
.avatar-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.65rem;
  line-height: 1;
  background: hsl(var(--h, 220) 85% 91%);
  transition: transform 0.15s ease;
}
:root[data-theme="dark"] .avatar-btn { background: hsl(var(--h, 220) 38% 24%); }
.avatar-btn:hover { transform: scale(1.07); }
.avatar-btn .edit {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
}

.avatar-pop {
  position: fixed;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  width: min(340px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.avatar-pop button {
  min-width: 0;
  padding: 0;
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.5rem;
  line-height: 1;
}
.avatar-pop button:hover { background: var(--primary-soft); }
.avatar-pop button.selected { background: var(--primary-soft); outline: 2px solid var(--primary); }

.name-row { display: flex; align-items: center; gap: 12px; }
.name-row .input { flex: 1; min-width: 0; }

.child-meta { flex: 1; min-width: 0; }
.child-meta h2 {
  font-size: 1.1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.child-sub { font-size: 0.85rem; color: var(--muted); }
.child-sub strong { color: var(--primary); font-weight: 700; }

.chevron-btn .icon { transition: transform 0.25s ease; }
.chevron-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }

/* Smooth collapse */
.collapsible {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.28s ease;
}
.collapsible.collapsed { grid-template-rows: 0fr; }
.collapsible-inner { min-height: 0; overflow: hidden; }
.child-body { padding: 4px 20px 20px; border-top: 1px solid var(--border); }
.collapsible.collapsed .child-body { border-top-color: transparent; }

/* ---------- Week block ---------- */
.week {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.week-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.week-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}
.week-title { flex: 1; min-width: 0; }
.week-title h3 { font-size: 1rem; font-weight: 700; }
.week-title span { font-size: 0.8rem; color: var(--muted); }

.pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- Day ---------- */
.day {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.day-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.day-chip {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.day-title { flex: 1; min-width: 0; }
.day-title h4 { font-size: 1rem; font-weight: 700; }
.day-title span { font-size: 0.8rem; color: var(--muted); }
.day-price { font-weight: 750; font-size: 1.05rem; color: var(--text); }
.day.has-order .day-price { color: var(--primary); }

.deadline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.78rem;
  font-weight: 600;
}
.deadline.closed { background: var(--danger-soft); color: var(--danger); }

.day.closed .day-chip { background: var(--border-strong); color: var(--muted); }
.day.compact { padding-bottom: 12px; }
.day.compact .deadline { margin-bottom: 0; }
.day.closed .options { opacity: 0.6; }

/* ---------- Collapsible days ---------- */
.day-head-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 12px;
  cursor: pointer;
  user-select: none;
}
.day-summary {
  display: none;
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--primary);
}
.day.collapsed .day-summary { display: block; }
.day.collapsed .day-title > span { display: none; } /* the date isn't needed once the summary is showing */
.day .chevron-btn { width: 38px; height: 38px; }
@media (max-width: 480px) {
  .day-head-toggle { column-gap: 8px; }
  .day-head-toggle .day-chip { width: 40px; height: 40px; }
  .day-head-toggle .day-price { font-size: 0.98rem; }
  .day .chevron-btn { width: 34px; height: 34px; }
}
.day-body { padding: 6px 4px 4px; }
.day.collapsed .day-body { padding-top: 0; }

/* ---------- Options (meal tiles) ---------- */
.options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.option {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 4px 12px 4px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.option:hover:not(.is-disabled) { border-color: var(--border-strong); }
.option:has(input.pick:checked),
.option.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.option:has(input.pick:focus-visible) { box-shadow: 0 0 0 4px var(--ring); }
.option.is-disabled { cursor: default; }

.option-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
  padding: 10px 8px;
  cursor: pointer;
}
.option.is-disabled .option-main { cursor: default; }

.option-mark {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.option-mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--on-primary);
  transform: scale(0);
  transition: transform 0.15s ease;
}
.option input.pick:checked + .option-main .option-mark {
  border-color: var(--primary);
  background: var(--primary);
}
.option input.pick:checked + .option-main .option-mark::after { transform: scale(1); }

.option-text { font-size: 0.95rem; font-weight: 550; }
.option-price { margin-left: auto; padding-left: 10px; font-size: 0.85rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
/* "Pick several" tiles use a square marker with a tick */
.option.multi .option-mark { border-radius: 7px; }
.option.multi .option-mark::after {
  inset: auto;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid var(--on-primary);
  border-width: 0 2.5px 2.5px 0;
  border-radius: 0;
  background: transparent;
  transform: rotate(45deg) scale(0);
}
.option.multi input.pick:checked + .option-main .option-mark::after { transform: rotate(45deg) scale(1); }

/* Dietary chips - only visible for the chosen option */
.dietary { display: none; gap: 6px; flex-wrap: wrap; padding: 0 0 6px 40px; width: 100%; }
.option:has(input.pick:checked) .dietary { display: flex; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1.5px solid var(--tag-border);
  border-radius: 999px;
  background: var(--tag-bg);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tag-text);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--tag-solid); color: var(--tag-text); background: var(--tag-bg); }
.dietary input:checked + .chip {
  background: var(--tag-solid);
  border-color: var(--tag-solid);
  color: var(--tag-solid-text);
}
.dietary input:focus-visible + .chip { box-shadow: 0 0 0 4px var(--ring); }
.dietary input:disabled + .chip { cursor: default; opacity: 0.7; }

/* ---------- Pizza slice steppers ---------- */
.slice-row { padding: 8px 12px; justify-content: space-between; flex-wrap: nowrap; }
.slice-row .option-text { flex: 1; min-width: 0; }

.stepper { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.step-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s ease;
}
.step-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.step-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.slice-input {
  width: 44px;
  padding: 6px 0;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  -moz-appearance: textfield;
  appearance: textfield;
}
.slice-input::-webkit-outer-spin-button,
.slice-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.slice-input:focus { outline: none; }

.price-note { margin-top: 10px; font-size: 0.8rem; color: var(--muted); }

/* ---------- Save status ---------- */
.save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  margin-top: 10px;
  font-size: 0.82rem;
  font-weight: 600;
}
.save-status:empty { display: none; }
.save-status.saving { color: var(--muted); }
.save-status.saved { color: var(--primary); }
.save-status.error { color: var(--danger); }

/* ---------- Camp weeks (counter, tabs, panel) ---------- */
.weeks-section { margin-top: 16px; }

.weeks-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.weeks-bar-label {
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.weeks-count {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 750;
}
.weeks-count.full { background: var(--warn-soft); color: var(--warn); }

.week-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(78px, 1fr);
  overflow-x: auto;
  scrollbar-width: thin;
  gap: 8px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.week-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 26px 9px 6px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.week-tab:hover { background: var(--surface); color: var(--text); }
.week-tab.active {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 6px 14px -8px var(--primary);
}
.week-tab-range { font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
.week-tab-total { font-size: 0.75rem; font-weight: 600; opacity: 0.85; }
.tab-trash {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  opacity: 0.55;
}
.tab-trash:hover { opacity: 1; background: var(--danger-soft); color: var(--danger); }
.week-tab.active .tab-trash:hover { background: rgb(255 255 255 / 0.25); color: inherit; }

.week-panel { margin-top: 4px; }
.week.in-tabs { margin-top: 0; }
.week.in-tabs .week-head { display: none; }


/* ---------- Add week ---------- */
.add-week {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}
.add-week .select-wrap { min-width: 180px; }

.empty-weeks {
  margin-top: 18px;
  padding: 24px 18px;
  text-align: center;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.empty-weeks .icon { color: var(--primary); margin-bottom: 6px; }
.empty-weeks p { font-size: 0.92rem; }
.empty-weeks strong { color: var(--text); }

/* ---------- Add child ---------- */
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Total bar ---------- */
.total-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.total-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
}
.total-bar .label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.total-bar .amount { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; color: var(--primary); }

@media (max-width: 480px) {
  .card { padding: 18px; }
  .child-head { padding: 16px; }
  .child-body { padding: 4px 14px 16px; }
  .week { padding: 12px; }
  .day { padding: 14px 12px; }
  .brand-sub { display: none; }
  .link-card { padding: 14px; gap: 12px; }
  .link-url { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Phones & touch screens ---------- */
@media (max-width: 480px) {
  .week-tabs { gap: 4px; padding: 4px; }
  .week-tab { padding: 8px 2px; }
  .week-tab-range { font-size: 0.8rem; white-space: normal; text-align: center; }
  .week-tab-total { font-size: 0.72rem; }
  .week.in-tabs { padding: 0; border: none; background: none; }
}

@media (max-width: 640px), (pointer: coarse) {
  .step-btn { width: 44px; height: 44px; }
  .slice-input { width: 40px; }
  .chip { padding: 10px 16px; font-size: 0.85rem; }
  .icon-btn { width: 44px; height: 44px; }
  .avatar-pop button { min-height: 40px; }
}

/* ---------- No plans / closed / balance bar ---------- */
.no-plans { text-align: center; padding: 48px 24px; }
.no-plans-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; margin-bottom: 14px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.closed-note { margin: 12px 0; }
.total-bar .total-text { display: flex; flex-direction: column; min-width: 0; }
.total-bar .sub { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.total-bar.is-paid .amount, .total-bar.is-paid .label { color: var(--success); }

/* ---------- Live clock and countdowns ---------- */
.bar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.camp-clock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: help;
}
.camp-clock:empty { display: none; }
.deadline { cursor: help; }
.deadline.soon { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px currentColor; }
.deadline.urgent { background: var(--danger-soft); color: var(--danger); }
.deadline.urgent .icon { animation: pulse-clock 1.6s ease-in-out infinite; }
@keyframes pulse-clock { 50% { opacity: 0.35; } }
@media (max-width: 560px) {
  .camp-clock .clock-text { max-width: 8.5em; overflow: hidden; text-overflow: ellipsis; }
  .camp-clock { padding: 6px 9px; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) { .deadline.urgent .icon { animation: none; } }
