:root {
  --sidebar-width: 246px;
  --sidebar-collapsed-width: 78px;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #17202c;
  --muted: #687386;
  --border: #dbe2eb;
  --nav: #111827;
  --nav-muted: #9aa7b8;
  --red: #c93636;
  --blue: #2f6fb4;
  --teal: #168c86;
  --amber: #d7952d;
  --slate: #59677b;
  --green: #278a53;
  --shadow: 0 18px 50px rgba(20, 32, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body.auth-locked {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(201, 54, 54, 0.35);
  outline-offset: 3px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-160%);
  border-radius: 7px;
  background: var(--red);
  color: #ffffff;
  padding: 10px 12px;
  text-decoration: none;
  font-weight: 900;
  transition: transform 0.16s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(380px, 1.05fr);
  color: var(--ink);
  background: #f5f7fa;
}

body.authenticated .auth-page {
  display: none;
}

body.auth-locked .sidebar,
body.auth-locked .app-shell,
body.auth-locked .detail-drawer,
body.auth-locked #volunteerDialog,
body.auth-locked #campaignDialog {
  display: none;
}

.auth-visual {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  padding: 38px;
  color: #ffffff;
  display: grid;
  align-content: space-between;
  overflow: hidden;
  background: #020712 url("assets/auth-background.jpg") 72% center / cover no-repeat;
}

.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(2, 7, 18, 0.28), rgba(2, 7, 18, 0.08)),
    linear-gradient(0deg, rgba(2, 7, 18, 0.36), rgba(2, 7, 18, 0.08));
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.auth-copy {
  max-width: 560px;
  display: grid;
  gap: 14px;
}

.auth-copy .label {
  color: rgba(255, 255, 255, 0.68);
}

.auth-copy p:last-child {
  margin: 0;
  max-width: 520px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 18px;
  line-height: 1.6;
}

.auth-panel {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 38px;
}

.auth-panel-header,
.auth-form {
  width: min(100%, 470px);
}

.auth-panel-header {
  margin-bottom: 22px;
}

.auth-panel-header h2 {
  margin: 5px 0 8px;
  color: var(--ink);
  font-size: 34px;
  letter-spacing: 0;
}

.auth-panel-header p:last-child {
  margin: 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-form label {
  display: grid;
  gap: 7px;
}

.auth-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

.auth-form input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(201, 54, 54, 0.14);
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 8px;
}

.password-field button,
.auth-primary {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 900;
}

.password-field button {
  color: var(--ink);
  background: #e8edf4;
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

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

.auth-primary {
  min-height: 48px;
  color: #ffffff;
  background: var(--red);
}

.auth-primary:hover {
  background: #ab2d2d;
}

.copyright-footer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.copyright-footer p {
  margin: 0;
}

.copyright-footer a {
  color: inherit;
  font-weight: 900;
  text-decoration: none;
}

.copyright-footer a:hover,
.copyright-footer a:focus-visible {
  color: var(--red);
  text-decoration: underline;
}

.auth-copyright {
  width: min(100%, 470px);
  margin-top: 18px;
  text-align: center;
}

.dashboard-copyright {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: auto -24px 0;
  padding: 10px 24px 12px;
  border-top: 1px solid var(--border);
  background: rgba(244, 247, 251, 0.96);
  backdrop-filter: blur(10px);
  text-align: center;
}

.footer-toggle {
  position: absolute;
  top: -18px;
  right: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(20, 32, 48, 0.12);
  transition: color 0.16s ease, transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.footer-toggle:hover,
.footer-toggle:focus-visible {
  border-color: rgba(201, 54, 54, 0.34);
  background: #fff7f7;
  color: var(--red);
}

.footer-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 0.18s ease;
}

body.footer-hidden .dashboard-copyright {
  padding-block: 0;
  border-top-color: transparent;
  background: transparent;
  backdrop-filter: none;
}

body.footer-hidden .footer-tool-strip,
body.footer-hidden .footer-copy {
  display: none;
}

body.footer-hidden .footer-toggle {
  top: auto;
  bottom: 10px;
  right: 0;
}

body.footer-hidden .footer-toggle svg {
  transform: rotate(180deg);
}

.footer-tool-strip {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.footer-tool-strip button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(20, 32, 48, 0.08);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.footer-tool-strip button:hover,
.footer-tool-strip button:focus-visible {
  border-color: rgba(201, 54, 54, 0.34);
  background: #fff7f7;
  color: var(--red);
  transform: translateY(-1px);
}

.footer-tool-strip svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.footer-copy {
  display: grid;
  gap: 1px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 22px 18px;
  color: white;
  background: var(--nav);
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow: hidden;
  z-index: 4;
  transition: width 0.22s ease, padding 0.22s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: white;
}

.florida-mark {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand-copy {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.brand-copy strong,
.brand-copy small,
.nav-category-label,
.nav-label,
.user-copy strong,
.user-copy span {
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.sidebar-toggle {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: white;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sidebar-toggle span {
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
}

.brand small,
.sidebar a {
  color: var(--nav-muted);
}

.sidebar-nav {
  display: grid;
  flex: 1 1 auto;
  gap: 8px;
  align-content: start;
  min-height: 0;
  margin-right: -8px;
  padding-right: 8px;
  overflow-y: auto;
  scrollbar-color: rgba(214, 221, 232, 0.35) transparent;
  scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(214, 221, 232, 0.26);
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav-category {
  display: grid;
  gap: 7px;
  align-content: start;
}

.nav-category:not(.nav-category-main):not(.is-collapsed) {
  margin-block: 4px;
}

.nav-category.is-collapsed {
  gap: 0;
}

.nav-category-main {
  gap: 0;
}

.nav-category-toggle {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  text-align: left;
}

.nav-category-label {
  display: block;
  flex: 1;
  margin: 0;
  padding: 0 12px;
  color: rgba(214, 221, 232, 0.56);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.nav-category-toggle:hover .nav-category-label,
.nav-category-toggle:focus-visible .nav-category-label {
  color: rgba(255, 255, 255, 0.82);
}

.nav-category-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.42);
  outline-offset: 3px;
  border-radius: 7px;
}

.nav-category-chevron {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 12px;
  border-right: 2px solid rgba(214, 221, 232, 0.7);
  border-bottom: 2px solid rgba(214, 221, 232, 0.7);
  transform: rotate(45deg);
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.nav-category.is-collapsed .nav-category-chevron {
  transform: rotate(-45deg);
}

.nav-submenu {
  display: grid;
  gap: 7px;
}

.nav-category.is-collapsed .nav-submenu {
  display: none;
}

.sidebar a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 14px;
  min-width: 0;
}

.nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar a.active,
.sidebar a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.09);
}

.sidebar a.active {
  color: #ffffff;
  background: rgba(201, 54, 54, 0.22);
  box-shadow: inset 3px 0 0 var(--red), 0 10px 22px rgba(0, 0, 0, 0.16);
}

.sidebar a.active .nav-icon {
  color: #ffffff;
  background: var(--red);
}

.sidebar a.active .nav-label {
  color: #ffffff;
  font-weight: 900;
}

.sidebar a.active:hover {
  background: rgba(201, 54, 54, 0.28);
}

.sidebar-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex: 0 0 auto;
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--nav);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red), #8f2222);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.user-copy {
  min-width: 0;
}

.user-copy strong,
.user-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  color: #ffffff;
  font-size: 13px;
  line-height: 1.25;
}

.user-copy span {
  color: var(--nav-muted);
  font-size: 11px;
  line-height: 1.35;
}

.sidebar-logout-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--nav-muted);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-logout-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-logout-btn:hover {
  color: #ffffff;
  background: rgba(201, 54, 54, 0.28);
  transform: translateY(-1px);
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  padding-inline: 12px;
}

body.sidebar-collapsed .brand {
  justify-content: center;
  gap: 0;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-category-label,
body.sidebar-collapsed .nav-category-chevron,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .user-copy {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: translateX(-8px);
}

body.sidebar-collapsed .brand-mark {
  margin-inline: auto;
}

body.sidebar-collapsed .sidebar-toggle {
  position: absolute;
  top: 72px;
  left: 23px;
}

body.sidebar-collapsed .sidebar-toggle span {
  transform: rotate(135deg);
}

body.sidebar-collapsed .sidebar nav {
  margin-top: 36px;
}

body.sidebar-collapsed .nav-category-toggle {
  display: none;
}

body.sidebar-collapsed .nav-category.is-collapsed .nav-submenu {
  display: grid;
}

body.sidebar-collapsed .sidebar a {
  justify-content: center;
  padding-inline: 8px;
}

body.sidebar-collapsed .sidebar-footer {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
}

.label {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 800;
}

.app-shell {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  padding: 24px 24px 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s ease, width 0.22s ease;
}

body.sidebar-collapsed .app-shell {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.election-ticker {
  position: relative;
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(201, 54, 54, 0.26);
  border-radius: 8px;
  background: #fff7f7;
  color: var(--ink);
  cursor: pointer;
  min-width: 0;
}

.topbar-actions .election-ticker {
  grid-column: 1;
  grid-row: 1 / span 3;
  align-self: stretch;
  min-height: 0;
}

.election-ticker:focus-visible {
  outline: 2px solid rgba(201, 54, 54, 0.42);
  outline-offset: 2px;
}

.ticker-track {
  position: absolute;
  inset: 0;
  display: block;
  animation: ticker-scroll-vertical 34s ease-in-out infinite;
  will-change: transform;
}

.ticker-track span {
  display: grid;
  grid-template-columns: auto minmax(0, auto) auto;
  place-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 3px 12px;
  white-space: normal;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.28;
  text-align: center;
}

.ticker-track span b {
  color: var(--red);
  font-size: 18px;
  line-height: 1;
}

.election-ticker:hover .ticker-track,
.election-ticker:focus-within .ticker-track {
  animation-play-state: paused;
}

@keyframes ticker-scroll-vertical {
  0%, 12% {
    transform: translateY(0);
  }

  16%, 28% {
    transform: translateY(-100%);
  }

  32%, 44% {
    transform: translateY(-200%);
  }

  48%, 60% {
    transform: translateY(-300%);
  }

  64%, 76% {
    transform: translateY(-400%);
  }

  80%, 92% {
    transform: translateY(-500%);
  }

  100% {
    transform: translateY(-600%);
  }
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.subtitle {
  color: var(--muted);
  margin-top: 8px;
}

.topbar-actions {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 350px);
  grid-template-rows: repeat(3, 48px);
  gap: 6px;
  align-items: stretch;
  justify-items: stretch;
  flex: 1 1 790px;
}

.phase-control,
.refresh-stamp,
.countdown-card,
.controls label {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.phase-control {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  gap: 2px;
  align-content: center;
  min-width: 0;
  padding: 2px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

select,
input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.phase-control select {
  text-align: center;
  text-align-last: center;
  font-size: 13px;
  font-weight: 900;
}

.refresh-stamp,
.countdown-card {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 2px 9px;
  text-align: center;
}

.refresh-stamp {
  grid-column: 2;
  grid-row: 1;
}

.countdown-card {
  grid-column: 2;
  grid-row: 3;
  justify-self: stretch;
  min-width: 0;
  border-color: rgba(201, 54, 54, 0.28);
  background: #fffafa;
}

.refresh-stamp span,
.countdown-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.countdown-card strong {
  display: block;
  margin-top: 2px;
  color: var(--red);
  font-size: 17px;
  line-height: 1.15;
  white-space: nowrap;
  text-align: center;
}

.refresh-stamp strong {
  display: block;
  text-align: center;
}

.controls {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.controls label {
  padding: 10px 12px;
  display: grid;
  gap: 6px;
  align-content: center;
  text-align: center;
}

.controls label.locked-filter {
  background: #fff7f7;
  border-color: rgba(201, 54, 54, 0.28);
}

.controls label.locked-filter select {
  color: var(--red);
  font-weight: 800;
}

.controls span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.controls input,
.controls select {
  text-align: center;
  text-align-last: center;
}

.controls input::placeholder {
  text-align: center;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card,
.panel,
.scenario-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 112px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  display: grid;
  align-content: space-between;
  justify-items: center;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.kpi-card:hover,
.bar-row:hover,
tr:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 54, 54, 0.45);
}

.kpi-card .kpi-title {
  display: grid;
  align-content: center;
  gap: 1px;
  min-height: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  width: 100%;
  text-align: center;
}

.kpi-card .kpi-title span {
  display: block;
}

.kpi-card strong {
  font-size: 26px;
  line-height: 1;
  width: 100%;
  text-align: center;
}

.kpi-card .kpi-note {
  display: grid;
  align-content: center;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  min-height: 36px;
  max-height: 36px;
  color: var(--muted);
  line-height: 1.25;
  width: 100%;
  overflow: hidden;
  text-align: center;
}

.kpi-card .kpi-note span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.wide {
  grid-column: span 1;
}

.tall {
  height: 500px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.icon-button,
.crud-action-button,
.export-actions button,
.primary-button,
.danger-button,
.form-actions button,
.row-actions button {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
}

.primary-button {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.danger-button {
  border-color: rgba(201, 54, 54, 0.35);
  color: var(--red);
}

.crud-action-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #435066;
}

.crud-action-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.crud-action-button:hover {
  border-color: #c3cfde;
  background: #eef3f8;
  color: var(--ink);
  transform: translateY(-1px);
}

.crud-action-button.is-danger {
  border-color: rgba(201, 54, 54, 0.28);
  color: var(--red);
}

.crud-action-button.is-danger:hover {
  border-color: rgba(201, 54, 54, 0.5);
  background: #fff4f4;
}

.action-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.bar-stack,
.ranked-list,
.stacked-list {
  display: grid;
  gap: 10px;
}

#precinctBars,
#stackedBars {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 36px 0;
  scrollbar-gutter: stable;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(145px, 0.9fr) minmax(180px, 1.6fr) 82px;
  gap: 12px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px;
  cursor: pointer;
}

.bar-label {
  min-width: 0;
}

.bar-label strong,
.bar-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-label small {
  color: var(--muted);
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf3;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

.bar-value {
  text-align: right;
  font-weight: 800;
}

.compact .bar-row {
  grid-template-columns: minmax(150px, 1fr) minmax(120px, 1fr) 76px;
  font-size: 13px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 16px;
}

.donut {
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(var(--red) 0 55%, var(--blue) 55% 76%, var(--teal) 76% 76%, var(--amber) 76% 97%, var(--slate) 97% 100%);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: white;
}

.legend {
  display: grid;
  gap: 10px;
}

.legend button {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 9px;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.stacked-row {
  cursor: pointer;
  min-width: 0;
  width: 100%;
}

.stacked-row .bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  min-width: 0;
}

.stacked-row .bar-label strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stacked-row .bar-label span {
  flex: 0 0 auto;
}

.stacked-track {
  height: 18px;
  display: flex;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f6;
}

.segment {
  min-width: 2px;
}

.simulation,
.data-panel,
.volunteer-panel,
.campaign-panel,
.admin-panel {
  margin-top: 16px;
}

body:not(.view-explorer):not(.view-exports) #explorer {
  display: none;
}

body:not(.view-volunteers) #volunteers {
  display: none;
}

body:not(.view-users) #users,
body:not(.view-permissions) #permissions,
body:not(.view-roles) #roles,
body:not(.view-precincts) #precincts {
  display: none;
}

#campaign {
  display: none;
}

body.view-campaign #campaign {
  display: block;
}

body.view-campaign #queryHeader,
body.view-users #queryHeader,
body.view-permissions #queryHeader,
body.view-roles #queryHeader,
body.view-precincts #queryHeader,
body.view-campaign #overview {
  display: none;
}

body.view-users #overview,
body.view-permissions #overview,
body.view-roles #overview,
body.view-precincts #overview {
  display: none;
}

body:not(.view-simulation) #simulation {
  display: none;
}

body.view-explorer .dashboard-grid,
body.view-exports .dashboard-grid,
body.view-simulation .dashboard-grid,
body.view-volunteers .dashboard-grid,
body.view-campaign .dashboard-grid,
body.view-users .dashboard-grid,
body.view-permissions .dashboard-grid,
body.view-roles .dashboard-grid,
body.view-precincts .dashboard-grid {
  display: none;
}

body.view-exports #explorer .table-wrap {
  display: none;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.scenario-card {
  padding: 16px;
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.scenario-card.selected {
  border-color: rgba(201, 54, 54, 0.5);
}

.scenario-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  width: 100%;
  text-align: center;
}

.scenario-card input {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

.scenario-card .percent-input {
  width: auto;
  min-width: 104px;
  display: inline-flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  line-height: 1;
  white-space: nowrap;
}

.scenario-card .percent-input input {
  width: 3ch;
  display: inline-block;
  flex: 0 0 3ch;
  padding: 0;
  border-bottom: 0;
  line-height: 1;
  text-align: right;
  appearance: textfield;
  -moz-appearance: textfield;
}

.scenario-card .percent-input input::-webkit-outer-spin-button,
.scenario-card .percent-input input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.scenario-card .percent-input b {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.scenario-card strong {
  width: 100%;
  text-align: center;
}

.mail-ballot-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 14px;
  margin-bottom: 14px;
}

.planner-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.planner-section-head p {
  color: var(--muted);
  font-size: 13px;
}

.planner-total {
  min-width: 210px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  padding: 10px 12px;
  text-align: center;
}

.planner-total span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.planner-total strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.mail-ballot-grid {
  display: grid;
  gap: 10px;
}

.mail-ballot-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(170px, 220px) minmax(130px, auto);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  padding: 10px 12px;
}

.mail-ballot-row span,
.mail-ballot-row strong,
.mail-ballot-row small {
  display: block;
}

.mail-ballot-row small,
.mail-ballot-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.mail-ballot-row input {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  padding: 8px 10px;
  text-align: right;
  font-weight: 800;
}

.scenario-metrics {
  display: grid;
  gap: 8px;
  width: 100%;
}

.scenario-card .scenario-metrics span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.scenario-card .scenario-metrics i {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.scenario-card .scenario-metrics b {
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}

.simulation-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

#simulationPrecinctRows {
  max-height: 430px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-gutter: stable;
}

.ranked-item {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px;
  cursor: pointer;
}

.ranked-item strong,
.ranked-item span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ranked-item span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
}

.estimate-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.volunteer-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.volunteer-stats div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  background: #fbfcfe;
}

.volunteer-stats span,
.volunteer-toolbar span,
.volunteer-form span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.volunteer-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.campaign-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.campaign-stats div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  background: #fbfcfe;
}

.campaign-stats span,
.campaign-toolbar span,
.swimlane-form span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.campaign-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.volunteer-toolbar {
  display: grid;
  grid-template-columns: 1.3fr 0.75fr 0.9fr 1.2fr;
  gap: 12px;
  margin-bottom: 14px;
}

.campaign-toolbar {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 0.7fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.volunteer-toolbar label,
.volunteer-form label,
.campaign-toolbar label,
.swimlane-form label {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
}

.volunteer-toolbar label,
.campaign-toolbar label {
  align-content: center;
  text-align: center;
}

.volunteer-toolbar span,
.campaign-toolbar span {
  text-align: center;
}

.volunteer-toolbar input,
.volunteer-toolbar select,
.campaign-toolbar input,
.campaign-toolbar select {
  text-align: center;
  text-align-last: center;
}

.volunteer-toolbar input::placeholder,
.campaign-toolbar input::placeholder {
  text-align: center;
}

.alert-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.alert-toggle input {
  width: auto;
}

.campaign-actions {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex: 0 0 auto;
}

.campaign-actions button {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.campaign-board {
  display: grid;
  gap: 14px;
  overflow: hidden;
}

.kanban-swimlanes {
  display: grid;
  gap: 14px;
}

.kanban-swimlane-row {
  display: grid;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(20, 32, 48, 0.05);
}

.kanban-swimlane-row.collapsed .swimlane-columns {
  display: none;
}

.swimlane-row-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.kanban-swimlane-row.collapsed .swimlane-row-head {
  border-bottom: 0;
  background: #f8fafc;
}

.swimlane-title strong,
.swimlane-title span {
  display: block;
}

.swimlane-title strong {
  font-size: 13px;
}

.swimlane-title span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.swimlane-collapse {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  font-size: 14px;
  width: 28px;
  height: 28px;
}

.swimlane-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.trello-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  overflow-x: hidden;
  padding: 2px 2px 10px;
}

.swimlane-columns {
  background: #f8fafc;
  padding: 10px;
}

.trello-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 250px;
  max-height: 430px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #eef3f8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.trello-column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid rgba(204, 216, 228, 0.9);
}

.trello-column-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.trello-column-head span {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.trello-card-list {
  display: grid;
  align-content: start;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.trello-card-list.drag-over {
  background: #fff7f7;
  box-shadow: inset 0 0 0 2px rgba(201, 54, 54, 0.18);
}

.campaign-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--border);
  border-left: 4px solid var(--slate);
  border-radius: 8px;
  background: white;
  padding: 10px;
  cursor: grab;
  box-shadow: 0 8px 20px rgba(20, 32, 48, 0.06);
}

.campaign-card:hover {
  border-color: #c5d1df;
  box-shadow: 0 12px 22px rgba(20, 32, 48, 0.1);
}

.campaign-card.dragging {
  opacity: 0.55;
}

.campaign-card.priority-low {
  border-left-color: var(--green);
}

.campaign-card.priority-medium {
  border-left-color: var(--blue);
}

.campaign-card.priority-high {
  border-left-color: var(--amber);
}

.campaign-card.priority-critical {
  border-left-color: var(--red);
}

.campaign-card.overdue {
  background: #fff7f7;
}

.campaign-card.due-soon {
  background: #fffaf0;
}

.campaign-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.campaign-card-head strong {
  font-size: 13px;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}

.campaign-card-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.card-select-field {
  display: grid;
  gap: 4px;
}

.card-select-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.card-role-select,
.card-volunteer-select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}

.campaign-card-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.campaign-card small {
  color: var(--muted);
  font-size: 12px;
}

.add-card-inline {
  border: 1px dashed #b8c5d5;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
  font-size: 12px;
  text-align: center;
}

.add-card-inline:hover {
  color: var(--ink);
  background: white;
}

.campaign-modal {
  width: min(980px, calc(100vw - 40px));
}

.swimlane-form {
  display: grid;
  gap: 18px;
}

.compact-actions {
  grid-template-columns: auto 1fr auto auto;
}

.alert-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.alert-summary div {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
  text-align: center;
}

.alert-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.alert-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.volunteer-table-wrap {
  max-height: 500px;
}

.volunteer-table {
  min-width: 1080px;
}

.volunteer-table th,
.volunteer-table td {
  text-align: center;
  vertical-align: middle;
}

.volunteer-table td strong,
.volunteer-table td small,
.volunteer-table td span {
  display: block;
  text-align: center;
}

.volunteer-table td small {
  color: var(--muted);
  margin-top: 4px;
}

.status-pill {
  width: fit-content;
  margin-inline: auto;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef4f1;
  color: #285c4a;
  font-weight: 800;
  font-size: 12px;
}

.row-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.volunteer-table th:last-child,
.volunteer-table td:last-child {
  width: 132px;
  min-width: 132px;
  text-align: center;
}

.admin-table-wrap {
  max-height: 560px;
}

.admin-table {
  min-width: 1040px;
}

.admin-table th,
.admin-table td {
  text-align: center;
  vertical-align: middle;
}

.admin-table td strong,
.admin-table td small,
.admin-table td span {
  display: block;
  text-align: center;
}

.admin-table td small,
.muted-cell {
  color: var(--muted);
  margin-top: 4px;
}

.admin-table code {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  padding: 4px 8px;
  color: #435066;
  font-family: inherit;
  font-weight: 900;
}

.admin-table th:last-child,
.admin-table td:last-child {
  width: 132px;
  min-width: 132px;
}

.permission-pill-list {
  display: flex !important;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 360px;
  margin-inline: auto;
}

.permission-pill-list b {
  border-radius: 999px;
  background: #eef3f8;
  color: #435066;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.2;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.volunteer-modal {
  width: min(920px, calc(100vw - 40px));
}

.volunteer-form {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-wide {
  grid-column: 1 / -1;
}

.permission-picker {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
}

.permission-picker legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.permission-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.permission-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.permission-option input {
  width: auto;
  margin-top: 2px;
}

.permission-option strong,
.permission-option small {
  display: block;
}

.permission-option small {
  margin-top: 3px;
  color: var(--muted);
}

.volunteer-form textarea {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  resize: vertical;
  min-height: 96px;
}

.form-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #c8d3df transparent;
  scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar,
.detail-table::-webkit-scrollbar,
.detail-modal::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-thumb,
.detail-table::-webkit-scrollbar-thumb,
.detail-modal::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c8d3df;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.data-panel th,
.data-panel td,
.detail-table th,
.detail-table td,
.volunteer-table th,
.volunteer-table td,
.admin-table th,
.admin-table td {
  text-align: center;
  vertical-align: middle;
}

.grid-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px 12px;
}

.grid-pagination.is-hidden {
  display: none;
}

.pagination-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-controls button {
  min-width: 34px;
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.pagination-controls button.is-current {
  border-color: var(--red);
  background: #fff4f4;
  color: var(--red);
}

.map-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--red);
  cursor: pointer;
}

.map-button:hover {
  border-color: rgba(201, 54, 54, 0.45);
  background: #fff7f7;
}

.map-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

td {
  font-size: 13px;
}

tr {
  cursor: pointer;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 8;
  overflow: auto;
}

.detail-drawer.open {
  display: grid;
  opacity: 1;
}

body.modal-open {
  overflow: hidden;
}

.detail-modal {
  position: relative;
  width: min(1180px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
  padding: 28px;
}

.detail-modal:has(.notice-tabs) {
  width: min(1240px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 28px));
  padding: 18px 24px;
}

.detail-modal:has(.notice-tabs) .detail-title {
  margin-bottom: 12px;
}

.detail-modal:has(.notice-tabs) .detail-title h2 {
  font-size: 22px;
}

.detail-modal:has(.notice-tabs) .detail-title .subtitle {
  margin-top: 5px;
}

.close-button {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.detail-title {
  margin: 0 48px 18px 0;
}

.detail-title h2 {
  font-size: 24px;
}

.metric-list {
  display: grid;
  gap: 9px;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.metric-list span {
  color: var(--muted);
}

.resource-list,
.district-map-resource {
  display: grid;
  gap: 10px;
}

.resource-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  padding: 12px 14px;
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.resource-card:hover,
.resource-card:focus-visible {
  border-color: rgba(201, 54, 54, 0.38);
  background: #fff7f7;
  transform: translateY(-1px);
}

.resource-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.resource-card strong {
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.district-map-link {
  text-align: center;
}

.district-map-frame {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.election-notice-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.notice-tabs {
  display: grid;
  gap: 10px;
}

.notice-tab-list {
  display: inline-flex;
  gap: 6px;
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  padding: 4px;
}

.notice-tab-list button {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.notice-tab-list button.active {
  background: var(--red);
  color: #ffffff;
}

.notice-tabs [data-notice-panel="calendar"] {
  overflow: hidden;
}

.election-notice-detail section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 14px;
}

.election-notice-detail section:first-child {
  grid-column: 1 / -1;
}

.election-notice-detail h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
}

.election-notice-detail p {
  color: var(--ink);
  font-weight: 800;
}

.notice-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.notice-date-grid div {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  padding: 10px;
  text-align: center;
}

.notice-date-grid span,
.notice-date-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.notice-date-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
}

.election-calendar {
  display: grid;
  gap: 7px;
  max-width: 100%;
}

.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 8px 10px;
}

.calendar-toolbar span,
.calendar-weekdays span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.calendar-toolbar strong {
  display: block;
  margin-top: 1px;
  font-size: 18px;
}

.calendar-nav {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 3px;
}

.calendar-nav button {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.calendar-nav button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.calendar-icon-button {
  width: 32px;
}

.calendar-today-button {
  grid-auto-flow: column;
  gap: 6px;
  min-width: 86px;
  padding: 0 10px;
}

.calendar-nav button:hover {
  background: #fff7f7;
  color: var(--red);
}

.calendar-nav button:focus-visible {
  outline: 2px solid rgba(201, 54, 54, 0.38);
  outline-offset: 2px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.calendar-grid {
  grid-auto-rows: 58px;
}

.calendar-weekdays span {
  text-align: center;
}

.calendar-day {
  min-height: 0;
  height: 58px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 5px;
  overflow: hidden;
}

.calendar-day.is-empty {
  background: #f8fafc;
}

.calendar-day.is-today {
  border-color: rgba(201, 54, 54, 0.58);
  box-shadow: inset 0 0 0 2px rgba(201, 54, 54, 0.12);
}

.calendar-day.has-event {
  background: #fffafa;
}

.calendar-day strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.calendar-event {
  display: block;
  margin-top: 2px;
  border-radius: 6px;
  background: rgba(201, 54, 54, 0.11);
  color: var(--red);
  padding: 2px 4px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  white-space: normal;
}

.calendar-event.general {
  background: rgba(47, 111, 180, 0.11);
  color: var(--blue);
}

.detail-table {
  margin-top: 14px;
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.detail-table table {
  box-shadow: none;
  min-width: 0;
  table-layout: auto;
}

.map-frame-wrap {
  display: grid;
  gap: 12px;
}

.map-frame {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.map-actions {
  display: flex;
  justify-content: flex-end;
}

.map-actions a {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  padding: 8px 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 12px;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.app-toast {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  padding: 12px;
  color: var(--ink);
  pointer-events: auto;
}

.app-toast::before {
  content: "";
  align-self: stretch;
  border-radius: 999px;
  background: var(--green);
}

.app-toast.is-error::before {
  background: var(--red);
}

.app-toast.is-info::before {
  background: var(--blue);
}

.app-toast strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.app-toast span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid,
  .simulation-layout {
    grid-template-columns: 1fr;
  }

  .controls,
  .scenario-grid,
  .campaign-toolbar,
  .campaign-stats,
  .alert-summary {
    grid-template-columns: repeat(2, 1fr);
  }

}

@media (max-width: 760px) {
  .auth-page {
    min-height: auto;
    grid-template-columns: 1fr;
    background: var(--bg);
  }

  .auth-visual,
  .auth-panel {
    min-height: auto;
    padding: 24px 18px;
  }

  .auth-visual {
    background: #020712 url("assets/auth-background.jpg") 72% center / cover no-repeat;
  }

  .auth-panel {
    align-content: start;
  }

  .password-field {
    grid-template-columns: 1fr;
  }

  .password-field button {
    min-height: 42px;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
  }

  .sidebar-nav {
    flex: none;
    min-height: 0;
    margin-right: 0;
    padding-right: 0;
    overflow: visible;
  }

  .sidebar-toggle {
    display: none;
  }

  body.sidebar-collapsed .sidebar {
    width: auto;
    padding: 22px 18px;
  }

  body.sidebar-collapsed .brand {
    justify-content: flex-start;
    gap: 12px;
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-category-label,
  body.sidebar-collapsed .nav-category-chevron,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .user-copy {
    opacity: 1;
    pointer-events: auto;
    position: static;
    transform: none;
  }

  body.sidebar-collapsed .sidebar-footer {
    grid-template-columns: minmax(0, 1fr) 40px;
    justify-items: stretch;
  }

  body.sidebar-collapsed .sidebar nav {
    margin-top: 0;
  }

  body.sidebar-collapsed .nav-category-toggle {
    display: flex;
  }

  body.sidebar-collapsed .nav-category.is-collapsed .nav-submenu {
    display: none;
  }

  body.sidebar-collapsed .sidebar a {
    justify-content: flex-start;
    padding-inline: 12px;
  }

  .permission-checklist {
    grid-template-columns: 1fr;
  }

  .app-shell {
    margin-left: 0;
    width: 100%;
    padding: 16px 16px 0;
  }

  .dashboard-copyright {
    margin: auto -16px 0;
    padding-inline: 16px;
  }

  .footer-toggle,
  body.footer-hidden .footer-toggle {
    right: 0;
  }

  .district-map-frame {
    min-height: 430px;
  }

  body.sidebar-collapsed .app-shell {
    margin-left: 0;
    width: 100%;
  }

  .topbar,
  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    width: 100%;
  }

  .phase-control,
  .refresh-stamp,
  .countdown-card {
    grid-column: 1;
    grid-row: auto;
  }

  .phase-control,
  .countdown-card {
    min-width: 0;
    justify-self: stretch;
  }

  .topbar-actions .election-ticker,
  .countdown-card {
    grid-column: 1;
    grid-row: auto;
  }

  .controls,
  .kpi-grid,
  .scenario-grid,
  .donut-wrap,
  .campaign-toolbar,
  .campaign-stats,
  .alert-summary {
    grid-template-columns: 1fr;
  }

  .campaign-actions {
    justify-content: stretch;
    grid-template-columns: 1fr;
  }

  .campaign-actions button {
    width: 100%;
  }

  .campaign-board {
    max-height: 620px;
  }

  .kanban-swimlane-row,
  .trello-board {
    max-width: 100%;
  }

  .planner-section-head,
  .mail-ballot-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .planner-total {
    min-width: 0;
  }

  .mail-ballot-row input {
    text-align: left;
  }

  .bar-row,
  .compact .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-value {
    text-align: left;
  }

  .detail-drawer {
    padding: 14px;
  }

  .detail-modal {
    width: 100%;
    max-height: calc(100vh - 28px);
    padding: 22px 16px;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }

  .grid-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls {
    justify-content: center;
  }

  .detail-title {
    margin-right: 42px;
  }

  .election-notice-detail,
  .notice-date-grid {
    grid-template-columns: 1fr;
  }

  .notice-tab-list {
    width: 100%;
  }

  .notice-tab-list button {
    flex: 1;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-nav {
    justify-content: center;
  }

  .calendar-nav button {
    flex: 0 0 auto;
  }

  .calendar-grid {
    min-width: 720px;
  }

  .election-calendar {
    overflow-x: auto;
  }
}
