/* ── BMD Parent Portal ────────────────────────────────────────────────────────
   Heritage Pulse palette, shared with the staff portal, but a warmer and much
   smaller sheet: this app is two pages on a phone, not an admin console.       */

:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --card-2: #f2f4f7;
  --ink: #191c1e;
  --muted: #3f4851;
  --faint: #6b7580;
  --accent: #006194;
  --accent-soft: #cce5ff;
  --gold: #fcab28;
  --green: #186a22;
  --line: #e6e8eb;
  --danger: #ba1a1a;
  --danger-soft: #ffdad6;
  --shadow: 0 1px 2px rgba(23,26,43,.04), 0 4px 16px rgba(23,26,43,.05);
  --shadow-lg: 0 8px 28px rgba(0,97,148,.16);
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-head: "Hanken Grotesk", var(--font-body);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; max-width: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  /* Atmospheric wash, matching the staff portal's login. */
  background-image:
    radial-gradient(60rem 40rem at 110% -10%, rgba(0,97,148,.07), transparent 60%),
    radial-gradient(45rem 35rem at -10% 110%, rgba(252,171,40,.10), transparent 60%);
  background-attachment: fixed;
}
a { color: var(--accent); }
button { font-family: inherit; }

.material-symbols-outlined {
  font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal;
  font-size: 24px; line-height: 1; display: inline-block; vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  -webkit-font-feature-settings: 'liga'; user-select: none;
}
.material-symbols-outlined.sm { font-size: 18px; }

/* ── Boot ─────────────────────────────────────────────────────────────────── */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login / picker ───────────────────────────────────────────────────────── */
.login-host {
  min-height: 100vh; display: grid; place-items: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
}
.login-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 34px 26px 28px; text-align: center;
}
.login-logo { width: 68px; height: 68px; object-fit: contain; margin-bottom: 14px; }
.login-title {
  font-family: var(--font-head); font-size: 25px; font-weight: 800;
  color: var(--accent); margin: 0 0 4px; line-height: 1.2;
}
.login-sub { margin: 0 0 26px; color: var(--faint); font-size: 14px; }
.login-form { display: block; }
.login-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--muted);
  margin-bottom: 12px;
}
.digits { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }
.digit {
  width: 56px; height: 66px; text-align: center;
  font-family: var(--font-head); font-size: 28px; font-weight: 700; color: var(--ink);
  border: 2px solid var(--line); border-radius: 14px; background: var(--card-2);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.digit:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 4px rgba(0,97,148,.12);
}
.login-err {
  margin: 0 0 16px; padding: 11px 13px; border-radius: 11px; text-align: left;
  background: var(--danger-soft); color: #7a1414; font-size: 13.5px; line-height: 1.45;
}
.login-help { margin: 20px 0 0; font-size: 13px; color: var(--faint); }

.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 13px 18px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: background .15s, transform .06s, box-shadow .15s;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(0,97,148,.22); }
.btn.primary:hover { background: #007bb9; }
.btn.primary:disabled { opacity: .6; cursor: default; }
.btn.block { width: 100%; }
.linkbtn {
  background: none; border: none; color: var(--faint); font-size: 13.5px;
  text-decoration: underline; cursor: pointer; padding: 10px; margin-top: 8px;
}
.linkbtn:hover { color: var(--accent); }

.pick-list { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.pick-item {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.pick-item:hover { border-color: var(--accent); background: #fff; }
.pick-avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft);
  color: var(--accent); font-weight: 800; font-size: 14px;
}
.pick-avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.pick-name { flex: 1; font-weight: 700; font-size: 16px; }
.pick-chev { color: var(--faint); }

/* ── Shell ────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; padding-top: calc(11px + env(safe-area-inset-top));
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-logo { width: 34px; height: 34px; object-fit: contain; flex: none; }
.tb-brandtext { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.tb-name { font-family: var(--font-head); font-weight: 800; font-size: 16px; color: var(--accent); }
.tb-sub { font-size: 11px; color: var(--faint); }

.camper-chip {
  display: flex; align-items: center; gap: 9px; flex: none;
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 5px 10px 5px 5px; cursor: default; max-width: 58vw;
}
.camper-chip:disabled { opacity: 1; color: var(--ink); }
.camper-chip.switchable { cursor: pointer; }
.camper-chip.switchable:hover { border-color: var(--accent); }
.chip-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff;
  font-weight: 800; font-size: 12px;
}
.chip-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; text-align: left; }
.chip-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-sub { font-size: 11px; color: var(--faint); }
.chip-chev { color: var(--faint); font-size: 20px; }

.switch-menu {
  position: absolute; right: 14px; top: calc(100% + 6px); z-index: 50;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 180px;
  display: flex; flex-direction: column; gap: 2px;
}
.switch-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; border: none; background: none; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; cursor: pointer;
}
.switch-item:hover { background: var(--card-2); }
.switch-item.on { color: var(--accent); }
.switch-item .material-symbols-outlined:last-child { margin-left: auto; }

.tabs {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 4px; padding: 10px 14px 0;
  max-width: 940px; margin: 0 auto;
}
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 10px; border-radius: 12px 12px 0 0; text-decoration: none;
  color: var(--muted); font-size: 14.5px; font-weight: 600;
  border-bottom: 3px solid transparent; transition: color .15s, background .15s;
}
.tab:hover { background: rgba(0,97,148,.05); }
.tab.active { color: var(--accent); font-weight: 800; border-bottom-color: var(--accent); }
.tab .material-symbols-outlined { font-size: 21px; }

.content {
  max-width: 940px; margin: 0 auto; padding: 22px 16px 8px;
  min-height: 46vh;
}
.page-head { margin-bottom: 18px; }
.page-head h2 {
  font-family: var(--font-head); font-size: 26px; font-weight: 800;
  margin: 0 0 4px; letter-spacing: -.01em;
}
.page-head p { margin: 0; color: var(--faint); font-size: 14.5px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 18px;
}
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: none; }
.kv-k { color: var(--faint); font-size: 13.5px; }
.kv-v { font-weight: 700; font-size: 14.5px; text-align: right; }

.soon {
  margin-top: 16px; text-align: center; padding: 46px 24px;
  background: var(--card); border: 1px dashed #cfd6de; border-radius: 18px;
}
.soon-icon { font-size: 46px; color: var(--accent); opacity: .55; }
.soon h3 { font-family: var(--font-head); font-size: 19px; margin: 12px 0 6px; }
.soon p { margin: 0 auto; max-width: 42ch; color: var(--faint); font-size: 14.5px; line-height: 1.55; }

.foot {
  max-width: 940px; margin: 0 auto; text-align: center;
  padding: 28px 20px calc(30px + env(safe-area-inset-bottom));
}
.foot p { margin: 0 auto; max-width: 56ch; font-size: 12px; color: var(--faint); line-height: 1.6; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; box-shadow: var(--shadow-lg); z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 40px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }

/* ── Small screens ────────────────────────────────────────────────────────── */
@media (max-width: 460px) {
  .digit { width: 52px; height: 62px; font-size: 26px; }
  .login-card { padding: 28px 20px 24px; }
  .page-head h2 { font-size: 22px; }
  .tb-sub { display: none; }
}
