/* ===== TOKENS — Terralo (v6.0) =====
   Elephant-logo colour pack. Earthy, grounded, calm. Pure neutrals avoided —
   greys bias slightly to the warm side so the palette reads as one system.
   Legacy Calm Brain variables stay named so existing screens auto-reskin
   while new Terralo-specific tokens live below the mapping. */
:root {
  /* Terralo brand palette */
  --forest:       #243D32;   /* primary dark — logo, headings, dark panels */
  --forest-deep:  #16261F;   /* pressed states on forest */
  --forest-mist:  #E8EFE8;   /* light forest tint */
  --clay:         #B96543;   /* primary accent — CTAs, Clay cards */
  --clay-deep:    #9A4F32;   /* pressed clay */
  --clay-soft:    #F0D9CD;   /* clay fill, badges */
  --ochre:        #D7A63B;   /* secondary accent — chips, highlights */
  --ochre-deep:   #8A6516;   /* strong ochre */
  --ochre-soft:   #F3E5BB;   /* ochre fill */
  --river:        #3D6173;   /* tertiary — info, links */
  --river-soft:   #D7DFE4;
  --limestone:    #F4EFDF;   /* page background */
  --limestone-dk: #E8DECC;   /* borders, dividers */
  --paper:        #FFFCF3;   /* card surface */
  --dusty-stone:  #B9B3A3;   /* muted icons / inactive */
  --dusty-text:   #6E6A5E;   /* secondary text */

  /* Journey chip states (per brief) */
  --state-new:        var(--ochre);
  --state-taking:     var(--forest);
  --state-mastered:   #4F8A5A;
  --state-revisit:    var(--river);
  --state-dusty:      var(--dusty-stone);

  /* Legacy aliases — existing screens read these so they auto-pick up the
     brand without a per-file rewrite. Values point at the Terralo palette. */
  --bg: #F4EFDF;
  --bg-2: #FFFCF3;
  --white: #FFFCF3;
  --teal: #243D32;
  --teal-deep: #243D32;
  --teal-soft: #D7E5DB;
  --teal-mist: #E8EFE8;
  --coral: #B96543;
  --coral-soft: #F0D9CD;
  --pink: #D7A63B;
  --pink-soft: #F3E5BB;
  --sun: #D7A63B;
  --sun-soft: #F3E5BB;
  --sun-deep: #8A6516;
  --lavender: #3D6173;
  --lavender-soft: #D7DFE4;
  --blue: #3D6173;
  --blue-soft: #D7DFE4;
  --blue-deep: #243D32;
  --ink: #243D32;
  --ink-soft: #6E6A5E;
  --ink-faint: #B9B3A3;
  --cloud: #E8DECC;
  --shadow: none;
  --shadow-lift: 0 1px 2px rgba(36, 61, 50, 0.06);
  --radius: 14px;
  --radius-lg: 22px;
  --radius-chip: 100px;

  /* App column width. One source of truth for #app and every fixed overlay
     so they always stay aligned. Widens on tablet/desktop via the responsive
     block at the end of this file. */
  --app-w: 480px;

  /* Fonts */
  --font-body: 'Noto Sans', system-ui, -apple-system, sans-serif;
  --font-hero: 'Lato', 'Noto Sans', system-ui, sans-serif;
}

/* ===== RESET / BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--limestone);
  color: var(--forest);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
/* No gradient wash on Terralo — plain Limestone paper. */
body { background: var(--limestone); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--river); text-decoration: none; }

h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 600; letter-spacing: -0.01em; color: var(--forest); }
em.accent { color: var(--clay); font-style: normal; font-weight: 600; }

/* ===== TERRALO COMPONENTS ===== */

/* Paper card — the dominant surface. No shadow, Limestone-dark border.
   Use .t-card for anything that holds content. */
.t-card {
  background: var(--paper);
  border: 1px solid var(--limestone-dk);
  border-radius: var(--radius);
  padding: 16px;
}

/* Forest dark panel — used for prominent CTAs, kid progress banners,
   today's path header. White text; Clay/Ochre accents land cleanly. */
.t-panel {
  background: var(--forest);
  color: var(--paper);
  border-radius: var(--radius-lg);
  padding: 20px;
  /* Subtle contour-line texture to echo the identity board. Pure CSS so no
     asset dependency. */
  background-image:
    repeating-linear-gradient(135deg,
      rgba(255,252,243,0.03) 0px,
      rgba(255,252,243,0.03) 1px,
      transparent 1px,
      transparent 24px);
}
.t-panel h1, .t-panel h2, .t-panel h3, .t-panel h4 { color: var(--paper); }

/* Journey chips — "New / Taking root / Mastered / Another visit / Dusty".
   Add .t-chip plus the modifier class. Always rounded, uppercase label. */
.t-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-chip);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--limestone-dk); color: var(--forest);
}
.t-chip.t-chip--new      { background: var(--ochre-soft);     color: var(--ochre-deep); }
.t-chip.t-chip--taking   { background: var(--forest-mist);    color: var(--forest); }
.t-chip.t-chip--mastered { background: #D6EADC;               color: #2F5B38; }
.t-chip.t-chip--revisit  { background: var(--river-soft);     color: var(--river); }
.t-chip.t-chip--dusty    { background: #E6E2D8;               color: var(--dusty-text); }

/* Terralo buttons — Clay primary, Forest-dark alt, ghost. Rounded, no shadow. */
.t-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--clay);
  color: var(--paper);
  font-family: inherit;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.t-btn:hover    { background: var(--clay-deep); }
.t-btn:active   { transform: scale(0.985); }
.t-btn:disabled { opacity: 0.5; cursor: default; }
.t-btn--forest  { background: var(--forest); color: var(--paper); }
.t-btn--forest:hover { background: var(--forest-deep); }
.t-btn--ghost   { background: transparent; color: var(--forest); border: 1.5px solid var(--limestone-dk); }
.t-btn--ghost:hover { background: var(--limestone-dk); }
.t-btn + .t-btn { margin-top: 10px; }

/* Terralo input — paper surface, Limestone-dark border, Forest focus ring. */
.t-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--paper);
  color: var(--forest);
  border: 1.5px solid var(--limestone-dk);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
.t-input:focus { border-color: var(--forest); }
.t-input::placeholder { color: var(--dusty-stone); }
.t-label {
  display: block;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 700; color: var(--dusty-text);
  margin-bottom: 6px;
}

/* Hero typography — only used on Welcome. Lato Bold, big. */
.t-hero-title {
  font-family: var(--font-hero);
  font-weight: 700;
  font-size: clamp(32px, 7vw, 44px);
  line-height: 1.1;
  color: var(--forest);
  text-wrap: balance;
  letter-spacing: -0.02em;
}
.t-hero-sub {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--dusty-text);
  letter-spacing: 0.02em;
}

/* Terralo section label — small all-caps header. */
.t-section-lbl {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 700; color: var(--dusty-text);
  margin: 20px 0 10px;
}

/* ===== APP SHELL (mobile-first, framed on desktop) ===== */
#app {
  max-width: var(--app-w);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-2);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lift);
}
@media (max-width: 520px) {
  #app { box-shadow: none; max-width: 100%; }
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 100vh;
}
.screen.has-nav { padding-bottom: 84px; }
.screen-body { flex: 1; padding: 20px 22px; }

/* ===== APP HEADER ===== */
.app-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px 4px;
}
.app-header .back {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--bg);
  color: var(--ink-soft); font-size: 18px;
}
.app-header h3 { flex: 1; font-size: 16px; }

/* ===== AUTH SCREENS ===== */
.auth-wrap {
  flex: 1;
  background: linear-gradient(180deg, var(--white) 0%, var(--teal-mist) 100%);
  display: flex; flex-direction: column;
  padding: 50px 28px 32px;
  min-height: 100vh;
}
.logo-mark {
  width: 84px; height: 84px;
  margin: 12px auto 24px;
  border-radius: 50%;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(45, 192, 197, 0.3);
}
.logo-mark svg { width: 46px; height: 46px; }
.brand { text-align: center; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 500; font-size: 34px; letter-spacing: -0.02em; }
.tagline { text-align: center; color: var(--ink-soft); font-size: 14px; margin-bottom: 36px; }

.field {
  background: var(--white);
  border: 1px solid var(--cloud);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex; flex-direction: column;
}
.field label {
  font-size: 10px; color: var(--ink-soft);
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 4px; font-weight: 600;
}
.field input, .field select {
  border: none; outline: none; background: transparent;
  font-size: 15px; color: var(--ink); font-weight: 500;
  width: 100%;
}
.field input::placeholder { color: var(--ink-faint); font-weight: 400; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 22px; border-radius: 100px;
  font-weight: 600; font-size: 14px;
  width: 100%; transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--ink); border: 1px solid var(--cloud); }
.btn-coral { background: var(--coral); color: var(--white); }
.btn-ghost { background: transparent; color: var(--teal-deep); }

.btn + .btn { margin-top: 10px; }

/* Google sign-in button — official style. Light background, bordered, with
   the coloured G. Works in both light + dark theme. */
.btn-google {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; width: 100%;
  padding: 12px 16px; border-radius: 10px;
  background: #ffffff; color: #1f1f1f;
  border: 1px solid #d9d9d9;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.btn-google:hover { background: #f8f9fa; }
.btn-google:active { transform: scale(0.98); }
.btn-google[disabled] { opacity: 0.6; cursor: default; }

/* "or" divider between Google and email form */
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 6px;
  color: var(--ink-faint);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--cloud);
}

.secondary-link { text-align: center; margin-top: 22px; font-size: 13px; color: var(--ink-soft); }
.secondary-link a { color: var(--coral); font-weight: 600; }

.error {
  background: var(--coral-soft);
  color: #8B3A3A;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.notice {
  background: var(--teal-mist);
  color: var(--teal-deep);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ===== PROFILE PICKER ===== */
.picker {
  background: linear-gradient(180deg, var(--white) 0%, var(--teal-mist) 100%);
  flex: 1; display: flex; flex-direction: column;
  padding-top: 50px;
}
.picker-greet { text-align: center; padding: 20px 30px 28px; }
.picker-greet .eyebrow {
  font-size: 11px; color: var(--coral); letter-spacing: 0.18em;
  text-transform: uppercase; font-weight: 600; margin-bottom: 10px;
}
.picker-greet h2 { font-size: 30px; margin-bottom: 4px; }
.picker-greet p { font-size: 13px; color: var(--ink-soft); }

.picker-cards { padding: 12px 22px; display: grid; gap: 14px; }
.picker-card {
  background: var(--white); border: 1px solid var(--cloud);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
  text-align: left; width: 100%;
}
.avatar {
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif; font-size: 24px;
  color: var(--white); flex-shrink: 0;
}
.picker-card .info { flex: 1; }
.picker-card .who { font-family: 'Bricolage Grotesque', sans-serif; font-size: 20px; font-weight: 500; }
.picker-card .pending { font-size: 12px; color: var(--ink-soft); }
.picker-card .arrow {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
}
.picker-footer { margin-top: auto; padding: 24px; text-align: center; }
.picker-footer button { color: var(--ink-soft); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }

/* ===== PARENT DASHBOARD ===== */
.dash-greeting { padding: 20px 22px 16px; }
.dash-greeting .hello { font-family: 'Bricolage Grotesque', sans-serif; font-size: 26px; font-weight: 500; letter-spacing: -0.02em; }
.dash-greeting .date { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

.kid-card {
  margin: 0 22px 12px;
  padding: 18px;
  border-radius: var(--radius-lg);
  display: flex; gap: 14px; align-items: center;
  background: var(--white); border: 1px solid var(--cloud);
  width: calc(100% - 44px);
  text-align: left;
}
.kid-card .info { flex: 1; }
.kid-card .name { font-family: 'Bricolage Grotesque', sans-serif; font-size: 17px; font-weight: 500; }
.kid-card .meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.kid-card .progress { display: flex; align-items: center; gap: 8px; }
.kid-card .bar { flex: 1; height: 6px; background: var(--bg); border-radius: 100px; overflow: hidden; }
.kid-card .bar .fill { height: 100%; border-radius: 100px; background: var(--teal); }
.kid-card .stat { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.kid-card .chev { color: var(--ink-soft); font-size: 18px; }

.dash-section { padding: 16px 22px 0; }
.dash-section .label {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 10px; font-weight: 600;
}
.empty-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}
.empty-card strong { color: var(--ink); display: block; margin-bottom: 4px; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 500; font-size: 15px; }

.action-tile {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
}
.action-tile .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sun); flex-shrink: 0; }
.action-tile .txt { flex: 1; }
.action-tile .what { font-size: 13px; font-weight: 600; }
.action-tile .when { font-size: 11px; color: var(--ink-soft); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--cloud);
  display: flex; justify-content: space-around;
  padding: 12px 8px 22px;
  max-width: var(--app-w);
  margin: 0 auto;
}
.bottom-nav .item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; color: var(--ink-soft); letter-spacing: 0.04em;
  font-weight: 600;
}
.bottom-nav .item .ic { font-size: 18px; }
.bottom-nav .item.active { color: var(--teal-deep); }

/* ===== DANI'S TODAY ===== */
.today-head { padding: 20px 22px 14px; }
.today-head .hello { font-family: 'Bricolage Grotesque', sans-serif; font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.calm-note {
  display: inline-flex; gap: 8px; align-items: center;
  margin-top: 12px;
  background: var(--teal-soft);
  padding: 10px 14px;
  border-radius: 100px;
  font-size: 12px; color: var(--teal-deep); font-weight: 500;
}
.section-lbl {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600;
  padding: 16px 22px 8px;
}
.chunk {
  margin: 0 22px 10px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--cloud);
  border-radius: var(--radius);
  display: flex; gap: 12px; align-items: center;
  width: calc(100% - 44px);
  text-align: left;
}
.chunk.locked { opacity: 0.55; }
.chunk.done { background: var(--teal-mist); border-color: var(--teal-soft); }
.chunk.overdue { border-color: var(--coral); background: var(--coral-soft); }
.chunk.overdue .ic { background: var(--coral); color: white; }
.chunk .ic {
  width: 38px; height: 38px;
  background: var(--bg);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.chunk.done .ic { background: var(--teal); color: white; }
.chunk .info { flex: 1; }
.chunk .name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.chunk .meta { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.chunk .play {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.chunk.locked .play { background: var(--cloud); color: var(--ink-soft); }

/* ===== DEVICE PAIRING ===== */
.pair-code {
  font-family: 'JetBrains Mono', 'Bricolage Grotesque', monospace;
  font-size: 48px;
  letter-spacing: 0.16em;
  text-align: center;
  background: var(--teal-mist);
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  margin: 18px 0;
  color: var(--teal-deep);
  font-weight: 600;
}
.pair-expiry { text-align: center; color: var(--ink-soft); font-size: 12px; margin-bottom: 18px; }

/* ===== LOADING ===== */
.loading {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 13px;
}
.spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--cloud);
  border-top-color: var(--teal);
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
.loading-block { display: flex; flex-direction: column; align-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== UTILITY ===== */
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.mt-auto { margin-top: auto; }
.hidden { display: none !important; }

/* The update banner/scrim style themselves from assets/js/update-check.js
   (Kelderhof-style), injected at runtime — nothing to define here. */

/* Kid Today — log out (paired device only) */
.kid-footer { text-align: center; padding: 28px 0 40px; }
.kid-logout {
  border: 1px solid var(--cloud);
  background: var(--white);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 12px;
  cursor: pointer;
}
.kid-logout:hover { color: var(--coral); border-color: var(--coral-soft); }

/* ===== RESPONSIVE — tablet & desktop ===== */
/* On tablet/desktop the app stretches edge-to-edge to fill the whole window:
   --app-w goes to 100% (so #app and the fixed nav/banner all span full width)
   and the centering shadow is dropped. Mobile (<768px) is untouched. */
@media (min-width: 768px) {
  :root { --app-w: 100%; }
  #app { max-width: 100%; box-shadow: none; }
  .bottom-nav { max-width: 100%; }
}

/* Exam plan — compact, quiet schedule tools */
.tool-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--cloud);
  color: var(--ink-soft);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.tool-btn:hover { border-color: var(--ink-faint); }
.tool-btn:disabled { opacity: 0.55; cursor: default; }
.tool-btn-danger { color: var(--coral); }
.tool-btn-danger:hover { border-color: var(--coral-soft); background: var(--coral-soft); }

/* Info icon + popover (exam plan tools). Hover-reveal on desktop only; tap to
   toggle on touch via .open. */
.info-tip { position: relative; flex: 0 0 auto; display: flex; align-items: center; }
.info-icon {
  width: 36px; align-self: stretch; min-height: 36px;
  border-radius: 10px; border: 1px solid var(--cloud); background: var(--white);
  color: var(--ink-soft); font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.info-icon:hover { border-color: var(--ink-faint); color: var(--ink); }
.info-pop {
  display: none;
  position: absolute; right: 0; bottom: calc(100% + 8px);
  width: 270px; max-width: 78vw;
  background: var(--ink); color: #fff;
  border-radius: 12px; padding: 12px 14px;
  font-size: 12px; line-height: 1.45; text-align: left;
  box-shadow: var(--shadow-lift); z-index: 50;
}
.info-pop strong { color: #fff; }
.info-tip.open .info-pop { display: block; }
@media (hover: hover) {
  .info-tip:hover .info-pop { display: block; }
}

/* ===== SIDEBAR / DRAWER NAV (Slices 1 & 2) ===== */
/* Hidden unless on a parent surface (JS toggles .is-visible). */
.cb-sidenav { display: none; }
.cb-sidenav.is-visible { display: flex; flex-direction: column; background: var(--bg); }

/* Desktop: fixed left sidebar; content shifts right. Top bar + scrim hidden. */
@media (min-width: 861px) {
  .cb-sidenav.is-visible {
    position: fixed; top: 0; left: 0; bottom: 0; width: 248px; z-index: 900;
    border-right: 1px solid var(--cloud); padding: 20px 14px;
    transform: none;
  }
  body.has-sidenav #app {
    margin-left: 248px; margin-right: 0;
    max-width: none; width: calc(100% - 248px);
  }
  .cb-topbar, .cb-scrim, .cb-drawer-close { display: none !important; }
}

/* Mobile: sticky top bar + slide-in drawer over a scrim. */
@media (max-width: 860px) {
  .cb-topbar { display: none; }
  body.has-sidenav .cb-topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 850;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    background: var(--bg-2); border-bottom: 1px solid var(--cloud);
  }
  .cb-hamburger {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--bg); color: var(--ink); font-size: 18px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .cb-topbar-name { font-family: 'Lato', 'Noto Sans', sans-serif; font-size: 18px; font-weight: 800; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; }
  .cb-topbar-name .logo-mark svg { display: block; }

  .cb-sidenav.is-visible {
    position: fixed; top: 0; left: 0; bottom: 0; width: 272px; z-index: 1200;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 16px;
    border-right: 1px solid var(--cloud);
    transform: translateX(-100%); transition: transform 0.25s ease;
    box-shadow: var(--shadow-lift);
  }
  body.drawer-open .cb-sidenav.is-visible { transform: translateX(0); }

  .cb-scrim {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(26, 31, 54, 0.45);
    opacity: 0; visibility: hidden; transition: opacity 0.25s ease;
  }
  body.drawer-open .cb-scrim { opacity: 1; visibility: visible; }

  .cb-drawer-close {
    align-self: flex-end;
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--bg); color: var(--ink-soft); font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 4px;
  }
}

/* No slide animation for reduced-motion users. */
@media (prefers-reduced-motion: reduce) {
  .cb-sidenav.is-visible, .cb-scrim { transition: none; }
}

.cb-sidenav-brand { padding: 6px 10px 16px; display: flex; align-items: center; gap: 10px; }
.cb-sidenav-brand .logo-mark svg { display: block; }
.cb-sidenav-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.cb-sidenav-name { font-family: 'Bricolage Grotesque', sans-serif; font-size: 20px; font-weight: 600; color: var(--ink); }
.cb-sidenav-ver { font-size: 11px; color: var(--ink-soft); letter-spacing: 0.08em; margin-top: 2px; }
.cb-sidenav-list { display: flex; flex-direction: column; gap: 4px; }
.cb-sidenav-item {
  display: block; padding: 10px 12px; border-radius: 10px;
  color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none;
}
.cb-sidenav-item:hover { background: var(--white); }
.cb-sidenav-item.active { background: var(--teal-mist); color: var(--teal-deep); }
.cb-sidenav-divider { height: 1px; background: var(--cloud); margin: 8px 8px; }
.cb-sidenav-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 10px 2px; border-top: 1px solid var(--cloud);
}
.cb-sidenav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.cb-sidenav-uname { font-size: 13px; font-weight: 600; color: var(--ink); }

/* Visible keyboard focus across the app (accessibility spec §5) */
a:focus-visible, button:focus-visible, .cb-sidenav-item:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}

/* ===== Home + Quick actions + section screens (Slices 4-7) ===== */
/* Child card: "Finish setup ›" replaces the bare arrow */
.kid-card .finish-setup {
  flex-shrink: 0; align-self: center;
  color: var(--teal-deep); font-size: 13px; font-weight: 600; white-space: nowrap;
}

/* "View quick actions" button on Home */
.quick-actions-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--teal-mist); border: 1px solid var(--teal-soft);
  color: var(--teal-deep); font-weight: 600; font-size: 15px;
  text-decoration: none;
}
.quick-actions-btn .qa-ic { font-size: 20px; }
.quick-actions-btn .qa-label { flex: 1; }
.quick-actions-btn .qa-arrow { font-size: 18px; opacity: 0.8; }

/* Quick actions screen — two actions side by side, stacked on mobile */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .qa-grid { grid-template-columns: 1fr; } }

/* Text back link ("‹ Home") */
.text-back {
  display: inline-block; margin-bottom: 6px;
  color: var(--ink-soft); font-size: 13px; font-weight: 600;
}
.text-back:hover { color: var(--teal-deep); }

/* Dashed "new" tile keeps its row shape but no chevron */
.action-tile-dashed { border-style: dashed; }

/* ===== Schedule calendar ===== */
.cal { margin-bottom: 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-family: 'Bricolage Grotesque', sans-serif; font-size: 15px; font-weight: 600; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button {
  width: 30px; height: 30px; border-radius: 8px; background: var(--bg);
  color: var(--ink-soft); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cal-dow-row, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 10px; color: var(--ink-faint); font-weight: 700; padding-bottom: 4px; }
/* Hide the native scrollbar on horizontal chip rows (filter pills).
   Keeps swipe-to-scroll but removes the ugly bar on mobile. */
.cb-chip-row {
  scrollbar-width: none;         /* Firefox */
  -ms-overflow-style: none;      /* IE 10+ */
  -webkit-overflow-scrolling: touch;
}
.cb-chip-row::-webkit-scrollbar { display: none; width: 0; height: 0; }

.cal-cell {
  aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid transparent;
  background: var(--bg); cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; color: var(--ink);
}
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.today { border-color: var(--teal); font-weight: 700; }
.cal-cell.selected { background: var(--teal); color: #fff; }
.cal-cell .cal-badge {
  font-size: 9px; font-weight: 700; line-height: 1.4;
  padding: 0 5px; border-radius: 100px;
  background: var(--teal-soft); color: var(--teal-deep);
}
.cal-cell.overdue .cal-badge { background: var(--coral-soft); color: #8B3A3A; }
.cal-cell.selected .cal-badge { background: rgba(255,255,255,0.3); color: #fff; }

/* ===== Exam plans — grouped by child + per-exam countdowns ===== */
.exam-child {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 18px; font-weight: 600; color: var(--ink);
  margin-bottom: 8px;
}
/* Countdowns flow horizontally, wrapping to new rows; each exam a compact box. */
.exam-cd-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.exam-cd-item {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg); border: 1px solid var(--cloud);
  border-radius: var(--radius); padding: 8px 12px; min-width: 118px;
}
.exam-cd-name { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.exam-cd-days { font-size: 14px; font-weight: 700; white-space: nowrap; }

/* Exam plan row: tile + archive button side by side */
.exam-plan-row { display: flex; align-items: stretch; gap: 8px; margin-bottom: 8px; }
.exam-archive-btn {
  flex-shrink: 0; align-self: stretch;
  padding: 0 14px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--cloud);
  color: var(--ink-soft); font-size: 12px; font-weight: 600; cursor: pointer;
}
.exam-archive-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.exam-archive-btn:disabled { opacity: 0.6; cursor: default; }

/* Exam paper — link to a subject */
.paper-subject {
  margin-top: 3px; max-width: 100%;
  font-size: 11px; color: var(--teal-deep); font-weight: 600;
  background: var(--bg); border: 1px solid var(--cloud); border-radius: 8px;
  padding: 3px 6px; cursor: pointer;
}
