/* Layout + chart styling on ui-kit Layer-1 tokens (:root/.dark blocks of
   tokens.css; the Tailwind @theme layer is not readable from plain CSS).
   Tier ramp steps are the ui-kit blue scale values (tokens.ts blue
   300/500/700/900 for light; 800/600/400/200 for dark). */
:root {
  --tier-0: #7DD3FC;
  --tier-5: #0EA5E9;
  --tier-10: #026AA2;
  --tier-15: #0C4A6E;
  --ok: #15803D;
  --bad: #B91C1C;
}
.dark {
  --tier-0: #075985;
  --tier-5: #0284C7;
  --tier-10: #38BDF8;
  --tier-15: #BAE6FD;
  --ok: #4ADE80;
  --bad: #F87171;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.5;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
/* PolicyEngine site shell — global nav and footer links rendered by this
   zone child so the tool carries the site header/footer at its public
   policyengine.org path (the shell-in-child pattern the zone audit checks). */
.pe-shell-header {
  border-bottom: 1px solid var(--border);
  background: var(--background);
  position: sticky; top: 0; z-index: 20;
}
.pe-shell-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
}
.pe-shell-brand { display: inline-flex; align-items: center; }
.pe-shell-brand .logo { height: 22px; width: auto; display: none; }
.pe-shell-links { display: flex; align-items: center; gap: 22px; }
.pe-shell-links a {
  color: var(--foreground); text-decoration: none; font-size: 14px;
  font-weight: 500;
}
.pe-shell-links a:hover { color: var(--primary); }
.pe-shell-links .pe-shell-donate {
  color: var(--primary); border: 1px solid var(--primary);
  padding: 5px 14px; border-radius: 6px;
}
.pe-shell-footer {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.pe-shell-footer a { color: var(--muted-foreground); }
.site-header { padding: 28px 0 8px; }
.brand { display: inline-block; margin-bottom: 14px; }
.framed .brand { display: none; }
.delaytag {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; font-size: 10.5px; font-weight: 600;
  background: var(--tier-0); color: #1E293B;
}
.muted { opacity: 0.65; font-size: 11px; }
.brand .logo { height: 26px; width: auto; display: none; }
:root:not(.dark) .logo-light { display: block; }
.dark .logo-dark { display: block; }
h1 { font-size: 1.9rem; margin: 0 0 10px; }
.lede { color: var(--muted-foreground); max-width: 760px; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 4px; }
.sub { color: var(--muted-foreground); font-size: 0.85rem; margin: 0 0 10px; }

.controls {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px; margin: 24px 0; padding: 16px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--secondary);
}
.control label, .control .label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; }
.control .hint { font-size: 0.72rem; color: var(--muted-foreground); margin-top: 4px; }
.control select, .control input[type="range"] { width: 100%; }
.control select { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--background); color: inherit; }
.levers label { display: flex; gap: 7px; align-items: center; font-weight: 400; font-size: 0.85rem; margin: 3px 0; }
.val { font-weight: 400; color: var(--muted-foreground); }
.badge {
  display: inline-block; margin-top: 8px; font-size: 0.72rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, var(--background)); color: var(--primary);
  border: 1px solid var(--primary);
}
.dark .badge { background: transparent; color: var(--primary); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 24px; }
.tile { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile .k { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 2px; }
.tile .d { font-size: 0.8rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.delta-good { color: var(--ok); }
.delta-bad { color: var(--bad); }

.chart-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-family: inherit; }

.fine { font-size: 0.8rem; color: var(--muted-foreground); margin: 26px 0; }
.fine summary { cursor: pointer; font-weight: 600; color: var(--foreground); }
.fine ul { padding-left: 18px; }
.verify-cta { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 12px 16px; margin-bottom: 30px; font-size: 0.9rem; }
.site-footer { border-top: 1px solid var(--border); padding: 16px 0 40px; font-size: 0.8rem; color: var(--muted-foreground); }

.tooltip {
  position: fixed; pointer-events: none; z-index: 10;
  background: var(--background); color: var(--foreground);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 9px; font-size: 0.75rem; box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  font-variant-numeric: tabular-nums;
}

.table-scroll { overflow-x: auto; }
#nat-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; font-variant-numeric: tabular-nums; }
#nat-table th { text-align: left; border-bottom: 2px solid var(--border); padding: 0; }
#nat-table th.num, #nat-table td.num { text-align: right; }
#nat-table th button {
  all: unset; cursor: pointer; display: block; width: 100%; box-sizing: border-box;
  padding: 6px 8px; font-weight: 600; font-size: 0.78rem; color: var(--muted-foreground);
}
#nat-table th.num button { text-align: right; }
#nat-table th button:hover, #nat-table th button.sorted { color: var(--foreground); }
#nat-table th button.sorted::after { content: " ↑"; }
#nat-table th button.sorted.desc::after { content: " ↓"; }
#nat-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
#nat-table tbody tr { cursor: pointer; }
#nat-table tbody tr:hover { background: var(--secondary); }
#nat-table tbody tr.current { background: color-mix(in srgb, var(--primary) 8%, var(--background)); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }
.vmark { color: var(--primary); font-weight: 700; }
.hint { font-size: 0.75rem; color: var(--muted-foreground); }
#nat-takeaway { margin: 10px 0 0; }

.control.off, .levers.off { opacity: 0.45; }
.control.off input, .levers.off input { cursor: not-allowed; }

@media print {
  .controls input, .site-footer, #nat-note { display: none; }
  .chart-card, .tiles, .verify-cta { break-inside: avoid; }
  body { color: #000; }
}
.mechanism { margin: -12px 0 18px 2px; }
.elect { list-style: none; padding: 0; margin: 0; }
.elect li { font-size: 0.9rem; margin: 6px 0; }
