
/* Shared illustrated add/edit surfaces. Kept after legacy page styles deliberately. */
html body:not(.is-native-app) :is(.secondary-button, .ghost-button),
html body.is-native-app :is(.secondary-button, .ghost-button),
html body:not(.is-native-app) [data-form-surface] :is(.secondary-button, .ghost-button),
html body.is-native-app [data-form-surface] :is(.secondary-button, .ghost-button) {
  border: 1px solid #b9ae9c;
  box-shadow: 0 3px 9px rgb(32 32 28 / 5%);
}
html body :is(.secondary-button, .ghost-button):hover:not(:disabled) { border-color: var(--teal); }
html body :is(.secondary-button, .ghost-button):focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
html body :is(.secondary-button, .ghost-button).danger-button { border-color: #b95f50; }
html body [data-form-surface] {
  --app-section-title-size: clamp(22px, 2.1vw, 28px);
  min-width: 0; font-family: var(--font-body);
}
html body [data-form-surface] > .form-topic-heading,
html body .reward-create-panel > .form-topic-heading,
html body .auth-panel .form-topic-heading,
html body .school-rule-card > .form-topic-heading {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center; gap: 16px; padding: 18px;
  border: 1px solid var(--line); border-radius: 10px;
  background: linear-gradient(120deg, rgb(47 111 115 / 7%), rgb(255 255 255 / 58%));
  min-width: 0; grid-column: 1 / -1;
}
html body [data-form-surface] .form-topic-heading > :is(div,h2,h3) { min-width: 0; }
html body [data-form-surface] .form-topic-illustration,
html body .auth-panel .form-topic-illustration,
html body .reward-create-panel .form-topic-illustration { width: 72px; height: 72px; }
html body [data-form-surface] .form-topic-heading :is(h2,h3),
html body .auth-panel .form-topic-heading :is(h2,h3) {
  margin: 0; font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 2.1vw, 28px); line-height: 1.2; overflow-wrap: anywhere;
}
html body [data-form-surface] .form-topic-heading p { margin: 5px 0 0; font: 400 14px/1.5 var(--font-body); color: var(--muted); }
html body [data-form-surface] .form-topic-heading .eyebrow { color: var(--teal); font-size: 11px; font-weight: 700; }
html body [data-form-surface] :is(input, select, textarea):not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=color]):not([type=file]) {
  box-sizing: border-box; max-width: 100%; min-width: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background-color: #fffdf9; color: var(--ink);
  font: 400 16px/1.45 var(--font-body);
}
html body [data-form-surface] :is(label,legend) { font-family: var(--font-body); text-transform: none; letter-spacing: normal; }
html body [data-form-surface] label > span:first-child:not(.picker-input-row):not(.avatar-option-thumb) { text-transform: none; letter-spacing: normal; }
html body [data-form-surface] label :is(small,.form-note) { color: var(--muted); font: 400 13px/1.45 var(--font-body); }
html body [data-form-surface] .form-topic-heading > .icon-button { margin: 0; flex-shrink: 0; }
html body :is(.school-dialog-form,.calendar-entry-form)[data-form-surface] > .form-topic-heading {
  border-width: 0 0 1px; border-radius: 0; margin: 0; padding: 20px 22px;
}
html body [data-form-surface] .segmented-pill-grid { border:0; padding:0; margin:0; gap:10px; }
html body [data-form-surface] .segmented-pill-grid legend { margin-bottom:8px; }
html body [data-form-surface] .segmented-pill-grid label {
 display:flex; align-items:center; justify-content:flex-start; gap:10px;
 min-height:52px; padding:12px; border:1px solid var(--line); border-radius:9px;
 background:#fffdf9; box-shadow:none;
}
html body [data-form-surface] .segmented-pill-grid label:has(input:checked) { border-color:var(--teal); background:#eaf2f2; }
html body [data-form-surface] .segmented-pill-grid span { font:600 14px/1.4 var(--font-body); text-transform:none; letter-spacing:normal; }
html body [data-form-surface] .segmented-pill-grid input { position:static; width:18px; height:18px; opacity:1; appearance:auto; flex:0 0 18px; }
html body [data-form-surface] .segmented-pill-grid label:focus-within { outline:2px solid var(--teal); outline-offset:2px; }
html body #parentReminderDialog .phone-reminder-card-copy { grid-template-columns:72px minmax(0,1fr) auto; }
html body .reward-create-panel > .form-topic-heading { grid-template-columns:56px minmax(0,1fr); padding:14px; }
html body .reward-create-panel .form-topic-illustration { width:56px; height:56px; }
html body .reward-create-panel .form-topic-heading h3 { font-size:22px; }
html body :is(.reward-level-card,.streak-bonus-card)[data-form-surface] { gap:16px; padding:18px; border:1px solid var(--line); border-radius:10px; background:#fffdf9; }
html body [data-form-surface] > .form-topic-heading-compact { grid-template-columns:48px minmax(0,1fr) auto; padding:12px; }
html body [data-form-surface] > .form-topic-heading-compact .form-topic-illustration { width:48px; height:48px; }
html body [data-form-surface] .form-topic-heading-compact .form-topic-copy { display:grid; gap:4px; }
html body [data-form-surface] .form-topic-heading-compact :is(b,span) { font-family:var(--font-body); }
html body .school-rule-card > .form-topic-heading { margin-bottom:16px; }
html body .auth-panel .form-topic-heading { --app-section-title-size:clamp(22px,2.1vw,28px); margin-bottom:20px; grid-template-columns:72px minmax(0,1fr); }
@media(max-width:640px) {
 html body [data-form-surface] > .form-topic-heading,
 html body .auth-panel .form-topic-heading { grid-template-columns:52px minmax(0,1fr) auto; gap:12px; padding:14px; }
 html body [data-form-surface] .form-topic-illustration,
 html body .auth-panel .form-topic-illustration { width:52px; height:52px; }
 html body .auth-panel .form-topic-heading { grid-template-columns:52px minmax(0,1fr); }
 html body #parentReminderDialog .phone-reminder-card-copy { grid-template-columns:52px minmax(0,1fr) auto; }
 html body .school-rule-card > .form-topic-heading { grid-template-columns:48px minmax(0,1fr); }
 html body .school-rule-card > .form-topic-heading .school-toggle { grid-column:2; }
 html body :is(.school-dialog-form,.calendar-entry-form)[data-form-surface] > .form-topic-heading { padding:16px 14px; }
}

/* In-place editors use a full-width heading followed by aligned fields. */
html body .reward-level-card[data-form-surface] { display:grid; grid-template-columns:minmax(0,1fr) minmax(120px,.45fr); }
html body .streak-bonus-card[data-form-surface] { display:grid; grid-template-columns:minmax(0,1fr) minmax(90px,.4fr) minmax(90px,.4fr); }
html body :is(.reward-level-card,.streak-bonus-card)[data-form-surface] > label { grid-column:auto; min-width:0; }
html body :is(.reward-level-card,.streak-bonus-card)[data-form-surface] > .reward-level-actions { grid-column:1/-1; justify-content:flex-end; }
@media(max-width:640px) {
 html body :is(.reward-level-card,.streak-bonus-card)[data-form-surface] { grid-template-columns:minmax(0,1fr); }
 html body #parentReminderDialog .phone-reminder-card-copy .form-topic-copy { display:contents; }
 html body #parentReminderDialog .phone-reminder-card-copy > img { grid-column:1; grid-row:1/3; }
 html body #parentReminderDialog .phone-reminder-card-copy .eyebrow { grid-column:2; grid-row:1; margin:0; }
 html body #parentReminderDialog .phone-reminder-card-copy h3 { grid-column:2; grid-row:2; }
 html body #parentReminderDialog .phone-reminder-card-copy .form-topic-copy > p:not(.eyebrow) { grid-column:1/-1; margin:0; }
 html body #parentReminderDialog .phone-reminder-card-copy > button { grid-column:3; grid-row:1/3; }
}

#chores :is(.reward-level-card,.streak-bonus-card)[data-form-surface] > label { grid-column:auto; grid-row:auto; }
#chores :is(.reward-level-card,.streak-bonus-card)[data-form-surface] > .form-topic-heading { grid-column:1/-1; grid-row:auto; }

/* Confirmation titles need a full line on narrow screens. */
html body .app-confirm-dialog { width:min(560px, calc(100vw - 32px)); }
html body .app-confirm-form > .form-topic-heading { grid-template-columns:48px minmax(0,1fr) auto; gap:12px; padding:14px; }
html body .app-confirm-form .form-topic-illustration { width:48px; height:48px; }
html body .app-confirm-form .form-topic-heading h2 { font-size:24px; }
@media(max-width:640px) {
 html body .app-confirm-form { padding:18px; }
 html body .app-confirm-form > .form-topic-heading > div { display:contents; }
 html body .app-confirm-form .form-topic-heading > img { grid-column:1; grid-row:1; }
 html body .app-confirm-form .form-topic-heading .eyebrow { grid-column:2; grid-row:1; }
 html body .app-confirm-form .form-topic-heading > button { grid-column:3; grid-row:1; }
 html body .app-confirm-form .form-topic-heading h2 { grid-column:1/-1; grid-row:2; font-size:22px; }
}

/* Sticky dialog headers must remain opaque over scrolled fields. */
html body #settings .family-dialog .family-dialog-heading.form-topic-heading { background-color:#fffdf9; }

/* Separate password recovery from the primary sign-in action. */
html body #signup > #authRecoveryToggle { margin-block:16px 4px; }

/* Recovery subviews already provide their own illustrated title. */
html body #signup:has(> .auth-recovery-panel:not([hidden])) > .panel-header { display:none; }

/* Calm, accessible loading feedback for the private message dialog. */
.school-detail-dialog .school-dialog-body { min-height:min(240px,40dvh); align-content:start; }
.school-detail-feedback { min-width:0; }
.school-detail-feedback .school-status { margin:0; }
.school-detail-dialog[data-loading="true"] .school-detail-feedback { display:flex; flex-direction:column; align-items:center; gap:12px; padding-top:24px; color:#426861; text-align:center; }
.school-detail-spinner { display:block; box-sizing:border-box; width:32px; height:32px; border:3px solid #dce6dd; border-top-color:#4b746e; border-radius:50%; animation:school-detail-spin .85s linear infinite; }
.school-detail-skeleton { display:grid; gap:10px; width:min(100%,560px); margin:8px auto 24px; }
.school-detail-skeleton span { display:block; height:10px; border-radius:5px; background:#e8eee8; animation:school-detail-pulse 1.6s ease-in-out infinite; }
.school-detail-skeleton span:nth-child(2) { width:92%; }
.school-detail-skeleton span:nth-child(3) { width:72%; }
.school-message-count { font-size:.85em; font-weight:500; color:#526257; white-space:normal; }
#schoolDetailLoading[hidden],#schoolDetailSpinner[hidden] { display:none; }
@keyframes school-detail-spin { to { transform:rotate(360deg); } }
@keyframes school-detail-pulse { 50% { opacity:.45; } }
@media(prefers-reduced-motion:reduce) { .school-detail-spinner,.school-detail-skeleton span { animation:none; } }

/* The heading receives reading focus; actionable controls retain visible rings. */
.school-detail-dialog #schoolDetailTitle:focus { outline:none; }
