:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e0da;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7a7974;
  --accent: #1c5cab;
  --yes: #2a78d6;
  --no: #e34948;
  --abstain: #eda100;
  --grid: #e9e7e2;
  --bar: #2a78d6;
  --flag-bg: #fdf3e1;
  --flag-text: #7a4b00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #33332f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #92918a;
    --accent: #86b6ef;
    --yes: #3987e5;
    --no: #e66767;
    --abstain: #c98500;
    --grid: #2b2b28;
    --bar: #3987e5;
    --flag-bg: #3a2c12;
    --flag-text: #f3cf86;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #33332f;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #92918a; --accent: #86b6ef;
  --yes: #3987e5; --no: #e66767; --abstain: #c98500; --grid: #2b2b28; --bar: #3987e5;
  --flag-bg: #3a2c12; --flag-text: #f3cf86;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
header { padding: 40px 0 8px; }
header .kicker { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.1; margin: 6px 0 10px; letter-spacing: -.01em; }
header p { color: var(--text-2); max-width: 680px; margin: 0; }
h2 { font-size: 20px; margin: 0 0 4px; }
.sub { color: var(--text-2); margin: 0 0 16px; font-size: 14px; max-width: 720px; }
section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin: 16px 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 20px 0 4px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; font: inherit; font-size: 14px; color: var(--text-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.filters .label { font-size: 13px; color: var(--text-3); margin-right: 2px; }
.year-select { max-width: 100%; font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat .v { font-size: 30px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 13px; color: var(--text-2); }

/* Split-vote matrix */
.matrix-scroll { overflow-x: auto; }
table.matrix { border-collapse: separate; border-spacing: 2px; font-size: 13px; }
.matrix th.mem { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 500; color: var(--text-2); padding: 4px 0; white-space: nowrap; text-align: left; vertical-align: bottom; }
.matrix td.bill { padding: 4px 10px 4px 0; min-width: 260px; max-width: 380px; }
.matrix td.bill .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.matrix td.bill .m { color: var(--text-3); font-size: 12px; }
.cell { width: 28px; height: 28px; border-radius: 4px; text-align: center; font-size: 11px; font-weight: 700; line-height: 28px; cursor: default; }
.v-yes { background: var(--yes); color: #fff; }
.v-no { background: var(--no); color: #fff; }
.v-abstain { background: var(--abstain); color: #111; }
.v-absent { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border); color: var(--text-3); font-weight: 500; }
.v-unknown { background: repeating-linear-gradient(45deg, var(--surface-2) 0 4px, var(--border) 4px 6px); color: var(--text-2); }
.v-none { background: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 8px; }
.legend .cell { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; line-height: 1; font-size: 11px; flex: none; }

/* Member cards */
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.member { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.member:hover, .member[aria-pressed="true"] { border-color: var(--accent); }
.member .n { font-weight: 600; }
.member .r { font-size: 12px; color: var(--text-3); }
.member dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 10px 0 0; font-size: 13px; }
.member dt { color: var(--text-2); }
.member dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--bar); border-radius: 3px; }
.tag-current { font-size: 11px; color: var(--text-2); border: 1px solid var(--border); border-radius: 99px; padding: 0 6px; margin-left: 6px; }

/* Department bars */
.bars { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; gap: 6px 10px; align-items: center; font-size: 13px; }
.bars .lab { color: var(--text-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .track { height: 14px; position: relative; }
.bars .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar); border-radius: 0 4px 4px 0; }
.bars .num { font-variant-numeric: tabular-nums; color: var(--text); min-width: 28px; }
.bars button { all: unset; cursor: pointer; display: contents; }

/* Bill list */
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tools input[type=search], .tools select { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.tools input[type=search] { flex: 1 1 240px; }
.tools label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--text-2); }
.bill-row { border-top: 1px solid var(--border); }
.bill-row summary { list-style: none; display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; padding: 10px 0; cursor: pointer; align-items: start; }
.bill-row summary::-webkit-details-marker { display: none; }
.bill-row .d { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.bill-row .cb { font-size: 12px; color: var(--text-3); font-weight: 600; }
.bill-row .ttl { font-size: 14px; }
.pill { font-size: 12px; border-radius: 99px; padding: 1px 8px; white-space: nowrap; border: 1px solid var(--border); color: var(--text-2); }
.pill.split { border-color: var(--no); color: var(--text); }
.pill.defeated { background: var(--no); border-color: var(--no); color: #fff; }
.pill.flag { background: var(--flag-bg); color: var(--flag-text); border-color: transparent; }
.detail { padding: 0 0 14px 104px; font-size: 14px; color: var(--text-2); }
.detail .votes { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.detail .votes span { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px 2px 2px; font-size: 13px; color: var(--text); }
.detail .votes .cell { width: 20px; height: 20px; line-height: 20px; font-size: 10px; }
.detail .flagnote { background: var(--flag-bg); color: var(--flag-text); padding: 6px 10px; border-radius: 6px; margin: 6px 0; }
.top-search { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; max-width: 680px; }
.top-search input { flex: 1 1 260px; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.top-search .more { margin-top: 0; }
.video-note { margin: 4px 0 0; }
.video-frame { position: relative; width: 100%; max-width: 860px; aspect-ratio: 16 / 9; margin: 0 0 8px; background: #000; border-radius: 8px; overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.live-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--no); }
.bill-title { font-size: clamp(22px, 4vw, 30px); line-height: 1.2; }
header .cb { font-size: 13px; color: var(--text-3); font-weight: 600; }
.bill-summary { font-size: 17px; line-height: 1.5; max-width: 720px; margin: 0 0 8px; }
.sub-inline { font-size: 14px; font-weight: 400; color: var(--text-2); }
.stat .v-text { font-size: 20px; line-height: 1.25; letter-spacing: 0; }
.bill-votes { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.bill-votes > span { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px 2px 2px; font-size: 13px; }
.bill-votes .cell { width: 20px; height: 20px; line-height: 20px; font-size: 10px; }
section .flagnote { background: var(--flag-bg); color: var(--flag-text); padding: 6px 10px; border-radius: 6px; margin: 6px 0; font-size: 14px; }
.more { margin-top: 12px; font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }

.tip { position: fixed; pointer-events: none; z-index: 20; background: var(--text); color: var(--surface); font-size: 12px; padding: 6px 9px; border-radius: 6px; max-width: 280px; opacity: 0; transition: opacity .1s; }
footer { color: var(--text-3); font-size: 13px; padding: 12px 0 48px; }
.notes li { margin-bottom: 6px; }
@media (max-width: 640px) {
  .bill-row summary { grid-template-columns: 1fr; gap: 4px; }
  .detail { padding-left: 0; }
  .bars { grid-template-columns: 110px 1fr auto; }
}

/* Member pages */
header a { color: inherit; }
a.member { display: block; text-decoration: none; }
.matrix th.mem a { color: inherit; text-decoration: none; }
.matrix th.mem a:hover { text-decoration: underline; }
.table-scroll { overflow-x: auto; }
.votes-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.votes-table th { text-align: left; border-bottom: 1px solid var(--border); padding: 6px 12px 6px 0; white-space: nowrap; }
.votes-table th button { all: unset; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
.votes-table th button:hover, .votes-table th button:focus-visible { color: var(--text); text-decoration: underline; }
.votes-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.votes-table .d { white-space: nowrap; font-variant-numeric: tabular-nums; }
.votes-table .d a { color: var(--text-2); }
.votes-table .cb { font-size: 12px; color: var(--text-3); font-weight: 600; }
.votes-table .m, .race .m { font-size: 12px; color: var(--text-3); }
.votes-table .flagnote { background: var(--flag-bg); color: var(--flag-text); padding: 4px 8px; border-radius: 6px; margin-top: 6px; font-size: 12px; }
.vote-cell { white-space: nowrap; }
.vote-cell .cell { display: inline-block; width: 22px; height: 22px; line-height: 22px; margin-right: 4px; }
.dissent-tag { font-size: 12px; font-weight: 600; margin-top: 4px; }
.race { padding: 14px 0; border-top: 1px solid var(--border); }
.race:first-child { border-top: 0; padding-top: 0; }
.race h3 { font-size: 15px; margin: 0; }
.race-bars { margin: 10px 0 6px; grid-template-columns: minmax(130px, 240px) 1fr minmax(92px, auto); }
.race-bars .lab { white-space: normal; }
.race-bars .self { color: var(--text); font-weight: 600; }
.race-bars .track i.other { background: var(--text-3); opacity: .55; }
.race-bars .num { white-space: nowrap; text-align: right; }
.race-bars .pct { color: var(--text-3); margin-left: 4px; }
.won { font-size: 11px; font-weight: 600; border: 1px solid var(--border); border-radius: 99px; padding: 0 6px; color: var(--text-2); white-space: nowrap; }
[hidden] { display: none !important; }

/* Agendas */
.topnav { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; margin-top: 12px; }
.agenda { padding: 14px 0; border-top: 1px solid var(--border); }
.agenda:first-child { border-top: 0; padding-top: 0; }
.agenda h3 { font-size: 16px; margin: 0; }
.agenda h4 { font-size: 13px; margin: 12px 0 4px; color: var(--text-2); }
.agenda p { margin: 4px 0; font-size: 14px; }
.agenda ul { margin: 0; padding: 0; list-style: none; }
.agenda li { padding: 6px 0; font-size: 14px; }
.agenda .cb { font-size: 12px; color: var(--text-3); font-weight: 600; }
.agenda .m { font-size: 13px; color: var(--text-2); }

.vote-cell a { color: inherit; text-underline-offset: 3px; }
.rep-district { font-size: 17px; margin: 16px 0 10px; }
.rep-note { margin: 14px 0 0; font-size: 12px; }
#repOut .members { margin-top: 4px; }
.agenda-fold { border-top: 1px solid var(--border); }
.agenda-fold summary { padding: 12px 0; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-2); }
.agenda-fold summary:hover { color: var(--text); }
.agenda-fold[open] summary { color: var(--text); }
.agenda-fold .agenda { border-top: 0; padding-top: 0; }
