:root {
  --bg: #FAF9F6;
  --bg-subtle: #F3F2EC;
  --navy: #0A1628;
  --navy-soft: #132542;
  --ink: #111827;
  --ink-muted: #4B5563;
  --ink-subtle: #6B7280;
  --spark: #FFDE00;
  --spark-amber: #D97706;
  --card-bg: #FFFFFF;
  --border: rgba(10, 22, 40, 0.1);
  --border-input: #CBD5E1;
  --emerald-bg: #ECFDF5;
  --emerald-border: #A7F3D0;
  --emerald-ink: #065F46;
  --amber-bg: #FFFBEB;
  --amber-border: #FDE68A;
  --amber-ink: #92400E;
  --red-bg: #FEF2F2;
  --red-border: #FECACA;
  --red-ink: #991B1B;
  --radius-pill: 9999px;
  --radius-card: 22px;
  --radius-sm: 12px;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #2563EB;
  outline-offset: 2px;
}

sup.fn {
  font-size: 0.68em;
  line-height: 0;
  margin-inline-start: 2px;
}

sup.fn a {
  color: var(--ink-subtle);
  text-decoration: none;
  font-weight: 600;
}

sup.fn a:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* Native Modal Dialog Scroll Containment (modern-web-guidance) */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(10, 22, 40, 0.56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Top App Header */
.app-header {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.15rem 1.5rem 0;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.6rem 0.5rem 1.1rem;
  box-shadow: 0 8px 26px -14px rgba(10, 22, 40, 0.1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--navy);
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
}

.brand-star {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-star svg {
  width: 16px;
  height: 16px;
}

.brand em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--spark-amber);
  font-size: 1.18em;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  background: var(--bg-subtle);
  border: 1px solid rgba(10, 22, 40, 0.08);
  padding: 0.18rem 0.58rem;
  border-radius: var(--radius-pill);
  margin-inline-start: 0.2rem;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.brand-sub[data-context="microschool"] {
  background: #FEF3C7;
  color: var(--amber-ink);
  border-color: var(--amber-border);
}

.brand-sub[data-context="coop"] {
  background: #EFF6FF;
  color: #1E3A8A;
  border-color: #BFDBFE;
}

.brand-sub[data-context="family"] {
  background: var(--emerald-bg);
  color: var(--emerald-ink);
  border-color: var(--emerald-border);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav-overview-link {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
}

.nav-overview-link:hover {
  color: var(--navy);
}

/* Upper-Right Account Profile Avatar Button */
.avatar-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg);
  border: 1px solid rgba(10, 22, 40, 0.14);
  border-radius: var(--radius-pill);
  padding: 0.26rem 0.75rem 0.26rem 0.3rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--navy);
  font-weight: 700;
  font-size: 0.84rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.avatar-trigger:hover {
  background: #FFFFFF;
  border-color: var(--navy);
}

.avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--spark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Main Workspace Container */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 2.25rem 1.5rem 4rem;
}

/* Loading State */
.loading-shell {
  max-width: 460px;
  margin: 4rem auto;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(10, 22, 40, 0.14);
  border-top-color: var(--navy);
  border-radius: 50%;
  margin: 0 auto 0.9rem;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Shared Card & Typography */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2.25rem;
  min-inline-size: 0;
  box-shadow: 0 20px 44px -24px rgba(10, 22, 40, 0.12);
}

.auth-shell {
  max-width: 552px;
  margin: 0.75rem auto 0;
}

.onboarding-narrow {
  max-width: 680px;
  margin: 0.5rem auto 0;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--spark-amber);
  margin-block-end: 0.55rem;
}

.serif-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--navy);
  margin-block-end: 0.65rem;
  text-wrap: balance;
}

.serif-title em {
  font-style: italic;
  color: var(--spark-amber);
}

.subcopy {
  font-size: 0.96rem;
  color: var(--ink-muted);
  line-height: 1.58;
  margin-block-end: 1.5rem;
}

/* Status & Invite Banners */
.banner {
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  margin-block-end: 1.25rem;
}

.banner-info {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E3A8A;
}

.banner-success {
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  color: var(--emerald-ink);
}

.banner-warn {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: var(--amber-ink);
}

.banner-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red-ink);
}

/* Role Selection Checkboxes on Auth */
.role-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-block-end: 1.35rem;
}

.role-check-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-block-size: 44px;
  background: var(--bg);
  border: 1.5px solid var(--border-input);
  border-radius: 15px;
  padding: 0.88rem 1.05rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.role-check-card:hover {
  border-color: var(--navy);
}

.role-check-card:has(input:checked) {
  background: #FFFFFF;
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(10, 22, 40, 0.08);
}

.role-check-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 0.15rem;
  accent-color: var(--navy);
  flex-shrink: 0;
  cursor: pointer;
}

.role-check-title {
  display: block;
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1.3;
  color: var(--navy);
}

.role-check-desc {
  display: block;
  font-size: 0.82rem;
  line-height: 1.42;
  color: var(--ink-muted);
  margin-top: 0.18rem;
}

/* Prominent Google Sign-In Button */
.google-btn-wrap {
  margin-block-end: 1.2rem;
}

.rec-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--emerald-ink);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.6rem;
  margin-block-end: 0.5rem;
}

.btn-google {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  background: var(--navy);
  color: #FFFFFF;
  border: 1px solid var(--navy);
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.8rem 1.25rem;
  box-shadow: 0 12px 28px -12px rgba(10, 22, 40, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-google:hover {
  background: var(--navy-soft);
  transform: translateY(-1px);
}

.btn-google-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.divider-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1.2rem 0;
}

.divider-or::before,
.divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Forms & Inputs */
.field-group {
  margin-block-end: 1.05rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field-row-3 {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 0.9fr;
  gap: 0.8rem;
}

label.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  margin-block-end: 0.36rem;
}

.opt-tag {
  font-weight: 500;
  font-size: 0.76rem;
  color: var(--ink-subtle);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
select,
textarea {
  font: inherit;
  font-size: 0.96rem;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  min-height: 46px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.prefix-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  overflow: hidden;
}

.prefix-input-wrap:focus-within {
  outline: 3px solid #2563EB;
  outline-offset: 2px;
}

.input-prefix {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0 0.75rem;
  border-right: 1px solid var(--border-input);
  white-space: nowrap;
}

.prefix-input-wrap input {
  border: 0;
  border-radius: 0;
  outline: none !important;
}

.field-hint {
  font-size: 0.79rem;
  color: var(--ink-subtle);
  margin-top: 0.32rem;
  line-height: 1.45;
}

.handle-status {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.35rem;
}

.handle-status.ok {
  color: var(--emerald-ink);
}

.handle-status.bad {
  color: var(--red-ink);
}

/* Primary & Secondary Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--navy);
  color: #FFFFFF;
  border: 1px solid var(--navy);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.82rem 1.55rem;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--navy-soft);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #FFFFFF;
  color: var(--navy);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.75rem 1.3rem;
  min-height: 46px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--navy);
  background: var(--bg);
}

.btn-spark {
  background: var(--spark);
  color: var(--navy);
  border-color: var(--spark);
  font-weight: 800;
}

.btn-spark:hover:not(:disabled) {
  background: #FFE84D;
}

.btn-full {
  width: 100%;
}

.text-btn {
  background: none;
  border: 0;
  color: var(--navy);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* Shareable @username Preview & Anti-Earmarking Statutory Card */
.ambassador-preview-card {
  background: var(--navy);
  color: #FFFFFF;
  border-radius: 18px;
  padding: 1.45rem 1.5rem;
  margin: 1.35rem 0;
}

.ambassador-url-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--spark);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 222, 0, 0.32);
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.75rem;
  margin-block-end: 0.8rem;
  word-break: break-all;
}

.ambassador-preview-card h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.18;
  margin-block-end: 0.5rem;
  color: #FFFFFF;
}

.ambassador-preview-card p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.55;
}

.statutory-rule-box {
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--spark);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.83rem;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.52;
}

.statutory-rule-box strong {
  color: var(--spark);
}

/* Split-Screen Co-Op / Microschool Builder */
.builder-split {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 1.75rem;
  align-items: start;
}

.preview-sticky {
  position: sticky;
  top: 1.25rem;
  min-inline-size: 0;
}

.preview-frame {
  background: #FFFFFF;
  border: 1px solid rgba(10, 22, 40, 0.14);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 24px 52px -24px rgba(10, 22, 40, 0.22);
}

.preview-browser-bar {
  background: #F1F5F9;
  border-bottom: 1px solid rgba(10, 22, 40, 0.08);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.preview-dots {
  display: inline-flex;
  gap: 5px;
}

.preview-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #CBD5E1;
}

.preview-url-bar {
  flex: 1;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-pill);
  padding: 0.22rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-body {
  padding: 1.65rem;
}

.coop-brand-row {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-block-end: 1rem;
  min-inline-size: 0;
}

.coop-brand-row > div {
  min-inline-size: 0;
}

.coop-logo-crest {
  width: 58px;
  height: 58px;
  border-radius: 15px;
  background: var(--navy);
  color: var(--spark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.coop-logo-crest img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.coop-type-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--spark-amber);
  background: #FEF3C7;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  margin-block-end: 0.2rem;
}

.preview-donor-widget {
  background: var(--navy);
  color: #FFFFFF;
  border-radius: 16px;
  padding: 1.25rem;
  margin-top: 1.15rem;
}

.preview-donor-widget h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.15;
  color: #FFFFFF;
  margin-block-end: 0.45rem;
}

.tier-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.85rem 0;
}

.tier-pill {
  background: rgba(255, 255, 255, 0.09);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  text-align: left;
  color: #FFFFFF;
  cursor: pointer;
  font-family: inherit;
}

.tier-pill.active {
  background: rgba(255, 222, 0, 0.15);
  border-color: var(--spark);
}

.tier-pill strong {
  display: block;
  font-size: 1.05rem;
  color: var(--spark);
}

.tier-pill span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.82);
}

/* Segmented Controls */
.segmented {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.24rem;
  gap: 0.2rem;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  padding: 0.44rem 0.95rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.seg-btn.active {
  background: #FFFFFF;
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(10, 22, 40, 0.08);
}

/* Logo Upload Row */
.logo-upload-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  border: 1px dashed var(--border-input);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  min-inline-size: 0;
}

.logo-upload-row > div {
  min-inline-size: 0;
}

.logo-upload-row input[type="file"] {
  max-inline-size: 100%;
}

/* Inline W-9 Accordion / Box */
.w9-panel {
  margin-top: 1.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.35rem;
}

.w9-panel summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--navy);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.w9-panel summary::-webkit-details-marker {
  display: none;
}

.ein-help-card {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E3A8A;
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0.9rem 0 1.1rem;
}

.ein-help-card a {
  color: #1D4ED8;
  font-weight: 700;
}

.attest-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 1rem 0;
}

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.83rem;
  color: var(--ink);
  line-height: 1.45;
  cursor: pointer;
}

.check-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.12rem;
  accent-color: var(--navy);
  flex-shrink: 0;
}

/* Active Portal Dashboard */
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-block-end: 1.5rem;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem;
}

.portal-card-full {
  grid-column: 1 / -1;
}

.copy-link-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-inline-size: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.55rem 0.65rem 0.55rem 0.9rem;
  margin-top: 0.9rem;
}

.copy-link-row.light {
  background: var(--bg);
  border-color: var(--border-input);
}

.copy-link-url {
  flex: 1;
  min-inline-size: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.15rem;
}

.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
}

.stat-num {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  line-height: 1.05;
  color: var(--navy);
}

.stat-label {
  font-size: 0.77rem;
  color: var(--ink-subtle);
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.26rem 0.7rem;
  border-radius: var(--radius-pill);
}

.status-pill.verified {
  background: var(--emerald-bg);
  color: var(--emerald-ink);
  border: 1px solid var(--emerald-border);
}

.status-pill.pending {
  background: var(--amber-bg);
  color: var(--amber-ink);
  border: 1px solid var(--amber-border);
}

/* Account Profile Native Dialog Drawer */
#accountProfileDialog {
  margin: auto 0 auto auto;
  width: min(560px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border: 0;
  border-left: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--ink);
  padding: 0;
  box-shadow: -20px 0 50px rgba(10, 22, 40, 0.22);
}

#accountProfileDialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.dialog-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.35rem 1.5rem 2rem;
}

.dialog-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.close-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-input);
  background: #FFFFFF;
  color: var(--navy);
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Public Share Pages (/@username and /c/:slug) */
.public-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.75rem;
  align-items: start;
}

.pledge-studio {
  background: var(--navy);
  color: #FFFFFF;
  border-radius: var(--radius-card);
  padding: 2rem;
  box-shadow: 0 24px 52px -22px rgba(10, 22, 40, 0.38);
}

.pledge-studio label.field-label {
  color: rgba(255, 255, 255, 0.92);
}

.pledge-math-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  margin: 0.95rem 0 1.15rem;
  font-size: 0.85rem;
}

.pledge-math-line {
  display: flex;
  justify-content: space-between;
  padding: 0.22rem 0;
  color: rgba(255, 255, 255, 0.84);
}

.pledge-math-line.highlight {
  color: var(--spark);
  font-weight: 700;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin-top: 0.35rem;
  padding-top: 0.5rem;
}

/* Toast */
.toast-region {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
}

.toast-pill {
  background: var(--navy);
  color: #FFFFFF;
  border: 1px solid rgba(255, 222, 0, 0.4);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(10, 22, 40, 0.32);
}

/* Minimal Footer */
.app-footer {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2.75rem;
  border-top: 1px solid var(--border);
}

/* ========================================================================== */
/* PER-CHILD ($1,000 / KID) ROSTER BUILDER & MERCURY SUB-LEDGER WALLET CARDS  */
/* ========================================================================== */
.roster-manager-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem 1.2rem;
  margin-block-end: 1.15rem;
}

.roster-manager-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-block-end: 0.85rem;
}

.roster-cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--emerald-ink);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-pill);
  padding: 0.22rem 0.68rem;
  white-space: nowrap;
}

.student-roster-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.student-roster-row {
  background: #FFFFFF;
  border: 1px solid var(--border-input);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.student-roster-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.student-slot-tag {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.18rem 0.6rem;
}

.student-roster-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(110px, 0.65fr) minmax(0, 1.6fr);
  gap: 0.65rem;
  align-items: end;
}

.btn-remove-student {
  background: transparent;
  border: 1px solid var(--red-border);
  color: var(--red-ink);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.btn-remove-student:hover {
  background: var(--red-bg);
}

.btn-add-student {
  margin-top: 0.75rem;
  width: 100%;
  min-height: 44px;
  border: 1.5px dashed var(--navy);
  background: #FFFFFF;
  color: var(--navy);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.55rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: background 0.15s ease;
}

.btn-add-student:hover:not(:disabled) {
  background: #F8FAFC;
}

.btn-add-student:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Per-Child $1,000 Mercury Sub-Ledger Wallet Cards */
.wallet-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 1.1rem;
  margin-top: 1rem;
}

.kid-wallet-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.kid-wallet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.kid-wallet-title {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.25;
}

.kid-wallet-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 0.15rem;
}

.kid-ledger-pill {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--navy);
  background: #FFFFFF;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}

.wallet-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wallet-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
}

.wallet-progress-track {
  width: 100%;
  height: 10px;
  background: #E2E8F0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
}

.wallet-progress-fill-disbursed {
  background: var(--emerald-ink);
  height: 100%;
  transition: width 0.25s ease;
}

.wallet-progress-fill-hold {
  background: var(--spark-amber);
  height: 100%;
  transition: width 0.25s ease;
}

.wallet-progress-fill-avail {
  background: var(--navy);
  height: 100%;
  opacity: 0.18;
  transition: width 0.25s ease;
}

.wallet-buckets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.wallet-bucket {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
}

.wallet-bucket-label {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-subtle);
  display: block;
}

.wallet-bucket-val {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--navy);
  margin-top: 0.1rem;
  display: block;
}

.wallet-bucket-val.emerald {
  color: var(--emerald-ink);
}

.wallet-bucket-val.amber {
  color: var(--amber-ink);
}

.kid-wishlist-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
}

.kid-wishlist-badge-url {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.wallet-reversion-strip {
  background: #FFFBEB;
  border: 1px solid var(--amber-border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font-size: 0.78rem;
  color: var(--amber-ink);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wallet-reversion-strip.extended {
  background: var(--emerald-bg);
  border-color: var(--emerald-border);
  color: var(--emerald-ink);
}

.wallet-reversion-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-claim-extension {
  background: var(--navy);
  color: #FFFFFF;
  border: 1px solid var(--navy);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  min-height: 34px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-claim-extension:hover:not(:disabled) {
  background: var(--navy-soft);
}

.btn-claim-extension:disabled {
  opacity: 0.65;
  cursor: default;
}

/* Interactive Dual-Mode Eligibility Checker (Materials + Educational Experiences) */
.sample-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin: 0.55rem 0 0.9rem;
}

.sample-test-pill {
  background: var(--bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--navy);
  padding: 0.32rem 0.72rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  text-align: left;
}

.sample-test-pill:hover {
  background: #FFFFFF;
  border-color: var(--navy);
}

.experience-prongs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.75rem 0 0.95rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem;
}

/* Built-In Reversion & Eligible Expense FAQ Reference Card */
.faq-reference-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.85rem;
}

.faq-ref-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.faq-ref-item h4 {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.3;
}

.faq-ref-item p,
.faq-ref-item ul {
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.52;
}

.faq-ref-item ul {
  padding-inline-start: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rule-chip-inline {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.rule-chip-inline.allow {
  background: var(--emerald-bg);
  color: var(--emerald-ink);
  border: 1px solid var(--emerald-border);
}

.rule-chip-inline.disallow {
  background: var(--red-bg);
  color: var(--red-ink);
  border: 1px solid var(--red-border);
}

.footnotes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.74rem;
  color: var(--ink-subtle);
  margin-block-end: 1.1rem;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-subtle);
}

.footer-row a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 860px) {
  .builder-split,
  .public-grid,
  .portal-grid,
  .faq-reference-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .student-roster-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .preview-sticky {
    position: static;
  }
}

@media (max-width: 640px) {
  .nav-overview-link {
    display: none;
  }
  .brand-sub {
    font-size: 0.62rem;
    padding: 0.14rem 0.46rem;
  }
  .app-main {
    padding: 1.5rem 1rem 3rem;
  }
  .card,
  .pledge-studio {
    padding: 1.5rem 1.25rem;
  }
  .field-row,
  .field-row-3,
  .stat-strip,
  .experience-prongs-grid,
  .wallet-buckets-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="url"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
  }
  .copy-link-row {
    flex-direction: column;
    align-items: stretch;
  }
  .prefix-input-wrap {
    flex-direction: column;
  }
  .input-prefix {
    border-right: 0;
    border-bottom: 1px solid var(--border-input);
    padding: 0.45rem 0.75rem;
  }
}

@media (max-width: 440px) {
  .brand-sub {
    display: none;
  }
}
