/* ═══════════════════════════════════════════════════════════════
   FamilyForce Scout — Dashboard Styles
   Shared across all /scout-dashboard/* pages.
   Design tokens inherited from FamilyForce system — no new tokens.
   ═══════════════════════════════════════════════════════════════ */

/* ─── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  --bg:              #FAFAFA;
  --surface:         #FFFFFF;
  --elevated:        #F4F2F9;
  --border:          #E5E2EC;
  --border-light:    #EDEBF2;
  --text:            #1D1D1F;
  --text-mid:        #5C5960;
  --text-dim:        #8A879A;
  --text-ghost:      #B0AEBC;
  --terra:           #6E4ED6;
  --terra-dark:      #5B3CC4;
  --terra-tint:      #F0EBFF;
  --terra-deep:      #3D2A9E;
  --green:           #22C55E;
  --green-tint:      #F0FDF4;
  --amber:           #F59E0B;
  --amber-tint:      #FFFBEB;
  --red:             #EF4444;
  --red-tint:        #FEF2F2;
  --blue:            #3B82F6;
  --blue-tint:       #EFF6FF;
  --sans:            'Outfit', system-ui, sans-serif;
  --serif:           'Instrument Serif', Georgia, serif;
  --radius-card:     16px;
  --radius-pill:     100px;
  --shadow-card:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-modal:    0 20px 60px rgba(0,0,0,.18);
  --sidebar-w:       240px;
  --nav-bottom-h:    60px;
  --transition:      .15s ease;
}

/* ─── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--sans); cursor: pointer; border: none; background: none; }
img { max-width: 100%; }
input, textarea, select { font-family: var(--sans); }

/* ─── LAYOUT ─────────────────────────────────────────────────────────────── */
.scout-layout {
  display: flex;
  min-height: 100dvh;
}

/* Sidebar */
.scout-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  z-index: 50;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 9px;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.sidebar-logo-mark {
  width: 30px; height: 30px;
  background: var(--terra); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-logo-mark svg { width: 14px; height: 14px; fill: #fff; }
.sidebar-logo-name { font-size: 15px; font-weight: 700; color: var(--text); }
.sidebar-logo-product { font-size: 13px; font-weight: 500; color: var(--terra); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Child selector */
.sidebar-child {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.child-selector {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
}
.child-selector:hover { border-color: var(--terra); }
.child-selector-arrow { color: var(--text-dim); font-size: 12px; }
.child-dropdown {
  position: absolute;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-modal);
  z-index: 200;
  min-width: 200px;
  overflow: hidden;
  display: none;
}
.child-dropdown.open { display: block; }
.child-dropdown-item {
  padding: 11px 16px;
  font-size: 14px; color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}
.child-dropdown-item:hover { background: var(--bg); }
.child-dropdown-item.active { color: var(--terra); font-weight: 600; }
.child-dropdown-item.add { color: var(--terra); border-top: 1px solid var(--border); }

/* Nav links */
.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  font-size: 14px; font-weight: 500; color: var(--text-mid);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-nav-item:hover { color: var(--text); background: var(--bg); }
.sidebar-nav-item.active { color: var(--terra); font-weight: 600; border-left-color: var(--terra); background: var(--terra-tint); }
.sidebar-nav-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.sidebar-nav-item .nav-icon { width: 20px; text-align: center; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
/* ─── NAV SVG ICONS ──────────────────────────────────────────────────────── */
.nav-icon svg, .bottom-nav-icon svg {
  width: 20px; height: 20px;
  display: block;
  flex-shrink: 0;
}
.bottom-nav-item { min-width: 44px; }



/* Sidebar divider */
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 20px; }

/* Trial banner in sidebar */
.sidebar-trial {
  margin: 12px 14px 0;
  background: var(--terra-tint);
  border-radius: 12px;
  padding: 12px 14px;
}
.sidebar-trial-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--terra); margin-bottom: 4px; }
.sidebar-trial-text { font-size: 12px; color: var(--text-mid); line-height: 1.5; }
.sidebar-trial-link { font-size: 12px; font-weight: 600; color: var(--terra); display: block; margin-top: 8px; }

/* Main content */
.scout-main {
  flex: 1;
  min-width: 0;
  padding: 32px 32px 80px;
  max-width: 900px;
}

/* ─── MOBILE BOTTOM NAV ──────────────────────────────────────────────────── */
.scout-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.bottom-nav-inner {
  display: flex; height: var(--nav-bottom-h);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-decoration: none; cursor: pointer;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active { color: var(--terra); }
.bottom-nav-icon { font-size: 20px; line-height: 1; }

/* ─── PAGE HEADER ────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header-child {
  font-family: var(--serif); font-size: 28px; font-weight: 400;
  color: var(--text); line-height: 1.2; margin-bottom: 4px;
}
.page-header-age { font-size: 15px; color: var(--text-mid); margin-bottom: 16px; }
.page-header-meta { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.page-header-meta a { color: var(--terra); }

/* Progress bar */
.progress-bar-wrap { margin-bottom: 4px; }
.progress-bar-track {
  height: 6px; background: var(--border); border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--terra); border-radius: var(--radius-pill);
  transition: width .4s ease;
}
@media (prefers-reduced-motion: reduce) { .progress-bar-fill { transition: none; } }
.progress-bar-label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* Mobile child pill header */
.mobile-child-header {
  display: none;
  align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.mobile-child-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-pill); padding: 6px 14px;
  font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer;
}
.mobile-child-pill-arrow { font-size: 11px; color: var(--text-dim); }

/* ─── WELCOME STATE ──────────────────────────────────────────────────────── */
.welcome-card {
  background: var(--indigo-deep, #1E1248);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  margin-bottom: 24px;
}
.welcome-card-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.3;
}
.welcome-card-text { font-size: 14px; color: rgba(255,255,255,.65); line-height: 1.7; }
.welcome-card-text strong { color: rgba(255,255,255,.9); }

/* ─── HEADS UP BANNER (inside closing section) ───────────────────────────── */
.heads-up-banner {
  background: var(--amber-bg, #FFFBEB);
  border: 1px solid var(--amber-border, #FDE68A);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--amber, #B45309);
  line-height: 1.6;
  margin-bottom: 14px;
}

/* ─── THE MOVE BOX (inside window cards) ─────────────────────────────────── */
.card-move {
  background: var(--terra-tint);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.card-move-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--terra);
  margin-bottom: 5px;
}
.card-move-text { font-size: 13px; color: var(--text); line-height: 1.6; }

/* ─── PREP BOX (inside preview window cards) ─────────────────────────────── */
.card-prep {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.card-prep-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.card-prep-text { font-size: 13px; color: var(--text-mid); line-height: 1.6; }

/* ─── FAMILY CIRCLE STREAK ───────────────────────────────────────────────── */
.family-streak {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
}
.family-streak-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.family-streak-title { font-weight: 600; color: #16A34A; margin-bottom: 2px; }
.family-streak-sub { color: var(--text-mid); }

/* ─── TRIAL BANNER (top of page) ─────────────────────────────────────────── */
.trial-banner {
  background: var(--terra-tint);
  border-radius: var(--radius-card);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.trial-banner-text { font-size: 14px; color: var(--terra-dark); }
.trial-banner-link { font-size: 14px; font-weight: 600; color: var(--terra); white-space: nowrap; }
.trial-banner-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 16px; padding: 0 4px; flex-shrink: 0; }

/* ─── SECTION HEADERS ────────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; margin-top: 28px;
}
.section-header:first-child { margin-top: 0; }
.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.section-label-closing { color: var(--amber, #B45309); }
.section-label-month   { color: var(--text-mid); }
.section-label-coming  { color: var(--text-dim); }
.section-label-done    { color: var(--text-dim); }
.section-label-habits  { color: var(--text-dim); }
.section-count { font-size: 12px; color: var(--text-ghost); }
.section-empty   { font-size: 14px; color: var(--text-dim); padding: 12px 0; }
.section-framing { font-size: 13px; color: var(--text-dim); padding: 10px 0 14px; line-height: 1.5; }

/* Good habits this month */
.habit-grid { display: flex; flex-direction: column; gap: 8px; }
.habit-card { display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.habit-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.habit-body { flex: 1; min-width: 0; }
.habit-title { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--text-main); line-height: 1.4; }
.habit-sub   { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ─── WINDOW CARD GRID ───────────────────────────────────────────────────── */
.window-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ─── WINDOW CARD ────────────────────────────────────────────────────────── */
.window-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
@media (hover: hover) {
  .window-card:hover { border-color: #D3CEED; box-shadow: 0 4px 12px rgba(110,78,214,.08); }
}
/* Card state variants */
.window-card.state-in-progress {
  border-left: 3px solid var(--amber);
  background: var(--amber-tint);
}
.window-card.state-done,
.window-card.state-skipped {
  opacity: .65;
}

.window-card.state-coming {
  border-color: var(--border-light);
  opacity: .8;
}
.window-card.state-missed-clinical {
  border-left: 3px solid var(--red);
}
/* in_progress window whose developmental window has since closed — elevated urgency */
.window-card.state-overdue {
  border-left: 3px solid #D97706;
  background: #FFFBEB;
}
.card-overdue-label {
  font-size: 12px; font-weight: 600; color: #D97706;
  margin-bottom: 8px;
}

/* Card header row */
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-badges { display: flex; flex-wrap: wrap; gap: 5px; }

/* Urgency badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  line-height: 1.4; white-space: nowrap;
}
.badge-advisory  { background: var(--elevated);   color: var(--text-dim); }
.badge-screening { background: var(--blue-tint);   color: var(--blue); }
.badge-clinical  { background: var(--red-tint);    color: var(--red); }
.badge-category  { background: var(--bg);          color: var(--text-dim); border: 1px solid var(--border); }

/* Expand icon */
.card-expand {
  background: none; border: none; padding: 2px 4px;
  color: var(--text-dim); font-size: 16px; cursor: pointer; flex-shrink: 0;
  border-radius: 6px; transition: color var(--transition), background var(--transition);
  line-height: 1;
}
@media (hover: hover) { .card-expand:hover { color: var(--terra); background: var(--terra-tint); } }

/* Card title + hook */
.card-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 5px; line-height: 1.4;
  cursor: pointer;
}
.card-hook { font-size: 14px; color: var(--text-mid); line-height: 1.5; margin-bottom: 14px; }
.card-missed-label { font-size: 12px; font-weight: 500; color: var(--amber, #B45309); margin-bottom: 8px; }

/* Action buttons */
.card-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.action-btn {
  min-height: 44px; padding: 0 14px;
  border-radius: var(--radius-pill);
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-mid);
  cursor: pointer; transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 5px;
}
@media (hover: hover) { .action-btn:hover { border-color: var(--text-dim); color: var(--text); } }
.action-btn.active-done     { background: var(--green);  border-color: var(--green);  color: #fff; }
.action-btn.active-progress { background: var(--amber);  border-color: var(--amber);  color: #fff; }
.action-btn.active-skip     { background: var(--text-dim); border-color: var(--text-dim); color: #fff; }
.action-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Note button */
.note-btn {
  background: none; border: none; padding: 0;
  font-size: 13px; color: var(--text-dim); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: color var(--transition);
}
@media (hover: hover) { .note-btn:hover { color: var(--terra); } }
/* Note inline preview (replaces dot indicator) */
.note-inline {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 10px; cursor: pointer;
}
.note-inline-icon { font-size: 13px; flex-shrink: 0; margin-top: 1px; }
.note-inline-text {
  flex: 1; font-size: 13px; color: var(--text-mid); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-inline-edit {
  flex-shrink: 0; background: none; border: none; padding: 0;
  font-size: 12px; color: var(--terra); font-weight: 600; cursor: pointer;
  font-family: var(--sans); white-space: nowrap; margin-top: 2px;
}
@media (hover: hover) { .note-inline-edit:hover { text-decoration: underline; } }

/* Note inline editor */
.note-editor { margin-top: 10px; display: none; }
.note-editor.open { display: block; }
.note-textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: var(--sans); font-size: 13px; color: var(--text);
  background: var(--surface); outline: none; resize: none; min-height: 60px; overflow: hidden;
  line-height: 1.5; transition: border-color var(--transition);
}
.note-textarea:focus { border-color: var(--terra); }
.note-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; }
.note-char-count { font-size: 11px; color: var(--text-ghost); }
.note-status { font-size: 11px; color: var(--text-dim); }
.note-status.saving { color: var(--text-dim); }
.note-status.saved  { color: var(--green); }
.note-status.error  { color: var(--red); cursor: pointer; }

/* ─── DONE ACCORDION ─────────────────────────────────────────────────────── */
.done-accordion { margin-top: 28px; }
.done-accordion-header {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 10px 0; border-top: 1px solid var(--border);
  user-select: none;
}
.done-accordion-label { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.done-accordion-arrow { font-size: 12px; color: var(--text-ghost); transition: transform var(--transition); }
.done-accordion.open .done-accordion-arrow { transform: rotate(180deg); }
.done-accordion-body { display: none; padding-top: 14px; }
.done-accordion.open .done-accordion-body { display: block; }

/* ─── PAYWALL CARD ───────────────────────────────────────────────────────── */
.paywall-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
  margin-top: 28px;
}
.paywall-title { font-family: var(--serif); font-size: 20px; font-weight: 400; color: var(--text); margin-bottom: 6px; line-height: 1.3; }
.paywall-sub { font-size: 14px; color: var(--text-mid); margin-bottom: 20px; line-height: 1.65; }
.paywall-note { font-size: 12px; color: var(--text-dim); margin-top: 12px; line-height: 1.6; }
.paywall-blur-row { display: flex; gap: 8px; margin-bottom: 20px; }
.paywall-blur-pill {
  background: var(--elevated); border-radius: var(--radius-pill);
  padding: 6px 14px; font-size: 13px; color: transparent;
  filter: blur(4px); opacity: .3; user-select: none;
}
.paywall-plans { display: flex; flex-direction: column; gap: 10px; }
.paywall-plan-btn {
  width: 100%; padding: 14px 18px;
  border-radius: 12px; cursor: pointer;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
  transition: all var(--transition);
}
.paywall-plan-annual {
  background: var(--terra); color: #fff; border: 2px solid var(--terra);
}
@media (hover: hover) { .paywall-plan-annual:hover { background: var(--terra-dark); border-color: var(--terra-dark); } }
.paywall-plan-monthly {
  background: var(--surface); color: var(--terra);
  border: 2px solid var(--terra);
}
@media (hover: hover) { .paywall-plan-monthly:hover { background: var(--terra-tint); } }
.paywall-plan-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  background: rgba(255,255,255,.25); color: #fff;
  padding: 2px 8px; border-radius: var(--radius-pill);
}

/* ─── WINDOW DETAIL MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%; max-height: 90dvh;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 24px 40px;
  transform: translateY(100%); transition: transform .25s ease;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: var(--radius-pill); margin: 0 auto 20px;
}
.modal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-mid); cursor: pointer; flex-shrink: 0;
  transition: all var(--transition);
}
@media (hover: hover) { .modal-close:hover { background: var(--border); color: var(--text); } }
.modal-title { font-family: var(--serif); font-size: 22px; font-weight: 400; line-height: 1.3; color: var(--text); }
.modal-age { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.modal-section { margin-top: 22px; }
.modal-section-header {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); padding-bottom: 8px; border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.modal-body-text { font-size: 15px; color: var(--text); line-height: 1.7; }
.modal-source { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.modal-playbook-link { font-size: 14px; font-weight: 500; color: var(--terra); margin-top: 8px; display: block; }
.modal-note-display {
  background: var(--elevated); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; color: var(--text-mid); line-height: 1.6;
  margin-bottom: 8px;
}
.modal-note-attr { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.modal-note-edit-btn {
  font-size: 13px; color: var(--terra); font-weight: 500; cursor: pointer;
  background: none; border: none;
}

/* Desktop modal centred */
@media (min-width: 900px) {
  .modal-overlay { align-items: center; }
  .modal-sheet {
    border-radius: 24px;
    width: 100%; max-width: 600px; max-height: 80dvh;
    transform: scale(.95) translateY(0);
  }
  .modal-overlay.open .modal-sheet { transform: scale(1); }
  .modal-handle { display: none; }
}

/* ─── TOAST ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: calc(70px + env(safe-area-inset-bottom)); right: 16px;
  z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
@media (min-width: 900px) { .toast-container { bottom: 24px; } }
.toast {
  background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: 280px;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: all; }
.toast.success { background: #15803D; }
.toast.error   { background: var(--red); }

/* ─── HISTORY SCREEN ─────────────────────────────────────────────────────── */
.history-search {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: var(--sans); font-size: 14px; color: var(--text);
  background: var(--surface); outline: none; margin-bottom: 24px;
  transition: border-color var(--transition);
}
.history-search:focus { border-color: var(--terra); }
.history-month { border: 1.5px solid var(--border); border-radius: var(--radius-card); margin-bottom: 12px; overflow: hidden; }
.history-month-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; cursor: pointer; background: var(--surface);
  transition: background var(--transition);
}
@media (hover: hover) { .history-month-header:hover { background: var(--bg); } }
.history-month-left h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.history-month-left p { font-size: 13px; color: var(--text-mid); margin-top: 2px; }
.history-month-right { display: flex; align-items: center; gap: 12px; }
.history-month-stat { font-size: 12px; color: var(--text-dim); }
.history-month-arrow { font-size: 13px; color: var(--text-ghost); transition: transform var(--transition); }
.history-month.open .history-month-arrow { transform: rotate(180deg); }
.history-month-body { display: none; border-top: 1px solid var(--border); }
.history-month.open .history-month-body { display: block; }
.history-window-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border-light);
}
.history-window-row:last-child { border-bottom: none; }
.history-window-status { flex-shrink: 0; margin-top: 2px; }
.history-window-info { flex: 1; min-width: 0; }
.history-window-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.history-window-note { font-size: 13px; color: var(--text-mid); line-height: 1.5; margin-top: 4px; }
.history-window-note-more { font-size: 12px; color: var(--terra); cursor: pointer; }

/* ─── SETTINGS SCREEN ────────────────────────────────────────────────────── */
.settings-section { margin-bottom: 32px; }
.settings-section-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 16px; }
.settings-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 14px; font-weight: 500; color: var(--text); }
.settings-row-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.settings-row-value { font-size: 14px; color: var(--text-mid); text-align: right; }
.settings-row-link { font-size: 14px; font-weight: 500; color: var(--terra); }
.settings-row-danger { color: var(--red); }
/* Toggle switch */
.toggle { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border); border-radius: 26px;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle input:checked + .toggle-slider { background: var(--terra); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── FAMILY CIRCLE ──────────────────────────────────────────────────────── */
.family-invite-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-card); padding: 24px; margin-bottom: 20px; }
.family-invite-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.family-invite-sub { font-size: 14px; color: var(--text-mid); line-height: 1.6; margin-bottom: 18px; }
.family-member-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--border-light);
}
.family-member-row:last-child { border-bottom: none; }
.family-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--terra-tint); color: var(--terra);
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.family-member-info { flex: 1; }
.family-member-name { font-size: 14px; font-weight: 600; color: var(--text); }
.family-member-role { font-size: 13px; color: var(--text-dim); }
.family-member-status { font-size: 12px; color: var(--text-dim); }
.family-member-status.pending { color: var(--amber); }
.family-leave-btn { font-size: 13px; color: var(--red); cursor: pointer; background: none; border: none; font-weight: 500; min-height: 44px; padding: 0 8px; }

/* ─── CHILD PROFILE ──────────────────────────────────────────────────────── */
.child-form { max-width: 480px; }
.form-field { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-mid); margin-bottom: 7px; }
.form-label-hint { font-weight: 400; color: var(--text-dim); }
.form-input {
  width: 100%; padding: 13px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: var(--sans); font-size: 15px; color: var(--text);
  background: var(--surface); outline: none;
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--terra); }
.form-hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; line-height: 1.5; }
/* Gender pills */
.gender-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.gender-pill {
  padding: 9px 18px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border); background: var(--surface);
  font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--text-mid);
  cursor: pointer; transition: all var(--transition);
}
.gender-pill:hover { border-color: var(--terra); color: var(--terra); }
.gender-pill.selected { background: var(--terra); border-color: var(--terra); color: #fff; }
.form-error { font-size: 13px; color: var(--red); margin-top: 6px; display: none; }
.form-error.show { display: block; }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: var(--radius-pill);
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); border: none;
}
.btn-primary { background: var(--terra); color: #fff; }
@media (hover: hover) { .btn-primary:hover { background: var(--terra-dark); } }
.btn-secondary { background: var(--surface); color: var(--terra); border: 1.5px solid var(--terra); }
@media (hover: hover) { .btn-secondary:hover { background: var(--terra-tint); } }
.btn-danger { background: var(--surface); color: var(--red); border: 1.5px solid var(--red); }
@media (hover: hover) { .btn-danger:hover { background: var(--red-tint); } }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Delete confirm modal */
.confirm-modal {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.5);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.confirm-modal.open { display: flex; }
.confirm-modal-card {
  background: var(--surface); border-radius: var(--radius-card);
  padding: 28px; max-width: 400px; width: 100%;
  box-shadow: var(--shadow-modal);
}
.confirm-modal-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.confirm-modal-text { font-size: 14px; color: var(--text-mid); line-height: 1.6; margin-bottom: 24px; }
.confirm-modal-actions { display: flex; gap: 10px; }
.confirm-modal-actions .btn { flex: 1; }

/* ─── PAGE TITLE ─────────────────────────────────────────────────────────── */
.page-title { font-family: var(--serif); font-size: 26px; font-weight: 400; color: var(--text); margin-bottom: 24px; }
.page-back-link { display:inline-block; font-size:14px; color:var(--terra); font-weight:600; text-decoration:none; margin-bottom:12px; }
.page-back-link:hover { text-decoration:underline; }
.btn-cancel-link { font-size:14px; color:var(--text-dim); text-decoration:none; font-weight:500; cursor:pointer; }
.btn-cancel-link:hover { color:var(--text); text-decoration:underline; }

/* ─── LOADING STATE ──────────────────────────────────────────────────────── */
.loading-state { text-align: center; padding: 60px 0; color: var(--text-dim); font-size: 14px; }
.skeleton {
  background: var(--elevated);
  border-radius: 8px;
  animation: skeleton-pulse 1.4s ease infinite;
}
@keyframes skeleton-pulse { 0%,100%{opacity:1}50%{opacity:.5} }

/* ─── EMPTY / END STATE ──────────────────────────────────────────────────── */
.end-state {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-card); padding: 28px; text-align: center; margin-top: 24px;
}
.end-state-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.end-state-text { font-size: 14px; color: var(--text-mid); line-height: 1.6; }

/* ─── TOUCH TARGETS — always 44×44px minimum (WCAG 2.5.5) ───────────────── */
.card-expand {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.note-btn {
  min-height: 44px; padding: 0;
  display: inline-flex; align-items: center; gap: 5px;
}
.modal-close { width: 44px; height: 44px; }
.trial-banner-close { min-width: 44px; min-height: 44px; font-size: 18px; padding: 0; }
.section-header { min-height: 44px; }
.onboarding-banner-close { min-height: 44px; padding: 10px 18px; }
.history-month-header { min-height: 52px; }

/* ─── RESPONSIVE: TABLET ─────────────────────────────────────────────────── */
@media (max-width: 899px) {
  .scout-sidebar    { display: none; }
  .scout-bottom-nav { display: block; }
  .scout-main       {
    padding: 20px 16px calc(var(--nav-bottom-h) + env(safe-area-inset-bottom) + 16px);
    overscroll-behavior: contain;
  }
  .mobile-child-header { display: flex; }
  .paywall-blur-row { flex-wrap: wrap; }

  /* Fix #2: iOS auto-zoom — bump all inputs to 16px on mobile */
  .note-textarea   { font-size: 16px; }
  .history-search  { font-size: 16px; }
  .form-input      { font-size: 16px; }

  /* Fix #17: trial banner — proper stacking on mobile */
  .trial-banner {
    position: relative;
    flex-wrap: wrap;
    gap: 6px;
    padding-right: 44px; /* room for the ✕ */
  }
  .trial-banner-close {
    position: absolute; top: 50%; right: 8px;
    transform: translateY(-50%);
  }
  .trial-banner-text { flex: 1; min-width: 160px; }

  /* Fix #23: toast full-width on mobile */
  .toast-container { left: 16px; right: 16px; bottom: calc(var(--nav-bottom-h) + env(safe-area-inset-bottom) + 12px); }
  .toast { max-width: none; }

  /* Fix #20: settings rows stack on mobile */
  .settings-row { flex-wrap: wrap; row-gap: 6px; }
  .settings-row-value { text-align: left; }
}

/* Fix #5: bottom nav labels — 10px → 11px (legible minimum) */
.bottom-nav-item { font-size: 11px; }

/* Fix #19: bottom nav active state — color change only (pill removed) */

/* 2-col cards on tablet; 1-col only on small phones */
@media (max-width: 559px) {
  .window-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .scout-main { padding: 16px 12px calc(var(--nav-bottom-h) + env(safe-area-inset-bottom) + 12px); }
  .card-actions { gap: 5px; }
  .action-btn { min-height: 44px; padding: 0 10px; font-size: 12px; }

  /* Fix #13: page titles smaller on small phones */
  .page-title         { font-size: 22px; }
  .page-header-child  { font-size: 24px; }

  /* Fix #25: gender pills fill row on mobile */
  .gender-picker { gap: 8px; }
  .gender-pill   { flex: 1; text-align: center; justify-content: center; }

  /* Fix #9: card actions — allow tighter wrap before 3-col overflow */
  .card-actions { flex-wrap: wrap; }
}

/* Fix #10: history window titles — clamp to 2 lines */
.history-window-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── SEGMENTED PROGRESS BAR ─────────────────────────────────────────────── */
.progress-seg-track {
  height: 8px; border-radius: var(--radius-pill);
  background: var(--border); overflow: hidden;
  display: flex; gap: 2px; margin-bottom: 10px;
}
.progress-seg-green {
  height: 100%; background: var(--green); border-radius: var(--radius-pill);
  transition: width .5s ease; flex-shrink: 0;
}
.progress-seg-amber {
  height: 100%; background: var(--amber); border-radius: var(--radius-pill);
  transition: width .5s ease; flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
  .progress-seg-green, .progress-seg-amber { transition: none; }
}
.progress-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
}
.progress-legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-dim);
}
.progress-legend-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.progress-legend-dot.green  { background: var(--green); }
.progress-legend-dot.amber  { background: var(--amber); }
.progress-legend-dot.grey   { background: var(--border); }
.progress-legend-count { font-weight: 600; color: var(--text-mid); }

/* ─── DATE PICKER PROMPT ─────────────────────────────────────────────────── */
.date-prompt {
  display: none; align-items: center; gap: 8px;
  margin-top: 10px; padding: 8px 12px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 10px; animation: fadeIn .2s ease;
}
.date-prompt.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.date-prompt-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.date-prompt-input {
  border: none; background: none; font-family: var(--sans);
  font-size: 12px; font-weight: 600; color: var(--terra);
  cursor: pointer; outline: none; padding: 0;
}
.date-prompt-dismiss {
  margin-left: auto; font-size: 11px; color: var(--text-ghost);
  cursor: pointer; background: none; border: none; padding: 0 2px;
}

/* ─── CARD ATTRIBUTION ───────────────────────────────────────────────────── */
.card-attribution {
  font-size: 11px; color: var(--text-ghost);
  margin-top: 8px; display: flex; align-items: center; gap: 4px;
}
.card-attribution-name { color: var(--text-dim); font-weight: 500; }
.card-edit-date-btn { background:none; border:none; padding:0; font-size:12px; color:var(--terra); font-weight:500; cursor:pointer; font-family:inherit; text-decoration:underline; }
.card-edit-date-btn:hover { color:var(--text); }

/* ─── COLLAPSIBLE SECTIONS ───────────────────────────────────────────────── */
.section-header { cursor: pointer; user-select: none; }
.section-header:hover .section-label { opacity: .8; }
.section-toggle-arrow {
  font-size: 11px; color: var(--text-ghost);
  transition: transform var(--transition); margin-left: auto;
}
.section-collapsed .section-toggle-arrow { transform: rotate(-90deg); }
.section-body {
  overflow: hidden;
  transition: max-height .25s ease, opacity .2s ease;
  max-height: 4000px; opacity: 1;
}
.section-collapsed + .section-body {
  max-height: 0; opacity: 0; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .section-body { transition: none; }
}

/* ─── Load error state ─────────────────────────────────────── */
.error-state {
  text-align: center; padding: 40px 20px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-card); margin-top: 20px;
}
.error-state-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.error-state-text  { font-size: 14px; color: var(--text-dim); }

/* ─── First-visit onboarding banner ───────────────────────── */
.onboarding-banner {
  background: var(--terra-tint); border: 1.5px solid var(--terra);
  border-radius: var(--radius-card); padding: 14px 18px;
  margin-bottom: 20px;
}
.onboarding-banner-inner {
  display: flex; align-items: flex-start; gap: 14px;
  justify-content: space-between;
}
.onboarding-banner-text {
  font-size: 14px; color: var(--text); line-height: 1.6; flex: 1;
}
.onboarding-banner-text strong { color: var(--terra); }
.onboarding-banner-close {
  flex-shrink: 0; padding: 5px 14px;
  background: var(--terra); color: #fff;
  border: none; border-radius: var(--radius-pill);
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap; align-self: flex-start;
  transition: background .15s;
}
@media (hover: hover) { .onboarding-banner-close:hover { background: var(--terra-dark); } }
@media (max-width: 480px) {
  .onboarding-banner-inner { flex-direction: column; gap: 10px; }
  .onboarding-banner-close { align-self: flex-start; }
}

/* ─── Lazy card reveal (IntersectionObserver) ─────────────────── */
/* Reduced motion: skip animation entirely */
@media (prefers-reduced-motion: no-preference) {
  .window-card.card-lazy {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .25s ease, transform .3s ease;
  }
  .window-card.card-lazy.card-visible {
    opacity: 1;
    transform: none;
  }
}

/* ─── SKELETON LOADING ───────────────────────────────────────────────────── */
@keyframes sk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.sk-line  { background: var(--border); border-radius: 6px; animation: sk-pulse 1.3s ease infinite; }
.sk-pill  { height: 30px; width: 80px; background: var(--border); border-radius: var(--radius-pill); animation: sk-pulse 1.3s ease infinite; }
.window-skeleton { pointer-events: none; }

/* ─── MOBILE CHILD DROPDOWN ──────────────────────────────────────────────── */
#mobileChildDropdown { min-width: 200px; }


/* ─── EARN TOAST (copy link / copied feedback) ──────────────────────────── */
.earn-toast {
  position: fixed; bottom: max(24px, env(safe-area-inset-bottom, 24px));
  left: 50%; transform: translateX(-50%) translateY(60px);
  background: #1D1D1F; color: #fff; padding: 10px 20px;
  border-radius: 24px; font-size: 13px; font-weight: 600;
  transition: transform .25s ease; white-space: nowrap;
  pointer-events: none; z-index: 9999;
}
.earn-toast.show { transform: translateX(-50%) translateY(0); }
@media (max-width: 768px) {
  .earn-toast { bottom: calc(var(--nav-bottom-h, 60px) + env(safe-area-inset-bottom, 0px) + 12px); }
}
