/* Light-theme pilot only: dark mode retains existing tested theme/layout tokens. */
/* Modern pilot: intentionally scoped; the released interface and theme preference
   are untouched unless ?ui=modern is present. All data/action mounts are retained. */
html[data-sage-ui="modern"]:not([data-theme="dark"]) { --modern-navy:#12233e; --modern-green:#69c5a7; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) body { background:#eef2f7; color:#182b45; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #appShell { --panel:#fff; --panel-2:#f5f7fa; --ink:#182b45; --muted:#54647b; --line:#dce3ec; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .app-top { background:#12233e; color:white; border:0; box-shadow:none; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .app-brand strong { color:#fff; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .app-brand span { color:#c6d3e6; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .app-brand img { background:white; border-radius:13px; padding:3px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .nav button { color:#d6dfec; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .nav button.active { background:#263c58; color:white; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #appShell main { max-width:1160px; padding-bottom:120px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .home-layout { display:block; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .agent-panel { background:radial-gradient(ellipse at 50% 30%,#24465a 0%,#12233e 70%); color:white; border:0; border-radius:0 0 32px 32px; padding:28px clamp(20px,5vw,52px); box-shadow:0 12px 32px #12233e12; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .panel-head { justify-content:center; text-align:center; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .agent-panel .panel-title { font-size:clamp(23px,4vw,32px); font-weight:650; color:white; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #talkHeroBtn { display:flex; flex-direction:column; gap:22px; width:100%; min-height:200px; padding:20px 12px 0; border:0; background:transparent; color:#fff; box-shadow:none; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #talkHeroIcon { display:grid; place-items:center; width:112px; height:112px; border:1px solid #b4f7dd; border-radius:50%; color:#123c38; background:radial-gradient(circle at 35% 28%,#cff9dc,#7cd4ac 42%,#49a699 80%); box-shadow:0 0 0 12px #77d6bd0c,0 0 0 25px #77d6bd08,0 0 40px #73d9be32; font-size:32px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #talkHeroIcon .ic { width:38px; height:38px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #talkHeroLabel { color:white; font-size:23px; font-weight:650; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #talkHeroBtn.listening #talkHeroIcon { outline:3px solid #f5c6ba; outline-offset:8px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #talkHeroBtn.speaking #talkHeroIcon { outline:3px solid #bfebff; outline-offset:8px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .modern-voice-description { max-width:390px; margin:12px auto 22px; text-align:center; line-height:1.6; color:#d3deec; font-size:16px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #voiceStatus { color:#e1f2ef; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .sage-type-row { gap:8px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .sage-type-row input { background:#fff; color:#172a43; border:1px solid #dce3ec; min-height:48px; border-radius:14px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .sage-type-row button { background:#d6f1e6; color:#173e35; min-height:48px; border-radius:14px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .home-scan-secondary { color:#d1deed; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .home-primary { gap:18px; margin-top:24px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .panel,html[data-sage-ui="modern"]:not([data-theme="dark"]) .mb-draft,html[data-sage-ui="modern"]:not([data-theme="dark"]) .mb-week,html[data-sage-ui="modern"]:not([data-theme="dark"]) .mb-groc,html[data-sage-ui="modern"]:not([data-theme="dark"]) .mb-profile,html[data-sage-ui="modern"]:not([data-theme="dark"]) .mb-scan { border-radius:22px; border:1px solid #dde4ed; box-shadow:0 5px 18px #172d4a05; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .modern-section-title { font-size:19px; margin:8px 0 0; color:#172a43; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #quickAccessGrid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .quick-access-item { background:#fff; border:1px solid #dce4ed; border-radius:18px; padding:16px 6px; min-width:0; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .qa-label { font-size:16px; overflow-wrap:anywhere; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-meals > .page-head,html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-more > .page-head { background:#12233e; color:#fff; padding:24px; border-radius:0 0 26px 26px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-meals > .page-head .page-title,html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-more > .page-head .page-title { color:#fff; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-meals > .page-head .page-copy,html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-more > .page-head .page-copy { color:#d3deec; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .sage-bar { background:#fff; border:1px solid #dce4ed; border-radius:18px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .mr-grid { gap:1px; padding:6px 16px; background:#fff; border:1px solid #dce4ed; border-radius:20px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .mr-tile { background:#fff; border:0; border-radius:0; box-shadow:none; border-bottom:1px solid #edf0f5; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .tabbar { background:#fff; border-top:1px solid #dce4ed; padding-bottom:env(safe-area-inset-bottom,0px); }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .tabbar button { color:#64748b; min-height:60px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .tabbar button.active { color:#12233e; font-weight:750; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) :is(button,a,input,select,textarea,summary):focus-visible { outline:3px solid #227d9f; outline-offset:4px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .agent-panel :is(button,a,input):focus-visible { outline-color:#b8f5dd; }
@media(max-width:899px){
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #appShell main { padding-left:14px; padding-right:14px; padding-bottom:calc(120px + env(safe-area-inset-bottom,0px)); }
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .agent-panel { margin:-1px -14px 0; }
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-meals > .page-head { flex-direction:column; align-items:stretch; gap:16px; }
 html[data-sage-ui="modern"]:not([data-theme="dark"]) .row-actions { flex-wrap:wrap; }
}
@media(min-width:900px){
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home.active { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:28px; align-items:start; }
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .agent-panel { border-radius:28px; }
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .home-primary { margin-top:0; }
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #captureReview { grid-column:1/-1; }
}
@media(prefers-reduced-motion:reduce){html[data-sage-ui="modern"]:not([data-theme="dark"]) #talkHeroBtn,html[data-sage-ui="modern"]:not([data-theme="dark"]) #talkHeroIcon{animation:none;transition:none;}}
html[data-sage-ui="modern"]:not([data-theme="dark"]) .agent-panel .assistant-log { background:#fff; color:#172a43; border:0; border-radius:18px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .agent-panel .suggestion { background:#fff; color:#172a43; border:1px solid #dce4ed; border-radius:18px; flex-wrap:wrap; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .agent-panel .suggestion .confirm-btn { min-height:44px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .agent-panel .location-access { background:#fff; color:#172a43; }
@media(min-width:900px){
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .home-layout { grid-row:1; }
 html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .home-primary { grid-row:1; }
}
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-home .agent-panel .panel-title { text-transform:none; letter-spacing:-.02em; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .agent-panel .assistant-log:empty { padding:0; }

html[data-sage-ui="modern"]:not([data-theme="dark"]) .sage-bar .sb-ic { color:#173e35; background:#e5f3ed; border-color:#c7ded5; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .sage-bar .sb-ic.listening { color:#fff; background:#b91c1c; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) .sage-bar .sb-ic.speaking { color:#fff; background:#174f65; }

/* Phone Talk lives on the raised tab-bar mic (sage-redesign.css). Do not shrink the hero mic to a 48px pill. */
@media (max-width:899px) {
  html[data-sage-ui="modern"] #section-home.modern-mobile-home > #dailyBriefCard { margin:0 0 16px; }
  html[data-sage-ui="modern"] #section-home.modern-mobile-home .agent-panel .panel-head,
  html[data-sage-ui="modern"] #section-home.modern-mobile-home .modern-voice-description { display:none; }
  html[data-sage-ui="modern"] #section-home.modern-mobile-home #talkHeroBtn { min-height:64px; }
}

/* Calendar: build on the existing planner and preserve its responsive breakpoints. */
html[data-sage-ui="modern"] #section-calendar > .page-head { padding:clamp(16px,3vw,24px); border-radius:0 0 26px 26px; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-calendar > .page-head { background:var(--modern-navy,#12233e); }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-calendar > .page-head .page-title { color:#fff; }
html[data-sage-ui="modern"]:not([data-theme="dark"]) #section-calendar > .page-head .page-copy { color:#d3deec; }
html[data-sage-ui="modern"][data-theme="dark"] #section-calendar > .page-head { background:var(--panel); border:1px solid var(--line); }
html[data-sage-ui="modern"] #section-calendar > .page-head .row-actions { gap:8px; flex-wrap:wrap; }
html[data-sage-ui="modern"] #section-calendar > .page-head .row-actions > button { min-height:44px; white-space:normal; }
html[data-sage-ui="modern"] #section-calendar > .page-head [data-action="openCalendarEventForm"] { background:#b8f5dd; color:#0d3027; border:1px solid #b8f5dd; font-weight:750; }
html[data-sage-ui="modern"] #section-calendar :is(button,a,input,select,summary):focus-visible { outline:2px solid #397eff; outline-offset:2px; }
html[data-sage-ui="modern"] #section-calendar :is(.cal-mini,.cal-week,.cal-sync,.cal-agenda-card) { border-radius:18px; }
html[data-sage-ui="modern"] #section-calendar .cal-filter-pill { min-height:44px; }
html[data-sage-ui="modern"] #section-calendar .cal-agenda-card { padding:14px; }
html[data-sage-ui="modern"] #section-calendar .cal-agenda-title { overflow-wrap:anywhere; font-size:16px; }
html[data-sage-ui="modern"] #section-calendar .cal-agenda-meta { font-size:16px; line-height:1.4; }
@media (max-width:600px) {
  html[data-sage-ui="modern"] #section-calendar > .page-head { flex-direction:column; align-items:stretch; gap:12px; }
  html[data-sage-ui="modern"] #section-calendar > .page-head .row-actions { justify-content:flex-start; }
  html[data-sage-ui="modern"] #section-calendar > .page-head [data-action="openCalendarEventForm"] { flex:1 0 100%; }
  html[data-sage-ui="modern"] #section-calendar .cal-filterbar { padding:3px; }
  html[data-sage-ui="modern"] #section-calendar .cal-agenda-chip { white-space:normal; }
}

/* Full-app preview. Shared chrome, surface rhythm and touch targets without
   reordering, hiding, or replacing the existing controls. */
html[data-sage-ui="modern"] {
  --preview-hero:#12233e;
  --preview-hero-end:#21465b;
  --preview-hero-copy:#e0eaf3;
  --preview-mint:#b8f5dd;
  --preview-mint-ink:#0d3027;
  --preview-focus:#227d9f;
  --preview-surface:var(--panel);
  --preview-soft:var(--panel-2);
  --preview-line:var(--line);
  --preview-space:clamp(12px,2vw,20px);
  --preview-radius:20px;
}
html[data-sage-ui="modern"][data-theme="dark"] {
  --preview-hero:#192d47;
  --preview-hero-end:#143a44;
  --preview-focus:#9fdbff;
}
html[data-sage-ui="modern"] #appShell main { min-width:0; }
html[data-sage-ui="modern"] #appShell main > .section { min-width:0; }
html[data-sage-ui="modern"] #appShell main > .section > .page-head {
  align-items:flex-start; border:1px solid #ffffff20; border-radius:22px;
  background:linear-gradient(125deg,var(--preview-hero),var(--preview-hero-end));
  color:white; padding:clamp(16px,3vw,27px); margin-bottom:var(--preview-space);
}
html[data-sage-ui="modern"] #appShell main > .section > .page-head > * { min-width:0; }
html[data-sage-ui="modern"] #appShell main > .section > .page-head .page-title {
  color:white; font-size:clamp(26px,4vw,37px); line-height:1.12; letter-spacing:-.035em;
  overflow-wrap:anywhere;
}
html[data-sage-ui="modern"] #appShell main > .section > .page-head .page-copy {
  color:var(--preview-hero-copy); line-height:1.5; max-width:60ch; overflow-wrap:anywhere;
}
html[data-sage-ui="modern"] #appShell main > .section > .page-head .row-actions { gap:8px; flex-wrap:wrap; }
html[data-sage-ui="modern"] #appShell main > .section > .page-head .row-actions > button {
  min-height:44px; max-width:100%; white-space:normal;
}
html[data-sage-ui="modern"] #appShell main > .section > .page-head .row-actions > button:not(.secondary):not(.ghost) {
  background:var(--preview-mint); border-color:var(--preview-mint); color:var(--preview-mint-ink);
}
html[data-sage-ui="modern"] #appShell main > .section > .page-head :is(button,a,input,select,textarea,summary):focus-visible {
  outline:3px solid var(--preview-mint); outline-offset:3px;
}
html[data-sage-ui="modern"] #appShell main > .section :is(.panel,.sage-bar) { border-radius:var(--preview-radius); }
html[data-sage-ui="modern"] #appShell main > .section :is(.empty,.row-meta) { overflow-wrap:anywhere; }
html[data-sage-ui="modern"] #appShell main > .section :is(.sage-bar input,.page-head input) { min-width:0; }
html[data-sage-ui="modern"][data-theme="dark"] #appShell .tabbar button.active { color:#c2f7e3; }
html[data-sage-ui="modern"] #appShell :is(button,a,input,select,textarea,summary):focus-visible {
  outline-color:var(--preview-focus);
}
html[data-sage-ui="modern"] #section-home .agent-panel :is(button,a,input):focus-visible { outline-color:var(--preview-mint); }
html[data-sage-ui="modern"] #section-meals .mb-board { gap:var(--preview-space); }
html[data-sage-ui="modern"] #section-meals :is(.mb-main,.mb-side,.mb-draft-head-copy) { min-width:0; }
html[data-sage-ui="modern"] #section-meals :is(.mb-draft,.mb-week,.mb-groc,.mb-profile,.mb-scan) { border-radius:var(--preview-radius); }
html[data-sage-ui="modern"] #section-meals :is(.mb-draft-head,.mb-week-head,.mb-foot) { gap:10px; flex-wrap:wrap; }
html[data-sage-ui="modern"] #section-meals :is(.mb-draft-title,.mb-week-title) { font-size:clamp(17px,2vw,22px); }
html[data-sage-ui="modern"] #section-more .mr-grid { gap:10px; padding:0; border:0; background:transparent; }
html[data-sage-ui="modern"] #section-more .mr-tile {
  min-width:0; min-height:72px; border:1px solid var(--preview-line); border-radius:16px;
  background:var(--preview-surface); padding:12px; text-align:left;
}
html[data-sage-ui="modern"] #section-more .mr-tile:hover { background:var(--preview-soft); }
html[data-sage-ui="modern"] #section-more :is(.mr-tile-name,.mr-tile-cap) { overflow-wrap:anywhere; }
html[data-sage-ui="modern"] #section-more :is(.mr-card,.mr-footer) { border-radius:var(--preview-radius); }
html[data-sage-ui="modern"] #section-more .mr-label { margin-top:clamp(16px,3vw,24px); letter-spacing:.07em; }
@media (max-width:600px) {
  html[data-sage-ui="modern"] #appShell main > .section > .page-head { flex-direction:column; }
  html[data-sage-ui="modern"] #appShell main > .section > .page-head .row-actions { width:100%; }
  html[data-sage-ui="modern"] #section-meals .mb-draft-head { align-items:flex-start; }
}

/* Existing reminder title is already one keyboard-focusable Edit button.
   A permanent visible label keeps the whole row tappable. */
html[data-sage-ui="modern"] #section-reminders .reminder-body {
  display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:10px; align-items:center;
}
html[data-sage-ui="modern"] #section-reminders .reminder-body > :is(.row-title,.row-meta) { grid-column:1; }
html[data-sage-ui="modern"] #section-reminders .reminder-body::after {
  content:"Edit"; grid-column:2; grid-row:1 / span 2; align-self:center;
  font-size:16px; font-weight:750; text-decoration:underline; text-underline-offset:.18em;
  color:var(--ink);
}
/* Operations pages use the existing Modern pilot, event handlers and state hooks. */
html[data-sage-ui="modern"] :is(#section-carpool, #section-reminders, #section-groceries, #section-sports) {
  --ops-hero: var(--modern-navy, #12233e);
  --ops-hero-ink: #fff;
  --ops-hero-copy: #d3deec;
  --ops-action: #b8f5dd;
  --ops-action-ink: #0d3027;
  --ops-focus: #227d9f;
  --ops-card-radius: 20px;
}
html[data-sage-ui="modern"][data-theme="dark"] :is(#section-carpool, #section-reminders, #section-groceries, #section-sports) {
  --ops-hero: #182a44;
  --ops-hero-ink: #f3f7ff;
  --ops-hero-copy: #c4d3eb;
  --ops-focus: #83c9ff;
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-reminders, #section-groceries, #section-sports) > .page-head {
  background: linear-gradient(122deg, var(--ops-hero), #21445a);
  border: 1px solid #ffffff14;
  border-radius: 0 0 26px 26px;
  padding: clamp(16px, 3vw, 26px);
  color: var(--ops-hero-ink);
  align-items: center;
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-reminders, #section-groceries, #section-sports) > .page-head .page-title {
  color: var(--ops-hero-ink);
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -.025em;
  line-height: 1.13;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-reminders, #section-groceries, #section-sports) > .page-head .page-copy {
  color: var(--ops-hero-copy);
  max-width: 62ch;
  line-height: 1.5;
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-groceries, #section-sports) > .page-head .row-actions {
  flex-wrap: wrap;
  gap: 8px;
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-groceries, #section-sports) > .page-head button {
  min-height: 44px;
  border-radius: 12px;
  white-space: normal;
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-groceries, #section-sports) > .page-head button:not(.secondary):not(:disabled) {
  background: var(--ops-action);
  color: var(--ops-action-ink);
  border-color: var(--ops-action);
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-groceries) > .page-head button.secondary:not(:disabled) {
  background: #ffffff12;
  border-color: #ffffff55;
  color: var(--ops-hero-ink);
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-reminders, #section-groceries, #section-sports) :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--ops-focus);
  outline-offset: 2px;
}
html[data-sage-ui="modern"] :is(#section-carpool, #section-groceries, #section-sports) > .page-head button:focus-visible {
  outline-color: #b8f5dd;
}
html[data-sage-ui="modern"] :is(#section-reminders, #section-groceries, #section-sports) .add-card {
  border-radius: var(--ops-card-radius);
  background: var(--panel);
  color: var(--ink);
}
html[data-sage-ui="modern"] :is(#section-reminders, #section-groceries, #section-sports) .add-card > summary {
  min-height: 44px;
  outline-offset: -4px;
}

/* CARPOOL — group context, segmented mobile control, and distinguishable ride lanes. */
html[data-sage-ui="modern"] #section-carpool :is(.carpool-toolbar, .cp-event, .carpool-chat-card, .carpool-members-card, .cp-first-run) {
  border-radius: var(--ops-card-radius);
}
html[data-sage-ui="modern"] #section-carpool .carpool-toolbar {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}
html[data-sage-ui="modern"] #section-carpool .carpool-mobile-tabs {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  padding: 4px;
}
html[data-sage-ui="modern"] #section-carpool .carpool-mobile-tab {
  min-height: 44px;
  border-radius: 10px;
}
html[data-sage-ui="modern"] #section-carpool .carpool-mobile-tab[aria-selected="true"] {
  background: var(--panel);
  color: var(--ink-teal);
  box-shadow: inset 0 0 0 1px var(--carpool-teal-line);
}
html[data-sage-ui="modern"] #section-carpool .cp-event {
  padding: clamp(12px, 2.2vw, 20px);
  background: var(--panel);
  border-color: var(--line);
}
html[data-sage-ui="modern"] #section-carpool .cp-event-head {
  gap: 10px;
}
html[data-sage-ui="modern"] #section-carpool .cp-event-title {
  font-size: clamp(16px, 2vw, 18px);
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] #section-carpool :is(.cp-ride, .cp-thread, .message-list) { border-radius: 14px; }
html[data-sage-ui="modern"] #section-carpool .cp-ride :is(.cp-ride-note, .cp-ride-meta, .cp-ride-shared) { overflow-wrap: anywhere; }
html[data-sage-ui="modern"] #section-carpool .cp-lane-label.is-need { color: var(--carpool-amber-text); }
html[data-sage-ui="modern"] #section-carpool .cp-lane-label.is-drive { color: var(--carpool-teal-text); }
html[data-sage-ui="modern"] #section-carpool :is(.cp-event-head, .cp-ride-actions, .cp-match-banner) .cp-btn { min-height: 44px; }
html[data-sage-ui="modern"] #section-carpool .carpool-add-event-trigger { min-height: 44px; border-radius: 14px; }

/* REMINDERS — full-width editable rows, visible actions, and a separate done group. */
html[data-sage-ui="modern"] #section-reminders > .panel {
  border-radius: var(--ops-card-radius);
  padding: clamp(12px, 2.2vw, 20px);
}
html[data-sage-ui="modern"] #section-reminders #reminderList { gap: 8px; }
html[data-sage-ui="modern"] #section-reminders .reminder-swipe:not(.swipe-armed) {
  background: var(--panel-2);
  border-color: var(--line);
}
html[data-sage-ui="modern"] #section-reminders .reminder-swipe {
  border-radius: 14px;
  padding: 6px clamp(6px, 1.8vw, 12px);
  gap: 6px;
}
html[data-sage-ui="modern"] #section-reminders .reminder-body {
  min-height: 48px;
  border-radius: 8px;
  padding: 8px 10px;
}
html[data-sage-ui="modern"] #section-reminders .reminder-body .row-meta { margin-top: 4px; }
html[data-sage-ui="modern"] #section-reminders .reminder-swipe .row-actions { gap: 5px; }
html[data-sage-ui="modern"] #section-reminders .reminder-swipe .row-actions button {
  min-height: 44px;
  border-radius: 9px;
}
html[data-sage-ui="modern"] #section-reminders .reminder-swipe .row-actions [data-action="editReminder"]:not(:disabled) {
  color: var(--ink-teal);
  background: var(--tint-suggest);
  border: 1px solid var(--tint-suggest-line);
}
html[data-sage-ui="modern"] #section-reminders .reminder-x { min-width: 44px; }
html[data-sage-ui="modern"] #section-reminders #completedReminders {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 4px;
}
html[data-sage-ui="modern"] #section-reminders #completedReminders > summary {
  min-height: 44px;
  padding: 12px 6px;
  color: var(--muted-strong);
  font-weight: 700;
}
html[data-sage-ui="modern"] #section-reminders #completedReminders > .reminder-swipe { margin-top: 5px; }
/* The native dialog is adjacent to (not nested in) the Reminders section. */
html[data-sage-ui="modern"] #reminderEditor {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(16px, 5vw, 24px);
}
html[data-sage-ui="modern"] #reminderEditor :is(button, input, select) { min-height: 44px; }
html[data-sage-ui="modern"] #reminderEditor #reminderEditError { color: var(--tint-rose-text); }

/* GROCERIES — lift shopping progress and keep supporting cards secondary. */
html[data-sage-ui="modern"] #section-groceries :is(.gro-panel, .gro-meals-card, .gro-staples-card, .gro-shared-card) {
  border-radius: var(--ops-card-radius);
}
html[data-sage-ui="modern"] #section-groceries .gro-head { background: var(--tint-suggest); }
html[data-sage-ui="modern"] #section-groceries .gro-title { font-size: clamp(17px, 2.3vw, 21px); }
html[data-sage-ui="modern"] #section-groceries .gro-progress-track { background: var(--tint-suggest-line); }
html[data-sage-ui="modern"] #section-groceries .gro-progress-fill { background: var(--ink-teal); }
html[data-sage-ui="modern"] #section-groceries :is(.gro-clear-btn, .gro-already, .gro-staple-chip) { min-height: 44px; }
html[data-sage-ui="modern"] #section-groceries .gro-aisle { background: var(--panel-2); padding-block: 10px; }
html[data-sage-ui="modern"] #section-groceries .gro-row { min-height: 52px; }
html[data-sage-ui="modern"] #section-groceries .gro-row :is(.gro-name, .gro-qty, .gro-source, .gro-meal-title) { overflow-wrap: anywhere; }
html[data-sage-ui="modern"] #section-groceries :is(.gro-shared-title, .gro-shared-copy, .gro-staple-chip, .gro-add-link) { color: var(--ink-navy); }
html[data-sage-ui="modern"] #section-groceries :is(.gro-meals-link, .gro-meal-status.is-ready, .gro-staple-chip.is-on) { color: var(--ink-teal); }
html[data-sage-ui="modern"] #section-groceries .gro-foot { flex-wrap: wrap; }
html[data-sage-ui="modern"] #section-groceries .gro-add-link { white-space: normal; padding-block: 9px; }

/* CALENDAR FEEDS — status at a glance; existing filters and event actions remain intact. */
html[data-sage-ui="modern"] #section-sports .mini-metric {
  border-radius: 16px;
  background: var(--tint-sage);
  border-color: var(--tint-sage-line);
  padding: clamp(12px, 2.2vw, 18px);
}
html[data-sage-ui="modern"] #section-sports .mini-metric strong {
  color: var(--ink-navy);
  font-size: clamp(19px, 3vw, 28px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] #section-sports #calendarFeedFilters {
  padding: 4px;
  gap: 6px;
  flex-wrap: wrap;
}
html[data-sage-ui="modern"] #section-sports #calendarFeedFilters .cal-filter-pill { min-height: 44px; }
html[data-sage-ui="modern"] #section-sports .sports-stack > .panel { border-radius: var(--ops-card-radius); }
html[data-sage-ui="modern"] #section-sports .sports-event {
  border-radius: 14px;
  border-inline-start: 4px solid var(--ink-teal);
  background: var(--panel-2);
}
html[data-sage-ui="modern"] #section-sports :is(.sports-event, #calendarFeedList) :is(.row-title, .row-meta) { overflow-wrap: anywhere; }
html[data-sage-ui="modern"] #section-sports :is(.sports-stack, #calendarFeedList, .calendar-feed-form) :is(button, select) { min-height: 44px; }
html[data-sage-ui="modern"] #section-sports #calendarFeedList .row-actions { flex-wrap: wrap; gap: 6px; }

@media (max-width: 600px) {
  html[data-sage-ui="modern"] :is(#section-carpool, #section-reminders, #section-groceries, #section-sports) > .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  html[data-sage-ui="modern"] :is(#section-carpool, #section-groceries) > .page-head .row-actions {
    justify-content: flex-start;
  }
  html[data-sage-ui="modern"] :is(#section-carpool, #section-groceries) > .page-head .row-actions > button {
    flex: 1 1 auto;
  }
  html[data-sage-ui="modern"] #section-reminders .reminder-body { flex-basis: 100%; }
  html[data-sage-ui="modern"] #section-reminders .reminder-swipe { flex-wrap: wrap; }
  html[data-sage-ui="modern"] #section-reminders .reminder-swipe .row-actions { margin-inline-start: auto; flex-wrap: wrap; }
  html[data-sage-ui="modern"] #section-groceries .gro-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  html[data-sage-ui="modern"] #section-groceries .gro-progress { grid-row: 2; grid-column: 1 / -1; width: 100%; }
  html[data-sage-ui="modern"] #section-groceries .gro-clear-btn { grid-row: 1; grid-column: 2; }
}
@media (max-width: 360px) {
  html[data-sage-ui="modern"] #section-groceries > .page-head [data-action="openAddGroceryForm"] { flex-basis: 100%; }
  html[data-sage-ui="modern"] #section-groceries .gro-row { flex-wrap: wrap; }
  html[data-sage-ui="modern"] #section-groceries .gro-row .gro-body { flex-basis: calc(100% - 40px); }
  html[data-sage-ui="modern"] #section-groceries .gro-row .gro-already { margin-inline-start: auto; }
  html[data-sage-ui="modern"] #section-sports .sports-provider-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-sage-ui="modern"] #section-groceries .gro-progress-fill { transition: none; }
}
/* Modern family tools. Keep all mounts, authored order and JS disclosure states. */
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) {
  --family-surface: #fff;
  --family-inset: #f5f8fb;
  --family-border: #dce4ee;
  --family-ink: #182b45;
  --family-muted: #52647a;
  --family-teal: #20634f;
  --family-mint: #e5f3ec;
  --family-mint-line: #bedbd1;
  --family-focus: #227d9f;
  --family-shadow: 0 4px 20px #172d4a09;
  --family-space: clamp(14px, 2.4vw, 24px);
  --family-gap: clamp(12px, 2vw, 18px);
  min-width: 0;
}
html[data-sage-ui="modern"][data-theme="dark"] :is(#section-family, #section-wallet, #section-kids, #section-school) {
  --family-surface: #151f30;
  --family-inset: #101929;
  --family-border: #314055;
  --family-ink: #edf3fc;
  --family-muted: #b5c3d5;
  --family-teal: #a8e9d1;
  --family-mint: #19392f;
  --family-mint-line: #376455;
  --family-focus: #9fd4ff;
  --family-shadow: 0 4px 18px #0003;
}

/* Pages share a calm, readable shell without redesigning the existing controls. */
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .page-head {
  padding: var(--family-space) clamp(16px, 3.5vw, 30px);
  align-items: center;
  background: linear-gradient(125deg, #12233e, #1b3b4f);
  border: 1px solid #34516a;
  border-radius: 0 0 26px 26px;
  color: #fff;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .page-head > div { min-width: 0; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .page-head .page-title {
  color: #fff;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -.025em;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .page-head .page-copy {
  color: #d3dfed;
  margin-top: 6px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] #section-wallet > .page-head > button {
  flex: none;
  background: #b8f5dd;
  color: #0d3027;
  border: 1px solid #b8f5dd;
  border-radius: 12px;
  min-height: 44px;
}
html[data-sage-ui="modern"] #section-wallet > .page-head > button:focus-visible { outline-color: #cbedfb; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar {
  min-width: 0;
  background: var(--family-surface);
  border: 1px solid var(--family-border);
  border-radius: 16px;
  box-shadow: var(--family-shadow);
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar input {
  min-width: 0;
  width: 0;
  background: var(--family-inset);
  color: var(--family-ink);
  border: 1px solid var(--family-border);
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar input::placeholder {
  color: var(--family-muted);
  opacity: 1;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar :is(.sb-send, .sb-ic:not(.listening, .speaking)) {
  color: var(--family-teal);
  background: var(--family-mint);
  border: 1px solid var(--family-mint-line);
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar .sb-ic.listening { background: #b91c1c; color: #fff; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar .sb-ic.speaking { background: #174f65; color: #fff; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) :is(.panel, .add-card, .wallet-share-panel) {
  min-width: 0;
  padding: var(--family-space);
  border: 1px solid var(--family-border);
  border-radius: 20px;
  background: var(--family-surface);
  color: var(--family-ink);
  box-shadow: var(--family-shadow);
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .add-card { padding: 0; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .add-card > summary {
  min-height: 52px;
  padding: 12px var(--family-space);
  color: var(--family-teal);
  background: var(--family-mint);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .add-card .add-body { padding: var(--family-space); }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .panel-head { flex-wrap: wrap; margin-bottom: 14px; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .panel-head > div { min-width: 0; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .panel-title {
  color: var(--family-ink);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) :is(.panel-sub, .row-meta, .binder-head-meta, .wallet-detail) {
  color: var(--family-muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .row-item {
  min-width: 0;
  align-items: flex-start;
  background: var(--family-inset);
  border-color: var(--family-border);
  padding: 13px 15px;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .row-item > div:first-child { min-width: 0; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .empty {
  grid-column: 1 / -1;
  background: var(--family-inset);
  border-color: var(--family-border);
  color: var(--family-muted);
  text-align: start;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) :is(.form-grid, .chip-add, .form-actions) { min-width: 0; gap: 10px; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) :is(.form-grid, .chip-add) > * { min-width: 0; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) :is(.form-grid, .chip-add, .binder-inline-select) :is(input, select, textarea),
html[data-sage-ui="modern"] :is(#section-family, #section-kids) .chip-add > input {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  color: var(--family-ink);
  background: var(--family-inset);
  border-color: var(--family-border);
  border-radius: 11px;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .form-grid :is(input, select, textarea) { width: 100%; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .form-grid textarea { min-height: 76px; resize: vertical; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) :is(.row-actions, .form-actions) { flex-wrap: wrap; }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) :is(.panel, .add-card, .wallet-share-panel) button {
  min-height: 44px;
  overflow-wrap: anywhere;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) button.danger { color: var(--tint-rose-text); }
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--family-focus);
  outline-offset: 2px;
}
html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) .add-card > summary:focus-visible { outline-offset: -4px; }

/* Binder: readable section navigator; JS still controls expand/collapse and jump. */
html[data-sage-ui="modern"] #section-family .binder-overview {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "copy" "tabs" "actions";
  gap: 14px;
}
html[data-sage-ui="modern"] #section-family .binder-overview-copy { grid-area: copy; }
html[data-sage-ui="modern"] #section-family .binder-overview-actions { grid-area: actions; }
html[data-sage-ui="modern"] #section-family .binder-section-tabs {
  grid-area: tabs;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
html[data-sage-ui="modern"] #section-family .binder-section-tab {
  min-height: 62px;
  border-color: var(--family-border);
  border-radius: 14px;
  background: var(--family-inset);
  color: var(--family-ink);
}
html[data-sage-ui="modern"] #section-family .binder-section-tab:is(:hover, [aria-pressed="true"]) {
  background: var(--family-mint);
  border-color: var(--family-mint-line);
}
html[data-sage-ui="modern"] #section-family .binder-section-tab > span:first-child { color: var(--family-teal); }
html[data-sage-ui="modern"] #section-family .binder-section-tab :is(strong, small) {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
html[data-sage-ui="modern"] #section-family .binder-section-tab small { color: var(--family-muted); }
html[data-sage-ui="modern"] #section-family > .grid.cols-2 { align-items: start; gap: var(--family-gap); }
html[data-sage-ui="modern"] #section-family .binder-card-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px 12px;
}
html[data-sage-ui="modern"] #section-family .binder-head-actions { min-width: 0; flex-wrap: wrap; }
html[data-sage-ui="modern"] #section-family .binder-inline-select { min-width: 0; }
html[data-sage-ui="modern"] #section-family .binder-inline-select select { max-width: 13rem; }
html[data-sage-ui="modern"] #section-family .binder-ic { border-radius: 13px; }
html[data-sage-ui="modern"][data-theme="dark"] #section-family #binderSectionMeal .binder-ic { color: var(--ink-green) !important; }
html[data-sage-ui="modern"][data-theme="dark"] #section-family #binderSectionKids .binder-ic { color: var(--ink-navy) !important; }
html[data-sage-ui="modern"][data-theme="dark"] #section-family #binderSectionHealth .binder-ic,
html[data-sage-ui="modern"][data-theme="dark"] #section-family :is(.chip-group-label[style*="--rose"], .binder-subhead [data-ic="heart"]) { color: var(--tint-rose-text) !important; }
html[data-sage-ui="modern"][data-theme="dark"] #section-family #binderSectionActivities .binder-ic { color: var(--ink-teal) !important; }
html[data-sage-ui="modern"] #section-family .binder-toggle { width: 44px; min-width: 44px; border-color: var(--family-border); }
html[data-sage-ui="modern"] #section-family .binder-section-body { padding-top: 14px; border-top: 1px solid var(--family-border); }
html[data-sage-ui="modern"] #section-family .binder-section[data-collapsed="true"] { background: var(--family-inset); }
html[data-sage-ui="modern"] #section-family .binder-section.binder-highlight { border-color: var(--family-focus); box-shadow: 0 0 0 2px var(--family-focus); }
html[data-sage-ui="modern"] :is(#section-family, #section-kids) .chip-wrap .chip { max-width: 100%; text-align: start; }
html[data-sage-ui="modern"] :is(#section-family, #section-kids) .chip-wrap.allergies .chip.on { color: var(--tint-rose-text); }
html[data-sage-ui="modern"] :is(#section-family, #section-kids) .mini-chip { max-width: 100%; overflow-wrap: anywhere; }

/* Wallet: safe spacing for scans, private card data, packet edits and share preview. */
html[data-sage-ui="modern"] #section-wallet :is(.wallet-command, .wallet-layout, .wallet-review-grid, .wallet-stack, .metric-pair, .wallet-grid) { gap: var(--family-gap); }
html[data-sage-ui="modern"] #section-wallet .wallet-command > .panel { display: grid; align-items: center; }
html[data-sage-ui="modern"] #section-wallet .wallet-command .panel-head { margin-bottom: 0; }
html[data-sage-ui="modern"] #section-wallet .metric-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-sage-ui="modern"] #section-wallet .mini-metric {
  padding: var(--family-space);
  color: var(--family-ink);
  background: var(--family-mint);
  border-color: var(--family-mint-line);
}
html[data-sage-ui="modern"] #section-wallet .mini-metric strong { color: var(--family-teal); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
html[data-sage-ui="modern"] #section-wallet .mini-metric span { color: var(--family-muted); }
html[data-sage-ui="modern"] #section-wallet .wallet-scan-zone { background: var(--family-inset); border-color: var(--family-mint-line); }
html[data-sage-ui="modern"] #section-wallet .wallet-scan-zone > div { min-width: 0; }
html[data-sage-ui="modern"] #section-wallet .wallet-review { border-color: var(--family-border); padding-top: var(--family-gap); }
html[data-sage-ui="modern"] #section-wallet .wallet-review-grid { grid-template-columns: minmax(0, 1fr); }
html[data-sage-ui="modern"] #section-wallet .wallet-preview {
  justify-self: start;
  width: min(100%, 18rem);
  min-width: 0;
  min-height: 90px;
  max-height: none;
}
html[data-sage-ui="modern"] #section-wallet .wallet-preview img { height: auto; max-height: 240px; object-fit: contain; }
html[data-sage-ui="modern"] #section-wallet .wallet-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
html[data-sage-ui="modern"] #section-wallet :is(.wallet-card, .wallet-packet, .wallet-share-preview) { background: var(--family-inset); border-color: var(--family-border); }
html[data-sage-ui="modern"] #section-wallet .wallet-share-panel { border-color: var(--family-mint-line); }
html[data-sage-ui="modern"] #section-wallet .wallet-share-preview { min-width: 0; color: var(--family-ink); }
html[data-sage-ui="modern"] #section-wallet .wallet-pill { background: var(--family-mint); color: var(--family-teal); border-color: var(--family-mint-line); }
html[data-sage-ui="modern"] #section-wallet .wallet-visual { background: linear-gradient(128deg, #182c53, #205956); }
html[data-sage-ui="modern"] #section-wallet .wallet-visual.school_id { background: linear-gradient(128deg, #403984, #243e65); }
html[data-sage-ui="modern"] #section-wallet .wallet-visual.sports_pass { background: linear-gradient(128deg, #204d49, #65501f); }
html[data-sage-ui="modern"] #section-wallet .wallet-visual.pharmacy { background: linear-gradient(128deg, #205949, #20526a); }
html[data-sage-ui="modern"] #section-wallet .wallet-visual.emergency { background: linear-gradient(128deg, #733944, #674821); }
html[data-sage-ui="modern"] #section-wallet :is(.wallet-type, .wallet-number, .wallet-owner) { opacity: 1; }

/* Child records stay in reading order; school events keep their chronological list. */
html[data-sage-ui="modern"] #section-kids #childList { gap: 12px; }
html[data-sage-ui="modern"] #section-kids #childList .row-item { flex-direction: column; }
html[data-sage-ui="modern"] #section-kids #childList .row-actions { justify-content: flex-start; }
html[data-sage-ui="modern"] #section-kids #childList .row-title { font-size: 17px; }
html[data-sage-ui="modern"] #section-school #schoolList .row-item { border-inline-start: 4px solid var(--family-mint-line); }

@media (min-width: 760px) {
  html[data-sage-ui="modern"] #section-kids #childList { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  html[data-sage-ui="modern"] #section-family .binder-section-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html[data-sage-ui="modern"] #section-family > .grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .page-head { align-items: stretch; gap: 12px; }
  html[data-sage-ui="modern"] #section-wallet > .page-head > button { align-self: flex-start; }
  html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar { gap: 6px; padding: 7px; }
  html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar .sb-ic { width: 44px; }
  html[data-sage-ui="modern"] :is(#section-family, #section-wallet, #section-kids, #section-school) > .sage-bar .sb-send { min-width: 44px; padding-inline: 10px; }
  html[data-sage-ui="modern"] #section-family .binder-overview-actions,
  html[data-sage-ui="modern"] #section-family .binder-head-actions-select { justify-content: flex-start; }
  html[data-sage-ui="modern"] #section-family .binder-section-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-sage-ui="modern"] #section-family .binder-card-head { gap: 8px; }
  html[data-sage-ui="modern"] #section-family .binder-head-actions { grid-column: 3; grid-row: 1; max-width: 6.5rem; justify-content: end; }
  html[data-sage-ui="modern"] #section-family #binderSectionKids .binder-head-actions,
  html[data-sage-ui="modern"] #section-family .binder-head-actions-select { grid-column: 2 / -1; grid-row: 2; max-width: none; width: 100%; }
  html[data-sage-ui="modern"] #section-family .binder-head-actions-select .binder-inline-select { flex-wrap: wrap; }
  html[data-sage-ui="modern"] #section-wallet .wallet-scan-zone .row-actions { justify-content: flex-start; }
  html[data-sage-ui="modern"] #section-school #schoolList .row-item { flex-wrap: wrap; }
}
@media (max-width: 360px) {
  html[data-sage-ui="modern"] #section-family .binder-section-tab { grid-template-columns: 18px minmax(0, 1fr); padding-inline: 7px; gap: 2px 5px; }
  html[data-sage-ui="modern"] #section-family .binder-section-tab > span:first-child .ic { width: 17px; height: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-sage-ui="modern"] #section-family :is(.binder-section, .binder-toggle .ic) { transition: none; }
}
/* Modern insights pages. Presentation only; hidden states and action mounts remain intact. */
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) {
  --ins-surface: #fff;
  --ins-soft: #f3f6fa;
  --ins-line: #dce4ed;
  --ins-ink: #182b45;
  --ins-muted: #53657c;
  --ins-accent: #176b58;
  --ins-tint: #eaf7f1;
  color: var(--ins-ink);
}
html[data-sage-ui="modern"][data-theme="dark"] :is(#section-budget, #section-nutrition, #section-memory) {
  --ins-surface: #17283f;
  --ins-soft: #20334a;
  --ins-line: #374c64;
  --ins-ink: #edf3fc;
  --ins-muted: #b5c5d8;
  --ins-accent: #8adfc1;
  --ins-tint: #193e38;
}
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) > .page-head {
  background: #12233e; color: #fff; border-radius: 0 0 26px 26px;
  padding: 26px; gap: 20px; margin-bottom: 22px;
}
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) > .page-head .page-title { color:#fff; font-size:clamp(24px, 3vw, 32px); letter-spacing:-.025em; }
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) > .page-head .page-copy { color:#d3deec; line-height:1.65; max-width:65ch; }
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) :is(.panel, .budget-panel, .budget-tray, .ntr-panel, .ntr-goal-card, .add-card) {
  background:var(--ins-surface); color:var(--ins-ink); border:1px solid var(--ins-line); border-radius:22px; box-shadow:0 5px 18px #071b3210;
}
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) :is(.panel-title, .ntr-card-title, .ntr-title) { color:var(--ins-ink); font-size:18px; letter-spacing:-.015em; }
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) :is(.page-copy, .row-meta, .panel-sub, .ntr-totals, .ntr-goal-explainer) { color:var(--ins-muted); line-height:1.6; }
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) :is(input, select, textarea) { max-width:100%; min-width:0; border-radius:12px; }
html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) :is(button, a, input, select, textarea, summary):focus-visible { outline:3px solid var(--ins-accent); outline-offset:3px; }
html[data-sage-ui="modern"] #section-budget .budget-subnav { padding:7px; gap:6px; background:var(--ins-surface); border:1px solid var(--ins-line); border-radius:18px; margin-bottom:22px; }
html[data-sage-ui="modern"] #section-budget .budget-subnav button { min-height:44px; border-radius:12px; background:transparent; border-color:transparent; color:var(--ins-muted); padding:10px 15px; }
html[data-sage-ui="modern"] #section-budget .budget-subnav button.active { background:var(--ins-tint); border-color:var(--ins-accent); color:var(--ins-accent); }
html[data-sage-ui="modern"] #section-budget :is(.budget-dash, .budget-main, .budget-side) { gap:18px; }
html[data-sage-ui="modern"] #section-budget .budget-panel { padding:22px; }
html[data-sage-ui="modern"] #section-budget .budget-stat { min-width:0; }
html[data-sage-ui="modern"] #section-budget .budget-stat-value { font-size:clamp(20px,2.3vw,30px); font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
html[data-sage-ui="modern"] #section-budget .budget-stat-label { color:var(--ins-muted); line-height:1.5; }
html[data-sage-ui="modern"] #section-budget :is(.budget-tray.is-open .budget-tray-head, .budget-tray-head:hover) { background:var(--ins-soft); }
html[data-sage-ui="modern"] #section-budget .budget-tray-head { padding-top:18px; padding-bottom:18px; }
html[data-sage-ui="modern"] #section-budget .budget-sample-banner { border-radius:14px; padding:14px 16px; }
html[data-sage-ui="modern"] #section-nutrition .ntr-board { gap:22px; }
html[data-sage-ui="modern"] #section-nutrition :is(.ntr-main, .ntr-rail) { gap:18px; min-width:0; }
html[data-sage-ui="modern"] #section-nutrition .ntr-head { background:var(--ins-soft); border-color:var(--ins-line); padding:18px 20px; }
html[data-sage-ui="modern"] #section-nutrition .ntr-goalbars { gap:16px; padding:22px 20px; }
html[data-sage-ui="modern"] #section-nutrition :is(.ntr-nav-btn, .ntr-row-del, .ntr-row-actions .secondary.small) { min-height:44px; min-width:44px; }
html[data-sage-ui="modern"] #section-nutrition .ntr-row { padding-top:16px; padding-bottom:16px; }
html[data-sage-ui="modern"] #section-nutrition .ntr-row-name { font-size:16px; overflow-wrap:anywhere; }
html[data-sage-ui="modern"] #section-nutrition .ntr-goal-edit-link { color:var(--ins-accent); }
html[data-sage-ui="modern"] #section-nutrition #nutritionPrivacyNote { padding:12px 16px; border-left:3px solid var(--ins-accent); background:var(--ins-tint); border-radius:0 12px 12px 0; margin-bottom:22px; }
html[data-sage-ui="modern"] #section-memory > .panel { padding:24px; }
html[data-sage-ui="modern"] #section-memory .form-grid { gap:14px; margin-top:18px; }
html[data-sage-ui="modern"] #section-memory :is(#memoryList, #memoryPending .list) { gap:12px; margin-top:18px; }
html[data-sage-ui="modern"] #section-memory .row-item { background:var(--ins-soft); border:1px solid var(--ins-line); border-radius:16px; padding:18px; gap:18px; align-items:center; }
html[data-sage-ui="modern"] #section-memory .row-item > div { min-width:0; }
html[data-sage-ui="modern"] #section-memory .row-title { color:var(--ins-ink); font-size:16px; line-height:1.6; overflow-wrap:anywhere; }
html[data-sage-ui="modern"] #section-memory .row-actions { flex-wrap:wrap; gap:8px; }
html[data-sage-ui="modern"] #section-memory .row-actions button { min-height:44px; padding:10px 16px; }
html[data-sage-ui="modern"] #section-memory .empty { color:var(--ins-muted); background:var(--ins-soft); border-radius:16px; padding:28px; line-height:1.7; }
@media (max-width:900px) {
  html[data-sage-ui="modern"] #section-nutrition .ntr-board { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:600px) {
  html[data-sage-ui="modern"] :is(#section-budget, #section-nutrition, #section-memory) > .page-head { padding:22px 18px; flex-direction:column; align-items:stretch; }
  html[data-sage-ui="modern"] #section-budget .budget-subnav { gap:4px; }
  html[data-sage-ui="modern"] #section-budget .budget-subnav button { flex:1 1 auto; padding:10px; }
  html[data-sage-ui="modern"] #section-budget .budget-panel { padding:18px 14px; }
  html[data-sage-ui="modern"] #section-nutrition .ntr-goalbars { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:16px; }
  html[data-sage-ui="modern"] #section-nutrition .ntr-foot { flex-wrap:wrap; }
  html[data-sage-ui="modern"] #section-nutrition .ntr-add-link { margin-left:0; white-space:normal; min-height:44px; display:inline-flex; align-items:center; }
  html[data-sage-ui="modern"] #section-nutrition .ntr-row-top { grid-template-columns:minmax(0,1fr); gap:6px; }
  html[data-sage-ui="modern"] #section-nutrition .form-grid { grid-template-columns:minmax(0,1fr); }
  html[data-sage-ui="modern"] #section-nutrition .form-grid .wide { grid-column:1/-1; }
  html[data-sage-ui="modern"] #section-memory > .panel { padding:20px 16px; }
  html[data-sage-ui="modern"] #section-memory .row-item { flex-wrap:wrap; padding:16px; }
  html[data-sage-ui="modern"] #section-memory .row-item > div:first-child { flex:1 1 100%; }
}
