.btn {
  display: inline-block; font: inherit; font-weight: 600;
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-control);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger-border); }

.card {
  background: var(--surface); border-radius: var(--r-card);
  padding: var(--sp-4); box-shadow: var(--shadow-card);
  border: 1px solid transparent;
}
[data-theme="dark"] .card { border-color: var(--border); }
.card + .card { margin-top: var(--sp-2); }

.stat-row { display: flex; gap: var(--sp-2); }
.stat { flex: 1; }
.stat__num { font-size: var(--fs-heading); font-weight: var(--fw-display); }
.stat__label { font-size: var(--fs-caption); color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-card); }
table.data th, table.data td { text-align: left; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-caption); }
table.data thead th { color: var(--muted); background: var(--bg); }
table.data tbody tr { border-top: 1px solid var(--hairline); }

.pill {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: var(--sp-1) var(--sp-3); border-radius: 999px;
}
.pill--ok { background: var(--pill-ok-bg); color: var(--pill-ok-fg); }
.pill--run { background: var(--pill-run-bg); color: var(--pill-run-fg); }
.pill--warn { background: var(--pill-warn-bg); color: var(--pill-warn-fg); }

.seg { display: inline-flex; border: 1px solid var(--border);
  border-radius: var(--r-control); overflow: hidden; background: var(--surface); }
.seg a { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-caption);
  font-weight: 600; color: var(--ink); text-decoration: none; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a:hover { background: var(--hairline); }

.empty { text-align: center; padding: var(--sp-8) var(--sp-4); }
.empty__icon {
  width: 46px; height: 46px; border-radius: 14px; margin: 0 auto var(--sp-3);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: var(--accent-soft); color: var(--accent);
}
.empty--warn .empty__icon { background: var(--pill-run-bg); color: var(--pill-run-fg); }

.steps { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.step { font-size: 11px; font-weight: 700; padding: var(--sp-1) var(--sp-2);
  border-radius: 6px; background: var(--hairline); color: var(--muted); }
.step--done { background: var(--accent); color: var(--accent-ink); }
.step--current { background: var(--ink); color: var(--surface); }

.progressbar { height: 10px; background: var(--hairline);
  border-radius: 999px; overflow: hidden; }
.progressbar > span { display: block; height: 100%; background: var(--accent); }

label { font-size: var(--fs-caption); color: var(--muted); display: block; margin-bottom: var(--sp-1); }
input[type=text], input[type=email], input[type=number], input[type=search],
textarea, select {
  font: inherit; width: 100%; padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-control);
  background: var(--surface); color: var(--ink);
}
.field + .field { margin-top: var(--sp-3); }
.messages article {
  background: var(--accent-soft); color: var(--pill-ok-fg);
  border-radius: var(--r-md); padding: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-3);
}

/* Layout helpers (available for future screens; existing screens use
   equivalent token-based inline styles — intentionally not mass-rewritten). */
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }

/* ---- Run-history gauge (Results page, gap C) ---- */

.run-history__bars {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  height: 160px;
  padding: var(--sp-2) 0 var(--sp-3);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--sp-3);
}

.run-history__bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
  min-width: 36px;
  height: 100%;
}

.run-history__bar {
  width: 28px;
  height: calc(var(--h, 0) * 1.1px);
  min-height: 2px;
  background: var(--accent);
  border-radius: var(--r-control) var(--r-control) 2px 2px;
}

.run-history__bar--projection {
  background: transparent;
  border: 1px dashed var(--accent);
  opacity: 0.7;
}

.run-history__bar-label {
  font-family: var(--mono);
  font-size: var(--fs-caption);
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

.run-history__table th,
.run-history__table td {
  font-size: var(--fs-caption);
}

.run-history__projection {
  margin: var(--sp-3) 0 0;
  padding: var(--sp-3);
  border-radius: var(--r-control);
  font-size: var(--fs-body);
}

.run-history__projection--fresh {
  background: var(--pill-ok-bg);
  color: var(--pill-ok-fg);
}

.run-history__projection--thinning {
  background: var(--pill-run-bg);
  color: var(--pill-run-fg);
}

.run-history__projection--tapped-out {
  background: var(--pill-warn-bg);
  color: var(--pill-warn-fg);
}

/* ---- Recipe card (campaign + simple search detail) ---- */

dl.recipe {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--sp-3) var(--sp-4);
  margin: 0;
}
dl.recipe > dt {
  color: var(--muted);
  font-weight: 600;
  align-self: baseline;
}
dl.recipe > dd {
  margin: 0;
  color: var(--ink);
}

.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border);
        margin-bottom: var(--sp-4); }
.tab { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-body);
       font-weight: 700; color: var(--muted);
       border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab--active { color: var(--accent); border-bottom-color: var(--accent); }
.def-strip { display: flex; align-items: center; justify-content: space-between;
             gap: var(--sp-3); flex-wrap: wrap; }

.recipe__details {
  margin-top: var(--sp-2);
}
.recipe__details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: var(--fs-caption);
  list-style: none;
}
.recipe__details > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.1s ease;
}
.recipe__details[open] > summary::before {
  transform: rotate(90deg);
}

.recipe__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
}
.recipe__chip {
  display: inline-block;
  padding: 2px var(--sp-2);
  background: var(--hairline);
  color: var(--ink);
  border-radius: 999px;
  font-size: var(--fs-caption);
  line-height: 1.4;
}

/* Paused-resume table: ✓ marker for completed (no-checkbox) rows. */
.resume__done {
  color: var(--accent);
  font-weight: 700;
}

/* btn variants used by the town picker */
.btn--link { background: transparent; border-color: transparent;
  color: var(--accent); padding: 0; font-weight: 600; }
.btn--link:hover { text-decoration: underline; }
.btn--sm { padding: var(--sp-1) var(--sp-2); font-size: var(--fs-caption); }

/* --- campaign town picker (geography step) -------------------- */
/* The base `label { display: block }` rule would stack the radio
   options and filter controls vertically; the rules below restore
   inline rows for the picker's own labels. */

/* Mode selector: "Pick by state" / "National" radios on one line. */
.geo-mode { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.geo-mode label {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  margin-bottom: 0; font-size: var(--fs-body); color: var(--ink);
  cursor: pointer;
}

/* National mode: top-N input, preset chips, Apply on one line. */
.geo-mode-national {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
}
.geo-mode-national label { margin-bottom: 0; }
.geo-mode-national #geo-top { display: inline-block; }
.geo-top-chips { display: inline-flex; gap: var(--sp-1); }
.geo-top-chips button {
  padding: var(--sp-1) var(--sp-2); font-size: var(--fs-caption);
  border: 1px solid var(--border); border-radius: var(--r-control);
  background: var(--surface); color: var(--ink); cursor: pointer;
}

/* Filter row: county/state/ZIP/name controls + bulk-select buttons. */
.geo-filters {
  display: flex; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap;
}
.geo-filters label {
  display: flex; flex-direction: column; gap: var(--sp-1);
  margin-bottom: 0;
}
.geo-filters select, .geo-filters input { width: auto; }

/* Town grid: one row per town. */
.geo-grid-head { padding: var(--sp-2) var(--sp-3); }
.geo-row {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-bottom: 0; padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-body); color: var(--ink);
  border-top: 1px solid var(--hairline); cursor: pointer;
}
.geo-row:first-of-type { border-top: none; }
.geo-row:hover { background: var(--accent-soft); }
.geo-row.kbd-focus { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Filtered-out rows. Without this the filter JS toggles a class that
   styles nothing, so no filter (county/state/ZIP/name) appears to work. */
.geo-row--hidden { display: none; }
.geo-row-name { flex: 1; min-width: 0; }
.geo-row-state, .geo-row-county, .geo-row-pop { white-space: nowrap; }

/* Selected-towns panel: removable chips. */
.geo-selected-head { font-weight: 700; margin-bottom: var(--sp-2); }
.geo-selected-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: var(--sp-1);
}
.geo-selected-list li {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  background: var(--accent-soft); color: var(--ink);
  border-radius: 999px; padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-caption);
}
.geo-chip-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); padding: 0; line-height: 1;
}

.warn { color: var(--pill-run-fg); }
