/* ==========================================================================
   Live Kidz design system
   Purple / teal / sunshine / coral · rounded, friendly, accessible
   ========================================================================== */
:root {
  --purple: #5638a5;
  --purple-600: #472d8b;
  --purple-50: #f0ebff;
  --teal: #087e83;
  --teal-600: #066a6e;
  --teal-50: #e4f5f4;
  --sunshine: #ffd166;
  --sunshine-50: #fff6de;
  --coral: #ff826e;
  --coral-50: #ffedea;
  --ink: #1f2430;
  --ink-2: #333a4a;
  --muted: #6b7280;
  --muted-2: #8b90a0;
  --line: #e9e6f2;
  --line-2: #f2f0f9;
  --bg: #f7f5ff;
  --card: #ffffff;
  --ok: #1a7f5a;
  --ok-bg: #e6f6ef;
  --warn: #a35c00;
  --warn-bg: #fff3dc;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 1px 2px rgba(31, 36, 48, .04), 0 12px 32px -18px rgba(86, 56, 165, .28);
  --shadow-lg: 0 24px 60px -28px rgba(31, 36, 48, .35);
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.22; letter-spacing: -.015em; }
h1 { font-size: 1.55rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 800; }
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid #b9a6f5; outline-offset: 2px; border-radius: 6px; }
.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 16px 18px;
  background: #fff;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 44px; height: 44px; flex: 0 0 44px; display: block; }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 1.18rem; font-weight: 800; letter-spacing: -.02em; }
.brand-text small { color: var(--muted); font-size: .68rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 12px;
  color: var(--ink-2); font-weight: 700; font-size: .9rem;
  transition: background .15s, color .15s, transform .15s;
}
.nav-link:hover { background: var(--purple-50); color: var(--purple); text-decoration: none; }
.nav-link.active { background: var(--purple); color: #fff; box-shadow: 0 8px 18px -10px rgba(86, 56, 165, .8); }
.nav-icon { width: 22px; text-align: center; font-size: 1.02rem; filter: saturate(.9); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.play-shortcut {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 14px;
  background: linear-gradient(135deg, var(--sunshine-50), #fff);
  border: 1px solid #ffe7ae; color: var(--ink);
}
.play-shortcut:hover { text-decoration: none; transform: translateY(-1px); }
.play-shortcut span:first-child { font-size: 1.3rem; }
.play-shortcut strong { display: block; font-size: .82rem; }
.play-shortcut small { color: var(--muted); font-size: .7rem; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 14px; background: var(--bg);
}
.user-chip-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.user-chip-text strong { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text small { color: var(--muted); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 30px;
  background: rgba(247, 245, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(233, 230, 242, .8);
}
.topbar-title { min-width: 0; flex: 1; }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: .64rem; font-weight: 800; color: var(--muted-2); }
.topbar h1 { font-size: 1.32rem; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topsearch {
  display: flex; align-items: center; gap: 8px;
  width: min(300px, 30vw); padding: 8px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted);
}
.topsearch input { border: 0; background: transparent; outline: none; width: 100%; font-size: .85rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  cursor: pointer; color: var(--ink-2); text-decoration: none; position: relative;
  transition: background .15s, transform .15s;
}
.icon-btn:hover { background: var(--purple-50); text-decoration: none; }
.bell-dot {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px;
  display: grid; place-items: center; padding: 0 5px;
  background: var(--coral); color: #fff; border-radius: 999px;
  font-size: .65rem; font-weight: 800; border: 2px solid var(--bg);
}
.menu-btn { display: none; }
.avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--purple-50); color: var(--purple);
  font-weight: 800; font-size: .82rem; letter-spacing: .02em;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.avatar-sm { width: 34px; height: 34px; font-size: .7rem; }
.main { padding: 26px 30px 60px; max-width: 1500px; width: 100%; }

/* ------------------------------------------------------------------ flashes */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: 14px; border: 1px solid;
  font-weight: 600; font-size: .88rem;
}
.flash p { flex: 1; }
.flash-success { background: var(--ok-bg); border-color: #bfe8d6; color: #145c42; }
.flash-error { background: var(--danger-bg); border-color: #f6c9c4; color: #8c1d18; }
.flash-info { background: var(--purple-50); border-color: #ddd2ff; color: var(--purple-600); }
.flash-close { border: 0; background: transparent; cursor: pointer; font-size: 1.1rem; line-height: 1; color: inherit; opacity: .6; }
.auth-flashes { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; width: min(460px, 92vw); }

/* ------------------------------------------------------------------ type + layout */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 62ch; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.section-head .muted { font-size: .82rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.strong { font-weight: 800; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .muted { font-size: .8rem; margin-top: 2px; }
.card-pad { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); background: #fdfcff; }
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, #5638a5 0%, #6a45c4 55%, #087e83 130%);
  color: #fff; border: 0;
}
.hero h1, .hero h2 { color: #fff; }
.hero p { color: #e9e2ff; }
.hero .eyebrow { color: #d8ccff; }
.hero-shape { position: absolute; border-radius: 50%; background: rgba(255, 209, 102, .18); }
.hero-shape.s1 { width: 220px; height: 220px; right: -70px; top: -80px; }
.hero-shape.s2 { width: 140px; height: 140px; right: 120px; bottom: -80px; background: rgba(255, 130, 110, .2); }
.hero-inner { position: relative; z-index: 1; }

/* ------------------------------------------------------------------ stats */
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; color: var(--muted); }
.stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-meta { font-size: .78rem; color: var(--muted); }
.stat-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.1rem; background: var(--purple-50); }
.stat-icon.teal { background: var(--teal-50); }
.stat-icon.sun { background: var(--sunshine-50); }
.stat-icon.coral { background: var(--coral-50); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 12px; border: 1px solid transparent;
  background: var(--purple); color: #fff; font-weight: 800; font-size: .85rem;
  cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: transform .12s, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--purple-600); text-decoration: none; transform: translateY(-1px); box-shadow: 0 8px 16px -10px rgba(86,56,165,.7); }
.btn:active { transform: translateY(0); }
.btn-teal { background: var(--teal); }
.btn-teal:hover { background: var(--teal-600); }
.btn-coral { background: var(--coral); color: #3a1712; }
.btn-coral:hover { background: #ff6f59; }
.btn-sun { background: var(--sunshine); color: #3d2c00; }
.btn-sun:hover { background: #ffc94d; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); box-shadow: none; }
.btn-ghost:hover { background: var(--purple-50); color: var(--purple); box-shadow: none; }
.btn-soft { background: var(--purple-50); color: var(--purple); }
.btn-soft:hover { background: #e5dbff; color: var(--purple-600); box-shadow: none; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fbd9d6; color: var(--danger); box-shadow: none; }
.btn-sm { padding: 6px 10px; font-size: .76rem; border-radius: 9px; }
.btn-lg { padding: 12px 20px; font-size: .95rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { border: 0; background: none; padding: 0; color: var(--purple); font-weight: 800; cursor: pointer; font-size: .82rem; }
.link-btn:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ badges + pills */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: .7rem; font-weight: 800;
  background: var(--purple-50); color: var(--purple-600); white-space: nowrap;
}
.badge-teal { background: var(--teal-50); color: var(--teal-600); }
.badge-sun { background: var(--sunshine-50); color: #7a5600; }
.badge-coral { background: var(--coral-50); color: #a83a26; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: #f1f0f6; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .76rem; font-weight: 700; }
.pill.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; background: var(--bg); font-size: .72rem; font-weight: 700; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); display: inline-block; }
.dot-ok { background: var(--ok); }
.dot-warn { background: #d18b00; }
.dot-danger { background: var(--danger); }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; gap: 13px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: .74rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: 11px;
  border: 1px solid #ded9ec; background: #fff; font-size: .87rem;
  transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: #a58ee0; box-shadow: 0 0 0 3px #eee8ff;
}
.textarea { min-height: 92px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.7' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: .84rem; font-weight: 600; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--purple); }
.inline-form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 140px; }
.status-editor { margin-top: 6px; }
.status-editor summary { font-size: .76rem; }
.status-editor-form { align-items: center; }
.status-editor-form .select { flex: 1; min-width: 110px; padding-top: 7px; padding-bottom: 7px; }
.form-note { font-size: .74rem; color: var(--muted); }
.form-section { border-top: 1px solid var(--line-2); padding-top: 16px; margin-top: 4px; }
.form-section h3 { margin-bottom: 10px; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table th {
  text-align: left; padding: 10px 14px; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); background: #fbfaff; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fdfcff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table-compact td, .table-compact th { padding: 8px 10px; }

/* ------------------------------------------------------------------ lists */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow strong { display: block; font-size: .87rem; }
.list-row .grow small { color: var(--muted); font-size: .76rem; display: block; }
.list-link { color: inherit; }
.list-link:hover { text-decoration: none; }
.list-link:hover .grow strong { color: var(--purple); }
.tile-icon {
  width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center;
  border-radius: 12px; background: var(--purple-50); font-size: 1.15rem;
}
.tile-icon.teal { background: var(--teal-50); }
.tile-icon.sun { background: var(--sunshine-50); }
.tile-icon.coral { background: var(--coral-50); }

/* ------------------------------------------------------------------ alerts / empty */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: .84rem; border: 1px solid; }
.alert p { flex: 1; }
.alert-sun { background: var(--sunshine-50); border-color: #ffe7ae; color: #6b4c00; }
.alert-coral { background: var(--coral-50); border-color: #ffd0c8; color: #8c2f20; }
.alert-teal { background: var(--teal-50); border-color: #c5e9e7; color: #075e61; }
.alert-purple { background: var(--purple-50); border-color: #ddd2ff; color: var(--purple-600); }
.empty { text-align: center; padding: 36px 18px; color: var(--muted); }
.empty .empty-emoji { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* ------------------------------------------------------------------ progress */
.progress { height: 8px; border-radius: 999px; background: #efedf6; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--purple); }
.progress.teal > span { background: var(--teal); }
.progress.sun > span { background: var(--sunshine); }
.progress.coral > span { background: var(--coral); }
.meter-row { display: grid; grid-template-columns: 110px 1fr 42px; align-items: center; gap: 10px; font-size: .8rem; }
.meter-row .label { font-weight: 700; }
.meter-row .value { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ------------------------------------------------------------------ timeline */
.timeline { position: relative; display: flex; flex-direction: column; gap: 0; }
.tl-item { position: relative; display: flex; gap: 13px; padding: 0 0 20px 0; }
.tl-item::before { content: ""; position: absolute; left: 19px; top: 38px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 50%; background: var(--purple-50); z-index: 1; border: 3px solid #fff; }
.tl-body { flex: 1; padding-top: 2px; }
.tl-body strong { display: block; font-size: .87rem; }
.tl-body p { font-size: .82rem; color: var(--muted); }
.tl-time { font-size: .7rem; color: var(--muted-2); font-weight: 700; }

/* ------------------------------------------------------------------ child cards */
.child-card { display: flex; align-items: center; gap: 13px; }
.child-avatar {
  width: 54px; height: 54px; flex: 0 0 54px; border-radius: 18px;
  display: grid; place-items: center; font-size: 1.45rem;
  background: linear-gradient(145deg, var(--purple-50), #fff);
  border: 1px solid var(--line);
}
.child-avatar.teal { background: linear-gradient(145deg, var(--teal-50), #fff); }
.child-avatar.sun { background: linear-gradient(145deg, var(--sunshine-50), #fff); }
.child-avatar.coral { background: linear-gradient(145deg, var(--coral-50), #fff); }
.child-card h3 { font-size: .98rem; }
.child-card .meta { font-size: .76rem; color: var(--muted); }

/* ------------------------------------------------------------------ modules */
.module-card { display: flex; flex-direction: column; gap: 10px; border-top: 5px solid var(--purple); }
.module-card.teal { border-top-color: var(--teal); }
.module-card.sun { border-top-color: var(--sunshine); }
.module-card.coral { border-top-color: var(--coral); }
.module-card .module-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.module-card h3 { font-size: 1.02rem; }
.module-card p { font-size: .82rem; color: var(--muted); }

/* ------------------------------------------------------------------ games */
.game-card { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.game-emoji {
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center;
  font-size: 1.8rem; background: linear-gradient(145deg, var(--purple-50), #fff); border: 1px solid var(--line);
}
.game-card.teal .game-emoji { background: linear-gradient(145deg, var(--teal-50), #fff); }
.game-card.sun .game-emoji { background: linear-gradient(145deg, var(--sunshine-50), #fff); }
.game-card.coral .game-emoji { background: linear-gradient(145deg, var(--coral-50), #fff); }
.game-card h3 { font-size: .98rem; }
.game-card .objective { font-size: .8rem; color: var(--muted); min-height: 2.4em; }
.game-card .game-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }

/* ------------------------------------------------------------------ chat */
.chat { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.chat-msg { display: flex; gap: 10px; max-width: 78%; }
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble { background: #fff; border: 1px solid var(--line); padding: 10px 13px; border-radius: 16px 16px 16px 4px; font-size: .86rem; }
.chat-msg.mine .chat-bubble { background: var(--purple); border-color: var(--purple); color: #fff; border-radius: 16px 16px 4px 16px; }
.chat-bubble .chat-meta { display: block; font-size: .66rem; opacity: .7; margin-top: 4px; }
.chat-msg.mine .chat-bubble .chat-meta { color: #e6ddff; }

/* ------------------------------------------------------------------ calendar */
.calendar-list { display: flex; flex-direction: column; gap: 10px; }
.cal-item { display: flex; gap: 13px; align-items: flex-start; padding: 13px; border-radius: 14px; background: #fbfaff; border: 1px solid var(--line-2); }
.cal-date { width: 54px; flex: 0 0 54px; text-align: center; border-radius: 12px; background: #fff; border: 1px solid var(--line); padding: 5px 0; }
.cal-date .m { display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--coral); font-weight: 800; }
.cal-date .d { display: block; font-size: 1.15rem; font-weight: 800; line-height: 1.1; }
.cal-body { flex: 1; min-width: 0; }
.cal-body strong { display: block; font-size: .88rem; }
.cal-body p { font-size: .78rem; color: var(--muted); }
.cal-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }

/* ------------------------------------------------------------------ auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-brand {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(150deg, #4a2f92 0%, #5638a5 45%, #087e83 125%);
  padding: 46px 52px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
}
.auth-brand .brand { color: #fff; padding: 0; }
.auth-brand .brand-text small { color: #d9ceff; }
.auth-copy { position: relative; z-index: 1; max-width: 520px; }
.auth-copy h1 { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.05; letter-spacing: -.035em; margin-bottom: 14px; }
.auth-copy p { color: #e7dfff; font-size: 1.02rem; max-width: 44ch; }
.auth-features { display: grid; gap: 10px; margin-top: 26px; }
.auth-feature { display: flex; align-items: center; gap: 10px; font-size: .88rem; font-weight: 600; color: #f3efff; }
.auth-feature span:first-child { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.14); }
.auth-quote { position: relative; z-index: 1; font-size: .8rem; color: #cfc3f5; }
.auth-art { position: absolute; inset: 0; pointer-events: none; }
.auth-art .blob { position: absolute; border-radius: 50%; filter: blur(2px); }
.auth-art .b1 { width: 360px; height: 360px; background: rgba(255,209,102,.16); right: -110px; top: -90px; }
.auth-art .b2 { width: 260px; height: 260px; background: rgba(255,130,110,.18); left: -80px; bottom: -90px; }
.auth-art .b3 { width: 150px; height: 150px; background: rgba(255,255,255,.07); right: 120px; bottom: 90px; }
.auth-mascot { position: absolute; right: 48px; bottom: 76px; width: 150px; opacity: .95; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { font-size: 1.6rem; margin-bottom: 4px; }
.auth-card > p { color: var(--muted); font-size: .88rem; margin-bottom: 20px; }
.auth-card .field { margin-bottom: 12px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 14px; color: var(--muted-2); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-btn {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: .76rem; font-weight: 700; color: var(--ink-2);
  transition: border .15s, background .15s;
}
.demo-btn:hover { border-color: #c9b8f7; background: var(--purple-50); }
.demo-btn .demo-emoji { font-size: 1.05rem; }
.demo-btn small { display: block; color: var(--muted); font-weight: 600; font-size: .66rem; }
.auth-foot { margin-top: 18px; font-size: .72rem; color: var(--muted); text-align: center; }
.auth-foot code { background: var(--bg); padding: 2px 5px; border-radius: 5px; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 13px; font-size: .84rem; font-weight: 800; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--purple); text-decoration: none; }
.tab.active { color: var(--purple); border-bottom-color: var(--purple); }

/* ------------------------------------------------------------------ play mode */
.play-body { background: #fdf8ec; }
.play-shell { max-width: 980px; margin: 0 auto; padding: 22px 20px 40px; }
.play-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.play-top .brand { color: var(--ink); }
.play-top .brand-text strong { font-size: 1rem; }
.play-top .brand-text small { color: var(--muted); }
.play-child { display: flex; align-items: center; gap: 8px; margin-left: auto; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px 5px 6px; font-size: .8rem; font-weight: 800; }
.play-stage { background: #fff; border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-lg); padding: 26px; }
.play-head { text-align: center; margin-bottom: 20px; }
.play-head .eyebrow { color: var(--purple); }
.play-head h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin: 4px 0; }
.play-head p { color: var(--muted); font-size: .9rem; }
.play-prompt { text-align: center; font-size: 1.35rem; font-weight: 800; margin: 4px 0 22px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.option-card {
  border: 2px solid var(--line); background: #fff; border-radius: 22px; padding: 22px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: transform .12s, border .12s, box-shadow .12s; min-height: 130px;
  justify-content: center;
}
.option-card:hover { transform: translateY(-3px); border-color: #c9b8f7; box-shadow: 0 14px 26px -18px rgba(86,56,165,.55); }
.option-card.selected { border-color: var(--purple); background: var(--purple-50); }
.option-card.correct { border-color: var(--ok); background: var(--ok-bg); }
.option-card.wrong { border-color: var(--danger); background: var(--danger-bg); }
.option-emoji { font-size: 2.5rem; line-height: 1; }
.option-label { font-weight: 800; font-size: 1rem; }
.play-feedback { min-height: 30px; text-align: center; font-weight: 800; margin-top: 16px; }
.play-feedback.good { color: var(--ok); }
.play-feedback.bad { color: var(--danger); }
.play-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.play-progress { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 20px; font-size: .76rem; color: var(--muted); font-weight: 700; }
.play-progress .progress { width: 160px; }
.count-stage { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 12px 0 22px; }
.count-object {
  width: 82px; height: 82px; border-radius: 20px; border: 2px dashed #d9d2ec; background: #fff;
  display: grid; place-items: center; font-size: 2.4rem; cursor: pointer; transition: transform .12s, background .12s, border .12s;
}
.count-object.counted { background: var(--sunshine-50); border-style: solid; border-color: var(--sunshine); transform: scale(.94); }
.memory-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 520px; margin: 0 auto; }
.memory-card { aspect-ratio: 1; border-radius: 18px; border: 2px solid var(--line); background: linear-gradient(145deg, var(--purple), #7a58d6); color: #fff; display: grid; place-items: center; font-size: 2rem; cursor: pointer; }
.memory-card.flipped, .memory-card.matched { background: #fff; color: var(--ink); border-color: #d8d1ea; }
.memory-card.matched { border-color: var(--ok); background: var(--ok-bg); }
.sequence-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 10px 0 18px; }
.sequence-slot { min-width: 92px; min-height: 92px; border-radius: 18px; border: 2px dashed #d9d2ec; display: grid; place-items: center; background: #fff; font-size: 2rem; padding: 8px; }
.sequence-slot.filled { border-style: solid; border-color: var(--purple); background: var(--purple-50); }
.sequence-bank { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sequence-piece { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 10px 14px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 88px; }
.sequence-piece:hover { border-color: #c9b8f7; }
.sequence-piece.used { opacity: .35; pointer-events: none; }
.sequence-piece .emoji { font-size: 1.8rem; }
.sequence-piece .label { font-size: .72rem; font-weight: 800; }
.slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 520px; margin: 0 auto 18px; }
.place-slot { min-height: 120px; border-radius: 20px; border: 2px dashed #d9d2ec; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; cursor: pointer; }
.place-slot.filled { border-style: solid; border-color: var(--teal); background: var(--teal-50); }
.place-slot .slot-label { font-size: .72rem; font-weight: 800; color: var(--muted); }
.maze-wrap { display: grid; place-items: center; gap: 14px; }
.maze-grid { display: grid; gap: 6px; }
.maze-cell { width: 64px; height: 64px; border-radius: 14px; background: #f4f1fb; display: grid; place-items: center; font-size: 1.7rem; }
.maze-cell.wall { background: #d9d2ec; }
.maze-cell.goal { background: var(--sunshine-50); border: 2px solid var(--sunshine); }
.maze-cell.hero { background: var(--purple-50); border: 2px solid var(--purple); }
.maze-pad { display: grid; grid-template-columns: repeat(3, 52px); gap: 6px; justify-content: center; }
.maze-pad button { height: 46px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 1.05rem; }
.maze-pad button:hover { background: var(--purple-50); }
.spot-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 620px; margin: 0 auto 16px; }
.spot-scene { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; border-radius: 20px; background: var(--teal-50); border: 2px solid #c5e9e7; }
.spot-cell { aspect-ratio: 1; border-radius: 14px; background: #fff; display: grid; place-items: center; font-size: 2rem; cursor: pointer; border: 2px solid transparent; }
.spot-cell:hover { border-color: var(--teal); }
.spot-cell.found { border-color: var(--ok); background: var(--ok-bg); }
.spot-cell.wrong { border-color: var(--danger); background: var(--danger-bg); }
.canvas-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.paint-canvas { width: 100%; max-width: 640px; height: 340px; border-radius: 20px; border: 2px solid var(--line); background: #fff; touch-action: none; cursor: crosshair; }
.palette { display: flex; gap: 8px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 3px var(--purple); }
.rhythm-pad { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.rhythm-btn { width: 110px; height: 110px; border-radius: 24px; border: 2px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font-weight: 800; }
.rhythm-btn:hover { border-color: var(--sunshine); background: var(--sunshine-50); }
.rhythm-btn.hit { background: var(--sunshine); border-color: var(--sunshine); }
.rhythm-btn .emoji { font-size: 2rem; }
.rhythm-seq { display: flex; gap: 8px; justify-content: center; margin: 8px 0 16px; }
.rhythm-seq span { padding: 5px 10px; border-radius: 9px; background: var(--sunshine-50); font-size: .78rem; font-weight: 800; }
.stars { display: flex; gap: 4px; font-size: 1.4rem; justify-content: center; }
.play-done { text-align: center; padding: 12px 0; }
.play-done h2 { font-size: 1.8rem; margin-bottom: 6px; }
.play-done .big-emoji { font-size: 3.4rem; display: block; margin-bottom: 8px; }

/* ------------------------------------------------------------------ misc */
.kpi-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #efedf6; }
.kpi-bar span { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .74rem; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; background: var(--bg); padding: 2px 6px; border-radius: 6px; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }
.mascot-note { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 16px; background: var(--sunshine-50); border: 1px solid #ffe7ae; font-size: .82rem; }
.mascot-note .mascot { font-size: 1.6rem; }
.print-only { display: none; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .main { padding: 20px 16px 50px; }
  .topsearch { display: none; }
  .scrim { position: fixed; inset: 0; background: rgba(31,36,48,.35); z-index: 35; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 24px; min-height: 0; }
  .auth-copy h1 { font-size: 2rem; }
  .auth-art, .auth-mascot { display: none; }
  .auth-panel { padding: 28px 18px; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spot-pair { grid-template-columns: 1fr; }
  .memory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .slot-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .topbar h1 { font-size: 1.1rem; }
  .table th, .table td { padding: 9px 10px; }
  .card { padding: 16px; border-radius: 16px; }
  .play-stage { padding: 18px; border-radius: 20px; }
  .play-prompt { font-size: 1.1rem; }
  .maze-cell { width: 52px; height: 52px; }
  .demo-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .page-head-actions, .btn, .icon-btn { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .print-only { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* ------------------------------------------------------------------ report charts */
.badge-purple { background: var(--purple-50); color: var(--purple-600); }
.grow { flex: 1; min-width: 0; }

.report-hero {
  background: linear-gradient(135deg, #fff 0%, var(--purple-50) 100%);
  border-color: #ddd2ff;
}
.report-hero-grid { display: grid; grid-template-columns: 180px 1fr 220px; gap: 20px; align-items: center; }
.attendance-ring {
  width: 168px; height: 168px; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 168px;
  box-shadow: 0 12px 26px -16px rgba(86, 56, 165, .55), inset 0 0 0 5px rgba(255,255,255,.85);
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.attendance-ring-hole {
  width: 112px; height: 112px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: inset 0 2px 8px rgba(31, 36, 48, .08);
}
.attendance-ring-hole strong { font-size: 1.9rem; line-height: 1; letter-spacing: -.04em; }
.attendance-ring-hole span { font-size: .7rem; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.attendance-legend { display: grid; gap: 8px; }
.legend-bubble {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  background: rgba(255,255,255,.82); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 5px 16px -12px rgba(31,36,48,.4);
}
.legend-bubble strong { display: block; font-size: .84rem; }
.legend-bubble small { display: block; font-size: .72rem; color: var(--muted); }
.legend-icon {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px;
  display: grid; place-items: center; font-size: 1rem; color: #fff;
  background: var(--bubble-colour, var(--purple)); text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.hero-sticker {
  background: var(--sunshine-50); border: 1px dashed #ffd166; border-radius: 18px;
  padding: 13px 15px; transform: rotate(-1deg); text-align: center;
}
.hero-sticker > span { font-size: 1.7rem; display: block; }
.hero-sticker strong { display: block; font-size: .86rem; color: #6b4c00; }
.hero-sticker small { display: block; font-size: .72rem; color: #8a6a1c; margin-top: 3px; }

.kid-chart { display: grid; gap: 8px; }
.kid-chart-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  background: linear-gradient(135deg, #fff, #fbfaff); border: 1px solid var(--line-2);
  border-radius: 15px;
}
.kid-chart-icon {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.05rem; background: var(--purple-50);
}
.kid-chart-icon.teal { background: var(--teal-50); }
.kid-chart-icon.sun { background: var(--sunshine-50); }
.kid-chart-icon.coral { background: var(--coral-50); }
.kid-chart-label { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 5px; font-size: .8rem; }
.kid-chart-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-chart-label .chip { flex: 0 0 auto; }
.kid-note { font-size: .72rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.kid-bar-track {
  display: block; width: 100%; height: 12px; border-radius: 999px; overflow: hidden;
  background: #efedf6; border: 2px solid #fff; box-shadow: inset 0 1px 3px rgba(31,36,48,.08);
}
.kid-bar-fill {
  display: block; height: 100%; width: var(--bar-width, 0%);
  border-radius: 999px; background: var(--bar-colour, var(--purple));
  transition: width .35s ease;
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.kid-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 10px; }
.kid-progress-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 13px;
  border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(145deg, #fff, var(--bg));
}
.kid-progress-tile strong { font-size: .88rem; }
.kid-progress-tile small { font-size: .72rem; color: var(--muted); }
.kid-progress-top { display: flex; justify-content: space-between; align-items: center; }
.kid-tile-emoji { font-size: 1.35rem; }

/* ------------------------------------------------------------------ fee plans */
.plan-editor {
  padding: 13px; margin-bottom: 10px; border: 1px solid var(--line);
  border-radius: 16px; background: linear-gradient(145deg, #fff, #fbfaff);
}
.plan-editor:last-child { margin-bottom: 0; }
.plan-editor details { margin-top: 9px; }
.plan-editor small.muted { line-height: 1.35; }

@media (max-width: 1180px) {
  .report-hero-grid { grid-template-columns: 170px 1fr; }
  .hero-sticker { grid-column: 1 / -1; transform: none; }
}
@media (max-width: 720px) {
  .report-hero-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .attendance-ring { width: 144px; height: 144px; flex-basis: 144px; }
  .attendance-ring-hole { width: 96px; height: 96px; }
  .attendance-legend, .hero-sticker { width: 100%; }
  .kid-chart-label { flex-wrap: wrap; }
}
@media print {
  .report-hero, .kid-chart, .kid-chart-grid, .kid-progress-tile { break-inside: avoid; }
  .attendance-ring, .kid-bar-fill, .legend-icon { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
