html {
  background-color: #f8faf7;
}

.family-header-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--header-height);
}

.family-header .brand-link {
  grid-column: auto;
  min-width: 0;
  flex: 1 1 auto;
}

.family-header .brand-wordmark {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}

.family-header-actions,
.family-inline-actions,
.family-content-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.family-header-actions {
  margin-left: auto;
  flex: 0 1 auto;
  min-width: 0;
}

.family-account-email {
  color: var(--muted);
  min-width: 0;
  overflow-wrap: normal;
  white-space: normal;
  word-break: normal;
}

.family-main {
  min-height: calc(100vh - var(--header-height));
  padding: 52px 0 80px;
}

.family-shell {
  display: grid;
  gap: 28px;
}

.family-intro {
  max-width: 820px;
}

.family-intro h1 {
  margin: 6px 0 10px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1;
}

.family-intro p {
  color: var(--muted);
  font-size: 1.05rem;
}

.family-message {
  min-height: 24px;
  padding: 0 2px;
  color: var(--brand-deep);
  font-weight: 650;
}

.family-message.is-error {
  color: #a62424;
}

.family-verification-message {
  padding: 14px 16px;
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 650;
}

.family-verification-message.is-error {
  border-left-color: #a62424;
  color: #7f1d1d;
}

.family-auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 22px;
  align-items: start;
}

.family-auth-card,
.family-help-card,
.family-centered-card,
.family-settings-card,
.family-report-detail {
  padding: clamp(20px, 4vw, 34px);
}

.family-help-card h2,
.family-centered-card h2,
.family-form h2,
.family-content h2 {
  margin: 0 0 14px;
}

.family-help-card ol {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.family-auth-tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 24px;
  padding: 5px;
  border-radius: 999px;
  background: var(--surface-alt);
}

.family-auth-tab,
.family-link-button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.family-auth-tab {
  padding: 9px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.family-auth-tab.is-active {
  background: var(--surface);
  color: var(--brand-deep);
  box-shadow: 0 6px 18px rgba(20, 36, 40, .08);
}

.family-link-button {
  justify-self: start;
  padding: 4px 0;
  background: transparent;
  color: var(--brand-deep);
  text-decoration: underline;
  text-underline-offset: .2em;
}

.family-form {
  display: grid;
  gap: 10px;
}

.family-form label,
.family-student-filter > label {
  font-weight: 750;
}

.family-form input,
.family-student-filter select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(24, 32, 34, .2);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}



.family-form input:focus-visible,
.family-student-filter select:focus-visible,
.family-auth-tab:focus-visible,
.family-portal-tab:focus-visible,
.family-link-button:focus-visible,
.family-details summary:focus-visible {
  outline: 3px solid rgba(15, 167, 178, .28);
  outline-offset: 2px;
}

.family-form .button {
  margin-top: 6px;
}

.family-subform {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.family-centered-card {
  max-width: 720px;
}

.family-portal {
  display: grid;
  gap: 20px;
}

.family-portal-tabs {
  display: inline-flex;
  justify-self: start;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--surface-alt);
}

.family-portal-tab {
  min-height: 42px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.family-portal-tab.is-active {
  background: var(--surface);
  color: var(--brand-deep);
  box-shadow: 0 6px 18px rgba(20, 36, 40, .08);
}

.family-portal-panel {
  min-width: 0;
}

.family-report-toolbar {
  display: block;
  margin-bottom: 18px;
  padding: 18px;
}

.family-student-filter select {
  margin-top: 8px;
}

.family-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}

.family-settings-card h3 {
  margin: 0;
}

.family-compact-form {
  margin-top: 16px;
}

.family-content-heading {
  margin-bottom: 18px;
}

.family-loading,
.family-empty,
.family-first-student {
  padding: 28px;
}

.family-report-list {
  display: grid;
  gap: 12px;
}

.family-report-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(16, 24, 28, .05);
  overflow: hidden;
}

.family-report-card.is-open {
  border-color: var(--brand);
}

.family-report-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.family-report-toggle:hover,
.family-report-toggle:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--brand) 5%, transparent);
}

.family-report-summary,
.family-report-summary strong,
.family-report-summary-meta,
.family-report-toggle-label {
  display: block;
}

.family-report-summary-meta,
.family-report-toggle-label {
  margin-top: 3px;
  color: var(--muted);
}

.family-report-toggle-label {
  margin-top: 0;
  white-space: nowrap;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .01em;
}

.family-report-close-label {
  display: none;
}

.family-report-card.is-open .family-report-open-label {
  display: none;
}

.family-report-card.is-open .family-report-close-label {
  display: inline;
}

.family-report-summary-meta {
  max-height: 2.5em;
  overflow: hidden;
  transition: max-height .2s ease, margin .2s ease, opacity .16s ease;
}

.family-report-card.is-open .family-report-summary-meta {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}

.family-report-expansion {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .26s ease, opacity .2s ease;
}

.family-report-card.is-open .family-report-expansion {
  grid-template-rows: 1fr;
  opacity: 1;
}

.family-report-expansion-inner {
  min-height: 0;
  overflow: hidden;
}

.family-report-card .family-report-detail {
  margin: 0;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.family-report-loading {
  margin: 0;
  padding: 18px;
  color: var(--muted);
}

.family-report-detail dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 18px;
  margin: 18px 0;
}

.family-report-detail dt {
  color: var(--muted);
  font-weight: 700;
}

.family-report-detail dd {
  margin: 0;
}

.family-report-indications {
  padding: 18px;
  border-radius: 14px;
  background: var(--surface-alt);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.family-report-indications a {
  color: #065bc4;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

.family-report-indications + .family-inline-actions {
  margin-top: 24px;
}

.family-footer {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .family-auth-grid,
  .family-settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .family-main {
    padding-top: 32px;
  }

  .family-header-shell {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: var(--header-height);
    padding: 0;
  }

  .family-account-email {
    max-width: clamp(132px, 37vw, 200px);
    font-size: clamp(.72rem, 3.35vw, .9rem);
    line-height: 1.2;
  }

  .family-header-actions {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .family-header .button {
    min-height: 44px;
    padding: 0 14px;
  }

  .family-content-heading {
    align-items: flex-start;
  }

  .family-portal-tabs {
    width: 100%;
  }

  .family-portal-tab {
    flex: 1 1 0;
    padding-inline: 12px;
  }

  .family-report-detail dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .family-report-detail dd {
    margin-bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

.family-message:empty { display: none; }
.family-form button[aria-busy="true"]::before,
.family-header button[aria-busy="true"]::before,
.family-inline-actions button[aria-busy="true"]::before,
.family-content button[aria-busy="true"]::before,
.family-loading::before {
  content: ""; display: inline-block; width: 1em; height: 1em;
  margin-right: .6em; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: family-spin .8s linear infinite; vertical-align: middle;
}
button:disabled { cursor: wait; opacity: .65; }
@keyframes family-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { [aria-busy="true"]::before, .family-loading::before { animation: none !important; } }

.family-first-student h3 { margin: 0 0 12px; }
.family-first-student p { color: var(--muted); }

.family-report-updated { display:inline-block; background:#d0efe0; color:#165c35; border-radius:20px; padding:4px 10px; margin:6px 0; font-size:13px; font-weight:700; }
