:root {
  --bg: #f7f8fa; --surface: #ffffff; --text: #1a2230; --muted: #5b6676; --line: #dfe3ea;
  --brand: #0b5cad; --brand-ink: #ffffff; --good: #0f7a3d; --bad: #b3261e; --soft: #eef4fb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b; --surface: #1a2029; --text: #e7ebf1; --muted: #a2adbd; --line: #2e3745;
    --brand: #6cb0f5; --brand-ink: #0c1420; --good: #5fd08f; --bad: #ff8a80; --soft: #1f2a38;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--brand); }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
header.site { background: var(--surface); border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
header.site .logo { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
header.site nav a { margin-left: 16px; text-decoration: none; font-size: .95rem; }
header.site nav a:first-child { margin-left: 0; }
main { padding: 24px 0 48px; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 8px 0 12px; }
h2 { font-size: 1.35rem; line-height: 1.3; margin: 36px 0 10px; }
h3 { font-size: 1.08rem; margin: 22px 0 6px; }
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } h1 { font-size: 1.55rem; } }
label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 4px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type="text"], select {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; grid-column: 1 / -1; }
.check input { margin-top: 6px; }
.check label { font-weight: 400; margin: 0; }
.error { margin-top: 16px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--bad); color: var(--bad); }
.result { margin-top: 20px; }
.headline { font-size: 1.2rem; font-weight: 700; padding: 14px 16px; border-radius: 8px; background: var(--soft); margin: 0 0 14px; }
.headline.good { color: var(--good); }
.headline.bad { color: var(--bad); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .96rem; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
thead th { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
tr.total td { font-weight: 700; border-bottom: 0; }
.small { font-size: .88rem; color: var(--muted); }
.note { background: var(--soft); border-radius: 8px; padding: 12px 16px; margin: 16px 0; font-size: .95rem; }
ul.states { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
ul.states a { display: block; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 600; }
ul.states a:hover { border-color: var(--brand); }
ul.sources { font-size: .9rem; padding-left: 20px; }
ul.sources li { margin-bottom: 4px; overflow-wrap: anywhere; }
.ad-slot { margin: 24px 0; min-height: 90px; }
footer.site { border-top: 1px solid var(--line); background: var(--surface); padding: 20px 0; font-size: .88rem; color: var(--muted); }
footer.site a { color: var(--muted); margin-right: 14px; }

/* logo, state switcher, slider */
header.site .logo { display: inline-flex; align-items: center; gap: 9px; }
header.site .logo .mark { display: block; flex: none; }
.switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.switch label { margin: 0; }
.switch select { width: auto; min-width: 200px; }
input[type="range"] { width: 100%; margin: 8px 0 0; accent-color: var(--brand); }

/* charts */
:root {
  --s-payroll: #257de0; --s-federal: #f47230; --s-state: #00b894; --s-entity: #f2a600; --s-admin: #ee7fac;
  --grid: #e7e7e7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --s-payroll: #338ced; --s-federal: #e76624; --s-state: #00a888; --s-entity: #d28e05; --s-admin: #e24d8b;
    --grid: #303a48;
  }
}
.chart { position: relative; margin: 8px 0 4px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.seg-payroll { fill: var(--s-payroll); background: var(--s-payroll); }
.seg-federal { fill: var(--s-federal); background: var(--s-federal); }
.seg-state { fill: var(--s-state); background: var(--s-state); }
.seg-entity { fill: var(--s-entity); background: var(--s-entity); }
.seg-admin { fill: var(--s-admin); background: var(--s-admin); }
.seg:hover, .seg:focus { opacity: .82; outline: none; }
.chart-label { fill: var(--text); font-size: 14px; font-weight: 600; }
.chart-value { fill: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.chart-tick { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-grid { stroke: var(--grid); stroke-width: 1; }
.chart-zero { stroke: var(--muted); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--s-payroll); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-dot { fill: var(--s-payroll); stroke: var(--surface); stroke-width: 2; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none; max-width: 260px; padding: 6px 10px; border-radius: 6px;
  background: var(--text); color: var(--bg); font-size: .85rem; line-height: 1.35; white-space: normal;
}
ul.legend { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .85rem; color: var(--muted); }
ul.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
