:root {
  --bg: #f5f7fa;
  --fg: #1f2937;
  --muted: #4b5563;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --border: #d1d5db;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-sm: 6px;
  --transition-fast: 0.15s ease;
  --chip-bg: #e5e7eb;
  --chip-fg: #374151;
  --chip-hover: #d1d5db;
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --card: #1e293b;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
  --chip-bg: #334155;
  --chip-fg: #e2e8f0;
  --chip-hover: #475569;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-switcher {
  display: flex;
  align-items: center;
}

.lang-select {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.lang-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}

.logo { font-size: 1.75rem; }

.brand h1 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.brand p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.nav-toggle {
  display: none;
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  margin-left: auto;
}
.nav-toggle:hover,
.nav-toggle:focus,
.nav-toggle[aria-expanded="true"] {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.top-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.top-nav a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.top-nav a:hover,
.top-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.theme-toggle {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.7rem;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

@media (max-width: 720px) {
  .theme-toggle { margin-left: 0; order: 2; }
  .nav-toggle { display: block; order: 3; }
  .top-nav {
    display: none;
    width: 100%;
    order: 4;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.5rem;
  }
  .top-nav.open { display: flex; }
  .top-nav a {
    padding: 0.5rem;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  .top-nav a.active {
    border-left-color: var(--primary);
    background: #eff6ff;
    border-bottom-color: transparent;
  }
}

@media (max-width: 420px) {
  .brand h1 { font-size: 0.95rem; }
  .brand p { font-size: 0.72rem; }
  .logo { font-size: 1.5rem; }
}

html[data-theme="dark"] .top-nav a.active { background: #1e3a8a; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.hero {
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.hero h2 {
  margin-top: 0;
  font-size: 1.4rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.whats-new {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

@media (max-width: 560px) {
  .whats-new { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

.section { margin: 1.75rem 0; }
.section-title {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.featured-card {
  border-left: 5px solid var(--primary);
}

.how-to-list li {
  margin-bottom: 0.75rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.25rem 0;
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card h3 { margin-top: 0; }

.alert-card {
  border-left: 5px solid var(--warn);
}

.alert-card.danger {
  border-left-color: var(--danger);
  background: #fef2f2;
}

.timeline {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}

.timeline-phase {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--muted);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.timeline-phase.ok { border-left-color: var(--ok); }
.timeline-phase.warn { border-left-color: var(--warn); }
.timeline-phase.danger { border-left-color: var(--danger); }

.timeline-phase h4 { margin-top: 0; }

.debt-input {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.debt-input label {
  display: block;
  margin-bottom: 0.5rem;
}

.debt-input input {
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
}

.ok-card { border-left: 5px solid var(--ok); }
.warn-card { border-left: 5px solid var(--warn); }
.danger-card { border-left: 5px solid var(--danger); }

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

@media (max-width: 420px) {
  .btn { padding: 0.45rem 0.8rem; font-size: 0.9rem; }
}

.btn:hover { background: #f8fafc; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: #f8fafc;
  color: var(--fg);
}

.status-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

@media (max-width: 720px) {
  .status-board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 420px) {
  .status-board { grid-template-columns: 1fr; }
}

.status-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.status-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.status-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.2;
}

.status-value.ok { color: var(--ok); }
.status-value.warn { color: var(--warn); }
.status-value.danger { color: var(--danger); }

.pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--bg);
  color: var(--fg);
}

.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.danger { background: #fee2e2; color: #991b1b; }

.muted { color: var(--muted); font-size: 0.9rem; }

.calc-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
}

@media (max-width: 560px) {
  .calc-form { padding: 1rem; }
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.chip {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  color: var(--fg);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

@media (max-width: 420px) {
  .chip { font-size: 0.78rem; padding: 0.3rem 0.6rem; }
}

.chip:hover {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}

html[data-theme="dark"] .chip {
  background: var(--card);
  color: var(--fg);
  border-color: var(--border);
}

html[data-theme="dark"] .chip:hover {
  background: #1e3a8a;
  color: var(--primary);
  border-color: var(--primary);
}

.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1rem;
}

@media (max-width: 560px) {
  .form-section { padding: 0.75rem 1rem 1rem; }
}

.form-section legend {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 0.5rem;
  color: var(--fg);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.form-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.form-grid.four-col {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
  .form-grid.four-col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .form-grid,
  .form-grid.two-col,
  .form-grid.three-col,
  .form-grid.four-col { grid-template-columns: 1fr; }
}

.form-grid label {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  font-weight: 500;
  font-size: 0.9rem;
  gap: 0.35rem;
  min-height: 0;
}

.form-grid label .label-text {
  font-weight: 600;
  min-height: 2.4em;
  line-height: 1.2;
  display: flex;
  align-items: flex-end;
}

.help-text {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
  min-height: 2.8em;
}

.form-grid input,
.form-grid select {
  margin-top: 0;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  height: 2.5rem;
  box-sizing: border-box;
  width: 100%;
}

.form-grid input:focus,
.form-grid select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.source-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  margin-left: 0;
  margin-top: 0.15rem;
  border-bottom: 1px dotted var(--muted);
  align-self: flex-start;
  min-height: 1.2em;
  line-height: 1;
}

.source-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.results-card {
  border-left: 5px solid var(--primary);
}

.summary-sentence {
  font-size: 1.05rem;
  background: #eff6ff;
  border-left: 4px solid var(--primary);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

@media (max-width: 560px) {
  .summary-sentence {
    font-size: 0.95rem;
    padding: 0.75rem;
  }
}

.ami-gauge-wrap,
.income-gauge-wrap {
  margin: 1.25rem 0;
}

.ami-gauge-label,
.income-gauge-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.ami-gauge,
.income-gauge {
  position: relative;
  height: 1.25rem;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: visible;
  display: flex;
}

.ami-seg,
.income-seg {
  height: 100%;
}
.seg-30 { background: #dbeafe; }
.seg-50 { background: #93c5fd; }
.seg-80 { background: #60a5fa; }

.ami-marker,
.income-marker {
  position: absolute;
  top: -0.25rem;
  width: 0.5rem;
  height: 1.75rem;
  background: var(--fg);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: left 0.3s ease;
}

.ami-caption,
.income-caption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: center;
}

.breakdown-table { margin-top: 1rem; }

/* Live scenario calculator components */
.scenario-calc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.calc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.calc-row.compact {
  align-items: center;
  gap: 1rem;
}

@media (max-width: 560px) {
  .calc-row { flex-direction: column; align-items: stretch; }
  .calc-row.compact { flex-direction: row; flex-wrap: wrap; }
  .scenario-calc input[type="range"] { width: 100%; }
}

.scenario-calc label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 160px;
  flex: 1 1 160px;
}

.scenario-calc input[type="range"] {
  width: 100%;
  max-width: 220px;
}

.sc-rate-display,
.sc-hours-display {
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 700;
}

.scenario-results .snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

@media (max-width: 720px) {
  .scenario-results .snapshot { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 420px) {
  .scenario-results .snapshot { grid-template-columns: repeat(2, 1fr); }
}

.scenario-results .snapshot-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  text-align: center;
}

.scenario-results .snapshot-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.scenario-results .snapshot-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
}

@media (max-width: 420px) {
  .scenario-results .snapshot-value { font-size: 0.95rem; }
}

.scenario-results .snapshot-value.ok { color: var(--ok); }
.scenario-results .snapshot-value.warn { color: var(--warn); }
.scenario-results .snapshot-value.danger { color: var(--danger); }

.sc-risk {
  font-size: 0.95rem;
  line-height: 1.3;
}

.btn-small {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.btn-small:hover {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}

.table-scroll table {
  min-width: 640px;
  width: 100%;
}

.dense {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.dense th,
.dense td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.dense th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 560px) {
  .dense th,
  .dense td { padding: 0.5rem; font-size: 0.82rem; }
  .dense th {
    font-size: 0.75rem;
    letter-spacing: 0.02em;
  }
}

.dense tr.highlight {
  background: #eff6ff;
}

.zone-table td[rowspan] {
  vertical-align: top;
  text-align: center;
  padding-top: 1rem;
}

.zone-table tr.ok-card,
.zone-table tr.warn-card,
.zone-table tr.danger-card {
  border-left: 6px solid transparent;
}

.zone-table tr.ok-card { border-left-color: var(--ok); }
.zone-table tr.warn-card { border-left-color: var(--warn); }
.zone-table tr.danger-card { border-left-color: var(--danger); }

.example {
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.ad-slot {
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1.5rem 0;
  text-align: center;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.ad-placeholder {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 2rem;
  width: 100%;
  max-width: 728px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 560px) {
  .ad-slot { padding: 0.75rem; min-height: 72px; }
  .ad-placeholder { padding: 0.75rem 1rem; min-height: 48px; }
}

@media print {
  .ad-slot { display: none; }
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-legal {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

.footer-credit {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
}

.footer-credit a {
  font-weight: 500;
}

.footer-credit span {
  color: var(--muted);
}

.fine-print summary {
  cursor: pointer;
  color: var(--primary);
  text-decoration: underline;
}

.fine-print-content {
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
}

.fine-print-content p {
  margin: 0.4rem 0;
}

ul li { margin-bottom: 0.5rem; }

.resources-list li a {
  font-weight: 500;
}

/* Clickable ZIP chips in zone tables */
.zip-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.25rem 0.55rem;
  margin: 0.15rem;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1;
  background: var(--chip-bg);
  color: var(--chip-fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: none;
}

.zip-chip:hover {
  background: var(--chip-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.zip-chip:active {
  transform: translateY(0);
}

.zip-chip.copied {
  background: var(--ok);
  color: #fff;
  border-color: var(--ok);
}

.zip-toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--fg);
  color: var(--card);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 1000;
  pointer-events: none;
}

.zip-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media print {
  .zip-chip {
    background: transparent;
    border: 1px solid var(--border);
    box-shadow: none;
    cursor: default;
  }
}

@media (max-width: 720px) {
  .site-header { padding: 1rem; }
  .nav-toggle { display: block; }
  .theme-toggle { margin-left: 0.5rem; }
  .top-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.5rem;
  }
  .top-nav.open { display: flex; }
  .top-nav a {
    padding: 0.5rem;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  .top-nav a.active {
    border-left-color: var(--primary);
    background: #eff6ff;
    border-bottom-color: transparent;
  }
  .hero { padding: 1.25rem; }
  .grid { grid-template-columns: 1fr; }
  .status-board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  html[data-theme="dark"] .top-nav a.active { background: #1e3a8a; }
}

@media print {
  .site-header, .site-footer, .nav-toggle, .preset-chips, .form-section, #estimate-btn, #print-btn, .theme-toggle { display: none; }
  .results-card { border: none; box-shadow: none; }
}

/* Dark mode overrides */
html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--fg);
}
html[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  border-color: #1e40af;
}
html[data-theme="dark"] .whats-new {
  background: #064e3b;
  border-color: #10b981;
}
html[data-theme="dark"] .alert-card.danger {
  background: #450a0a;
}
html[data-theme="dark"] .debt-input,
html[data-theme="dark"] select,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .btn-small,
html[data-theme="dark"] .snapshot-item,
html[data-theme="dark"] .example,
html[data-theme="dark"] .ad-slot {
  background: var(--card);
}
html[data-theme="dark"] .btn:hover {
  background: #1e293b;
}
html[data-theme="dark"] .chip:hover,
html[data-theme="dark"] .btn-small:hover {
  background: #1e3a8a;
}
html[data-theme="dark"] .pill.ok { background: #064e3b; color: #86efac; }
html[data-theme="dark"] .pill.warn { background: #713f12; color: #fde047; }
html[data-theme="dark"] .pill.danger { background: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .summary-sentence {
  background: #1e3a8a;
}
html[data-theme="dark"] .ami-gauge,
html[data-theme="dark"] .income-gauge {
  background: #334155;
}
html[data-theme="dark"] .seg-30 { background: #1e3a8a; }
html[data-theme="dark"] .seg-50 { background: #3b82f6; }
html[data-theme="dark"] .seg-80 { background: #60a5fa; }
html[data-theme="dark"] .dense th { background: #1e293b; }
html[data-theme="dark"] .dense tr.highlight { background: #1e3a8a; }
html[data-theme="dark"] .form-grid input,
html[data-theme="dark"] .form-grid select,
html[data-theme="dark"] .zip-lookup input,
html[data-theme="dark"] input,
html[data-theme="dark"] select {
  background: #0f172a;
  color: var(--fg);
  border-color: var(--border);
}
html[data-theme="dark"] .form-grid input::placeholder,
html[data-theme="dark"] .zip-lookup input::placeholder {
  color: #64748b;
}
@media (max-width: 720px) {
  html[data-theme="dark"] .top-nav a.active { background: #1e3a8a; }
}
