:root {
  --ink: #14233a;
  --muted: #667386;
  --navy: #0b2746;
  --navy-2: #12385f;
  --blue: #286f9d;
  --teal: #1a8b83;
  --orange: #d20b24;
  --cream: #f4f1e9;
  --paper: #ffffff;
  --line: #dfe4e8;
  --soft: #f5f7f8;
  --danger: #a83b38;
  --shadow: 0 14px 36px rgba(15, 38, 65, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--soft); }
body { margin: 0; min-height: 100%; color: var(--ink); background: var(--soft); font-family: Inter, Aptos, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, .button { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px 20px; color: #fff; background: linear-gradient(165deg, #09233f 0%, #0d3154 70%, #12405f 100%); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; color: inherit; text-decoration: none; }
.brand-logo { width: 58px; height: 58px; flex: 0 0 auto; display: block; object-fit: cover; border: 1px solid rgba(255,255,255,.18); border-radius: 14px; box-shadow: 0 8px 22px rgba(0,0,0,.2); }
.brand-product { min-width: 0; }
.brand strong { display: block; font: 700 22px/1 Georgia, serif; letter-spacing: .06em; }
.brand small { display: block; margin-top: 5px; color: #a9bdd0; font-size: 10px; letter-spacing: .04em; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 11px 12px; color: #c8d6e2; border-radius: 10px; text-decoration: none; font-size: 14px; transition: .15s ease; }
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar nav a.active { color: #fff; background: rgba(255,255,255,.13); box-shadow: inset 3px 0 0 var(--orange); }
.nav-dot { width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 50%; }
.sidebar nav a.active .nav-dot { border-color: var(--orange); background: var(--orange); }
.sidebar-foot { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.12); display: grid; gap: 5px; }
.sidebar-foot strong { font-size: 13px; }
.sidebar-foot span { color: #a9bdd0; font-size: 11px; }
.link-button { padding: 7px 0 0; border: 0; color: #fff; background: transparent; font-size: 12px; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; }
.topbar { min-height: 92px; padding: 21px clamp(20px, 4vw, 54px); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.topbar p { margin: 0 0 4px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.topbar h1 { margin: 0; font: 700 clamp(22px, 2.5vw, 30px)/1.05 Georgia, serif; }
.environment-pill { margin-left: auto; padding: 6px 9px; color: #536576; background: #edf1f3; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.environment-pill.production { color: #a10b20; background: #fde8eb; }
.menu-button { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.content { padding: 30px clamp(20px, 4vw, 54px) 60px; max-width: 1540px; margin: 0 auto; }

.hero-card { position: relative; overflow: hidden; min-height: 176px; padding: 34px clamp(26px, 5vw, 58px); color: #fff; background: linear-gradient(115deg, var(--navy), #145270); border-radius: 22px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; }
.hero-card::after { content: ""; position: absolute; width: 310px; height: 310px; right: -90px; top: -155px; border: 54px solid rgba(255,255,255,.06); border-radius: 50%; }
.hero-card h2 { max-width: 650px; margin: 4px 0 9px; font: 700 clamp(26px, 3vw, 38px)/1.08 Georgia, serif; }
.hero-card p { max-width: 630px; margin: 0; color: #c4d5df; font-size: 14px; line-height: 1.6; }
.eyebrow { margin: 0; color: var(--orange) !important; font-size: 10px !important; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero-date { z-index: 1; width: 98px; height: 98px; flex: 0 0 auto; display: grid; place-content: center; text-align: center; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; color: #bcd0db; font-size: 10px; letter-spacing: .06em; }
.hero-date span { display: block; color: #fff; font: 700 38px/1 Georgia, serif; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.metric-card { min-height: 142px; padding: 23px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 7px 20px rgba(15,38,65,.04); display: flex; flex-direction: column; }
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { margin: auto 0 4px; font: 700 32px/1 Georgia, serif; }
.metric-card small { color: var(--teal); font-size: 11px; }
.metric-card.accent { border-color: #ecd4c4; background: #fffaf7; }
.metric-card.accent strong { color: #b9542e; }
.metric-grid.compact { margin-top: 0; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.panel, .table-card, .record-form, .notice-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 7px 20px rgba(15,38,65,.04); }
.panel { padding: 25px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.panel-heading h3 { margin: 4px 0 0; font: 700 20px/1.2 Georgia, serif; }
.panel-heading a { color: var(--blue); font-size: 12px; text-decoration: none; }
.stack-list { display: grid; }
.stack-list a { display: grid; grid-template-columns: 68px 1fr; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid #edf0f2; text-decoration: none; }
.stack-list time { color: var(--muted); font-size: 11px; }
.stack-list strong, .stack-list small { display: block; }
.stack-list strong { font-size: 13px; }
.stack-list small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.coverage-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 26px; }
.coverage-panel .panel-heading { margin: 0; }
.coverage-panel > p { max-width: 600px; color: var(--muted); font-size: 13px; }
.progress-ring { grid-row: span 2; width: 124px; height: 124px; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--value)*1%), #e7ecee 0); display: grid; place-items: center; }
.progress-ring::before { content: ""; width: 88px; height: 88px; background: white; border-radius: 50%; grid-area: 1/1; }
.progress-ring span { z-index: 1; grid-area: 1/1; text-align: center; }
.progress-ring strong, .progress-ring small { display: block; }
.progress-ring strong { font: 700 24px/1 Georgia, serif; }
.progress-ring small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.section-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.search-form { display: flex; gap: 8px; flex: 1; max-width: 620px; }
.search-form input, .elector-search input { min-width: 0; flex: 1; height: 43px; padding: 0 14px; border: 1px solid #cfd7dd; border-radius: 10px; background: #fff; }
.button { min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 700; transition: .15s; }
.button.primary { color: #fff; background: var(--navy); }
.button.primary:hover { background: var(--navy-2); transform: translateY(-1px); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.full { width: 100%; }
.button:disabled { opacity: .6; cursor: wait; }

.table-card { overflow: hidden; }
.table-meta { padding: 14px 18px; color: var(--muted); background: #fafbfb; border-bottom: 1px solid var(--line); font-size: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; color: var(--muted); background: #fff; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid #edf0f2; font-size: 12px; vertical-align: middle; }
tbody tr:hover { background: #fafcfc; }
tbody tr:last-child td { border-bottom: 0; }
.row-action { width: 60px; text-align: right; }
.row-action a { color: var(--blue); font-weight: 700; text-decoration: none; }
.status { display: inline-flex; padding: 5px 8px; color: #315470; background: #eaf2f6; border-radius: 999px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status.success { color: #176860; background: #e1f4f0; }
.status.neutral { color: #68727b; background: #eceff1; }
.empty { padding: 42px; color: var(--muted); text-align: center; }
.empty-inline { padding: 25px 0; color: var(--muted); font-size: 13px; }
.pagination { display: flex; justify-content: flex-end; gap: 16px; padding: 15px 4px; color: var(--muted); font-size: 12px; }
.pagination a { color: var(--blue); text-decoration: none; }

.form-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.form-heading a { color: var(--blue); font-size: 12px; text-decoration: none; }
.form-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.record-form { padding: clamp(20px, 4vw, 36px); }
.compact-form { padding: 24px; }
.compact-form > .field { display: flex; margin-bottom: 16px; }
.fiscal-form-grid, .split-panels { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin-top: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 20px; }
.field { display: grid; gap: 7px; }
.field.wide { grid-column: 1 / -1; }
.field > span:first-child { color: #435266; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid #cfd7dd; border-radius: 9px; outline: none; }
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .search-form input:focus, .elector-search input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,111,157,.12); }
.check-control { min-height: 43px; display: flex; align-items: center; gap: 8px; }
.check-control input { width: 18px; min-height: 18px; }
.form-actions { margin-top: 26px; display: flex; justify-content: flex-end; gap: 10px; }

.notice-card { padding: 19px 22px; margin-bottom: 18px; border-left: 4px solid var(--teal); }
.notice-card strong { font: 700 16px/1.2 Georgia, serif; }
.notice-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.elector-search { display: flex; align-items: end; gap: 10px; margin: 18px 0; padding: 20px; background: var(--navy); border-radius: var(--radius); }
.elector-search label { flex: 1; display: grid; gap: 7px; }
.elector-search label span { color: #c7d4df; font-size: 11px; font-weight: 700; }
.elector-search .button { color: var(--navy); background: #fff; }
.elector-results { display: grid; gap: 18px; padding: 18px; background: var(--soft); }
.elector-card { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 18px rgba(15,38,65,.05); }
.elector-card-heading { padding: 20px 22px; color: #fff; background: linear-gradient(115deg, var(--navy), #145270); display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.elector-card-kicker { color: #aac3d3; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.elector-card-heading h2 { margin: 5px 0 0; font: 700 21px/1.2 Georgia, serif; }
.elector-document { flex: 0 0 auto; text-align: right; }
.elector-document span, .elector-document strong { display: block; }
.elector-document span { color: #aac3d3; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.elector-document strong { margin-top: 4px; font-size: 17px; letter-spacing: .04em; }
.elector-data-group { padding: 20px 22px; }
.elector-data-group + .elector-data-group { border-top: 1px solid var(--line); }
.elector-data-group h3 { margin: 0 0 14px; color: var(--blue); font: 700 15px/1.2 Georgia, serif; }
.elector-data-grid { margin: 0; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px 20px; }
.elector-data-grid > div { min-width: 0; }
.elector-data-grid dt { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.elector-data-grid dd { margin: 5px 0 0; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.elector-data-wide { grid-column: span 2; }
.elector-address { padding: 12px 14px; background: #eef7f5; border-left: 3px solid var(--teal); border-radius: 8px; }
.elector-address dd { color: #145d57; font-size: 14px; font-weight: 700; }
.phase-panel { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.phase-panel h2 { margin: 6px 0; font: 700 24px/1.2 Georgia, serif; }
.phase-panel p { max-width: 700px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.phase-steps { display: flex; align-items: center; }
.phase-steps span { width: 34px; height: 34px; display: grid; place-items: center; color: #64717e; background: #edf0f2; border-radius: 50%; font-size: 11px; font-weight: 800; }
.phase-steps span.done { color: #fff; background: var(--teal); }
.phase-steps i { width: 24px; height: 2px; background: #dce2e5; }
.two-column { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(300px,.75fr); gap: 18px; align-items: start; }
.side-form { display: grid; gap: 16px; }
.side-form h2 { margin: 4px 0 0; font: 700 22px/1.2 Georgia, serif; }
.account-grid { display: grid; grid-template-columns: minmax(260px,.72fr) minmax(360px,1.28fr); gap: 18px; align-items: start; }
.account-summary h2, .account-password-form h2 { margin: 5px 0 18px; font: 700 24px/1.2 Georgia, serif; }
.account-summary dl { margin: 0; display: grid; gap: 14px; }
.account-summary dl div { padding-top: 14px; border-top: 1px solid var(--line); }
.account-summary dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.account-summary dd { margin: 5px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.account-password-form { display: grid; gap: 17px; }
.account-password-form .form-actions { margin-top: 4px; }
.form-help { margin: -8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.password-reset-form { width: min(720px,100%); display: grid; gap: 17px; }
.alert { padding: 13px 16px; margin-bottom: 15px; border-radius: 10px; font-size: 12px; }
.alert.success { color: #125c55; background: #e1f4f0; border: 1px solid #b8e4db; }
.alert.error { color: #8e2f2d; background: #fff0ef; border: 1px solid #efc7c4; }
.empty-state { padding: 80px 20px; text-align: center; }
.empty-state h2 { font: 700 28px/1.2 Georgia, serif; }

.login-body { min-height: 100vh; padding: 24px; color: #fff; background: #081f38; display: grid; place-items: center; }
.login-shell { width: min(1080px,100%); min-height: 650px; display: grid; grid-template-columns: 1.12fr .88fr; overflow: hidden; background: #fff; border-radius: 24px; box-shadow: 0 28px 90px rgba(0,0,0,.28); }
.login-intro { position: relative; overflow: hidden; padding: 46px; background: linear-gradient(145deg,#0a2949,#12526e); display: flex; flex-direction: column; justify-content: space-between; }
.login-intro::after { content: ""; position: absolute; width: 450px; height: 450px; right: -200px; bottom: -200px; border: 75px solid rgba(255,255,255,.05); border-radius: 50%; }
.login-brand { position: relative; z-index: 1; padding: 0; }
.login-brand .brand-logo { width: clamp(112px, 12vw, 150px); height: clamp(112px, 12vw, 150px); border-radius: 20px; box-shadow: 0 18px 45px rgba(0,0,0,.28); }
.login-brand .brand-product strong { font-size: 30px; }
.login-brand .brand-product small { max-width: 150px; color: #c8d6e2; font-size: 11px; line-height: 1.35; }
.login-intro h1 { margin: 12px 0 20px; font: 700 clamp(38px,5vw,60px)/1.02 Georgia,serif; }
.login-intro p { max-width: 520px; color: #c5d5df; line-height: 1.7; }
.login-intro > small { color: #9fb5c5; font-size: 11px; }
.login-panel { padding: clamp(28px,6vw,70px); color: var(--ink); display: grid; place-items: center; }
.login-form { width: 100%; display: grid; gap: 20px; }
.login-form h2 { margin: 5px 0 9px; font: 700 32px/1.1 Georgia,serif; }
.login-form > div > p:last-child { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.privacy-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; }
.recovery-note { margin: 0; padding: 12px 14px; color: #435266; background: #f3f6f8; border-radius: 9px; font-size: 11px; line-height: 1.5; text-align: center; }
.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; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .elector-data-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -270px; width: 248px; transition: left .2s ease; box-shadow: 18px 0 50px rgba(0,0,0,.22); }
  .sidebar.open { left: 0; }
  .menu-button { display: block; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .coverage-panel { grid-column: auto; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { min-height: 320px; padding: 32px; }
  .login-brand .brand-logo { width: 96px; height: 96px; border-radius: 16px; }
  .login-intro > small { display: none; }
}
@media (max-width: 640px) {
  .topbar { min-height: 76px; padding: 14px 16px; }
  .topbar p { display: none; }
  .topbar h1 { font-size: 21px; }
  .content { padding: 18px 14px 45px; }
  .hero-card { min-height: 220px; padding: 25px; align-items: flex-start; }
  .hero-date { width: 76px; height: 76px; }
  .hero-date span { font-size: 28px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 125px; padding: 18px; }
  .metric-card strong { font-size: 27px; }
  .section-actions { align-items: stretch; flex-direction: column; }
  .search-form { max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .fiscal-form-grid, .split-panels { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .coverage-panel { grid-template-columns: 1fr; }
  .progress-ring { grid-row: auto; }
  .elector-search { align-items: stretch; flex-direction: column; }
  .elector-results { padding: 12px; }
  .elector-card-heading { align-items: flex-start; flex-direction: column; }
  .elector-document { text-align: left; }
  .elector-data-group { padding: 18px; }
  .elector-data-grid { grid-template-columns: 1fr; }
  .elector-data-wide { grid-column: auto; }
  .phase-panel { align-items: flex-start; flex-direction: column; }
  .login-body { padding: 0; }
  .login-shell { min-height: 100vh; border-radius: 0; }
  .login-intro { min-height: 270px; }
  .login-brand { gap: 10px; }
  .login-brand .brand-logo { width: 78px; height: 78px; border-radius: 14px; }
  .login-brand .brand-product strong { font-size: 24px; }
  .login-panel { padding: 34px 24px; }
}
