/* Groundwork Campaign Manager — tokens and components (from the Groundwork brand kit). */
:root, [data-theme="light"] {
  --ground: #F7F4EE; --surface: #FFFFFF; --surface-sunken: #EFEAE1; --line: #DCD4C7; --border-control: #7D7366;
  --ink: #1F1B16; --ink-muted: #5E564C; --survey: #1D4E89; --on-survey: #FFFFFF; --survey-soft: #D3E1F2;
  --soil: #3B2F25; --on-soil: #F5F1EA; --undecided: #E6E1D8; --plum-soft: #EEE2EE; --plum: #6E3B6F; --on-plum: #FFFFFF;
  --success: #0F6B75; --critical: #B42318; --focus: var(--survey); --campaign-accent: var(--survey);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 14px; --tap-min: 48px; --control-height: 40px;
  --font-sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-theme="dark"] {
  --ground: #15130F; --surface: #1F1C18; --surface-sunken: #2A2621; --line: #4A443B; --border-control: #8A8174;
  --ink: #F2EDE4; --ink-muted: #B5ACA0; --survey: #8FB3E0; --on-survey: #0F1B2B; --survey-soft: #1E3350;
  --soil: #4A3B2E; --undecided: #36312A; --plum-soft: #3E2640; --plum: #D3A6D5; --on-plum: #1E1020;
  --success: #5CC2CF; --critical: #F97066;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font: 400 15px/22px var(--font-sans); -webkit-font-smoothing: antialiased; }
h1 { font-size: 26px; line-height: 32px; font-weight: 700; margin: 0 0 var(--space-2); }
h2 { font-size: 20px; line-height: 28px; font-weight: 600; margin: 0 0 var(--space-3); }
h3 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }
a { color: var(--survey); }
small, .small { font-size: 13px; line-height: 18px; }
.muted { color: var(--ink-muted); }
.label { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.data { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat { font-size: 32px; line-height: 36px; font-weight: 700; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* buttons */
.btn { font: inherit; font-weight: 600; height: var(--control-height); padding: 0 var(--space-4); border-radius: var(--radius-md);
  border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); white-space: nowrap; text-decoration: none; }
.btn.primary { background: var(--survey); color: var(--on-survey); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--border-control); }
.btn.quiet { background: transparent; color: var(--survey); padding: 0 var(--space-2); }
.btn.danger { background: var(--surface); color: var(--critical); border-color: var(--critical); }
.btn.small { height: 32px; padding: 0 var(--space-3); font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* forms */
.field { display: grid; gap: var(--space-1); margin-bottom: var(--space-3); }
.field > span { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-control); border-radius: var(--radius-sm);
  height: var(--control-height); padding: 0 var(--space-3); width: 100%; }
textarea { height: auto; min-height: 96px; padding: var(--space-2) var(--space-3); resize: vertical; }
input[type=color] { width: 48px; height: var(--control-height); border: 1px solid var(--border-control); border-radius: var(--radius-sm); padding: 2px; background: var(--surface); }
.check { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--survey); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 var(--space-4); }

/* cards and layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); margin-bottom: var(--space-6); }
.card.tight { padding: var(--space-4); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); }
.tile .label { margin-bottom: var(--space-2); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 var(--space-6); }
.spacer { flex: 1; }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted);
  background: var(--surface-sunken); padding: var(--space-2) var(--space-3); white-space: nowrap; }
table.t td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-sunken); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* support chips */
.chip { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-sm); font-size: 12px; line-height: 16px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.chip .n { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 10px; line-height: 1; }
.s1 { background: var(--survey); color: var(--on-survey); }
.s2 { background: var(--survey-soft); color: var(--ink); }
.s3 { background: var(--undecided); color: var(--ink); }
.s4 { background: var(--plum-soft); color: var(--ink); }
.s5 { background: var(--plum); color: var(--on-plum); }
.s0 { background: var(--surface-sunken); color: var(--ink-muted); border: 1px dashed var(--border-control); }
.tag { display: inline-block; padding: 1px var(--space-2); border-radius: var(--radius-sm); background: var(--surface-sunken); font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.tag.ok { color: var(--success); } .tag.bad { color: var(--critical); }
.party-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border-control); margin-right: var(--space-1); vertical-align: 0; }

/* bars */
.bar { height: 10px; background: var(--surface-sunken); border-radius: 5px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--survey); }
.stack { display: flex; height: 28px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-sunken); }
.stack > span { display: grid; place-items: center; font-size: 12px; font-weight: 600; min-width: 0; overflow: hidden; }
.hbar { display: grid; grid-template-columns: 120px 1fr 56px; gap: var(--space-2); align-items: center; margin-bottom: var(--space-2); }
.hbar .track { height: 16px; background: var(--surface-sunken); border-radius: var(--radius-sm); overflow: hidden; }
.hbar .track > span { display: block; height: 100%; background: var(--survey); }

/* messages */
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--survey-soft); margin-bottom: var(--space-4); }
.notice.error { background: var(--surface); border: 1px solid var(--critical); color: var(--critical); }
.notice.ok { background: var(--surface); border: 1px solid var(--success); color: var(--success); }
.empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--ink-muted); }
#toast { position: fixed; left: 50%; bottom: var(--space-6); transform: translateX(-50%); z-index: 50; display: grid; gap: var(--space-2); }
#toast div { background: var(--ink); color: var(--ground); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
#toast div.bad { background: var(--critical); color: #fff; }

/* side panel / dialog */
.backdrop { position: fixed; inset: 0; background: rgba(31,27,22,.35); z-index: 40; display: flex; justify-content: flex-end; }
.panel { background: var(--ground); width: min(560px, 100%); height: 100%; overflow: auto; padding: var(--space-6); box-shadow: -4px 0 24px rgba(0,0,0,.18); }
.dialog-wrap { position: fixed; inset: 0; background: rgba(31,27,22,.35); z-index: 45; display: grid; place-items: center; padding: var(--space-4); }
.dialog { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-6); width: min(520px, 100%); max-height: 90vh; overflow: auto; }

/* lockup */
.lockup { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: 16px; }
.lockup img { width: 32px; height: 32px; }
