/* Calvary Nursery — palette drawn from the Calvary logo greens + charcoal,
   with a warm amber accent for pickups and a soft coral for allergies. */
:root {
  --green: #46b549;
  --green-mid: #3a9e47;
  --green-dark: #2f8a44;
  --green-deep: #1f6b35;
  --green-tint: #eaf6e8;
  --green-tint-2: #d6eed3;
  --charcoal: #58595b;
  --ink: #26292b;
  --muted: #6b6f72;
  --line: #dfe5dc;
  --bg: #f5f8f3;
  --card: #ffffff;
  --amber: #f2a33a;
  --amber-tint: #fff4e2;
  --amber-ink: #8a5300;
  --coral: #d9534f;
  --coral-tint: #fdecea;
  --coral-ink: #9b2420;
  --sky-tint: #e8f1fb;
  --sky-ink: #24598f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 61, 37, 0.06), 0 6px 18px rgba(31, 61, 37, 0.07);
  --font-head: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Nunito Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 8px; color: var(--green-deep); }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
p { margin: 0 0 12px; }
a { color: var(--green-dark); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.94);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
  padding: 10px 16px; display: flex; align-items: center; gap: 12px; min-height: 60px;
}
.topbar .logo { height: 34px; width: auto; }
.topbar .title { font-family: var(--font-head); font-weight: 700; color: var(--charcoal); font-size: 0.95rem; }
.topbar .who { margin-left: auto; font-size: 0.85rem; color: var(--muted); text-align: right; }
.page { max-width: 620px; margin: 0 auto; padding: 18px 16px calc(110px + var(--safe-bottom)); }
.page.wide { max-width: 1100px; }
.hero { text-align: center; padding: 28px 8px 8px; }
.hero img.logo { width: min(320px, 82%); margin: 0 auto 18px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid rgba(0,0,0,0.02); }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card + .card { margin-top: 12px; }
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 10px; }
.section-title h2 { margin: 0; }
.section-title .count { color: var(--muted); font-weight: 600; font-size: 0.95rem; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--font-head); font-weight: 700; font-size: 1rem;
  min-height: 52px; padding: 12px 22px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green-dark); color: #fff; text-decoration: none; transition: transform .06s, background .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:hover { background: var(--green-deep); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.btn.big { min-height: 62px; font-size: 1.1rem; }
.btn.secondary { background: #fff; color: var(--green-deep); box-shadow: inset 0 0 0 2px var(--green-tint-2); }
.btn.secondary:hover { background: var(--green-tint); }
.btn.ghost { background: transparent; color: var(--green-dark); min-height: 44px; padding: 8px 12px; }
.btn.ghost:hover { background: var(--green-tint); }
.btn.warn { background: var(--amber); color: #3b2500; }
.btn.warn:hover { background: #e3922a; }
.btn.danger { background: var(--coral); }
.btn.danger:hover { background: #c2423e; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 0.9rem; }
.btn .ico { font-size: 1.2em; line-height: 1; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px 16px calc(12px + var(--safe-bottom)); background: linear-gradient(to top, var(--bg) 70%, rgba(245,248,243,0));
}
.bottom-bar > div { max-width: 620px; margin: 0 auto; }

/* ---------- forms ---------- */
label.field { display: block; }
.field > span { display: block; font-weight: 700; font-size: 0.92rem; margin-bottom: 6px; color: var(--charcoal); }
.field > span em { font-weight: 400; font-style: normal; color: var(--muted); }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; min-height: 52px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(70,181,73,0.18); }
input.code-input { font-size: 2rem; letter-spacing: 0.4em; text-align: center; font-family: var(--font-head); font-weight: 700; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; min-height: 44px; }
.check input { width: 24px; height: 24px; accent-color: var(--green-dark); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--green-tint); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { appearance: none; border: 0; background: transparent; border-radius: 9px; font: inherit; font-weight: 700; font-size: 0.9rem; padding: 10px 6px; min-height: 46px; color: var(--green-deep); cursor: pointer; }
.seg button.on { background: #fff; box-shadow: var(--shadow); color: var(--ink); }

/* ---------- chips & badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--green-tint); color: var(--green-deep); white-space: nowrap; }
.badge.allergy { background: var(--coral-tint); color: var(--coral-ink); }
.badge.severe { background: var(--coral); color: #fff; }
.badge.pickup { background: var(--amber); color: #3b2500; }
.badge.out { background: #eceeee; color: var(--muted); }
.badge.info { background: var(--sky-tint); color: var(--sky-ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip { appearance: none; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer; white-space: nowrap; color: var(--charcoal); }
.chip.on { border-color: var(--green-dark); background: var(--green-dark); color: #fff; }

/* ---------- avatars ---------- */
.avatar { width: 56px; height: 56px; border-radius: 50%; flex: none; object-fit: cover; display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; color: #fff; font-size: 1.1rem; background: var(--green); overflow: hidden; }
.avatar.lg { width: 76px; height: 76px; font-size: 1.4rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- child cards ---------- */
.kid { display: flex; gap: 14px; align-items: flex-start; }
.kid .meta { flex: 1; min-width: 0; }
.kid .name { font-family: var(--font-head); font-weight: 700; font-size: 1.08rem; color: var(--ink); }
.kid .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.select-card { cursor: pointer; border: 3px solid transparent; transition: border-color .15s, background .15s; position: relative; }
.select-card.on { border-color: var(--green); background: #fbfefa; }
.select-card .tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: #fff; font-weight: 800; }
.select-card.on .tick { background: var(--green); border-color: var(--green); }
.select-card.disabled { cursor: default; opacity: .75; }

.vol-kid.pickup { border: 3px solid var(--amber); background: var(--amber-tint); }
.vol-kid.out { opacity: .6; }
.vol-kid .details { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 0.95rem; }
.vol-kid .details dt { font-weight: 700; color: var(--charcoal); font-size: 0.82rem; text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; }
.vol-kid .details dd { margin: 2px 0 0; }
.vol-kid .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.vol-kid .actions .btn { flex: 1; min-width: 130px; }
.alert-line { margin-top: 8px; font-size: 0.88rem; background: var(--sky-tint); color: var(--sky-ink); border-radius: 10px; padding: 6px 10px; }
.alert-line.acked { background: var(--green-tint); color: var(--green-deep); }

/* ---------- banners ---------- */
.banner { border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.banner.ok { background: var(--green-tint); color: var(--green-deep); }
.banner.warn { background: var(--amber-tint); color: var(--amber-ink); }
.banner.bad { background: var(--coral-tint); color: var(--coral-ink); }
.banner.info { background: var(--sky-tint); color: var(--sky-ink); }
.banner .big-ico { font-size: 1.6rem; line-height: 1; }
.dev-note { background: #fff8d6; color: #6b5600; border: 1px dashed #d8c15a; border-radius: 12px; padding: 10px 12px; font-size: 0.9rem; }

.pickup-code { text-align: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 3px dashed var(--green-tint-2); }
.pickup-code .code { font-family: var(--font-head); font-weight: 800; font-size: 3.4rem; letter-spacing: 0.18em; color: var(--green-deep); line-height: 1.1; margin: 6px 0; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 14px; padding: 12px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--font-head); font-size: 1.6rem; color: var(--green-deep); }
.stat span { font-size: 0.8rem; color: var(--muted); font-weight: 700; }

.help-btn { width: 100%; min-height: 64px; font-size: 1.1rem; }

/* ---------- home tiles ---------- */
.tiles { display: grid; gap: 12px; margin-top: 18px; }
.tile { display: flex; gap: 16px; align-items: center; text-decoration: none; color: inherit; }
.tile .ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.7rem; background: var(--green-tint); flex: none; }
.tile b { font-family: var(--font-head); font-size: 1.1rem; color: var(--green-deep); display: block; }

/* ---------- sheets / modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 30, 22, 0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-bottom)); animation: up .2s ease-out; }
.sheet .grab { width: 44px; height: 5px; background: var(--line); border-radius: 3px; margin: -6px auto 14px; }
@media (min-width: 700px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 22px; }
}
.alert-modal .sheet { border-top: 8px solid var(--amber); text-align: center; }
.alert-modal .msg { font-size: 1.35rem; font-weight: 700; margin: 12px 0 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; z-index: 80; width: max-content; max-width: min(440px, calc(100% - 32px)); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--coral-ink); }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 60px; z-index: 15; scrollbar-width: none; }
.tabs button { appearance: none; border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--muted); padding: 10px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--green-tint); color: var(--green-deep); }
.list-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
table.log { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.log th, table.log td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
.shift-date { font-family: var(--font-head); font-weight: 700; color: var(--charcoal); margin: 18px 0 8px; }

.qr-card { text-align: center; padding: 28px 20px; }
.qr-card .qr img { margin: 16px auto; width: 240px; height: 240px; image-rendering: pixelated; }
.qr-card .logo { width: 220px; height: auto; margin: 0 auto 6px; }
.qr-card .big { font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; color: var(--green-deep); }
.qr-card.staff { border: 4px solid var(--coral); }
.qr-card .url { font-size: 0.75rem; color: var(--muted); word-break: break-all; }

@media print {
  body { background: #fff; }
  .topbar, .tabs, .no-print, #toast, .bottom-bar { display: none !important; }
  .page { padding: 0; max-width: none; }
  .print-only-target .card:not(.printing) { display: none; }
  .qr-card { box-shadow: none; page-break-inside: avoid; }
  .qr-card .qr img { width: 320px; height: 320px; }
}

@media (min-width: 760px) {
  .kids-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .kids-grid .card + .card { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
