:root {
  color-scheme: light;
  --bg: #f7f9f7;
  --surface: #ffffff;
  --surface-2: #f1f6f2;
  --surface-3: #e8f1eb;
  --text: #17211d;
  --muted: #69746f;
  --muted-2: #8a9690;
  --line: #d8e0dc;
  --line-strong: #bfcac4;
  --green: #08733f;
  --green-2: #0c8a4d;
  --green-3: #0f5f37;
  --green-soft: #e7f4ec;
  --blue: #285f86;
  --amber: #c77b00;
  --amber-soft: #fff3dc;
  --red: #b42318;
  --red-soft: #fff0ee;
  --shadow: 0 20px 45px rgba(20, 36, 28, 0.09);
  --radius: 8px;
  --sidebar: 292px;
  --right-rail: 360px;
  --topbar: 62px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(8, 115, 63, 0.24);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(620px, 1fr) var(--right-rail);
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  background: var(--bg);
}

.sidebar {
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 16px 20px 14px;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 9px);
  align-items: end;
  gap: 5px;
  width: 45px;
  height: 45px;
  border-left: 4px solid var(--green);
  border-bottom: 4px solid var(--green);
  padding: 0 0 5px 6px;
}

.brand-mark span {
  display: block;
  width: 9px;
  background: var(--green);
}

.brand-mark span:nth-child(1) {
  height: 17px;
}

.brand-mark span:nth-child(2) {
  height: 28px;
}

.brand-mark span:nth-child(3) {
  height: 38px;
}

.nav-list {
  display: grid;
  gap: 6px;
  padding: 8px 16px;
}

.nav-item,
.text-link,
.privacy-link,
.info-button,
.modal-close {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 12px;
  color: #32413a;
  font-weight: 650;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.nav-item svg,
.icon-action svg,
.metric-card svg,
.privacy-card svg,
.info-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover {
  background: var(--green-soft);
  color: var(--green-3);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(180deg, var(--green-2), var(--green-3));
  box-shadow: 0 10px 22px rgba(8, 115, 63, 0.18);
}

.sidebar-card,
.privacy-card {
  margin: auto 20px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sidebar-card {
  padding: 18px 16px;
}

.sidebar-card h2,
.panel h2,
.poll-card h2,
.panel h1 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

.sidebar-card h2 {
  font-size: 15px;
}

.sidebar-card p {
  margin: 12px 0 10px;
  color: #59655f;
  font-size: 13px;
}

.text-link,
.privacy-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.text-link::after {
  content: "->";
  font-weight: 800;
}

.privacy-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 14px;
  border-color: rgba(8, 115, 63, 0.36);
  background: #fbfffc;
}

.privacy-card svg {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--green);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.privacy-card strong {
  display: block;
  color: var(--green);
  font-size: 13px;
}

.privacy-card span {
  display: block;
  margin-top: 2px;
  color: #59655f;
  font-size: 12px;
}

.side-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.topbar {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 0 24px;
}

.update-meta,
.top-actions,
.poll-status,
.poll-meta,
.panel-header,
.segmented-control,
.trend-legend {
  display: flex;
  align-items: center;
}

.update-meta {
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.update-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  gap: 9px;
}

.icon-action,
.secondary-button,
.primary-button,
.country-select select,
.filter-select select,
.segmented-control button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: #26322d;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.icon-action:hover,
.secondary-button:hover,
.country-select select:hover,
.filter-select select:hover {
  border-color: var(--line-strong);
  background: #fbfdfb;
}

.country-select select,
.filter-select select {
  height: 36px;
  min-width: 122px;
  padding: 0 34px 0 12px;
  cursor: pointer;
}

.filter-select.small select {
  min-width: 154px;
}

.info-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.main-content,
.right-rail {
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
}

.main-content {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 20px 24px 34px;
}

.right-rail {
  grid-column: 3;
  grid-row: 2;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #fbfcfb;
  padding: 20px 22px 34px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(20, 36, 28, 0.02);
}

.metric-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  min-height: 122px;
  padding: 17px;
}

.metric-card svg {
  width: 31px;
  height: 31px;
  color: var(--green);
  border-radius: 7px;
  background: var(--green-soft);
  padding: 6px;
}

.metric-card span,
.metric-card small,
.metric-card em {
  display: block;
}

.metric-card span {
  color: #4c5852;
  font-size: 13px;
  font-weight: 650;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  color: #111915;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.metric-card em {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.metric-card em.good {
  color: var(--green);
}

.panel {
  padding: 16px;
}

.panel + .panel,
.right-rail .panel + .panel {
  margin-top: 16px;
}

.panel-header {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.office-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.office-strip > span {
  color: #4b5751;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.office-control {
  flex: 0 1 auto;
}

.office-control button {
  min-width: 104px;
}

.panel-header.compact {
  align-items: flex-start;
  margin-bottom: 12px;
}

.panel-header h1 {
  font-size: 20px;
}

.panel-header h2,
.poll-card h2 {
  font-size: 17px;
}

.panel-header p,
.poll-card p,
.issue-panel p,
.trend-panel p,
.anomaly-panel p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.trust-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: 7px;
  border: 1px solid rgba(8, 115, 63, 0.25);
  border-radius: 4px;
  padding: 0 7px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(52px, 1fr));
  align-items: end;
  gap: 13px;
  min-height: 174px;
  padding: 14px 4px 0;
  border-bottom: 1px solid var(--line);
}

.bar-item {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: end;
  min-height: 154px;
  text-align: center;
}

.bar-value {
  color: #24302b;
  font-size: 13px;
  font-weight: 800;
}

.bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 105px;
  margin-top: 7px;
}

.bar-fill {
  width: min(62px, 70%);
  min-height: 6px;
  border-radius: 4px 4px 0 0;
  background: var(--party-color, var(--green-2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--party-color, var(--green-2)) 86%, #ffffff), var(--party-color, var(--green-3)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: height 220ms ease;
}

.bar-label {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 30px;
  margin-top: 8px;
  color: #5b6761;
  font-size: 11px;
  line-height: 1.15;
}

.party-logo {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  object-fit: contain;
}

.bar-party-logo {
  width: 24px;
  height: 24px;
  padding: 2px;
}

.chart-notes {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 16px;
  margin-top: 16px;
}

.segmented-control {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #f8fbf9;
}

.segmented-control button {
  height: 32px;
  min-width: 46px;
  border: 0;
  border-radius: 0;
  padding: 0 11px;
  cursor: pointer;
  color: #52615a;
  font-size: 12px;
  font-weight: 750;
}

.segmented-control button.active {
  color: #ffffff;
  background: var(--green);
}

.state-content {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(210px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.state-heatmap {
  display: grid;
  grid-template-columns: repeat(6, minmax(26px, 1fr));
  gap: 4px;
  min-height: 168px;
  align-content: center;
  border-radius: 7px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(8, 115, 63, 0.04), transparent 45%),
    #f6faf7;
}

.state-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 22px;
  border: 1px solid rgba(8, 115, 63, 0.12);
  border-radius: 5px;
  background: var(--cell-color, #dce9e0);
  color: #123223;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.state-cell:hover,
.state-cell.active {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(8, 115, 63, 0.16);
}

.state-cell.fct {
  color: #ffffff;
  background: var(--green);
}

.state-table-wrap {
  min-width: 0;
}

.state-table,
.anomaly-table {
  width: 100%;
  border-collapse: collapse;
}

.state-table th,
.state-table td,
.anomaly-table th,
.anomaly-table td {
  border-bottom: 1px solid var(--line);
  padding: 6px;
  text-align: left;
  vertical-align: middle;
}

.state-table th,
.anomaly-table th {
  color: #4b5751;
  font-size: 11px;
  font-weight: 800;
}

.state-table td,
.anomaly-table td {
  color: #283530;
  font-size: 12px;
}

.state-table td:last-child,
.anomaly-table td:nth-child(3),
.anomaly-table td:nth-child(4) {
  white-space: nowrap;
}

.align-right {
  float: right;
  margin-top: 10px;
}

.issue-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: issue;
}

.issue-item {
  display: grid;
  grid-template-columns: 24px minmax(148px, 1fr) 130px 38px;
  align-items: center;
  gap: 10px;
  min-height: 24px;
}

.issue-item::before {
  content: counter(issue);
  counter-increment: issue;
  color: #283530;
  font-weight: 800;
}

.issue-name {
  color: #283530;
  font-size: 12px;
  white-space: nowrap;
}

.issue-bar {
  height: 7px;
  border-radius: 999px;
  background: #e5ece8;
  overflow: hidden;
}

.issue-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--green-2));
}

.issue-value {
  color: #4e5a54;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.trend-panel {
  margin-top: 16px;
}

.trend-legend {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.legend-item i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.trend-chart {
  min-height: 210px;
  border-radius: 7px;
  background:
    linear-gradient(#edf3ef 1px, transparent 1px) 0 0 / 100% 42px,
    #fbfdfb;
  overflow: hidden;
}

.trend-chart svg {
  display: block;
  width: 100%;
  height: 210px;
}

.empty-chart {
  display: grid;
  place-items: center;
  min-height: 210px;
  padding: 1.5rem;
  color: var(--ink-soft);
  text-align: center;
}

.trend-axis {
  color: var(--muted-2);
  font-size: 11px;
}

.anomaly-panel {
  margin-top: 16px;
}

.anomaly-panel h2 span {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  margin-left: 6px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--amber);
  font-size: 11px;
}

.table-scroll {
  overflow-x: auto;
}

.severity,
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.severity::before,
.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.severity.low::before,
.status-dot.good::before {
  background: var(--green);
}

.severity.high::before {
  background: var(--red);
}

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  min-height: 42px;
  border-color: var(--green);
  color: #ffffff;
  background: linear-gradient(180deg, var(--green-2), var(--green-3));
}

.primary-button:hover {
  filter: brightness(0.98);
}

.primary-button:disabled {
  border-color: var(--line);
  background: #a8b7af;
  cursor: not-allowed;
}

.poll-status {
  justify-content: space-between;
  gap: 12px;
}

.poll-status span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.poll-status i,
.quality-score i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.poll-card form {
  margin-top: 16px;
}

fieldset {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.office-field + fieldset {
  margin-top: 14px;
}

legend {
  margin-bottom: 8px;
  color: #1f2a25;
  font-size: 13px;
  font-weight: 800;
}

.candidate-options {
  display: grid;
  gap: 10px;
}

.candidate-choice,
.consent-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #536059;
  font-size: 13px;
}

.candidate-choice {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--party-color, var(--line));
  border-radius: 7px;
  padding: 9px 10px;
  background: #fbfdfb;
}

.candidate-choice:hover {
  border-color: var(--party-color, var(--line-strong));
}

.choice-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 3px;
}

.candidate-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.candidate-copy strong,
.candidate-copy small,
.candidate-copy em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.candidate-copy strong {
  color: #25302b;
  font-size: 13px;
}

.candidate-copy small {
  color: #5c6862;
  font-size: 12px;
}

.candidate-copy em,
.candidate-note {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.candidate-note {
  margin: 0;
}

input[type="radio"],
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--green);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.field-grid label,
.full-field {
  display: grid;
  gap: 5px;
}

.field-grid span,
.full-field span {
  color: #4d5a54;
  font-size: 12px;
  font-weight: 800;
}

.field-grid select,
.full-field select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: #ffffff;
}

.full-field {
  margin-top: 10px;
}

.consent-line {
  align-items: flex-start;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.privacy-link {
  margin-top: 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form-message {
  min-height: 18px;
  margin: 9px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-message.error {
  color: var(--red);
}

.form-message.success {
  color: var(--green);
}

.poll-meta {
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.party-list {
  display: grid;
  gap: 8px;
}

.party-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--party-color, var(--green));
  border-radius: 7px;
  padding: 7px 9px;
  background: #ffffff;
}

.roster-logo {
  width: 32px;
  height: 32px;
  padding: 3px;
}

.party-row strong,
.party-row span {
  display: block;
  overflow-wrap: anywhere;
}

.party-row strong {
  color: #1f2a25;
  font-size: 13px;
}

.party-row span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.quality-score {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 12px;
}

.quality-score strong {
  font-size: 30px;
  line-height: 1;
}

.quality-score span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.quality-meter {
  height: 8px;
  margin: 14px 0 13px;
  border-radius: 999px;
  background: #dce5df;
  overflow: hidden;
}

.quality-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #3fab73);
}

.quality-list {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.quality-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.quality-list dt,
.quality-list dd {
  margin: 0;
  font-size: 12px;
}

.quality-list dt {
  color: var(--muted);
}

.quality-list dd {
  color: var(--green);
  font-weight: 800;
}

.trust-list {
  display: grid;
  gap: 10px;
  margin: 13px 0 14px;
  padding: 0;
  list-style: none;
}

.trust-list li {
  position: relative;
  padding-left: 22px;
  color: #4e5c55;
  font-size: 12px;
}

.trust-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--green);
  border-radius: 3px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 44px));
  border: 1px solid rgba(8, 115, 63, 0.26);
  border-radius: 7px;
  padding: 12px 14px;
  color: #133323;
  background: #f4fff8;
  box-shadow: var(--shadow);
  font-weight: 750;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(14, 24, 19, 0.38);
}

.modal {
  position: relative;
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 38px 14px 0;
  font-size: 22px;
}

.modal h3 {
  margin: 20px 0 8px;
  font-size: 15px;
}

.modal p,
.modal li {
  color: #4f5c56;
}

.modal ul,
.modal ol {
  padding-left: 20px;
}

.modal form {
  display: grid;
  gap: 12px;
}

.modal label {
  display: grid;
  gap: 5px;
  color: #4d5a54;
  font-size: 12px;
  font-weight: 800;
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--text);
  background: #ffffff;
}

.modal textarea {
  min-height: 110px;
  resize: vertical;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 1320px) {
  :root {
    --sidebar: 248px;
    --right-rail: 330px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    order: 0;
    position: sticky;
    top: 0;
    z-index: 20;
    display: block;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    min-height: 66px;
    padding: 12px 18px;
  }

  .nav-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 14px 12px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 36px;
    font-size: 13px;
  }

  .sidebar-card,
  .privacy-card,
  .side-footer {
    display: none;
  }

  .topbar {
    order: 1;
    position: sticky;
    top: 117px;
    z-index: 18;
    padding: 10px 16px;
  }

  .main-content,
  .right-rail {
    overflow: visible;
    padding: 16px;
  }

  .right-rail {
    order: 2;
  }

  .main-content {
    order: 3;
  }

  .right-rail {
    border-left: 0;
    background: var(--bg);
  }
}

@media (max-width: 760px) {
  .topbar,
  .top-actions,
  .chart-notes,
  .panel-header,
  .office-strip,
  .state-content,
  .field-grid {
    display: block;
  }

  .topbar {
    top: 110px;
  }

  .top-actions {
    margin-top: 10px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .office-control {
    display: inline-flex;
    max-width: 100%;
    margin-top: 8px;
    overflow-x: auto;
  }

  .icon-action,
  .country-select,
  .country-select select {
    display: inline-flex;
    vertical-align: top;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    grid-template-columns: repeat(7, minmax(44px, 1fr));
    gap: 7px;
    overflow-x: auto;
  }

  .bar-item {
    min-width: 50px;
  }

  .bar-fill {
    width: 30px;
  }

  .state-heatmap {
    margin-bottom: 14px;
  }

  .issue-item {
    grid-template-columns: 20px minmax(88px, 1fr) minmax(74px, 34%) 34px;
    gap: 7px;
  }

  .issue-name {
    white-space: normal;
  }

  .table-scroll {
    margin: 0 -4px;
  }

  .anomaly-table {
    min-width: 720px;
  }

  .poll-meta {
    display: grid;
  }
}

@media (max-width: 520px) {
  :root {
    font-size: 13px;
  }

  .brand strong {
    font-size: 17px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .nav-item svg {
    display: none;
  }

  .main-content,
  .right-rail {
    padding: 12px;
  }

  .panel,
  .metric-card {
    padding: 13px;
  }

  .panel-header h1 {
    font-size: 17px;
  }

  .state-heatmap {
    grid-template-columns: repeat(5, minmax(27px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
