:root {
  --bg: #FFF8EE; --card: #ffffff; --ink: #1E2347; --muted: #545a78;
  --primary: #1E2347; --primary-ink: #fff; --accent: #F4A62A; --ok: #157347; --bad: #b42318;
  --line: #ECE3D3; --radius: 16px; --shadow: 0 4px 18px rgba(30, 35, 71, .08);
  --tan: #F6D9B0; --fur: #8A5A3B;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 17px; }
button, input, select, textarea { font: inherit; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand span { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 26px; letter-spacing: -.5px; }
h1, h2, h3 { font-family: "Baloo 2", "Inter", sans-serif; }
#topbar-right { display: flex; gap: 10px; align-items: center; }
main { max-width: 1200px; margin: 0 auto; padding: 18px; }
.center { text-align: center; padding: 40px 10px; }
.muted { color: var(--muted); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
h1, h2, h3 { margin: 0 0 8px; }
.btn { border: 0; border-radius: 12px; padding: 10px 18px; cursor: pointer; font-weight: 700;
  background: var(--primary); color: var(--primary-ink); transition: transform .05s; }
.btn:active { transform: scale(.97); }
.btn.secondary { background: #fff; color: var(--primary); border: 2px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { background: #ffe4ea; color: var(--bad); }
.btn.big { font-size: 20px; padding: 14px 26px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=number], select, textarea { border: 2px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; }
.google-btn { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #1f1f1f;
  border: 1px solid #dadce0; border-radius: 999px; padding: 12px 22px; font-weight: 700; cursor: pointer; text-decoration: none; }
.google-btn img { width: 20px; height: 20px; }
.hero { display: grid; gap: 24px; grid-template-columns: 1.2fr 1fr; align-items: center; }
.hero h1 { font-size: 38px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--tan); color: #5B3A29; font-weight: 700; font-size: 14px; }
.error { background: #ffe4ea; color: var(--bad); padding: 10px 14px; border-radius: 10px; }
.success { background: #dcfce7; color: var(--ok); padding: 10px 14px; border-radius: 10px; }

/* Parent dashboard */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.kid { text-align: center; }
.kid .avatar { font-size: 56px; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick button { font-size: 26px; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 4px 8px; cursor: pointer; }
.avatar-pick button.sel { border-color: var(--primary); background: var(--tan); }

/* Mission map */
.grade-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.grade-tabs button { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; white-space: nowrap; font-weight: 700; }
.grade-tabs button.sel { background: var(--primary); color: #fff; border-color: var(--primary); }
.grade-tabs button.mine::after { content: " ⭐"; }
.missions { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.mission-card { cursor: pointer; border: 3px solid transparent; transition: transform .1s; }
.mission-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.mission-card .emoji { font-size: 44px; }
.mission-card .stars { color: var(--accent); font-size: 22px; letter-spacing: 2px; }
.tag { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }

/* Mission */
.mission-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.workspace { min-height: 460px; }
.blockly-area { height: 440px; width: 100%; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
pre.code, .output { background: #12172e; color: #e6e9ff; border-radius: 12px; padding: 12px; margin: 0;
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 14px; white-space: pre-wrap; min-height: 80px; overflow: auto; }
.output.err { color: #ffb4c4; }
textarea.editor { width: 100%; height: 360px; font-family: "JetBrains Mono", Consolas, monospace; font-size: 15px;
  background: #12172e; color: #e6e9ff; border: 0; border-radius: 12px; padding: 14px; resize: vertical; tab-size: 4; }
.grid { display: grid; gap: 4px; background: #c9e7c1; padding: 8px; border-radius: 14px; width: max-content; margin: 0 auto; }
.cell { width: 56px; height: 56px; background: #e6f6df; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 34px; position: relative; }
.cell.wall { background: #8d6e63; }
.robot .dir { position: absolute; right: 2px; bottom: 0; font-size: 18px; color: var(--primary); transition: transform .2s; }
.chat { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.bubble { padding: 8px 12px; border-radius: 14px; max-width: 95%; white-space: pre-wrap; }
.bubble.me { background: #E8EAF6; align-self: flex-end; }
.bubble.robo { background: #fff7e0; align-self: flex-start; }
.bubble.robo.flagged { background: #e0f2fe; }

/* Teach AI */
video.cam { width: 100%; max-width: 420px; border-radius: 14px; background: #000; transform: scaleX(-1); }
.classes { display: grid; gap: 10px; }
.class-row { display: grid; grid-template-columns: 1fr 70px; gap: 8px; align-items: center; }
.bar { height: 16px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.guess { font-size: 34px; font-weight: 800; text-align: center; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 24, 50, .45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal { background: #fff; border-radius: 20px; padding: 24px; max-width: 560px; width: 100%; max-height: 85vh; overflow: auto; }
.celebrate { text-align: center; }
.celebrate .big-stars { font-size: 56px; color: var(--accent); }
.celebrate .confetti { font-size: 40px; animation: pop .6s ease-out; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.log-item { border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 15px; }

@media (max-width: 900px) {
  .hero, .mission-layout, .split { grid-template-columns: 1fr; }
  .cell { width: 44px; height: 44px; font-size: 26px; }
}

/* ---- admin & tables ---- */
.btn { min-height: 40px; }
.btn.sm { padding: 6px 12px; font-size: 14px; min-height: 34px; }
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.subtabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.subtabs button.sel { color: var(--ink); border-bottom-color: var(--accent); }
.subtabs .count { background: var(--accent); color: var(--ink); border-radius: 99px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
table.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); }
table.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl td.actions { white-space: nowrap; text-align: right; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat strong { font-size: 28px; display: block; font-family: "Baloo 2", sans-serif; }
.hbar { display: grid; grid-template-columns: 70px 1fr 40px; gap: 10px; align-items: center; font-size: 14px; margin: 6px 0; }
.hbar .track { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--accent); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--ink); }
.badge.ok { background: #d9f2e4; color: var(--ok); } .badge.warn { background: #fff0cc; color: #7a4b00; } .badge.bad { background: #fde2e1; color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.form-grid label, label.f { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
label.f input, label.f select, label.f textarea { width: 100%; box-sizing: border-box; }
.modal input[type=text], .modal input[type=password], .modal input[type=number], .modal input[type=time], .modal select, .modal textarea { width: 100%; }
.modal textarea { font-family: "JetBrains Mono", Consolas, monospace; font-size: 14px; }
.cred { background: var(--bg); border: 2px dashed var(--accent); border-radius: 12px; padding: 14px; font-family: Consolas, monospace; font-size: 16px; white-space: pre-wrap; }
.course-card { border-left: 6px solid var(--accent); }
.course-card.off { opacity: .65; border-left-color: var(--line); }
.mrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mrow .t { flex: 1; min-width: 0; }
.login-card { max-width: 440px; margin: 30px auto; }
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--line); padding: 4px; border-radius: 12px; }
.login-tabs button { border: 0; padding: 10px; border-radius: 9px; font-weight: 700; background: transparent; cursor: pointer; color: var(--muted); }
.login-tabs button.sel { background: #fff; color: var(--ink); }
label.f input, label.f select { min-height: 44px; }
.course-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* class lock, batches & fees */
.mission-card.locked { opacity: .55; cursor: not-allowed; }
.mission-card.locked:hover { transform: none; border-color: transparent; }
.mission-card .lock { float: right; font-size: 22px; }
.access-note { border-left: 6px solid var(--accent); }
.access-note.ok { border-left-color: var(--ok); }
.fee-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 15px; }

/* =====================================================================
   Premium layer: matches the public website (navy + honey, Baloo 2 + Inter)
   ===================================================================== */
:root {
  --bg: #F7F4EE; --paper: #FFFCF7; --card: #ffffff; --ink: #121633; --navy: #1E2347; --muted: #5A6080;
  --primary: #1E2347; --accent: #F4A62A; --honey-2: #FFC861; --honey-dark: #B86E00; --line: #ECE3D3; --line-2: #E4DACA;
  --radius: 20px; --shadow: 0 1px 2px rgba(18, 22, 51, .04), 0 10px 28px -10px rgba(18, 22, 51, .14);
  --shadow-lg: 0 30px 80px -24px rgba(6, 8, 30, .45); --ease: cubic-bezier(.2, .7, .2, 1);
}
body { background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.3px; line-height: 1.15; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
a { color: var(--navy); }

/* top bar */
.topbar { padding: 0 24px; min-height: 64px; background: rgba(255, 252, 247, .82); backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); z-index: 30; }
.brand span { font-size: 26px; color: var(--navy); }
#topbar-right .muted { font-size: 14px; }
main { max-width: 1320px; padding: 24px; }

/* buttons */
.btn { border-radius: 999px; padding: 10px 20px; min-height: 42px; background: var(--navy); color: #fff; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; text-decoration: none; transition: transform .15s var(--ease), background .2s, box-shadow .2s; }
.btn:hover { background: #2A3163; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--navy); border: 1.5px solid var(--line-2); }
.btn.secondary:hover { border-color: var(--navy); background: #fff; }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.ghost:hover { background: rgba(30, 35, 71, .06); }
.btn.danger { background: #FDECEC; color: var(--bad); }
.btn.danger:hover { background: #F9D6D6; }
.btn.honey { background: linear-gradient(180deg, var(--honey-2), var(--accent)); color: var(--ink); box-shadow: 0 10px 26px -10px rgba(244, 166, 42, .8); }
.btn.big { font-size: 17px; padding: 14px 26px; min-height: 52px; }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 14px; min-height: 34px; font-size: 13.5px; }

/* inputs */
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  border: 1.5px solid var(--line-2); border-radius: 12px; padding: 10px 13px; background: var(--paper); color: var(--ink); min-height: 44px;
  transition: border-color .2s, box-shadow .2s, background .2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(244, 166, 42, .18); }
label.f, .form-grid label { font-size: 14px; color: var(--ink); }
label.f small { font-weight: 400; color: var(--muted); font-size: 13px; margin-top: -4px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--honey-dark);
  font-weight: 700; font-size: 13px; padding: 8px 10px; cursor: pointer; border-radius: 8px; }
input.pin { letter-spacing: 6px; font-size: 20px; }

/* surfaces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.stack-lg > * + * { margin-top: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 22px; margin: 0; }
.card-head p { margin: 4px 0 0; font-size: 14.5px; }
.tag { font-size: 11.5px; letter-spacing: 1px; }
.error { border: 1px solid #F6C9C9; border-radius: 12px; }
.success { border: 1px solid #BFE7CD; border-radius: 12px; }
.badge { font-size: 12px; padding: 3px 10px; background: #F1ECE3; }
.pill { background: #FBE7C6; color: #6B4423; }

/* modal */
.modal-bg { background: rgba(11, 14, 36, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal { border-radius: 24px; padding: 28px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: modal-in .25s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal h2 { font-size: 24px; }

/* tables */
.tbl-wrap { border: 1px solid var(--line); border-radius: 16px; background: #fff; }
table.tbl th { background: var(--paper); font-size: 11.5px; letter-spacing: .8px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
table.tbl td { padding: 12px 14px; border-bottom: 1px solid #F2ECE1; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: #FFFBF3; }
.mrow { border-bottom-color: #F2ECE1; }

/* role tabs (admin / teacher / family) */
.grade-tabs { gap: 4px; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 999px; width: max-content; max-width: 100%; box-shadow: var(--shadow); }
.grade-tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 16px; }
.grade-tabs button.sel { background: var(--ink); color: #fff; }

/* ---------- login ---------- */
body.on-auth main { max-width: none; padding: 0; }
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 64px); }
.auth-side { position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(900px 500px at 90% -10%, #2A3170 0%, transparent 60%), var(--ink);
  color: #E6E8F7; padding: clamp(32px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; }
.auth-glow { position: absolute; width: 460px; height: 460px; border-radius: 50%; background: #F4A62A; filter: blur(110px); opacity: .22; bottom: -200px; left: -120px; z-index: -1; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-hero { position: absolute; top: clamp(24px, 5vw, 64px); right: clamp(24px, 5vw, 64px); width: 150px; height: 150px; z-index: -1;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .4)); animation: pop .6s ease-out; }
.auth-brand span { font: 800 34px/1 "Baloo 2", sans-serif; color: #fff; letter-spacing: -.6px; }
.auth-tag { color: var(--honey-2); font-weight: 700; margin: 14px 0 34px; letter-spacing: .3px; }
.auth-side h1 { color: #fff; font-size: clamp(38px, 4vw, 56px); margin: 0 0 10px; letter-spacing: -1px; }
.auth-sub { color: #A9AFD4; font-size: 18px; max-width: 460px; margin: 0 0 36px; }
.auth-how { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--honey-2); margin-bottom: 14px; }
.auth-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 480px; }
.auth-steps li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09); }
.auth-steps .n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: linear-gradient(180deg, var(--honey-2), var(--accent)); color: var(--ink); }
.auth-steps strong { display: block; color: #fff; }
.auth-steps small { display: block; color: #A9AFD4; font-size: 14px; margin-top: 2px; }
.auth-full { margin: 40px 0 0; font-size: 12.5px; letter-spacing: .5px; color: #7E85B0; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--paper); }
.auth-card { width: 100%; max-width: 440px; display: grid; gap: 20px; }
.auth-card h2 { font-size: 30px; margin: 0; }
.auth-card .muted { margin: 4px 0 0; }
.login-tabs { background: #F1ECE3; border-radius: 999px; padding: 5px; }
.login-tabs button { border-radius: 999px; padding: 10px; font-size: 15px; }
.login-tabs button.sel { box-shadow: var(--shadow); }
.auth-help { border-top: 1px solid var(--line); padding-top: 16px; font-size: 14px; color: var(--muted); }
.auth-help p { margin: 0 0 8px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; min-height: 0; }
.linkish:hover { color: #B86E00; }
.login-card { border: 1px solid var(--line); }

/* ---------- admin shell: menu docked on the left, collapsible to icons ---------- */
body.on-admin main { max-width: none; padding: 0; }
body.on-admin #app > .grade-tabs { padding: 14px 24px 0; margin-bottom: 0 !important; }
.admin { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: stretch; min-height: calc(100vh - 64px); transition: grid-template-columns .2s ease; }
.admin.collapsed { grid-template-columns: 76px minmax(0, 1fr); }
.admin-main { min-width: 0; padding: 28px clamp(20px, 3vw, 44px) 56px; }
.side { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; overflow-x: hidden; background: #fff;
  border-right: 1px solid var(--line); padding: 14px 12px 24px; box-sizing: border-box; scrollbar-width: thin; }
.side .side-toggle { flex: none; width: 34px; height: 34px; padding: 0; margin-left: auto; justify-content: center; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); }
.side .side-toggle:hover { background: var(--paper); color: var(--ink); }
.side .side-toggle svg { transition: transform .2s ease; }
.side .ico { font-size: 18px; flex: none; }
/* icons only */
.admin.collapsed .side { padding: 14px 10px 24px; }
.admin.collapsed .side .lbl, .admin.collapsed .side-label, .admin.collapsed .side-brand > div {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.admin.collapsed .side-brand { flex-direction: column; gap: 10px; padding: 4px 0 12px; }
.admin.collapsed .side .side-toggle { margin: 0; }
.admin.collapsed .side .side-toggle svg { transform: rotate(180deg); }
.admin.collapsed .side button[data-at] { justify-content: center; padding: 11px 0; position: relative; }
.admin.collapsed .side .count { position: absolute; top: 3px; right: 6px; min-width: 16px; padding: 0 4px; font-size: 10.5px; line-height: 16px; text-align: center; box-sizing: border-box; }
.admin.collapsed .side-group + .side-group { margin-top: 6px; padding-top: 6px; }
@media (prefers-reduced-motion: reduce) { .admin, .side .side-toggle svg { transition: none; } }
.side-group + .side-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid #F2ECE1; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 14px; margin-bottom: 8px; border-bottom: 1px solid #F2ECE1; }
.side-brand img { flex: none; }
.side-brand strong { display: block; font: 800 20px/1.1 "Baloo 2", sans-serif; color: var(--ink); }
.side-brand small { display: block; font-size: 12.5px; color: #8A8FA8; }
.robo-h { display: flex; align-items: center; gap: 10px; }
.robo-h img { flex: none; }
.cell .bot { width: 80%; height: 80%; }
.celebrate .confetti { display: flex; align-items: center; justify-content: center; gap: 10px; }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #9A9FB8; padding: 6px 10px; }
.side button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 10px 12px; border-radius: 12px;
  font-weight: 600; font-size: 14.5px; color: var(--ink); cursor: pointer; text-align: left; transition: background .15s; }
.side button:hover { background: var(--paper); }
.side button.sel { background: var(--ink); color: #fff; }
.side .ico { width: 22px; text-align: center; }
.side .lbl { flex: 1; }
.side .count { background: var(--accent); color: var(--ink); border-radius: 99px; padding: 1px 8px; font-size: 12px; font-weight: 800; }
.page-head { margin: 4px 0 22px; max-width: 820px; }
.page-head h1 { font-size: clamp(30px, 3vw, 40px); margin: 6px 0 6px; }
.page-head p { color: var(--muted); margin: 0; font-size: 16px; }
.step-chip { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .6px; color: var(--honey-dark); background: #FDEFD6; border: 1px solid #F6D9A6;
  padding: 4px 12px; border-radius: 999px; }
/* the page header already names the page: hide each tab's own first heading */
#admin-body > .card > h2:first-child, #admin-body > .card > .row:first-child > h2 { display: none; }
#admin-body > .card > .row:first-child:not(:has(> :not(h2))) { display: none; }
#admin-body > .card > .row:first-child { justify-content: flex-end !important; }
.subtabs { display: none; }

/* journey */
.journey { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; counter-reset: j; }
.journey li { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); }
.journey li:not(:last-child)::after { content: ""; position: absolute; top: 34px; right: -15px; width: 16px; height: 2px; background: var(--line-2); }
.journey li.wait { background: #FFF8EA; border-color: #F6D9A6; }
.journey h3 { margin: 4px 0 0; font-size: 19px; }
.journey p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; flex: 1; }
.j-top { display: flex; justify-content: space-between; align-items: center; }
.j-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--ink); color: var(--honey-2); }
.journey li.done .j-num { background: #D9F2E4; color: var(--ok); }
.j-ico { font-size: 24px; }
.j-status .badge { white-space: normal; line-height: 1.35; }
.journey .btn { align-self: flex-start; }
.ov-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; }
.small { font-size: 13px; }
.stat small { display: block; font-size: 12.5px; margin-top: 2px; }
/* enquiries */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 36px; }
.chip span { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 99px; background: #F1ECE3; font-size: 12px; text-align: center; }
.chip:hover { border-color: var(--accent); }
.chip.sel { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.sel span { background: var(--accent); color: var(--ink); }
table.leads { min-width: 860px; table-layout: fixed; width: 100%; }
table.leads th:nth-child(1) { width: 28%; } table.leads th:nth-child(2) { width: 17%; }
table.leads th:nth-child(3) { width: 17%; } table.leads th:nth-child(4) { width: 24%; } table.leads th:nth-child(5) { width: 14%; }
table.leads td { overflow-wrap: break-word; }
table.leads td, table.leads td * { white-space: normal; }
table.leads .btn { white-space: normal; }
table.leads .contact { white-space: normal; }
table.leads td { vertical-align: top; padding-top: 14px; padding-bottom: 14px; }
table.leads tr.overdue td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
table.leads tr.overdue { background: #FFF8F6; }

table.leads .msg { font-size: 14px; color: var(--muted); margin-top: 4px; font-style: italic; }

.stage-cell select { width: 100%; }
.stage-cell .fu { margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.last-note { font-size: 14.5px; }
.lead-actions { padding-right: 4px; }
.lead-actions .btn { display: block; width: 100%; margin-bottom: 6px; white-space: normal; line-height: 1.2; }
.lead-actions .del { color: var(--bad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.contact { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.contact .wa { font-size: 13px; color: #128C7E; font-weight: 600; }
.notes-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.notes-head .contact { display: inline-flex; flex-direction: row; gap: 8px; }
.timeline { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; max-height: 320px; overflow-y: auto; }
.note { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; background: var(--paper, #FFFCF7); font-size: 15px; }
.note.first { margin-bottom: 10px; background: #FDF6EA; }
.note-meta { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.decision { margin-top: 6px; font-size: 13px; font-weight: 600; color: #7a4b00; }
.note-form { border-top: 1px solid var(--line); padding-top: 16px; }
.note-form textarea { font: inherit; font-size: 15px; width: 100%; box-sizing: border-box; }
.note-form .form-grid { align-items: start; }
.note-form select { width: 100%; }
.fu-choice { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.fu-choice legend { font-weight: 700; font-size: 15px; margin-bottom: 6px; padding: 0; }
.fu-choice label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; font-weight: 500; }
.fu-choice input[type=date] { border: 2px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; }
.todo li.urgent { border-color: #F5B7B1; background: #FFF4F2; }
/* overview charts */
.funnel { display: grid; gap: 10px; }
.f-row { display: grid; grid-template-columns: 110px 1fr 34px 40px; gap: 10px; align-items: center; font-size: 14.5px; }
.f-row .track { height: 14px; background: #F1ECE3; border-radius: 99px; overflow: hidden; }
.f-row .fill { height: 100%; border-radius: 99px; background: var(--accent); }
.f-row .fill.f0 { background: #C9CCE6; } .f-row .fill.f1 { background: #A9AFD4; } .f-row .fill.f2 { background: #F6C46B; }
.f-row .fill.f3 { background: var(--accent); } .f-row .fill.f4 { background: var(--ok); }
.f-pct { text-align: right; }
.weekbars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; align-items: end; height: 190px; padding-top: 6px; }
.wb { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.wb-bar { width: 100%; max-width: 38px; min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #F6C46B, var(--accent)); }
.wb-n { font-size: 13px; font-weight: 700; }
.wb-l { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.todo { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.todo li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.todo .ico { font-size: 20px; } .todo .t { flex: 1; font-weight: 600; font-size: 14.5px; }
.empty { text-align: center; padding: 28px 10px; }
.empty .e-ico { font-size: 40px; }
.stat { border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.stat strong { font-size: 30px; color: var(--ink); }
.hbar .track { height: 10px; background: #F1ECE3; }
.hbar .fill { background: linear-gradient(90deg, var(--accent), var(--honey-2)); border-radius: 99px; }

/* family & kid cards get the same polish */
.kid { border-radius: 22px; }
.mission-card { border: 1px solid var(--line); }
.mission-card:hover { border-color: var(--accent); box-shadow: 0 20px 40px -20px rgba(18, 22, 51, .3); }

@media (max-width: 1100px) {
  .journey { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journey li::after { display: none; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 36px 20px; }
  .auth-side h1 { font-size: 34px; }
  .auth-steps li { padding: 12px; }
  .auth-main { padding: 32px 16px 48px; }
  .admin, .admin.collapsed { grid-template-columns: 1fr; min-height: 0; }
  .admin-main { padding: 18px 16px 40px; }
  .side, .admin.collapsed .side { position: sticky; top: 64px; z-index: 4; height: auto; display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px;
    border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .side .side-toggle { display: none; }
  .admin.collapsed .side .lbl { position: static; width: auto; height: auto; clip: auto; }
  .admin.collapsed .side button[data-at] { padding: 8px 14px; }
  .admin.collapsed .side .count { position: static; }
  .side::-webkit-scrollbar { display: none; }
  .side-group { display: contents; }
  .side-label, .side-brand { display: none; }
  .side button { width: auto; white-space: nowrap; border-radius: 999px; padding: 8px 14px; flex: none; }
  .ov-grid { grid-template-columns: 1fr; }
  main { padding: 16px; }
}
@media (max-width: 560px) {
  .journey { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .card { padding: 18px; }
  .auth-side .auth-sub { margin-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { .modal, .auth-hero { animation: none; } }
@media (max-width: 560px) { .auth-hero { width: 84px; height: 84px; } }

/* polish after review */
.admin > *, .ov-grid > * { min-width: 0; }
.ov-grid { align-items: start; }
.journey .btn { width: 100%; white-space: nowrap; padding: 7px 10px; font-size: 13px; }
.stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.badge { white-space: nowrap; }
table.tbl td:first-child { white-space: nowrap; }
.fee-line .muted { white-space: normal; }
@media (max-width: 700px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
