:root {
  --bg: #16181d;
  --panel: #1f2229;
  --panel-2: #262a33;
  --line: #333844;
  --text: #eceef2;
  --muted: #9aa1ae;
  --green: #16a34a;
  --green-hi: #22c55e;
  --link: #86efac;
  --danger: #7f1d1d;
  --amber: #fbbf24;
  --stripe: rgba(255, 255, 255, .02);
  --radius: .75rem;
  --dem: #3b82f6;
  --rep: #ef4444;
  --gain: #4ade80;
  --loss: #f87171;
  color-scheme: dark;
}
/* Light mode, chosen with the switch in the footer (the script in _base.html remembers it). */
:root[data-theme="light"] {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #eef0f3;
  --line: #d5d9e0;
  --text: #1a1d23;
  --muted: #5d6573;
  --link: #15803d;
  --danger: #fee2e2;
  --amber: #b45309;
  --stripe: rgba(0, 0, 0, .025);
  --dem: #2563eb;
  --rep: #dc2626;
  --gain: #15803d;
  --loss: #b91c1c;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.5;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* The page fills the window, so a short one's footer sits at the bottom, not under it. */
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 84rem; margin: 0 auto; padding: 0 1.25rem 3rem; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: 1.5rem 0 .5rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }

/* top bar */
.topbar { border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar .wrap { padding-bottom: 0; display: flex; align-items: center; gap: .75rem; height: 3.75rem; }
.logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); font-size: 1.2rem;
        font-weight: 700; letter-spacing: .01em; white-space: nowrap; flex: none; }
.logo:hover { text-decoration: none; }
.logo svg { width: 2rem; height: 2rem; }
/* the sections, as tabs: the current one underlined to the bar's edge */
.sections { display: flex; align-self: stretch; gap: .25rem; margin-left: 1rem; }
.sections a { display: flex; align-items: center; padding: 0 .75rem; color: var(--muted); white-space: nowrap;
              border-bottom: 3px solid transparent; }
.sections a:hover { color: var(--text); text-decoration: none; }
.sections a[aria-current] { color: var(--text); border-bottom-color: var(--green); }
@media (max-width: 40rem) {
  .logo { font-size: 0; gap: 0; }
  .sections { margin-left: 0; }
  .sections a { padding: 0 .5rem; font-size: .9rem; }
}
/* profile menu, top right */
.menu { margin-left: auto; position: relative; min-width: 0; }
/* Outlined, with a full-size chevron, so it reads as something to click. */
.menu summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: .45rem;
  padding: .4rem .5rem .4rem .8rem; border: 1px solid var(--line); border-radius: .5rem;
  max-width: min(50vw, 20rem);
}
.menu summary::-webkit-details-marker { display: none; }
/* One line, cut short with "…": a long name or email would otherwise wrap the
   top bar or run off a phone's screen. The full ones are in the menu and on /profile.
   The chevron sits outside it, so it is never the part cut off. */
.menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { flex: none; width: 1.25rem; height: 1.25rem; color: var(--text); transition: transform .15s; }
.menu[open] .chevron { transform: rotate(180deg); }
.menu summary:hover, .menu[open] summary { background: var(--panel-2); border-color: var(--muted); }
.menu-items {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 10; width: max-content;
  min-width: 14rem; max-width: calc(100vw - 2.5rem);
  display: flex; flex-direction: column; padding: .35rem 0;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: .6rem;
}
.menu-items > * { padding: .5rem 1rem; }
.menu-email { color: var(--muted); font-size: .875rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.menu-items a { color: var(--text); }
.menu-items form { padding: 0; }
.menu-items button {
  width: 100%; padding: .5rem 1rem; text-align: left; font: inherit; font-weight: normal;
  color: var(--text); background: none; border: 0; border-radius: 0;
}
.menu-items a:hover, .menu-items button:hover { background: var(--line); color: var(--text); text-decoration: none; }

/* login */
.login, .profile { max-width: 32rem; margin: 2.5rem auto 0; }
.admin { max-width: 60rem; margin: 2.5rem auto 0; }
.admin h1 { margin-top: 0; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.admin-head h1 { margin: 0; }
.admin .scroll { margin-top: 1rem; }
dialog.add-user {
  width: min(26rem, calc(100vw - 2rem)); padding: 1.25rem 1.4rem; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
dialog.add-user::backdrop { background: rgba(0, 0, 0, .6); }
.add-user form { display: flex; flex-direction: column; gap: .7rem; }
.add-user h2 { margin: 0 0 .3rem; }
.add-user .error { margin: 0; }
.add-user label.check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
/* Reversed: the default (Enter) button is first in the source but shows last. */
.dialog-buttons { display: flex; flex-direction: row-reverse; gap: .6rem; margin-top: .6rem; }
.admin td form { margin: 0; }
/* Rows hold buttons taller than a line of text: centre every cell on them. */
.admin table.data td { vertical-align: middle; }
/* An on/off switch: a submit button whose aria-checked says the current state. */
.switch {
  position: relative; display: block; width: 2.6rem; height: 1.5rem; padding: 0;
  background: var(--line); border: 1px solid var(--muted); border-radius: 999px;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.5rem - 6px); height: calc(1.5rem - 6px);
  border-radius: 50%; background: var(--muted);
}
.switch[aria-checked="true"] { background: var(--green); border-color: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(1.1rem); background: #fff; }
.switch:hover { background: var(--line); border-color: var(--text); }
.switch[aria-checked="true"]:hover { background: var(--green-hi); border-color: var(--green-hi); }
.switch:focus-visible { outline: 2px solid var(--green-hi); outline-offset: 2px; }
/* High-contrast modes drop the knob's background, and with it the state. */
@media (forced-colors: active) { .switch::after { background: CanvasText; } }
.login h1, .profile h1 { margin-top: 0; }
.login form, .profile form { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.login input, .profile input { flex: 1 1 12rem; }

/* search panel */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.search { margin-top: 1.25rem; }
.search-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.search-row input[type=search] { flex: 1 1 14rem; }
input[type=search], .member-search input[type=text], .login input, .profile input, .add-user input[type=email] {
  padding: .65rem .8rem; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: .5rem;
}
input[type=search]:focus, .member-search input[type=text]:focus, .login input:focus, .profile input:focus, .add-user input[type=email]:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
button, .button {
  display: inline-block; padding: .65rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--green); border: 0; border-radius: .5rem; text-decoration: none;
}
button:hover, .button:hover { background: var(--green-hi); color: #04210f; text-decoration: none; }
.button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.button.secondary:hover { background: var(--line); color: var(--text); }
.button.small { padding: .4rem .75rem; font-size: .9rem; }
.hint { margin: .6rem 0 0; color: var(--muted); font-size: .875rem; }
.unlisted { color: var(--muted); font-size: .875rem; }
details.filter-box { margin-top: .75rem; }
/* The House member tables' characteristics filter: the boxes wrap under its fold, the count beside it. */
.pick-one { align-items: flex-start; }
.label-filter { flex: 1 1 100%; margin-top: 0; }
.label-boxes { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .6rem; }
.label-boxes label { display: flex; gap: .4rem; align-items: center; cursor: pointer; }
details > summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details > summary:hover { color: var(--text); }
.filters { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .75rem; }
fieldset { flex: 1 1 15rem; margin: 0; padding: .6rem .9rem .8rem; border: 1px solid var(--line); border-radius: .6rem; }
legend { padding: 0 .4rem; color: var(--muted); font-size: .8rem; font-weight: 600;
         text-transform: uppercase; letter-spacing: .06em; }
fieldset label { display: flex; gap: .5rem; align-items: center; font-size: .9rem; padding: .15rem 0; cursor: pointer; }
input[type=checkbox] { accent-color: var(--green); width: 1rem; height: 1rem; flex: none; }

/* messages */
.error { background: var(--danger); padding: .8rem 1rem; border-radius: .6rem; margin: 1.25rem 0; }
.note { background: var(--panel-2); border-left: 3px solid var(--green); padding: .7rem 1rem;
        border-radius: .4rem; color: var(--muted); font-size: .9rem; margin: 1rem 0; }
.crumb { margin: 1.25rem 0 0; font-size: .9rem; }
.meta { color: var(--muted); margin: .25rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0; }

/* data tables */
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.data { border-collapse: collapse; width: 100%; table-layout: auto; font-size: .9rem; }
table.data th {
  /* z-index: above the positioned cells it scrolls over (a label's color swatch). */
  position: sticky; top: 0; z-index: 2; background: var(--panel-2); color: var(--muted); font-size: .75rem;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600; text-align: left;
  padding: .7rem .8rem; vertical-align: bottom; border-bottom: 1px solid var(--line);
}
table.data th.num { text-align: right; }
table.data th.sortable a { color: inherit; text-decoration: none; white-space: nowrap; }
table.data th.sortable a:hover, table.data th[aria-sort] a { color: var(--text, inherit); }
table.data th .arrow { font-size: .65rem; }
/* The donations tables' sort button, beside an amount column's heading. */
table.data th .sort-arrow { font: inherit; font-size: .7rem; line-height: 1; padding: .1rem .2rem; margin-left: .15rem;
  background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); cursor: pointer; vertical-align: middle; }
table.data th .sort-arrow:hover, table.data th .sort-arrow[data-dir] { color: var(--text, inherit); border-color: currentColor; }
table.data td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:nth-child(even) { background: var(--stripe); }
table.data tbody tr:hover { background: rgba(34, 197, 94, .07); }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .id { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .nowrap { white-space: nowrap; }
table.data .memo { min-width: 14rem; }
table.data td:first-child { min-width: 12rem; }
table.data .none { color: var(--muted); }
.pager { display: flex; gap: .6rem; align-items: center; justify-content: space-between; margin: 1rem 0; }
.count { color: var(--muted); margin: 0; }

/* key/value tables */
table.kv { border-collapse: collapse; width: 100%; font-size: .93rem; }
/* Read like a committee's facts row: a small grey name, then its value in full. */
/* Each row ruled and shaded across its full width, so the eye can follow a name to its value. */
table.kv th { text-align: left; font-weight: normal; font-size: .85rem; color: var(--muted); width: 16rem;
              padding: .45rem .8rem .4rem .5rem; vertical-align: top; text-transform: capitalize;
              border-bottom: 1px solid var(--line); }
table.kv td { padding: .4rem .5rem .4rem 0; border-bottom: 1px solid var(--line); word-break: break-word; color: var(--text); }
table.kv tr:nth-child(even) { background: var(--stripe); }
table.kv tr:hover { background: var(--panel-2); }
/* A field holding a list: plain values on one line with commas, records one to a line. */
ul.values { margin: 0; padding: 0; list-style: none; }
ul.values.inline li { display: inline; }
ul.values.inline li + li::before { content: ", "; }
table.kv tr:last-child td, table.kv tr:last-child th { border-bottom: 0; }
table.kv td { font-variant-numeric: tabular-nums; }

/* committee page */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; margin: 1rem 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
/* A square that opens the list behind it. */
a.stat.link { display: block; color: inherit; text-decoration: none; }
a.stat.link:hover, a.stat.link:focus-visible { border-color: var(--green); }
.stat .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 1.4rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: tabular-nums; }
/* Money against expected: green above, red below. */
.stat .value.gain, td.gain { color: var(--gain); }
.stat .value.loss, td.loss { color: var(--loss); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: .8rem 0; }
.card > summary { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; list-style: none; }
.card > summary::-webkit-details-marker { display: none; }
.card > summary::before { content: "\25B8"; color: var(--muted); }
.card[open] > summary::before { content: "\25BE"; }
.card[open] > summary { margin-bottom: .8rem; }
.card > summary h3 { color: var(--text); }
.card .spacer { flex: 1; }
.card .when { color: var(--muted); font-size: .9rem; }

body > main { flex: 1 0 auto; }
/* A flex item with auto margins would shrink to its content. */
body > main, body > footer { width: 100%; }
footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
footer .theme { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; cursor: pointer; }
@media (max-width: 40rem) {
  table.kv th { width: 9rem; }
  h1 { font-size: 1.4rem; }
}

/* Money-flow Sankey */
.flow { padding: .5rem; overflow-x: auto; }
.flow svg { width: 100%; min-width: 720px; height: auto; display: block; }
.flow .ribbon { fill-opacity: .28; stroke: none; }
.flow .ribbon:hover { fill-opacity: .55; }
.flow .ribbon.in { fill: #60a5fa; }
.flow .ribbon.out { fill: var(--green-hi); }
.flow .node.in { fill: #60a5fa; }
.flow .node.out { fill: var(--green-hi); }
.flow .node.center { fill: var(--text); }
.flow .label { fill: var(--text); font-size: 12px; dominant-baseline: central; }
.flow .label .amt { fill: var(--muted); font-size: 11px; }
.flow a:hover .label { text-decoration: underline; }
.flow .center-label { fill: var(--muted); font-size: 12px; }

/* Transactions page filters */
fieldset.wide { flex-basis: 100%; }
fieldset.wide label { align-items: flex-start; }
fieldset.wide label input { margin-top: .25rem; }
.off { color: var(--muted); font-size: .8rem; font-style: italic; }
/* A "?" beside a filter that opens a short explanation as a popover (transactions.html),
   centred on screen by the browser so it moves nothing and never runs off the edge. */
button.help {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 1.3rem; height: 1.3rem; margin-left: .3rem; padding: 0; border: 1px solid var(--muted); border-radius: 50%;
  background: none; font-size: .8rem; font-weight: normal; color: var(--muted);
}
button.help:hover { background: none; color: var(--text); border-color: var(--text); }
.help-text {
  width: min(32rem, calc(100vw - 2.5rem)); padding: .8rem 1rem; font-size: .9rem; line-height: 1.5;
  text-transform: none; letter-spacing: normal; font-weight: normal;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: .4rem; color: var(--text); box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .5);
}
.help-text::backdrop { background: rgba(0, 0, 0, .35); }
/* First in its panel, so no space above it. */
.actions.lead { margin-top: 0; }
/* Which cycle a page shows: small pills under its title, the current one filled. */
.pills { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .75rem; }
.pill { padding: .2rem .7rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--muted); }
.pill:hover { color: var(--text); border-color: var(--muted); text-decoration: none; }
.pill[aria-current] { background: var(--green); border-color: var(--green); color: #fff; }
.pill.disabled { opacity: .45; }
/* Views of the same data, as tabs over what they show. */
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin: 1.5rem 0 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .6rem .9rem; margin-bottom: -1px; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--green); }
/* A House committee's name is a picker of the others, styled as the heading it is. */
.committee-picker { field-sizing: content; max-width: 100%; padding: .1rem .3rem; margin-left: -.3rem; font: inherit; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: .5rem; cursor: pointer; }
.committee-picker:hover, .committee-picker:focus { border-color: var(--line); background: var(--panel); }
.committee-picker option, .committee-picker optgroup { font-size: 1rem; background: var(--panel); }
/* Which donations table a page shows: the members as pills, the period as a dropdown, on one line. */
.report-picker { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.report-picker .pills { margin: 0; }
.report-picker select { field-sizing: content; padding: .35rem .5rem; font: inherit; font-size: .9rem; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: .5rem; }
.actions > label { display: flex; gap: .5rem; align-items: center; cursor: pointer; }

/* A committee's values, each under its name. */
.facts { display: flex; flex-wrap: wrap; gap: .4rem 1.75rem; margin: 0 0 1rem; }
.facts > div { display: flex; gap: .4rem; align-items: baseline; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dt::after { content: ":"; }
.facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
/* Amber means a value set here over the FEC's; .was says what the FEC has. */
.overridden { color: var(--amber); }
.mark { display: inline-block; padding: 0 .4rem; border: 1px solid var(--amber); border-radius: .6rem; color: var(--amber); font-size: .8rem; white-space: nowrap; }
.was { color: var(--muted); font-size: .8rem; }
/* "Edit" opens a small form under it to change the designation. */
.designation-edit { position: relative; }
.designation-edit summary { list-style: none; font-size: .85rem; font-weight: normal; color: var(--link); }
.designation-edit summary::-webkit-details-marker { display: none; }
.designation-edit summary:hover { text-decoration: underline; color: var(--link); }
.designation-edit .popover {
  position: absolute; left: 0; top: calc(100% + .35rem); z-index: 10; width: max-content; max-width: min(34rem, calc(100vw - 2.5rem));
  padding: .75rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: .6rem;
}
.designation-edit .hint.lead { margin: 0 0 .6rem; }
/* Below the list: naming a new type (custom_types), set here and offered on every committee. */
.designation-edit .new-type { margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.designation-edit .new-type .hint { margin: 0 0 .4rem; }
.designation-edit .new-type input { margin-right: .4rem; padding: .4rem; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: .5rem; }
.designation-edit select { margin-right: .4rem; padding: .4rem; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: .5rem; }

/* Whose leadership PAC this is, and their campaign committee: one line each, under the tabs. */
.sponsors { margin: .8rem 0 0; padding: .5rem .9rem; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--green); border-radius: .5rem; }
.sponsors p { margin: .15rem 0; }

/* Labels on a committee, each a chip in its own color; "+ Add label" opens a small form under it. */
.labels { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .6rem 0 0; }
.label-chip { display: inline-flex; align-items: center; gap: .2rem; margin: 0; padding: .1rem .2rem .1rem .6rem;
  border-radius: 999px; font-size: .85rem; font-weight: 600; }
/* Read-only for non-experts: no x, so the right padding matches the left. */
.label-chip.read-only { padding: .1rem .6rem; }
.label-chip button { padding: 0 .35rem; font-size: 1rem; line-height: 1.2; color: inherit; background: none; opacity: .7; }
.label-chip button:hover { background: none; color: inherit; opacity: 1; }
/* A chip's name links to the committees with the label. */
.label-chip a, a.label-chip { color: inherit; text-decoration: none; }
.label-chip a:hover, a.label-chip:hover { color: inherit; text-decoration: underline; }
.label-chip.big { font-size: 1.1rem; padding: .25rem .9rem; }
.label-add { position: relative; }
.label-add summary { list-style: none; font-size: .85rem; font-weight: normal; color: var(--link); }
.label-add summary::-webkit-details-marker { display: none; }
.label-add summary:hover { text-decoration: underline; color: var(--link); }
.label-add .popover {
  position: absolute; left: 0; top: calc(100% + .35rem); z-index: 10;
  width: max-content; max-width: min(30rem, calc(100vw - 2.5rem));
  padding: .75rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: .6rem;
}
.label-add .labels.yours { margin: 0 0 .75rem; }
.label-add .labels.yours .label-chip { padding: .1rem .6rem; border: 0; cursor: pointer; }
.label-add .labels.yours .label-chip:hover { filter: brightness(1.15); }
/* Every label, in a list that scrolls, with a box above it that narrows it. */
.label-list { margin: 0 0 .75rem; }
.label-list form { margin: 0; }
.label-list ul { list-style: none; margin: .35rem 0 0; padding: .25rem; max-height: 14rem; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: .5rem; }
.label-list button { display: flex; gap: .5rem; align-items: center; width: 100%; padding: .3rem .4rem; font: inherit;
  font-size: .9rem; text-align: left; color: var(--text); background: none; border-radius: .3rem; }
.label-list button:hover { background: var(--panel-2); color: var(--text); }
.label-list .name { flex: 1; }
.label-list .dot { width: .8rem; height: .8rem; border-radius: 999px; border: 1px solid var(--line); flex: none; }
.label-add .new { display: flex; gap: .4rem; align-items: center; margin: 0; }
.label-add input[type=text], .label-list input[type=search] {
  width: 14rem; padding: .4rem .6rem; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: .5rem; }
.label-list input[type=search] { width: 100%; box-sizing: border-box; }
.labels-table td { vertical-align: middle; }
/* No scrolling box around the labels table: one would clip a color grid
   opened in it. */
.scroll.labels-frame { overflow: visible; }
.labels-table form { margin: 0; }
.labels-table form.inline { display: inline; }
/* A dialog over a dimmed page: Rename on /labels, and the confirm every data-confirm form asks in (_base.html). */
dialog.app-dialog { width: min(26rem, calc(100vw - 2.5rem)); padding: 1.1rem; text-align: left; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
dialog.app-dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog.app-dialog h2 { margin: 0 0 .4rem; font-size: 1.1rem; }
dialog.app-dialog .message { margin: 0 0 1rem; }
dialog.app-dialog input[type=text] { width: 100%; box-sizing: border-box; margin: .5rem 0 .9rem; padding: .45rem .6rem; font: inherit;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: .5rem; }
dialog.app-dialog textarea { width: 100%; box-sizing: border-box; margin: .5rem 0; padding: .45rem .6rem; font: inherit; resize: vertical;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: .5rem; }
dialog.app-dialog .bulk-label-name { display: flex; gap: .5rem; align-items: center; }
/* So the color grid can hang below the dialog rather than be cut off. */
dialog#bulk-label { overflow: visible; }
dialog.app-dialog .bulk-label-name input[type=text] { flex: 1; margin: .5rem 0; }
dialog.app-dialog .bulk-label-name + datalist + .hint { margin-top: 0; }
dialog.app-dialog .actions { display: flex; gap: .5rem; justify-content: flex-end; margin: 0; }
/* The chosen color as a swatch; clicking it opens a 4x4 grid of colors to choose from. */
.color-pick { position: relative; }
.color-pick summary { list-style: none; width: 2.1rem; height: 2.1rem; border: 2px solid var(--line); border-radius: .5rem; cursor: pointer; }
.color-pick summary::-webkit-details-marker { display: none; }
.color-pick summary:hover, .color-pick[open] summary { border-color: var(--muted); }
.color-grid { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 11; display: grid;
  grid-template-columns: repeat(4, 2rem); gap: .35rem; padding: .5rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: .6rem; }
.color-grid label { width: 2rem; height: 2rem; border: 2px solid var(--line); border-radius: .4rem; cursor: pointer; }
.color-grid label:hover { border-color: var(--muted); }
.color-grid label:has(input:checked) { outline: 2px solid var(--text); outline-offset: 1px; }
.color-grid input { position: absolute; opacity: 0; pointer-events: none; }

/* A committee's totals for every cycle, folded under its glance. */
.all-totals { margin: 1rem 0; }

/* The search boxes' type-ahead list (static/suggest.js). */
.search-row .suggest { position: relative; flex: 1 1 14rem; display: flex; }
.search-row .suggest input[type=search] { flex: 1; min-width: 0; }
/* The committee page's leadership PAC candidate box. */
.sponsors .designation-edit { margin-top: .3rem; }
#sponsor-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
#sponsor-form .hint.lead { flex-basis: 100%; }
#sponsor-form .suggest { position: relative; flex: 1 1 18rem; display: flex; }
#sponsor-form input[type=search] { flex: 1; min-width: 14rem; padding: .4rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: .5rem; }
.member-search .suggest { position: relative; flex: 0 1 18rem; display: flex; }
.member-search .suggest input[type=search] { flex: 1; min-width: 0; }
.suggestions {
  position: absolute; z-index: 10; top: calc(100% + .25rem); left: 0; right: 0;
  max-height: min(24rem, 60vh); overflow-y: auto;
  margin: 0; padding: .25rem 0; list-style: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: .5rem;
  box-shadow: 0 .5rem 1.5rem rgb(0 0 0 / .4);
}
.suggestions li { padding: .45rem .8rem; cursor: pointer; }
.suggestions li[aria-selected=true] { background: var(--line); }
.suggestions .name { display: block; color: var(--text); overflow-wrap: anywhere; }
.suggestions .name b { color: var(--link); }
.suggestions .details { display: block; font-size: .85em; color: var(--muted); }

/* Top Expected Donors (Cycle Analytics): Remove opens its two choices under it, to the left, as it is the last column. */
.expected-donors { margin-top: 2rem; }
/* Set widths, so turning to the next ten keeps every column where it was: the PAC
   takes what is left, and long names and reasons wrap.
   Every column but the PAC (3rd) has a width, each wide enough for its header's longest word;
   headers wrap, numeric ones too. Below the min-width the table scrolls sideways. */
table.data.donors { table-layout: fixed; min-width: 92rem; }
table.data.donors td:first-child { min-width: 0; }
table.data.donors td { overflow-wrap: anywhere; }
table.data.donors th { white-space: normal; }
table.data.donors th:nth-child(1) { width: 4rem; }     /* Rank */
table.data.donors th:nth-child(2) { width: 5.5rem; }   /* Chance */
table.data.donors th:nth-child(4) { width: 7rem; }     /* Type */
table.data.donors th:nth-child(5) { width: 16%; }      /* Strongest committee */
table.data.donors th:nth-child(6) { width: 13%; }      /* Strongest characteristic */
table.data.donors th:nth-child(7) { width: 13%; }      /* Strongest issue */
table.data.donors th:nth-child(8) { width: 6.5rem; }   /* Mean gift */
table.data.donors th:nth-child(9) { width: 6.5rem; }   /* Max-gift rate */
table.data.donors th:nth-child(10) { width: 7rem; }    /* House total this cycle */
table.data.donors th:nth-child(11) { width: 6rem; }    /* Remove (experts) */
table.data.given-members, table.data.given-pacs { table-layout: fixed; }
/* Vote Scores: the member's name takes what the numbers leave, wrapping only on a narrow screen. */
table.data.vote-scores { table-layout: fixed; min-width: 38rem; }
table.data.vote-scores td:first-child { min-width: 0; }
table.data.vote-scores th:nth-child(1) { width: 4rem; }     /* Rank */
table.data.vote-scores th:nth-child(3) { width: 7rem; }   /* Party */
table.data.vote-scores th:nth-child(4) { width: 5rem; }     /* Score */
table.data.vote-scores th:nth-child(5) { width: 6.5rem; white-space: normal; }     /* Votes scored */
table.data.vote-scores th:nth-child(6) { width: 6.5rem; }   /* Given */
table.data.given-pacs td:first-child { min-width: 0; }
table.data.given-pacs th:nth-child(1) { width: 4rem; }
table.data.given-pacs th:nth-child(3) { width: 8.5rem; }
table.data.given-pacs th:nth-child(4) { width: 8rem; }
/* What the filings show for a capped PAC goes under its amount. */
table.data.given-pacs .num .hint { display: block; white-space: normal; }
table.data.given-members td:first-child { min-width: 0; }
table.data.given-members th:nth-child(1) { width: 4rem; }
table.data.given-members th:nth-child(3) { width: 8rem; }
table.data.given-members th:nth-child(4) { width: 8rem; }
/* The days a PAC gave: one or several, each kept whole. */
table.data.given-members th:nth-child(5), table.data.given-pacs th:nth-child(5) { width: 9.5rem; }
table.data.given-members td.date, table.data.given-pacs td.date { white-space: normal; }
table.data.given-members td.date span, table.data.given-pacs td.date span { white-space: nowrap; }
/* Giving's charts: a bar per label or committee, its share of members given to, with the figures on hover. */
.reach-chart { margin: .5rem 0 1rem; padding: .9rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.reach-chart .bar-row { position: relative; display: grid; grid-template-columns: minmax(6rem, 14rem) 1fr 3rem; gap: .6rem; align-items: center; padding: .15rem 0; outline: none; }
.reach-chart .bar-name { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reach-chart .bar-track { height: 1rem; background: var(--panel-2); border-radius: .25rem; overflow: hidden; }
.reach-chart .bar { display: block; height: 100%; min-width: 2px; border-radius: .25rem; }
.reach-chart .bar-percent { font-size: .85rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.reach-chart .bar-row:hover .bar, .reach-chart .bar-row:focus-visible .bar { filter: brightness(1.2); }
.reach-chart .bar-tip { display: none; position: absolute; z-index: 5; left: 50%; bottom: 100%; transform: translateX(-50%); padding: .4rem .6rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: .4rem; font-size: .82rem; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.reach-chart .bar-row:hover .bar-tip, .reach-chart .bar-row:focus-visible .bar-tip { display: block; }
.reach-chart figcaption { margin-top: .5rem; }
@media (max-width: 600px) { .reach-chart .bar-row { grid-template-columns: 6rem 1fr 2.5rem; } }
/* Max donations: the three counts, and a pie of them by party. */
.max-donations { display: flex; flex-wrap: wrap; gap: 0 1.5rem; align-items: center; }
.max-donations .stats { flex: 1 1 30rem; }
.party-pie { display: flex; gap: 1rem; align-items: center; margin: 0; }
.party-pie .pie { width: 9rem; height: 9rem; border-radius: 50%; border: 1px solid var(--line); }
.party-pie figcaption { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.party-pie .swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: .2rem; margin-right: .4rem; vertical-align: -.05rem; }
/* Giving's most common characteristic and committee: a pie of the members given to who have it. */
.common-pie { flex-wrap: wrap; margin: .5rem 0 1rem; padding: .9rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.common-pie .pie-title { flex-basis: 100%; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.member-search { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 .8rem; }
.donor-remove .popover { left: auto; right: 0; }
.donor-remove .popover .button { margin: .2rem .3rem 0 0; }
.expected-donors .removed { margin: .5rem 0; }
.expected-donors .removed summary { cursor: pointer; color: var(--link); }
.expected-donors .removed li { margin: .35rem 0; }
.expected-donors form.inline { display: inline; margin-left: .4rem; }
.donor-filters { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; margin: .8rem 0 0; }
.donor-filters label { display: flex; gap: .4rem; align-items: center; cursor: pointer; }
/* The table's ← and →: square, and greyed out at either end. */
.pager .arrow { min-width: 2.2rem; text-align: center; font-size: 1rem; line-height: 1.2; }
.pager .arrow.disabled { opacity: .4; cursor: default; pointer-events: none; }
.pager .hint { margin: 0; }
/* Remove's "Why?" box, and the note under each removed PAC. */
.donor-remove .note-box { display: block; margin: 0 0 .5rem; font-size: .9rem; }
.donor-remove .note-box .hint { display: inline; margin: 0; }
.donor-remove textarea { display: block; width: 26rem; max-width: 100%; margin-top: .3rem; padding: .4rem; font: inherit;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: .5rem; resize: vertical; }
.expected-donors .removal-note { display: block; color: var(--muted); font-style: italic; white-space: pre-line; }

/* The spinner on a page that refreshes itself: the donkey and the elephant chase
   each other round a half-blue, half-red track, each dragging its color along. */
.race { position: relative; width: 6rem; height: 6rem; margin: 2rem auto; display: grid; place-items: center; }
.race .track { position: absolute; inset: 0; animation: race-lap 2.4s linear infinite; }
.race .track::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from -90deg, #2563eb 0 50%, #dc2626 50% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); }
/* Feet on the track, facing the way it turns: the one at the bottom runs upside down. */
.race .runner { position: absolute; left: 50%; top: -1.7rem; width: 2rem; margin-left: -1rem;
  font-size: 1.8rem; line-height: 1; text-align: center; transform-origin: 50% 4.7rem; }
.race .runner.gop { transform: rotate(180deg); }
.race .runner > span { display: inline-block; animation: race-gallop .3s ease-in-out infinite alternate; }
.race .runner.dem > span { filter: drop-shadow(0 0 3px #2563eb); }
.race .runner.gop > span { filter: drop-shadow(0 0 3px #dc2626); animation-delay: -.15s; }
.race .ballot { font-size: 2rem; animation: race-wobble 1.2s ease-in-out infinite; }
@keyframes race-lap { to { transform: rotate(360deg); } }
@keyframes race-gallop { from { transform: scaleX(-1) translateY(0); } to { transform: scaleX(-1) translateY(-.25rem); } }
@keyframes race-wobble { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@media (prefers-reduced-motion: reduce) { .race *, .race .track::before { animation: none; } }

/* A House member's page: its own header band, with the photo over a box of their initials. */
.member-header { display: flex; gap: 1.25rem; align-items: center; margin: .75rem 0 0; padding: 1.25rem 1.5rem;
  background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--green); border-radius: .75rem; }
.member-photo { position: relative; overflow: hidden; flex: none; display: flex; align-items: center; justify-content: center; width: 6rem; height: 7.5rem;
  border: 2px dashed var(--line); border-radius: .5rem; color: var(--muted); font-size: 1.75rem; letter-spacing: .05em; }
.member-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--panel); }
.member-id h1 { margin: 0 0 .25rem; }
.member-line { margin: .1rem 0; }
.member-link { margin: .25rem 0 0; }
.tabs.sub { margin-top: .5rem; }
ul.traits, ul.seats, ul.member-committees { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.traits li { padding: .2rem 0; }
ul.member-committees li { padding: .3rem 0; }
.new-label { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
@media (max-width: 40rem) { .member-header { flex-direction: column; align-items: flex-start; } }
/* Bulk add: wide enough for a row's congress picker and Remove; the member list opens under its box inside the dialog. */
dialog#bulk-label { width: min(36rem, calc(100vw - 2.5rem)); overflow: visible; }
dialog#bulk-label input[type=search] { width: 100%; box-sizing: border-box; }
dialog#bulk-label table.data { width: 100%; }

/* admin schema: a table per database table, its CREATE statement under it */
.schema h3 { margin: 2rem 0 0; scroll-margin-top: 4rem; }
/* Wider than the 60rem of the other admin page: a column's row has seven cells. */
.admin.schema { max-width: 80rem; }
.schema td.description { min-width: 18rem; }
.schema .table-description { margin: .4rem 0 0; }
.schema .unused { color: var(--muted); }
.schema .page-path { white-space: nowrap; font-size: .85rem; }
.schema pre { overflow-x: auto; padding: .75rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); font-size: .8rem; }
