/* ────────────────────────────────────────────────────────────
   KidsNest — brand tokens, layout primitives, mobile responsive
   ──────────────────────────────────────────────────────────── */

:root {
  /* Neutrals */
  --ink: oklch(0.22 0.025 250);
  --ink-soft: oklch(0.42 0.025 250);
  --ink-mute: oklch(0.62 0.02 250);
  --paper: oklch(0.985 0.005 230);
  --paper-warm: oklch(0.97 0.012 220);
  --card: #ffffff;
  --line: oklch(0.92 0.012 230);
  --line-soft: oklch(0.95 0.008 230);

  /* Blue family — primary brand */
  --blue: oklch(0.55 0.13 235);
  --blue-deep: oklch(0.42 0.14 245);
  --blue-soft: oklch(0.93 0.04 230);
  --blue-wash: oklch(0.97 0.02 230);

  /* Mint — secondary accent */
  --mint: oklch(0.72 0.11 165);
  --mint-soft: oklch(0.94 0.05 165);
  --mint-deep: oklch(0.5 0.1 170);

  /* Semantic */
  --safe: oklch(0.65 0.13 155);
  --warn: oklch(0.7 0.15 70);
  --alert: oklch(0.6 0.18 25);
  --spark: oklch(0.7 0.15 70);

  /* Fonts */
  --font-display: "Be Vietnam Pro", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,40,80,0.06);
  --shadow-md: 0 12px 40px rgba(0,40,80,0.08);
  --shadow-lg: 0 30px 80px rgba(0,40,80,0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ────────────── Typography ────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -0.4px;
  margin: 0;
  text-wrap: pretty;
}
h1 { font-size: clamp(32px, 5vw, 64px); line-height: 1.04; letter-spacing: -1.4px; font-weight: 700; }
h2 { font-size: clamp(24px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -0.8px; font-weight: 700; }
h3 { font-size: clamp(18px, 2vw, 22px); line-height: 1.25; font-weight: 600; }
p  { margin: 0 0 12px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.muted { color: var(--ink-mute); }
.soft  { color: var(--ink-soft); }

/* ────────────── Top bar / nav ────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.4px;
  font-size: 20px;
}
.brand-link:hover { text-decoration: none; }
.brand-link .domain { opacity: 0.55; font-weight: 500; }

.nav-main { display: flex; gap: 24px; font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.nav-main a { color: inherit; text-decoration: none; }
.nav-main a:hover { color: var(--ink); }
.nav-end { display: flex; gap: 12px; align-items: center; }
.nav-end form { display: inline; margin: 0; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 28px; height: 28px;
  border: none; background: transparent; cursor: pointer;
  padding: 0; align-items: center; justify-content: center;
}
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--ink); border-radius: 1px;
}

/* ────────────── Buttons ────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: filter .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.secondary {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
}
.btn.secondary:hover { background: var(--paper-warm); color: var(--ink); }
.btn.ghost {
  background: transparent; color: var(--ink-soft);
  padding: 8px 12px; font-weight: 500;
}
.btn.ghost:hover { color: var(--ink); }
.btn.danger { background: var(--alert); color: #fff; }
.btn.danger:hover { filter: brightness(1.05); }
.btn.lg { padding: 15px 26px; font-size: 15px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ────────────── Layout primitives ────────────── */
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 720px; }
.container.wide { max-width: 1320px; }

.section { padding: 64px 0; }
.section.tight { padding: 40px 0; }
.section.warm  { background: var(--paper-warm); border-top: 1px solid var(--line-soft); }
.section.wash  { background: var(--blue-wash); border-top: 1px solid var(--line-soft); }
.section.cardbg { background: #fff; border-top: 1px solid var(--line-soft); }

.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.hero { grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 24px;
}
.card.flat { border-radius: 14px; padding: 18px; }
.card.lift { box-shadow: var(--shadow-md); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--blue-soft); color: var(--blue-deep);
}
.pill.mint { background: var(--mint-soft); color: var(--mint-deep); }
.pill.warm { background: oklch(0.96 0.04 70); color: oklch(0.5 0.13 60); }
.pill.alert { background: oklch(0.95 0.04 25); color: var(--alert); }

.badge {
  display: inline-block; font-family: var(--font-mono); font-size: 10px;
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink-soft); letter-spacing: 0.5px;
}

/* ────────────── Forms ────────────── */
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.field-row > * { flex: 1 1 200px; }
label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}
input[type=text], input[type=email], input[type=password],
input[type=search], input[type=number], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px oklch(0.93 0.06 235 / 0.5);
}
textarea { min-height: 96px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.checkbox input { width: auto; }
.checkbox label { margin: 0; cursor: pointer; }

/* ────────────── Banners ────────────── */
.flash, .error-banner {
  padding: 12px 14px; border-radius: 12px;
  margin-bottom: 16px; font-size: 14px;
}
.flash { background: var(--mint-soft); color: var(--mint-deep); }
.flash.error, .error-banner { background: oklch(0.95 0.04 25); color: var(--alert); }

/* ────────────── Tables ────────────── */
table.simple {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
table.simple th, table.simple td {
  text-align: left; padding: 12px 10px;
  border-bottom: 1px solid var(--line-soft);
}
table.simple th { font-weight: 600; color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ────────────── Call page ────────────── */
/* Picture-in-picture stage — remote fills the frame, local is a small
   overlay in the bottom-right corner (like Zoom / Daily prebuilt). */
.call-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  border-radius: 18px;
  overflow: hidden;
  margin-top: 14px;
}
.call-stage .remote-video {
  position: absolute;
  inset: 0;
}
.call-stage .remote-video video {
  width: 100%; height: 100%; object-fit: cover;
}
.call-stage .local-video {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 22%;
  max-width: 240px;
  min-width: 140px;
  aspect-ratio: 4 / 3;
  background: oklch(0.18 0.02 240);
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.42);
  box-shadow: 0 10px 28px rgba(0,0,0,0.42);
  z-index: 2;
}
.call-stage .local-video video {
  width: 100%; height: 100%; object-fit: cover;
}
.call-stage .label {
  position: absolute; bottom: 12px; left: 12px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 14px; border-radius: 999px;
  color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.call-stage .label::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mint);
  display: inline-block;
}
.call-stage .local-video .label {
  font-size: 11px; padding: 4px 10px; bottom: 8px; left: 8px;
}

/* Legacy: kept so older /call invocations or design references don't break */
.call-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.video-tile {
  position: relative;
  background: var(--ink);
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.video-tile video {
  width: 100%; height: 100%; object-fit: cover;
}
.video-tile .label {
  position: absolute; bottom: 12px; left: 12px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 14px; border-radius: 999px;
  color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.video-tile .label::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mint);
  display: inline-block;
}
.call-controls {
  display: flex; align-items: center; justify-content: center;
  gap: 24px; margin-top: 28px;
}
/* Stop-sign STOP button — octagonal, bright red, attention-grabbing.
   Two layers: outer red octagon with white border ring, inner content.
   clip-path: polygon() draws the 8-sided shape. */
.stop-btn {
  background: var(--alert); color: #fff; border: none;
  width: 120px; height: 120px;
  font-size: 22px; font-weight: 800; cursor: pointer;
  font-family: var(--font-display); letter-spacing: 2px;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 10px 36px oklch(0.6 0.18 25 / 0.45);
  transition: transform .1s, filter .15s;
  /* Inset white ring effect via inner box-shadow */
  outline: 6px solid var(--alert);
  outline-offset: -10px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.stop-btn::before {
  content: ""; position: absolute; inset: 8px;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  border: 3px solid #fff;
  pointer-events: none;
}
.stop-btn:hover { filter: brightness(1.06); transform: scale(1.02); }
.stop-btn:active { transform: scale(0.97); }
.stop-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.stop-btn .square { display: none; }  /* old inner square hidden — text alone is the sign */

/* AI Guardian status pill — sits above the call stage, always visible,
   recolors when the live Claude check emits a flag. */
.ai-status-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 12px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px;
  font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  margin-bottom: 14px;
  transition: background-color .3s, color .3s;
}
.ai-status-pill .dot {
  width: 10px; height: 10px; border-radius: 50%;
  animation: kn-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 currentColor;
}
.ai-status-pill.calm  { background: var(--mint-soft); color: var(--mint-deep); }
.ai-status-pill.calm  .dot { background: var(--mint); }
.ai-status-pill.watch { background: oklch(0.96 0.06 78); color: oklch(0.42 0.13 60); }
.ai-status-pill.watch .dot { background: var(--warn, oklch(0.74 0.18 70)); }
.ai-status-pill.alert { background: oklch(0.96 0.06 25); color: var(--alert); }
.ai-status-pill.alert .dot { background: var(--alert); animation: kn-pulse-fast .9s ease-in-out infinite; }
@keyframes kn-pulse-fast {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.7; }
}

/* Call layout: stage + AI side panel side by side on desktop,
   stacked vertically on tablet/mobile. */
.call-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}
@media (max-width: 980px) {
  .call-layout { grid-template-columns: 1fr; }
}
.ai-side-panel {
  background: var(--paper, #fff);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  max-height: 540px; overflow-y: auto;
}
.ai-side-panel .panel-head h3 {
  font-size: 16px; margin: 4px 0 6px;
}
.suggestions-list {
  display: flex; flex-direction: column; gap: 10px;
}
.suggestion-empty {
  font-size: 13px; color: var(--ink-soft); padding: 12px;
  background: var(--paper-warm); border-radius: 10px; text-align: center;
}
.suggestion-card {
  padding: 12px 14px; border-radius: 12px;
  background: var(--paper-warm);
  border-left: 3px solid var(--mint);
  display: flex; flex-direction: column; gap: 4px;
  animation: kn-suggest-in .35s ease-out;
}
.suggestion-card.kind-fact  { border-left-color: var(--brand); }
.suggestion-card.kind-news  { border-left-color: oklch(0.65 0.15 50); }
.suggestion-card.kind-game  { border-left-color: oklch(0.65 0.16 320); }
.suggestion-card .kind {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-mute);
}
.suggestion-card .title {
  font-size: 14px; font-weight: 700; color: var(--ink);
}
.suggestion-card .prompt {
  font-size: 13px; color: var(--ink-soft); line-height: 1.45;
}
@keyframes kn-suggest-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Debug feed (R-4) — collapsible drawer at the bottom of the AI side panel.
   Shows the live transcript + the latest AI quality assessment. Useful for
   testing; not meant to be a primary feature. */
.debug-feed {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-warm);
  font-size: 12px;
  margin-top: 8px;
}
.debug-feed summary {
  cursor: pointer; padding: 8px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--font-mono); letter-spacing: 0.5px;
  list-style: none;
}
.debug-feed summary::-webkit-details-marker { display: none; }
.debug-feed .dbg-label { font-weight: 700; }
.debug-feed .dbg-quality {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--mint-soft); color: var(--mint-deep);
}
.debug-feed .dbg-quality.watch { background: oklch(0.96 0.06 78); color: oklch(0.42 0.13 60); }
.debug-feed .dbg-quality.alert { background: oklch(0.96 0.06 25); color: var(--alert); }
.debug-feed .dbg-body {
  padding: 0 12px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.debug-feed .dbg-section { background: #fff; border-radius: 8px; padding: 8px 10px; }
.debug-feed .dbg-h {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--ink-mute);
  margin-bottom: 6px;
}
.debug-feed .dbg-assessment { font-size: 12px; line-height: 1.4; }
.debug-feed .dbg-transcript {
  max-height: 200px; overflow-y: auto;
  font-size: 12px; line-height: 1.45;
  font-family: var(--font-mono);
}
.debug-feed .dbg-line { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.debug-feed .dbg-line:last-child { border-bottom: none; }
.debug-feed .dbg-line .who { font-weight: 700; color: var(--brand); margin-right: 6px; }
.debug-feed .dbg-line.peer .who { color: var(--mint-deep); }

/* Whiteboard overlay — sits on top of the remote video inside .call-stage.
   Aspect-matched canvas with a tool strip at the bottom. */
.whiteboard-overlay {
  position: absolute; inset: 0;
  background: #fdfdf9;
  border-radius: inherit;
  display: flex; flex-direction: column;
  z-index: 5;
  overflow: hidden;
}
.whiteboard-overlay canvas {
  flex: 1; width: 100%; height: 100%;
  cursor: crosshair;
  touch-action: none;
}
.whiteboard-tools {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.92);
  border-top: 1px solid var(--line);
}
.tool-color {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
  cursor: pointer; padding: 0;
  transition: transform .1s;
}
.tool-color.active { transform: scale(1.15); box-shadow: 0 0 0 2px var(--ink); }
.tool-color:hover { transform: scale(1.08); }

/* Screen-share toggled state: dim the call-stage border to signal something
   different is happening, and let #remoteScreen take the full frame. */
.call-stage.screen-on .remote-video video#remoteVideo { display: none; }
.call-stage.screen-on .remote-video video#remoteScreen { display: block !important; object-fit: contain; background: #000; }

/* When local user is sharing: tint the local PiP frame slightly so they see
   it's their screen, not their cam, that's being shared. */
.local-video.local-screen-on { outline: 3px solid var(--brand); }

/* Photo avatars — when the partial renders an <img>, drop the colored bg
   and letter so the photo fills the circle cleanly. */
.kid-avatar.has-photo {
  background: none !important;
  color: transparent;
  padding: 0;
  overflow: hidden;
}
.kid-avatar.has-photo img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.timer {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--alert);
}
.status-line {
  text-align: center; color: var(--ink-mute);
  font-size: 13px; margin-top: 12px;
}

/* ────────────── Mentor / user cards ────────────── */
.mentor-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  margin-bottom: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.mentor-card:hover { border-color: var(--line); box-shadow: var(--shadow-sm); }
.mentor-card .info { flex: 1; min-width: 0; }
.mentor-card .info h3 { margin: 0 0 6px; }
.mentor-card .info .bio { color: var(--ink-soft); font-size: 14px; margin: 8px 0 0; }
.mentor-card .actions { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-soft), var(--blue));
  display: grid; place-items: center;
  color: #fff; font-family: var(--font-display); font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

/* ────────────── Stat tiles ────────────── */
.stat {
  background: var(--blue-wash);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 18px;
}
.stat .k {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700;
  color: var(--ink);
}
.stat .l {
  font-size: 12px; color: var(--ink-mute);
  margin-top: 4px;
}

/* ────────────── Reusable two-column splits ────────────── */
/* `.split-2` is a 1.4fr 1fr grid that collapses to one column under 860px.
   Used by /admin/sessions/:id, /app/children/:id, /admin/settings. */
.split-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: start;
}

/* ────────────── Mobile ────────────── */
@media (max-width: 860px) {
  /* Make the top nav horizontally scrollable instead of hiding it — teens
     have 5 nav items on every page and need to reach them on phones. */
  .nav-main {
    display: flex !important;
    overflow-x: auto;
    flex: 1;
    margin: 0 8px;
    gap: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .nav-main::-webkit-scrollbar { display: none; }
  .nav-main a { flex: 0 0 auto; }

  .nav-end .desktop-only { display: none; }
  .nav-toggle { display: flex; }

  .grid.hero { grid-template-columns: 1fr; gap: 28px; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; }

  /* Two-column splits collapse */
  .split-2 { grid-template-columns: 1fr; }

  /* Call controls wrap so Stop + timer + Report don't overflow */
  .call-controls {
    flex-wrap: wrap;
    gap: 14px;
  }
  .call-controls #reportBtn { margin-left: 0 !important; }

  /* Picture-in-picture: shrink local tile on phones so it doesn't
     dominate the remote video. */
  .call-stage .local-video {
    width: 32%;
    min-width: 96px;
    right: 8px;
    bottom: 8px;
  }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  .container, .container.wide, .container.narrow { padding: 0 18px; }
  .section { padding: 40px 0; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .call-grid { grid-template-columns: 1fr; }
  .mentor-card { flex-direction: column; }
  .mentor-card .actions { flex-direction: row; align-items: stretch; width: 100%; }
  .mentor-card .actions .btn { flex: 1; }
  .field-row { flex-direction: column; align-items: stretch; }
  .field-row > * { flex: 1 1 auto; }
  table.simple th, table.simple td { padding: 10px 6px; font-size: 13px; }
  h1 { font-size: 36px; letter-spacing: -1px; }
  h2 { font-size: 24px; letter-spacing: -0.4px; }
}

/* ────────────── Utilities ────────────── */
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > * { flex: 1 1 280px; }
.spacer { height: 24px; }
.center { text-align: center; }
.hide { display: none; }
@media (max-width: 860px) { .hide-tablet { display: none; } }
@media (max-width: 560px) { .hide-mobile { display: none; } }
@media (min-width: 561px) { .only-mobile { display: none; } }

/* ────────────── Marketing — KidsNest peers product ──────────────
   Pieces specific to the kids-with-verified-peers narrative. Generic
   primitives (.card, .pill, .grid, .stat) already cover most of it. */
.tile-pair {
  width: 100%;
  aspect-ratio: 5 / 4;
  border-radius: 22px;
  overflow: hidden;
  background: var(--ink);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}
.tile-pair .tile {
  position: relative;
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(48px, 8vw, 96px);
}
.tile-pair .tile .label {
  position: absolute; bottom: 14px; left: 14px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 14px; border-radius: 999px;
  color: #fff;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
}
.tile-pair .tile .label::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--mint); display: inline-block;
}
.tile-pair .tile .label .sub { font-size: 11px; opacity: 0.8; font-weight: 400; }

.float-card {
  position: absolute;
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px;
  max-width: 240px;
}
.float-card .icon-tile {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--mint-soft); color: var(--mint-deep);
  display: grid; place-items: center;
  flex-shrink: 0;
}

/* Toggle row (parent-controls preview, KPI cards w/ toggles, etc.) */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 4px;
  border-top: 1px solid var(--line-soft);
}
.toggle-row:first-child { border-top: none; }
.toggle-row .lab { font-size: 13px; font-weight: 500; }
.toggle-row .val { font-size: 11px; color: var(--ink-mute); }
.toggle {
  width: 32px; height: 18px; border-radius: 9px;
  background: var(--mint); position: relative; flex-shrink: 0;
}
.toggle.off { background: var(--line); }
.toggle::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; position: absolute; top: 2px; left: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: left .2s;
}
.toggle.off::after { left: 2px; }

/* Compliance badges row in marketing footer */
.compliance {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}

/* ────────────── Verify (parent registration) ────────────── */
.verify-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.verify-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; background: #fff; border-bottom: 1px solid var(--line-soft);
}
.verify-bar .lock {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-mute);
}

.stepper { display: flex; flex-direction: column; gap: 4px; }
.stepper .step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid transparent;
}
.stepper .step.active {
  background: var(--blue-soft);
  border-color: oklch(0.55 0.13 235 / 0.2);
}
.stepper .step .num {
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line);
  color: var(--ink-mute);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.stepper .step.done .num { background: var(--mint); border: none; color: #fff; }
.stepper .step.active .num { background: var(--blue); border: none; color: #fff; }
.stepper .step .title { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.stepper .step.done .title { color: var(--ink); font-weight: 500; }
.stepper .step.active .title { color: var(--blue-deep); font-weight: 600; }
.stepper .step .meta { font-size: 11px; color: var(--ink-mute); margin-top: 1px; }
.stepper .step.done .meta { color: var(--mint-deep); }

.why-pill {
  margin-top: 24px; padding: 14px; background: var(--mint-soft);
  border-radius: 12px;
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 12px; color: var(--mint-deep); line-height: 1.5;
}

.verify-panel {
  background: #fff; border-radius: 18px; padding: 36px;
  border: 1px solid var(--line-soft);
}

.doc-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.doc-pick {
  padding: 16px; border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  position: relative; cursor: pointer;
}
.doc-pick.sel { border: 2px solid var(--blue); background: var(--blue-wash); }
.doc-pick .strip {
  width: 40px; height: 28px; border-radius: 5px; margin-bottom: 10px;
  background: repeating-linear-gradient(45deg, var(--blue-soft) 0 4px, var(--blue-wash) 4px 8px);
  border: 1px solid oklch(0.55 0.13 235 / 0.33);
}
.doc-pick .name { font-size: 13px; font-weight: 600; }
.doc-pick .tick {
  position: absolute; top: 12px; right: 12px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--blue);
  display: grid; place-items: center;
}

.upload-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.upload-card {
  border-radius: 12px; padding: 16px; min-height: 160px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
}
.upload-card.done {
  border: 1.5px solid var(--mint); background: var(--mint-soft);
}
.upload-card.pending {
  border: 2px dashed oklch(0.55 0.13 235 / 0.33);
  background: var(--blue-wash);
}
.upload-card .doc-thumb {
  width: 70px; height: 46px; border-radius: 6px; position: relative;
  background: repeating-linear-gradient(45deg, var(--mint-soft) 0 4px, #fff 4px 8px);
  border: 1px solid var(--mint);
}
.upload-card .doc-thumb .badge-tick {
  position: absolute; top: -8px; right: -8px;
  background: var(--mint); color: #fff;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
}
.upload-card .title { font-size: 13px; font-weight: 600; }
.upload-card.done .title { color: var(--mint-deep); }
.upload-card.pending .title { color: var(--blue-deep); }
.upload-card .filename { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); }
.upload-card .hint { font-size: 11px; color: var(--ink-mute); }
.upload-card .hint a { color: var(--blue); font-weight: 600; }
.upload-card .upload-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: #fff; color: var(--blue);
  display: grid; place-items: center;
  border: 1px solid oklch(0.55 0.13 235 / 0.2);
}

.verify-live {
  background: var(--blue-wash);
  border: 1px solid oklch(0.55 0.13 235 / 0.2);
  border-radius: 12px;
  padding: 16px;
  display: flex; gap: 14px; align-items: center;
}
.verify-live .spinner {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; display: grid; place-items: center;
  position: relative; flex-shrink: 0;
}
.verify-live .spinner::before {
  content: ""; position: absolute; inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--blue);
  border-right-color: transparent;
  animation: spin 1.2s linear infinite;
}
.verify-live .checks {
  display: flex; gap: 14px; font-size: 11px;
  font-family: var(--font-mono); color: var(--ink-soft);
  flex-wrap: wrap;
}
.verify-live .checks .ok { color: var(--mint-deep); }
@keyframes spin { to { transform: rotate(360deg); } }

.collect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.collect-grid .item {
  display: flex; gap: 8px; align-items: center;
  font-size: 12px; color: var(--ink-soft);
}
.collect-grid .item.mute { color: var(--ink-mute); }

/* ────────────── Parent admin dashboard ────────────── */
.dash {
  display: flex;
  min-height: calc(100vh - 0px);
  background: var(--paper-warm);
}
.dash-side {
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--line-soft);
  padding: 24px 16px;
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.dash-side .brand-link { margin: 0 8px 24px; font-size: 18px; }
.dash-side .nav-items { display: flex; flex-direction: column; gap: 2px; }
.dash-side .item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--ink-soft); font-size: 13px; font-weight: 500;
  text-decoration: none;
}
.dash-side .item:hover { background: var(--paper-warm); color: var(--ink); text-decoration: none; }
.dash-side .item.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 600; }
.dash-side .item .count {
  font-family: var(--font-mono); font-size: 10px;
  padding: 2px 7px; border-radius: 999px;
  background: var(--line); color: var(--ink-soft);
  font-weight: 600;
}
.dash-side .item.active .count { background: var(--blue); color: #fff; }
.dash-side .item .count.alert { background: var(--alert); color: #fff; }
.dash-side .systems {
  margin-top: auto; padding: 12px;
  background: var(--mint-soft); border-radius: 10px;
  font-size: 11px; color: var(--mint-deep); line-height: 1.5;
}
.dash-side .systems .heading {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; margin-bottom: 4px;
}
.dash-side .me {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 0; margin-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.dash-side .me .name { font-size: 12px; font-weight: 600; }
.dash-side .me .role {
  font-size: 10px; color: var(--ink-mute);
  font-family: var(--font-mono); letter-spacing: 0.5px;
}
.dash-side .avatar { width: 32px; height: 32px; font-size: 13px; }

.dash-main {
  flex: 1; padding: 28px 36px 40px;
  min-width: 0;
}
.dash-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px; gap: 18px; flex-wrap: wrap;
}
.dash-head .date { font-size: 13px; color: var(--ink-mute); margin-bottom: 4px; }
.dash-head h1 {
  font-size: 30px; line-height: 1.1; letter-spacing: -0.5px;
  margin: 0; font-weight: 700;
}
.dash-head .actions { display: flex; gap: 10px; }
.dash-head .btn { padding: 9px 14px; font-size: 13px; }

.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 22px;
}
.kpi {
  background: #fff; border-radius: 14px; padding: 18px;
  border: 1px solid var(--line-soft);
}
.kpi .l {
  font-size: 11px; color: var(--ink-mute);
  font-family: var(--font-mono); text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 8px;
}
.kpi .k {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700; letter-spacing: -0.4px;
}
.kpi .sub { font-size: 11px; color: var(--ink-mute); margin-top: 4px; }

.dash-row {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}
.dash-row.even { grid-template-columns: 1fr 1fr; margin-top: 18px; }

.live-card {
  background: #fff; border-radius: 16px; padding: 20px;
  border: 1px solid var(--line-soft);
}
.live-card .head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.live-card .live-tag {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--ink-mute);
}
.live-card .live-tag .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--alert);
  animation: pulse 1.4s ease-in-out infinite;
}
.live-card .live-tag .label-live {
  font-size: 12px; font-weight: 700; color: var(--alert);
  letter-spacing: 0.4px; font-family: var(--font-mono);
}
.live-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.live-card .actions .btn {
  padding: 6px 12px; font-size: 12px;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.session-tiles {
  position: relative; border-radius: 12px; overflow: hidden;
  margin-bottom: 14px; background: var(--ink);
}
.session-tiles .pair {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px; height: 200px;
}
.ai-hud {
  position: absolute; top: 12px; left: 12px;
  background: rgba(20,30,45,0.85);
  color: #fff; padding: 8px 12px; border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.ai-hud .text { font-size: 11px; font-family: var(--font-mono); letter-spacing: 0.5px; }
.ai-hud .text .top { color: var(--mint); font-weight: 700; }
.ai-hud .text .topic { color: #fff; opacity: 0.7; }
.ai-strip {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  background: rgba(255,255,255,0.95);
  border-radius: 10px; padding: 10px 12px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  font-size: 11px; font-family: var(--font-mono);
}
.ai-strip .ok { color: var(--mint-deep); }
.ai-strip .warn { color: var(--warn); }
.ai-strip .mute { color: var(--ink-mute); }

.tag-chips {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-mute);
}
.tag-chips .chip {
  font-family: var(--font-mono); font-size: 11px;
  padding: 3px 9px; background: var(--blue-soft);
  color: var(--blue-deep); border-radius: 999px;
}

.list-card {
  background: #fff; border-radius: 16px; padding: 20px;
  border: 1px solid var(--line-soft);
}
.list-card .head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.list-card .head .title {
  font-family: var(--font-display); font-size: 16px; font-weight: 600;
}
.list-card .head .more { font-size: 12px; color: var(--blue); font-weight: 600; }

.session-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line-soft);
}
.session-row:first-of-type { border-top: none; }
.session-row .meta { flex: 1; min-width: 0; }
.session-row .meta .who { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-row .meta .topic { font-size: 12px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-row .right { text-align: right; }
.session-row .right .dur { font-size: 11px; color: var(--ink-mute); font-family: var(--font-mono); }
.session-row .right .flag { font-size: 10px; font-weight: 700; font-family: var(--font-mono); margin-top: 2px; }
.session-row .right .flag.clean { color: var(--mint-deep); font-weight: 500; }
.session-row .right .flag.minor { color: var(--warn); }
.session-row .right .flag.alert { color: var(--alert); }

.alert-card {
  background: oklch(0.97 0.04 25);
  border: 1px solid oklch(0.6 0.18 25 / 0.2);
  border-radius: 16px; padding: 20px;
}
.alert-card .heading {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 12px;
  font-family: var(--font-display); font-size: 16px; font-weight: 600;
  color: var(--alert);
}
.alert-card .body {
  background: #fff; border-radius: 12px; padding: 14px;
}
.alert-card .severity {
  font-size: 12px; font-family: var(--font-mono);
  color: var(--alert); font-weight: 700; margin-bottom: 6px;
}
.alert-card .who { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.alert-card .summary {
  font-size: 12px; color: var(--ink-soft);
  line-height: 1.5; margin-bottom: 12px;
}

.kid-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line-soft);
}
.kid-row:first-of-type { border-top: none; }
.kid-row .info { flex: 1; min-width: 0; }
.kid-row .info .name { font-size: 14px; font-weight: 600; }
.kid-row .info .name .age { color: var(--ink-mute); font-weight: 400; }
.kid-row .info .status { font-size: 12px; color: var(--ink-mute); }
.kid-row .info .status.live { color: var(--alert); }
.kid-row .info .subs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.kid-row .info .subs .tag {
  font-size: 10px; font-family: var(--font-mono);
  padding: 2px 7px; background: var(--line-soft);
  border-radius: 999px; color: var(--ink-soft);
}

.kid-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-family: var(--font-display);
  font-weight: 700; font-size: 18px;
  position: relative; flex-shrink: 0;
}
.kid-avatar.online::after {
  content: ""; position: absolute; right: 0; bottom: 0;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--safe); border: 2px solid #fff;
}

/* Inline "● Online" pill used on cards next to a name */
.online-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.5px;
  color: var(--safe); padding: 2px 6px;
  background: oklch(0.96 0.04 155); border-radius: 999px;
  font-weight: 600;
}
.online-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--safe);
  animation: kn-pulse 1.6s ease-in-out infinite;
}
@keyframes kn-pulse { 0%,100%{ opacity: 1; transform: scale(1); } 50%{ opacity: .55; transform: scale(.85); } }
.kid-avatar.tone-blue { background: linear-gradient(135deg, oklch(0.78 0.1 230), oklch(0.55 0.13 235)); }
.kid-avatar.tone-mint { background: linear-gradient(135deg, oklch(0.78 0.1 165), oklch(0.45 0.1 170)); }
.kid-avatar.tone-warm { background: linear-gradient(135deg, oklch(0.82 0.11 60), oklch(0.52 0.13 55)); }
.kid-avatar.tone-rose { background: linear-gradient(135deg, oklch(0.8 0.1 20), oklch(0.55 0.14 20)); }
.kid-avatar.tone-plum { background: linear-gradient(135deg, oklch(0.75 0.1 310), oklch(0.5 0.13 310)); }
.kid-avatar.tone-sun  { background: linear-gradient(135deg, oklch(0.88 0.13 90), oklch(0.6 0.14 80)); }

/* Mobile breakpoints for dash + verify */
@media (max-width: 1024px) {
  .verify-shell { grid-template-columns: 1fr; gap: 28px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-row, .dash-row.even { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .dash { flex-direction: column; }
  .dash-side {
    width: 100%; flex-direction: row;
    padding: 12px 16px; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--line-soft);
  }
  .dash-side .brand-link { margin: 0 8px 0 0; flex-shrink: 0; }
  .dash-side .nav-items { flex-direction: row; flex: 1; }
  .dash-side .item { padding: 8px 12px; }
  .dash-side .item .count { display: none; }
  .dash-side .systems, .dash-side .me { display: none; }
  .dash-main { padding: 22px 18px 32px; }
  .verify-panel { padding: 20px; }
  .upload-pair { grid-template-columns: 1fr; }
  .collect-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi .k { font-size: 22px; }
  .doc-picker { grid-template-columns: 1fr; }
  .dash-head h1 { font-size: 24px; }
}

/* Compatibility — legacy bare-button fallback used in older views */
button:not(.btn):not(.stop-btn):not(.logout):not(.nav-toggle) {
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
}
.logout {
  background: transparent; border: none; color: var(--ink-soft);
  cursor: pointer; font: inherit; padding: 0; font-size: 14px; font-weight: 500;
}
.logout:hover { color: var(--ink); }
