:root {
  --bg: #f7f8f6;
  --card: #ffffff;
  --ink: #1b2421;
  --muted: #5b6763;
  --line: #dfe4e1;
  --accent: #0f6b5c;
  --accent-ink: #ffffff;
  --soft: #e8f5f1;
  --warn: #8a5a00;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111715;
    --card: #19211e;
    --ink: #e6ece9;
    --muted: #9aa8a3;
    --line: #2c3833;
    --accent: #4cc3a8;
    --accent-ink: #0b1210;
    --soft: #1d2d28;
    --warn: #f0b75a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
main { max-width: 760px; margin: 0 auto; padding: 8px 16px 40px; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 16px 0 8px; }
h2 { font-size: 1.3rem; margin: 32px 0 8px; }
h3 { font-size: 1.05rem; margin: 20px 0 4px; }
.lede { color: var(--muted); margin-top: 0; }

header.site, footer.site { max-width: 760px; margin: 0 auto; padding: 12px 16px; }
header.site { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; min-height: 44px; }
header nav { display: flex; gap: 4px; }
header nav a { padding: 10px 12px; min-height: 44px; text-decoration: none; border-radius: 8px; }
header nav a:hover { background: var(--soft); }
footer.site { color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); margin-top: 24px; }
footer.site a { display: inline-block; padding: 8px 2px; }

/* Calculator card */
.calc-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
form.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; }
form.calc label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.95rem; }
form.calc label small { font-weight: 400; color: var(--muted); }
form.calc label.check { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; }
form.calc label.check input { width: 22px; height: 22px; }
form.calc .wide { grid-column: 1 / -1; }
input[type=number], input[type=text], select {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
  min-height: 46px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { flex-direction: row !important; align-items: center; gap: 6px; padding: 0 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500 !important; cursor: pointer; }
.seg input { margin: 0; }
.seg label:has(input:checked) { background: var(--soft); border-color: var(--accent); }

.result { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
dl.rows { margin: 0; }
dl.rows .row { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
dl.rows .row:last-child { border-bottom: 0; }
dl.rows dt { color: var(--muted); }
dl.rows dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
dl.rows .row.big dt { color: var(--ink); font-weight: 600; }
dl.rows .row.big dd { font-size: 1.35rem; color: var(--accent); }
.note { color: var(--muted); font-size: 0.9rem; }
.callout { background: var(--soft); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
.sources { font-size: 0.9rem; color: var(--muted); }

table.ex { border-collapse: collapse; width: 100%; font-size: 0.95rem; margin: 8px 0; }
table.ex th, table.ex td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
table.ex td.n, table.ex th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* Home grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.grid a { display: block; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); min-height: 44px; }
.grid a:hover { border-color: var(--accent); }
.grid strong { display: block; color: var(--accent); margin-bottom: 2px; }
.grid span { color: var(--muted); font-size: 0.93rem; }

/* Row of short links, e.g. the eight state pages */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 8px 0; list-style: none; }
.chips a { display: inline-flex; align-items: center; min-height: 44px; min-width: 56px; justify-content: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); text-decoration: none; font-weight: 600; }
.chips a:hover { border-color: var(--accent); }

.ad-slot { margin: 20px 0; min-height: 0; }
details { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 8px 0; background: var(--card); }
summary { cursor: pointer; font-weight: 600; min-height: 28px; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
}
