:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5a626d;
  --border: #e1e4e8;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4f1;
  --radius: 10px;
  --max: 920px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2024;
    --text: #e8eaed;
    --muted: #a0a8b2;
    --border: #2f343a;
    --accent: #5eead4;
    --accent-ink: #062521;
    --accent-soft: #11302c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

a { color: var(--accent); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.logo { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-size: 0.85rem; }
.search { display: flex; gap: 6px; flex: 1 1 220px; max-width: 320px; }
.search input { flex: 1; min-width: 0; font: inherit; font-size: 0.95rem; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.search button { font: inherit; font-weight: 600; padding: 6px 12px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.nav { display: flex; gap: 14px; font-size: 0.95rem; overflow-x: auto; white-space: nowrap; max-width: 100%; padding-bottom: 2px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }

main { padding: 24px 0 48px; }

h1 { font-size: 1.9rem; line-height: 1.2; margin: 8px 0 8px; }
h2 { font-size: 1.3rem; margin: 32px 0 12px; }
h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }

.breadcrumbs { font-size: 0.85rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }

/* The big answer at the top of generated pages and under each tool */
.answer {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 18px 20px; margin: 16px 0;
}
.answer .label { font-size: 0.9rem; color: var(--muted); margin: 0; }
.answer .value { font-size: 1.7rem; font-weight: 700; line-height: 1.25; margin: 4px 0; }
.answer .sub { margin: 0; color: var(--muted); }


/* Tool forms */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.tool input, .tool select {
  font: inherit; font-size: 1.05rem; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); width: 100%;
}
.tool input:focus, .tool select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.tool .check { flex-direction: row; align-items: center; gap: 8px; font-size: 0.95rem; color: var(--text); }
.tool .check input { width: auto; }
.tool .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.tool button {
  font: inherit; font-weight: 600; padding: 9px 16px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.tool button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.tabs button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.error { color: #c0392b; margin: 8px 0 0; }

/* Fact tables */
table.facts { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.facts th, table.facts td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.facts tr:last-child th, table.facts tr:last-child td { border-bottom: 0; }
table.facts th { font-weight: 500; color: var(--muted); width: 42%; }
table.facts td { font-weight: 600; }

/* Ads: reserve space so the page doesn't jump when an ad loads */
.ad-slot { margin: 24px 0; min-height: 100px; display: flex; justify-content: center; }

.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; padding: 0; list-style: none; }
.num-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; padding: 0; list-style: none; }
.num-grid a {
  display: block; text-align: center; padding: 6px 0; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums;
}
.num-grid a:hover { border-color: var(--accent); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.pill-list a { display: inline-block; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; background: var(--surface); }

.faq dt { font-weight: 600; margin-top: 12px; }
.faq dd { margin: 4px 0 0; color: var(--muted); }

.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: 0.9rem; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

.prose p, .prose li { max-width: 70ch; }
.muted { color: var(--muted); }

/* Area code pages */
.warn { background: #fff6e5; border: 1px solid #e6b34d; border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
@media (prefers-color-scheme: dark) { .warn { background: #2e2512; border-color: #8a6a24; } }
.warn strong { display: block; margin-bottom: 4px; }
.code-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.code-table th, .code-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.code-table th { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.code-table td:first-child { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.code-table tr:last-child td { border-bottom: 0; }
.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; padding: 0; list-style: none; }
.city-grid .n { color: var(--muted); font-size: 0.85rem; }
.lookup-result { margin-top: 12px; }
.lookup-result:empty { display: none; }
.lookup-result .answer { margin: 0; }

/* ZIP pages */
.small { font-size: 0.85rem; }
.address { display: inline-block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5; }
.num-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.code-table { display: block; overflow-x: auto; }
@media (min-width: 640px) { .code-table { display: table; } }
.code-table th.sort { cursor: pointer; user-select: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.stats strong { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 0.85rem; }
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; padding: 0; list-style: none; }
.state-grid .n { color: var(--muted); font-size: 0.85rem; }
.result-list { padding-left: 18px; }
