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

:root {
  /* Primary — calming teal */
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #5eead4;
  --primary-bg: #f0fdfa;
  --primary-gradient: linear-gradient(135deg, #0f766e 0%, #0d9488 40%, #14b8a6 100%);

  /* Accent — warm amber for CTAs and highlights */
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fde68a;
  --accent-bg: #fffbeb;

  /* Semantic */
  --success: #059669;
  --success-dark: #047857;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --info: #0284c7;
  --info-dark: #0369a1;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;

  /* Neutrals — warm-tinted slate */
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --bg: #fafaf9;
  --bg-warm: #f5f5f4;
  --card: #ffffff;

  /* Shape */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.03);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
}

/* ======================== */
/* Hero                     */
/* ======================== */
.hero {
  background: var(--primary-gradient);
  padding: 3.5rem 1.5rem 5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 25% 120%, rgba(255,255,255,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 75% -20%, rgba(255,255,255,0.12) 0%, transparent 50%);
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 48px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.hero-inner {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  z-index: 1;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 0.35rem 1rem;
  border-radius: 24px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255,255,255,0.22);
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.hero p {
  color: rgba(255,255,255,0.88);
  margin-top: 0.85rem;
  font-size: 1.1rem;
  line-height: 1.55;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.hero-features {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.hero-feature {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.9);
  font-size: 0.82rem;
  font-weight: 500;
}
.hero-feature svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* ======================== */
/* Container                */
/* ======================== */
.container {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 1.5rem;
  margin-top: -2.5rem;
  position: relative;
  z-index: 2;
}

/* ======================== */
/* Form Card                */
/* ======================== */
.form-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  border: 1px solid rgba(0,0,0,0.04);
}
.form-card-header {
  margin-bottom: 1.75rem;
}
.form-card-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.form-card-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
}
.currency-icon {
  font-size: 0.9rem;
  font-weight: 600;
}

input, select {
  width: 100%;
  padding: 0.75rem 0.85rem 0.75rem 2.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
  accent-color: var(--primary);
}
input.has-currency {
  padding-left: 1.85rem;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.22 4.47a.75.75 0 011.06 0L6 7.19l2.72-2.72a.75.75 0 011.06 1.06l-3.25 3.25a.75.75 0 01-1.06 0L2.22 5.53a.75.75 0 010-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}
input:hover, select:hover {
  border-color: var(--primary-light);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--primary);
}

.form-error {
  display: none;
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-xs);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

/* ======================== */
/* Children Section         */
/* ======================== */
.children-section {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1.5px solid var(--border-light);
}
.children-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.children-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.child-entry {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  border: 1.5px solid var(--border-light);
  transition: border-color var(--transition), background var(--transition);
}
.child-entry:hover {
  border-color: var(--border);
  background: var(--bg-warm);
}
.child-entry .child-label {
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 60px;
  color: var(--text-secondary);
}
.child-entry select {
  flex: 1;
  padding-left: 0.85rem;
  background-color: var(--card);
}
.child-entry .remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.3rem 0.4rem;
  line-height: 1;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.child-entry .remove-btn:hover {
  color: var(--error);
  background: var(--error-bg);
}

.add-child-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1.5px dashed var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
}
.add-child-btn:hover {
  background: #ccfbf1;
  border-color: var(--primary);
}

/* ======================== */
/* Buttons                  */
/* ======================== */
.btn-row {
  display: flex;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.btn-primary, .btn-secondary {
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-primary:focus-visible, .btn-secondary:focus-visible,
.add-child-btn:focus-visible, .child-entry .remove-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  padding: 0.85rem 2rem;
  font-size: 1rem;
  flex: 1;
  box-shadow: 0 2px 12px rgba(13,148,136,0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(13,148,136,0.4);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 1px 6px rgba(13,148,136,0.3);
}

.btn-secondary {
  background: var(--card);
  color: var(--primary);
  border: 1.5px solid var(--primary-light);
  padding: 0.85rem 1.35rem;
  font-size: 0.9rem;
  white-space: nowrap;
}
.btn-secondary:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
}

.btn-tertiary {
  background: none;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.btn-tertiary:hover {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-bg);
}
.btn-tertiary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ======================== */
/* Results                  */
/* ======================== */
#results {
  display: none;
  scroll-margin-top: 1.5rem;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--primary), var(--primary-light), transparent) 1;
}
.results-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.015em;
}

.region-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--primary-bg);
  color: var(--primary-dark);
  padding: 0.4rem 0.95rem;
  border-radius: 24px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(13,148,136,0.12);
}

/* ======================== */
/* Summary bar chart        */
/* ======================== */
.cost-summary {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.75rem;
  border: 1px solid rgba(0,0,0,0.04);
}
.cost-summary h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text);
}
.bar-legend {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.bar-legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.bar-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.bar-legend-swatch.gross { background: #ccfbf1; }
.bar-legend-swatch.effective { background: var(--primary); }

.bar-row {
  margin-bottom: 0.95rem;
}
.bar-row:last-child { margin-bottom: 0; }
.bar-label {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.best-badge {
  display: inline-block;
  background: var(--success-bg);
  color: var(--success);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 0.4rem;
  border: 1px solid var(--success-border);
}
.bar-track {
  position: relative;
  height: 34px;
  background: var(--bg-warm);
  border-radius: 10px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: #ccfbf1;
  border-radius: 10px;
  position: relative;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}
.bar-eff {
  height: 100%;
  background: var(--primary);
  border-radius: 10px 0 0 10px;
}
.bar-amount {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 0 8px #fff, 0 0 8px #fff, 0 0 8px #fff;
  font-variant-numeric: tabular-nums;
}

/* ======================== */
/* Cost cards               */
/* ======================== */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  margin-bottom: 1.75rem;
}

.cost-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.65rem;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  position: relative;
  border: 1.5px solid rgba(0,0,0,0.04);
  overflow: hidden;
}
.cost-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}
.cost-card.cheapest {
  border-color: var(--success);
  box-shadow: var(--shadow), 0 0 0 1px var(--success-border);
  background: linear-gradient(to bottom, #ecfdf5, var(--card) 60px);
}
.cost-card.cheapest::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--success), #34d399);
  background-size: 200% 100%;
  animation: shimmer 3s ease infinite;
}
@keyframes shimmer {
  0%, 100% { background-position: 0% 0; }
  50% { background-position: 100% 0; }
}
.card-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  background: var(--success);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cost-card .icon {
  font-size: 1.85rem;
  margin-bottom: 0.4rem;
  display: block;
}
.cost-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
  color: var(--text-secondary);
}
.cost-card .total {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.cost-card .per-yr {
  font-size: 0.55em;
  font-weight: 500;
  color: var(--text-muted);
}
.cost-card .monthly {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.cost-card .cost-breakdowns {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.cost-card .cost-breakdowns span {
  white-space: nowrap;
}

.effective-cost {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem 0.65rem 1rem;
  background: var(--success-bg);
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  border: 1px solid var(--success-border);
  border-left: 3px solid var(--success);
}
.effective-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
  font-weight: 500;
}
.effective-amount {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--success-dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}
.effective-monthly {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}
.tax-detail-mini {
  font-size: 0.72rem;
  color: var(--success-dark);
  opacity: 0.7;
  margin-top: -1px;
  padding: 0.22rem 0.85rem 0.28rem 1rem;
  background: var(--success-bg);
  border-radius: 0 0 var(--radius-xs) var(--radius-xs);
  border: 1px solid var(--success-border);
  border-left: 3px solid var(--success);
  border-top: none;
}

.cost-card .breakdown {
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  padding-top: 0.65rem;
}
.cost-card .breakdown div {
  display: flex;
  justify-content: space-between;
  padding: 0.22rem 0;
}
.cost-card .au-pair-info {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ======================== */
/* Section headers          */
/* ======================== */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.section-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tax-icon {
  background: var(--success-bg);
  color: var(--success-dark);
}
.subsidy-icon {
  background: var(--info-bg);
  color: var(--info);
}

/* ======================== */
/* Tax Savings              */
/* ======================== */
.tax-section {
  background: var(--card);
  border: 1.5px solid var(--success-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}
.tax-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--success-dark);
}

.tax-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
}

.tax-item {
  background: var(--success-bg);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  border: 1px solid var(--success-border);
}
.tax-item h4 {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.tax-item .amount {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--success-dark);
  font-variant-numeric: tabular-nums;
}
.tax-item .detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}
.tax-item.total-savings {
  grid-column: 1 / -1;
  text-align: center;
  background: linear-gradient(135deg, var(--success-dark), #10b981, #34d399);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(5,150,105,0.25);
  padding: 1.5rem;
}
.tax-item.total-savings h4 { color: rgba(255,255,255,0.82); }
.tax-item.total-savings .amount { color: #fff; font-size: 1.75rem; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.tax-item.total-savings .detail { color: rgba(255,255,255,0.78); }

/* ======================== */
/* Subsidies                */
/* ======================== */
.subsidy-section {
  background: var(--card);
  border: 1.5px solid var(--info-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}
.subsidy-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--info-dark);
}
.subsidy-section .subsidy-intro {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}
.subsidy-card {
  background: var(--info-bg);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--info-border);
}
.subsidy-card:last-child { margin-bottom: 0; }
.subsidy-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.subsidy-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  line-height: 1.65;
}
.subsidy-card .income-badge {
  display: inline-block;
  background: var(--accent-bg);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  margin-top: 0.55rem;
}
.subsidy-card a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--info);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}
.subsidy-card a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.no-subsidy {
  background: var(--info-bg);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ======================== */
/* Skip Link                */
/* ======================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--primary);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 100;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 1rem;
}

/* ======================== */
/* Affordability Section    */
/* ======================== */
.affordability-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.04);
}
.affordability-section:empty {
  display: none;
}
.affordability-icon {
  background: var(--accent-bg);
  color: var(--accent-dark);
}
.affordability-intro {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.65;
}
.affordability-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.affordability-row {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  background: var(--bg);
}
.affordability-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}
.affordability-pct {
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pct-good { color: var(--success-dark); }
.pct-warn { color: var(--warn); }
.affordability-bar-track {
  position: relative;
  height: 10px;
  background: var(--bg-warm);
  border-radius: 6px;
  overflow: visible;
}
.affordability-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
  position: relative;
}
.affordability-bar-fill::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px #fff;
}
.bar-good::after { color: var(--success); }
.bar-warn::after { color: var(--warn); }
.bar-good { background: linear-gradient(90deg, #a7f3d0, var(--success)); }
.bar-warn { background: linear-gradient(90deg, var(--accent-light), var(--warn)); }
.affordability-threshold {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--error);
  opacity: 0.6;
}
.threshold-label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--error);
  white-space: nowrap;
}
.affordability-tag {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
}
.affordable .affordability-tag { color: var(--success); }
.not-affordable .affordability-tag { color: var(--warn); }

/* ======================== */
/* Projection Section       */
/* ======================== */
.projection-section {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}
.projection-icon {
  background: var(--purple-bg);
  color: var(--purple);
}
.projection-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.projection-intro {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.65;
}
.projection-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.projection-header-row {
  display: grid;
  grid-template-columns: 80px 110px 1fr;
  gap: 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0 0.5rem 0.5rem;
  border-bottom: 1.5px solid var(--border-light);
}
.projection-row {
  display: grid;
  grid-template-columns: 80px 110px 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.5rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}
.projection-row:last-child { border-bottom: none; }
.projection-year {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
}
.projection-annual {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.projection-cumulative {
  position: relative;
  display: flex;
  align-items: center;
}
.projection-row:nth-child(even) {
  background: var(--bg);
  border-radius: var(--radius-xs);
}
.projection-row:hover {
  background: var(--primary-bg);
}
.projection-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--purple-bg), rgba(124, 58, 237, 0.2));
  border-radius: 4px;
  transition: width 0.4s ease;
}
.projection-val {
  position: relative;
  z-index: 1;
  font-weight: 700;
  color: var(--purple);
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  font-variant-numeric: tabular-nums;
}
.projection-total-row {
  display: grid;
  grid-template-columns: 80px 110px 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem 0.25rem;
  border-top: 2px solid var(--text);
  margin-top: 0.25rem;
  font-weight: 800;
  font-size: 0.9rem;
}
.projection-total-val {
  color: var(--purple);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

/* ======================== */
/* Export Row                */
/* ======================== */
.export-row {
  text-align: center;
  margin-bottom: 1.75rem;
}

/* ======================== */
/* Care type descriptions   */
/* ======================== */
.info-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 500;
  padding: 0.35rem 0;
  margin-top: 0.5rem;
  transition: color var(--transition);
}
.info-toggle:hover { color: var(--primary); }
.info-toggle .info-label { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.care-desc {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.65;
  padding: 0 0.85rem;
  background: var(--bg);
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  margin-top: 0.45rem;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease, border-color 0.3s ease;
}
.cost-card.show-desc .care-desc {
  max-height: 200px;
  opacity: 1;
  padding: 0.65rem 0.85rem;
  border-color: var(--border-light);
}
.cost-card.show-desc .info-toggle .info-label { text-decoration: none; }

/* Cost factor badges */
.cost-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.4rem 0;
}
.cost-factor {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  white-space: nowrap;
}
.sibling-tag, .summer-tag {
  font-size: 0.65rem;
  font-style: normal;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  vertical-align: middle;
}
.sibling-tag { background: var(--success-bg); color: var(--success-dark); }
.summer-tag { background: var(--accent-bg); color: var(--accent-dark); }

/* ======================== */
/* Button active states     */
/* ======================== */
.btn-secondary:active {
  transform: scale(0.97);
}
.btn-tertiary:active {
  transform: scale(0.97);
}

/* ======================== */
/* Staggered animations     */
/* ======================== */
.animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  transition-delay: var(--delay, 0s);
}
.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Child entry slide-in */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.child-entry-new {
  animation: slideIn 0.25s ease forwards;
}

/* Section dividers */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 2.5rem 0;
}

/* Tax donut chart */
.tax-donut-wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.15rem;
}
.tax-donut {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.tax-donut::after {
  content: '';
  position: absolute;
  inset: 16px;
  background: var(--card);
  border-radius: 50%;
}
.tax-donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.tax-donut-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.tax-donut-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ======================== */
/* Footer                   */
/* ======================== */
.disclaimer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2.5rem;
  padding-bottom: 3rem;
  line-height: 1.75;
}
.disclaimer p + p {
  margin-top: 0.15rem;
}

/* ======================== */
/* Content visibility        */
/* ======================== */
.tax-section,
.subsidy-section,
.projection-section,
.affordability-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

/* ======================== */
/* Backdrop-filter form     */
/* ======================== */
@supports (backdrop-filter: blur(1px)) {
  .form-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* ======================== */
/* Responsive               */
/* ======================== */
@media (max-width: 640px) {
  .hero {
    padding: 2.25rem 1.25rem 3.5rem;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .hero p {
    font-size: 0.95rem;
  }
  .hero-features {
    gap: 0.75rem 1.25rem;
  }
  .hero-feature {
    font-size: 0.78rem;
  }
  .container {
    padding: 0 1rem;
    margin-top: -2rem;
  }
  .form-card {
    padding: 1.5rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .results-grid {
    grid-template-columns: 1fr;
  }
  .tax-grid {
    grid-template-columns: 1fr;
  }
  .cost-card .total {
    font-size: 1.4rem;
  }
  .btn-row {
    flex-direction: column;
    position: sticky;
    bottom: 0;
    background: var(--card);
    margin: 0 -1.5rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    z-index: 10;
    border-top: 1px solid var(--border-light);
  }
  .btn-secondary, .btn-tertiary {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .bar-amount {
    position: static;
    display: block;
    transform: none;
    text-align: right;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    text-shadow: none;
  }
  .bar-track {
    height: 26px;
  }
  .children-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
  }
  .projection-header-row,
  .projection-row,
  .projection-total-row {
    grid-template-columns: 65px 90px 1fr;
    gap: 0.5rem;
  }
  .affordability-label {
    font-size: 0.8rem;
  }
  .affordability-threshold {
    top: -14px;
  }
  .threshold-label {
    font-size: 0.6rem;
  }
  .cost-factors {
    gap: 0.2rem;
  }
  .cost-factor {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
  }
  .sibling-tag, .summer-tag {
    font-size: 0.6rem;
  }
  .cost-breakdowns {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.78rem;
  }
  .tax-detail-mini {
    font-size: 0.65rem;
  }
  /* Touch targets */
  .remove-btn {
    padding: 0.5rem 0.6rem !important;
    min-height: 44px;
  }
  .info-toggle {
    padding: 0.5rem 0;
    min-height: 44px;
  }
  .add-child-btn {
    padding: 0.65rem 1.1rem;
    min-height: 44px;
  }
  .tax-donut-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ======================== */
/* Reduced motion           */
/* ======================== */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition: 0.01s;
  }
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01s !important;
    transition-duration: 0.01s !important;
  }
}

/* ======================== */
/* Dark mode                */
/* ======================== */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #14b8a6;
    --primary-dark: #0d9488;
    --primary-light: #5eead4;
    --primary-bg: #042f2e;
    --primary-gradient: linear-gradient(135deg, #0f766e 0%, #0d9488 40%, #14b8a6 100%);

    --accent: #fbbf24;
    --accent-dark: #f59e0b;
    --accent-light: #78350f;
    --accent-bg: #451a03;

    --success: #34d399;
    --success-dark: #6ee7b7;
    --success-bg: #022c22;
    --success-border: #065f46;
    --info: #38bdf8;
    --info-dark: #7dd3fc;
    --info-bg: #0c2d48;
    --info-border: #0e4868;
    --warn: #fbbf24;
    --warn-bg: #451a03;
    --error: #f87171;
    --error-bg: #450a0a;
    --purple: #a78bfa;
    --purple-bg: #1e1348;

    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --bg: #0f172a;
    --bg-warm: #1e293b;
    --card: #1e293b;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.15);
  }
  .hero::after {
    background: var(--bg);
  }
  .bar-fill {
    background: #134e4a;
  }
  .bar-legend-swatch.gross { background: #134e4a; }
  .bar-amount {
    text-shadow: 0 0 8px var(--card), 0 0 8px var(--card), 0 0 8px var(--card);
  }
  .cost-card {
    border-color: var(--border);
  }
  .cost-card.cheapest {
    background: linear-gradient(to bottom, #022c22, var(--card) 60px);
  }
  .form-card {
    border-color: var(--border);
  }
  @supports (backdrop-filter: blur(1px)) {
    .form-card {
      background: rgba(30, 41, 59, 0.85);
    }
  }
  .tax-donut::after {
    background: var(--card);
  }
  .affordability-bar-fill::after {
    box-shadow: 0 0 0 2px var(--card);
  }
}

/* ======================== */
/* Print                    */
/* ======================== */
@media print {
  body { background: #fff; }
  .hero { display: none; }
  .form-card, .btn-row, .add-child-btn, .btn-tertiary, .export-row, .disclaimer, .skip-link, .info-toggle, .care-desc { display: none; }
  #results { display: block !important; }
  .animate-in { opacity: 1 !important; transform: none !important; }
  .cost-card, .tax-section, .subsidy-section, .cost-summary, .affordability-section, .projection-section { break-inside: avoid; }
  .cost-card { box-shadow: none; border: 1px solid #ddd; }
  .cost-summary { box-shadow: none; border: 1px solid #ddd; }
  .container { margin-top: 0; }
}
