:root {
  --navy: #17434d;
  --blue: #078eb8;
  --sky: #25b7df;
  --cyan-soft: #daf4fa;
  --ink: #18383f;
  --muted: #61777b;
  --surface: #ffffff;
  --canvas: #f3fafb;
  --line: #d5e7e9;
  --gold: #f3bd24;
  --red: #ec3040;
  --green: #3d8f1e;
  --success: #348422;
  --danger: #c62f3e;
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
.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;
}
.editor-page[data-role="EDITOR"] .admin-only { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 3%, rgb(37 183 223 / 10%), transparent 28rem),
    radial-gradient(circle at 92% 18%, rgb(243 189 36 / 8%), transparent 25rem),
    var(--canvas);
}
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar,
.editor-header {
  height: 72px;
  display: flex;
  align-items: stretch;
  background: #fff;
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(90deg, var(--sky) 0 48%, var(--gold) 48% 72%, var(--red) 72% 84%, var(--green) 84%) 1;
  box-shadow: 0 3px 16px rgb(23 67 77 / 11%);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 290px;
  padding: 10px 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dce8e8;
  border-radius: 13px;
  box-shadow: 0 3px 10px rgb(23 67 77 / 13%);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; transform: scale(1.16); }

.brand strong,
.brand small { display: block; }
.brand strong { color: var(--navy); font-size: 19px; letter-spacing: -.2px; }
.brand small { color: var(--muted); margin-top: 2px; }

.main-nav { display: flex; align-items: stretch; flex: 1; }
.main-nav a {
  display: flex;
  align-items: center;
  padding: 0 24px;
  color: #264a66;
  font-weight: 600;
  border-left: 1px solid #edf1f4;
}
.main-nav a:hover,
.main-nav a.active { color: #fff; background: linear-gradient(135deg, var(--blue), #08a7ce); }
.topbar-location {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 210px;
  padding: 0 18px;
  margin-left: auto;
  color: var(--navy);
  background: linear-gradient(135deg, #eefbfe, #fffdf4);
  border-left: 1px solid #dcebed;
}
.topbar-location-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(145deg, var(--sky), var(--blue));
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  font-size: 9px;
}
.topbar-location small,
.topbar-location strong { display: block; white-space: nowrap; }
.topbar-location small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; }
.topbar-location strong { margin-top: 2px; color: var(--navy); font-size: 13px; }

.editor-link {
  align-self: center;
  margin-right: 20px;
  padding: 10px 16px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  color: var(--blue);
  background: #f5fcfe;
  font-weight: 700;
}

.results-page main { max-width: 1360px; margin: 0 auto; padding: 24px 28px 46px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.hero h1 { margin: 0; font-size: clamp(27px, 3vw, 40px); color: var(--navy); letter-spacing: -1px; }
.hero p { margin: 7px 0 0; color: var(--muted); font-size: 17px; }
.hero-status { display: grid; justify-items: end; gap: 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: 2px; font-size: 12px !important; font-weight: 900; color: var(--blue) !important; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  color: var(--success);
  background: #eaf7e6;
  border: 1px solid #cee8c4;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.live-badge i { width: 8px; height: 8px; background: var(--success); border-radius: 50%; animation: blink 1.5s infinite; }
.updated-note { margin: 0; color: var(--muted) !important; font-size: 13px !important; text-align: right; }
.updated-note b { color: var(--navy); }
@keyframes blink { 50% { opacity: .25; box-shadow: 0 0 0 7px rgb(20 128 94 / 12%); } }

.records-card {
  padding: 20px 22px 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 22px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 7px 22px rgb(23 67 77 / 11%);
  border: 1px solid #d8e8ea;
  border-top: 4px solid var(--sky);
}
.records-main > span { display: block; color: var(--muted); }
.records-main strong { display: block; color: var(--navy); font-size: 35px; line-height: 1; white-space: nowrap; }
.records-detail { align-self: center; display: flex; flex-direction: column; color: var(--muted); }
.records-detail b { color: var(--ink); font-size: 17px; }
.progress-track { grid-column: 1 / -1; height: 9px; background: #d9ebf4; margin: 14px 0 10px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--sky), #62cee9); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.records-footer { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 15px; color: var(--muted); font-size: 13px; }
.records-footer ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; }
.dot { display: inline-block; width: 13px; height: 13px; margin-right: 5px; border-radius: 50%; vertical-align: -2px; border: 1px solid var(--navy); }
.dot.counted { background: var(--navy); }
.dot.observed { background: var(--sky); }
.dot.pending { background: #fff; }

.voter-summary {
  display: grid;
  grid-template-columns: 1.25fr repeat(4, 1fr);
  gap: 1px;
  margin: 14px 0 12px;
  overflow: hidden;
  background: #dce5ea;
  border: 1px solid #dce5ea;
  border-radius: 14px;
  box-shadow: 0 6px 19px rgb(23 67 77 / 9%);
}
.voter-summary-main,
.vote-type { padding: 11px 15px; background: #fff; }
.voter-summary-main > span,
.vote-type > span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.voter-summary-main > strong { display: block; margin: 2px 0; color: var(--navy); font-size: 24px; line-height: 1; }
.voter-summary-main p { margin: 4px 0 7px; color: var(--muted); font-size: 11px; }
.participation-track { height: 5px; overflow: hidden; background: #dfeaf0; border-radius: 9px; }
.participation-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--sky), var(--gold)); transition: width .8s ease; }
.vote-type { position: relative; display: flex; flex-direction: column; justify-content: center; }
.vote-type::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--type-color); }
.vote-type.valid { --type-color: var(--green); }
.vote-type.blank { --type-color: #8da1af; }
.vote-type.invalid { --type-color: var(--red); }
.vote-type.missing { --type-color: var(--gold); }
.vote-type strong { margin: 4px 0 1px; color: var(--navy); font-size: 21px; line-height: 1; }
.vote-type small { color: var(--muted); font-size: 10px; }

.results-filter-bar {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  margin: 8px 0 16px;
}
.results-filter-dropdown {
  position: relative;
  display: inline-block;
}
.results-filter-popover {
  position: relative;
}
.results-filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  min-width: 64px;
  padding: 0 12px;
  color: #fff;
  background: linear-gradient(180deg, #2d84d6, #256fbe);
  border: 0;
  border-radius: 5px;
  box-shadow: 0 7px 16px rgb(28 81 142 / 18%);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  cursor: pointer;
}
.results-filter-trigger:hover {
  background: linear-gradient(180deg, #358ddd, #2a77c6);
}
.results-filter-trigger-icon {
  display: block;
  width: 22px;
  height: 30px;
  object-fit: contain;
}
.results-filter-caret {
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform .18s ease;
}
.results-filter-trigger[aria-expanded="true"] .results-filter-caret {
  transform: rotate(225deg) translateY(-1px);
}
.results-filter-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 12;
  min-width: 160px;
  padding: 6px 0;
  background: #fff;
  border: 1px solid #c8d5e4;
  border-radius: 3px;
  box-shadow: 0 10px 22px rgb(16 42 67 / 18%);
}
.results-filter-options {
  list-style: none;
  margin: 0;
  padding: 0;
}
.results-filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  color: #1d4f8a;
  background: #fff;
  border: 0;
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}
.results-filter-option:hover {
  background: #eef4fb;
}
.results-filter-option.active {
  background: #dfe9f8;
}
.results-filter-check {
  opacity: 0;
  color: #0c4b8e;
  font-size: 18px;
  font-weight: 900;
}
.results-filter-option.active .results-filter-check {
  opacity: 1;
}

.candidates-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 360px;
  background: linear-gradient(90deg, #fbfcfc, #fff 50%, #fbfcfc);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #d7e9eb;
  box-shadow: 0 8px 24px rgb(23 67 77 / 8%);
}
.candidates-grid::before {
  content: "";
  position: absolute;
  inset: 20px 32%;
  z-index: 0;
  background: url("logo-morales.png") center / contain no-repeat;
  opacity: .025;
  filter: grayscale(1);
  pointer-events: none;
}
.candidate-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 360px;
  padding: 44px 36px 28px 24px;
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity .7s ease, transform .7s ease;
}
.candidate-rank { display: none; }
.candidate-leader {
  background: linear-gradient(135deg, rgb(255 255 255 / 35%), rgb(255 249 224 / 20%));
}
.candidate-card:nth-child(even) { border-left: 1px solid #dce5ea; }
.candidate-card:nth-child(n+3) { border-top: 1px solid #dce5ea; }
.candidate-card-right { flex-direction: row-reverse; text-align: right; padding: 44px 24px 28px 36px; transform: translateX(30px); }
.candidate-card.ready { opacity: 1; transform: translateX(0); }
.candidate-card.pulse .portrait-ring { animation: resultPulse .75s ease; }
@keyframes resultPulse { 50% { transform: scale(1.035); filter: drop-shadow(0 8px 12px rgb(7 61 105 / 18%)); } }

.portrait-ring {
  flex: 0 0 auto;
  width: 262px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--candidate-color) 0 var(--angle), #e5e7e8 var(--angle) 360deg);
  transition: background .8s ease, transform .4s ease;
}
.portrait {
  width: 198px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 5px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, #e6edf1, #fff);
  box-shadow: 0 4px 20px rgb(16 42 67 / 16%);
}
.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
}
.candidate-photo-placeholder,
.photo-placeholder {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #edf4f5, #dce8ea);
}
.candidate-photo-placeholder::before,
.photo-placeholder::before {
  content: "";
  position: absolute;
  top: 18%;
  left: 50%;
  width: 30%;
  aspect-ratio: 1;
  background: #9fb2b7;
  border-radius: 50%;
  transform: translateX(-50%);
}
.candidate-photo-placeholder::after,
.photo-placeholder::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 12%;
  height: 40%;
  background: #9fb2b7;
  border-radius: 50% 50% 18% 18%;
}
.candidate-copy { flex: 1; min-width: 0; }
.candidate-percent {
  display: block;
  color: #06447d;
  font-family: "Arial Black", "Segoe UI", Arial, sans-serif;
  font-size: clamp(38px, 4vw, 52px);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: .95;
}
.candidate-rule { width: 100%; height: 5px; margin: 14px 0 14px; background: linear-gradient(90deg, var(--candidate-color), #d7d9da); border-radius: 5px; }
.candidate-card-right .candidate-rule { margin-left: auto; background: linear-gradient(90deg, #d7d9da, var(--candidate-color)); }
.candidate-name {
  min-height: 58px;
  margin: 0;
  color: #06447d;
  font-family: "Arial Black", "Segoe UI", Arial, sans-serif;
  font-size: clamp(19px, 1.85vw, 27px);
  font-weight: 900;
  letter-spacing: -.6px;
  line-height: 1.05;
  text-transform: uppercase;
}
.candidate-party { display: flex; align-items: center; gap: 12px; min-height: 60px; margin: 9px 0 4px; font-weight: 800; color: #646b6e; }
.candidate-card-right .candidate-party { justify-content: flex-end; }
.party-logo {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 4px;
  background: #fff;
  border: 2px solid color-mix(in srgb, var(--candidate-color) 58%, #d5e0e3);
  border-radius: 50%;
  box-shadow: none;
}
.party-logo img { width: 100%; height: 100%; object-fit: contain; }
.party-logo-placeholder {
  width: 25px;
  height: 25px;
  border: 3px solid #aebdc1;
  border-radius: 5px;
  transform: rotate(45deg);
}
.party-name { font-size: 14px; line-height: 1.13; text-transform: uppercase; }
.candidate-votes { margin: 3px 0 0; color: #06447d; font-size: 18px; font-weight: 900; }
.total-votes { display: flex; justify-content: center; gap: 15px; align-items: baseline; padding: 18px; color: var(--muted); }
.total-votes strong { color: var(--navy); font-size: 26px; }

.results-page footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  padding: 22px max(28px, calc((100vw - 1304px) / 2));
  background:
    linear-gradient(90deg, transparent 0 50%, rgb(37 183 223 / 7%) 50%),
    var(--navy);
  border-top: 5px solid var(--sky);
  color: white;
}
.results-page footer strong, .results-page footer span { display: block; }
.results-page footer strong { margin-bottom: 5px; color: #ffd95a; }
.results-page footer span { font-size: 13px; opacity: .9; }
.update-toast { position: fixed; right: 25px; bottom: 25px; padding: 12px 18px; color: white; background: var(--success); border-radius: 8px; box-shadow: 0 8px 22px rgb(16 42 67 / 20%); transform: translateY(25px); opacity: 0; transition: .25s; }
.update-toast.show { transform: translateY(0); opacity: 1; }
.unpublished { padding: 80px 30px; text-align: center; background: white; border-radius: 14px; }

.auth-page { display: grid; place-items: center; background: linear-gradient(140deg, #e5f8fc, #fffdf4 55%, #f3faf5); }
.auth-shell { width: min(460px, calc(100% - 30px)); }
.auth-brand { justify-content: center; min-width: 0; margin-bottom: 15px; }
.auth-card { padding: 34px; background: #fff; border: 1px solid #d7e9eb; border-top: 5px solid var(--sky); border-radius: 16px; box-shadow: 0 20px 50px rgb(23 67 77 / 14%); }
.auth-card h1 { margin: 0; color: var(--navy); font-size: 30px; }
.auth-card > p { color: var(--muted); }
.stack-form { display: grid; gap: 17px; margin-top: 25px; }
label { display: grid; gap: 7px; color: #3f566b; font-size: 13px; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cbd8e0;
  border-radius: 7px;
  outline: none;
}
input:focus, select:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgb(37 183 223 / 17%); }
.primary-button, .outline-button, .text-button {
  min-height: 42px;
  padding: 10px 17px;
  border-radius: 7px;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { border: 0; color: white; background: linear-gradient(135deg, var(--blue), #06a7ce); box-shadow: 0 5px 13px rgb(7 142 184 / 23%); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.outline-button { display: inline-flex; justify-content: center; align-items: center; color: var(--blue); background: #fff; border: 1px solid var(--blue); }
.text-button { border: 0; color: var(--muted); background: transparent; }
.back-link { display: block; margin-top: 22px; color: var(--blue); text-align: center; font-weight: 700; font-size: 13px; }
.flash { margin: 18px 0; padding: 12px 15px; border-radius: 8px; font-weight: 700; font-size: 14px; }
.flash.success { color: #106349; background: #e7f7f0; border: 1px solid #bde5d5; }
.flash.error { color: #8f2933; background: #fff0f1; border: 1px solid #f1c4c9; }

.editor-page {
  background:
    radial-gradient(circle at top left, rgb(37 183 223 / 11%), transparent 32rem),
    radial-gradient(circle at top right, rgb(243 189 36 / 7%), transparent 28rem),
    #f2f8f9;
}
.editor-header { justify-content: space-between; }
.editor-session { display: flex; align-items: center; gap: 14px; padding-right: 22px; }
.editor-session span small, .editor-session span b { display: block; }
.editor-session span small { color: var(--muted); }
.editor-session span b { color: var(--navy); }
.editor-session form { margin: 0; }
.editor-main { max-width: 1180px; margin: 0 auto; padding: 35px 25px 70px; }
.editor-title { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 24px; }
.editor-title h1 { margin: 0; color: var(--navy); font-size: 32px; }
.editor-title p { color: var(--muted); }
.status-pill { padding: 9px 15px; border-radius: 999px; font-weight: 800; font-size: 13px; }
.status-pill.published { color: var(--success); background: #daf2e9; }
.status-pill.draft { color: #876517; background: #fff1c9; }

.editor-section { margin-bottom: 20px; padding: 25px; background: #fff; border: 1px solid #d6e7e9; border-radius: 13px; box-shadow: 0 5px 15px rgb(23 67 77 / 7%); }
.compact-editor-section { padding: 17px 20px; }
.section-heading { display: flex; gap: 14px; align-items: center; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #e8edf0; }
.compact-section-heading { padding-bottom: 11px; margin-bottom: 13px; }
.section-heading.compact-section-heading > span { width: 34px; height: 34px; font-size: 13px; }
.section-heading.compact-section-heading h2 { font-size: 18px; }
.section-heading.compact-section-heading p { font-size: 12px; }
.section-heading > span { display: grid; place-items: center; width: 39px; height: 39px; color: white; background: linear-gradient(145deg, var(--blue), var(--sky)); border-radius: 9px; font-weight: 900; box-shadow: 0 4px 9px rgb(7 142 184 / 20%); }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading h2 { color: var(--navy); font-size: 20px; }
.section-heading p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; gap: 17px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.compact { grid-template-columns: 1fr 90px; }
.titles-section .form-grid { gap: 12px; }
.titles-section label, .electors-section label { font-size: 11px; }
.titles-section input, .electors-section input { min-height: 39px; padding: 8px 11px; }
.electors-layout { display: grid; grid-template-columns: minmax(230px, 300px) 1fr; gap: 14px; align-items: end; }
.candidate-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.candidate-editor { min-width: 0; overflow: hidden; border: 1px solid #dce5ea; border-left: 5px solid var(--candidate-color); border-radius: 9px; background: #fff; }
.candidate-editor[open] { box-shadow: 0 8px 20px rgb(23 67 77 / 10%); }
.candidate-editor-summary { display: grid; grid-template-columns: 45px minmax(0, 1fr) auto 66px; gap: 10px; align-items: center; min-height: 68px; padding: 9px 11px; list-style: none; cursor: pointer; background: #f7fafb; }
.candidate-editor-summary::-webkit-details-marker { display: none; }
.candidate-editor-summary > img, .candidate-editor-summary > .photo-placeholder { width: 45px; height: 45px; overflow: hidden; object-fit: cover; border-radius: 50%; }
.candidate-editor-summary > .photo-placeholder { display: block; background: var(--candidate-color); }
.candidate-summary-copy, .candidate-summary-result { min-width: 0; }
.candidate-summary-copy b, .candidate-summary-copy small, .candidate-summary-result strong, .candidate-summary-result small { display: block; }
.candidate-summary-copy b { overflow: hidden; color: var(--navy); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.candidate-summary-copy small { overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.candidate-summary-result { min-width: 76px; text-align: right; }
.candidate-summary-result strong { color: var(--navy); font-size: 17px; }
.candidate-summary-result small { color: var(--blue); font-size: 11px; font-weight: 800; }
.candidate-summary-toggle { color: var(--blue); font-size: 11px; font-weight: 900; text-align: right; text-transform: uppercase; }
.candidate-close-label { display: none; }
.candidate-editor[open] .candidate-open-label { display: none; }
.candidate-editor[open] .candidate-close-label { display: inline; }
.candidate-editor-fields { padding: 13px; border-top: 1px solid #e1e9ec; }
.candidate-fields-grid { display: grid; grid-template-columns: 1fr 1fr 72px; gap: 10px; align-items: end; }
.candidate-fields-grid label, .candidate-media-grid label { font-size: 10px; }
.candidate-fields-grid input, .candidate-media-grid input { min-height: 37px; padding: 7px 9px; }
.candidate-color-field input { padding: 3px; }
.candidate-media-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; margin-top: 10px; }
.candidate-upload-block { padding: 9px; background: #f5f9fa; border-radius: 8px; }
.candidate-save-row { display: flex; justify-content: flex-end; gap: 9px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #edf1f2; }
.candidate-save-button { min-height: 33px; padding: 6px 12px; font-size: 11px; }
.candidate-create-panel { margin-bottom: 13px; padding: 13px; background: linear-gradient(135deg, #eefbfe, #fffdf5); border: 1px dashed #83c9d9; border-radius: 10px; }
.candidate-create-heading { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 10px; }
.candidate-create-heading strong, .candidate-create-heading span { display: block; }
.candidate-create-heading strong { color: var(--navy); font-size: 17px; }
.candidate-create-heading div > span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.candidate-count { padding: 6px 10px; color: var(--blue); background: #fff; border-radius: 999px; font-size: 12px; font-weight: 800; }
.candidate-create-grid { display: grid; grid-template-columns: 1.4fr 1.4fr 65px .65fr auto; gap: 9px; align-items: end; }
.candidate-create-grid label { font-size: 10px; }
.candidate-create-grid input { min-height: 37px; padding: 7px 9px; }
.add-candidate-button { white-space: nowrap; }
.candidate-create-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.vote-register-section { border-top: 5px solid var(--gold); }
.vote-register-heading { display: flex; justify-content: space-between; gap: 24px; align-items: center; list-style: none; cursor: pointer; }
.vote-register-heading::-webkit-details-marker { display: none; }
.vote-register-heading h2, .vote-register-heading p { margin: 0; }
.vote-register-heading h2 { color: var(--navy); font-size: 23px; }
.vote-register-heading p:last-child { margin-top: 5px; color: var(--muted); font-size: 13px; }
.vote-toggle { display: grid; place-items: center; min-width: 190px; pointer-events: none; }
.vote-toggle-close { display: none; }
.vote-register-section[open] .vote-toggle-open { display: none; }
.vote-register-section[open] .vote-toggle-close { display: inline; }
.vote-register-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid #e1e9ec; }
.vote-register-panel label { font-size: 10px; }
.vote-register-panel input, .vote-register-panel select { min-height: 38px; padding: 7px 9px; }
.vote-location-fields { display: grid; grid-template-columns: minmax(280px, 1.65fr) 72px 78px minmax(110px, .85fr); gap: 12px; align-items: start; margin-bottom: 14px; }
.institution-selector { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.institution-field-block { display: grid; gap: 7px; }
.vote-observed-footer { display: flex; align-items: end; gap: 10px; flex: 1 1 320px; flex-wrap: wrap; }
.observed-check-label { padding: 8px 10px; background: #fff8e6; border: 1px solid #f1d38b; border-radius: 8px; font-size: 11px; font-weight: 900; }
.observed-reason-field { font-size: 10px; }
.observed-reason-field input:disabled { opacity: .55; background: #f3f6f7; cursor: not-allowed; }
.institution-create-box { position: relative; }
.institution-create-box > summary { min-height: 38px; padding: 7px 11px; list-style: none; white-space: nowrap; cursor: pointer; font-size: 11px; }
.institution-create-box > summary::-webkit-details-marker { display: none; }
.institution-create-fields { position: absolute; top: calc(100% + 7px); right: 0; z-index: 20; width: min(390px, 88vw); padding: 13px; background: #fff; border: 1px solid #cbdde2; border-radius: 9px; box-shadow: 0 12px 30px rgb(23 67 77 / 20%); }
.institution-create-fields label { margin-bottom: 9px; }
.institution-create-fields .primary-button { width: 100%; }
.location-candidate-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.location-candidate-row { display: flex; grid-template-columns: none; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 11px; background: #f5f9fa; border: 1px solid #dce7e9; border-left: 4px solid var(--candidate-color); border-radius: 9px; }
.location-candidate-identity { display: flex; align-items: center; gap: 9px; min-width: 0; }
.location-candidate-identity > img, .location-candidate-identity > i { flex: 0 0 auto; width: 38px; height: 38px; padding: 3px; object-fit: contain; background: #fff; border: 1px solid #d6e3e6; border-radius: 8px; }
.location-candidate-identity > i { position: relative; }
.location-candidate-identity > i::after { position: absolute; inset: 12px; content: ""; border: 3px solid var(--candidate-color); border-radius: 4px; transform: rotate(45deg); }
.vote-type-row { --candidate-color: #8d9da3; }
.blank-vote-row { background: #fafcfc; }
.invalid-vote-row { --candidate-color: #c44753; background: #fff8f8; }
.vote-type-row .location-candidate-identity > i::after { inset: 10px; border-radius: 50%; transform: none; }
.invalid-vote-row .location-candidate-identity > i::after { border-radius: 3px; transform: rotate(45deg); }
.location-candidate-identity strong, .location-candidate-identity small { display: block; }
.location-candidate-identity strong { overflow: hidden; color: var(--navy); text-overflow: ellipsis; white-space: nowrap; }
.location-candidate-identity small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.location-vote-input { flex: 0 0 86px; }
.location-vote-input > span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.location-vote-input input { color: var(--navy); font-size: 17px; font-weight: 900; text-align: center; min-height: 36px; padding: 6px 8px; }
.vote-register-footer { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e1e9ec; }
.vote-register-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; flex: 0 0 auto; }
.vote-register-actions > span { color: var(--muted); font-size: 14px; }
.vote-register-footer strong { color: var(--navy); font-size: 20px; }
.observed-reason-footer { min-width: 260px; flex: 1 1 260px; }
.reports-section { scroll-margin-top: 15px; }
.report-filters { display: grid; grid-template-columns: repeat(4, 1fr) auto auto; gap: 12px; align-items: end; }
.report-filters .primary-button, .report-filters .outline-button { min-height: 44px; white-space: nowrap; }
.report-filters .outline-button { display: grid; place-items: center; }
.report-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 11px; margin-top: 20px; }
.report-summary > div { padding: 13px 15px; background: #f4f8f9; border-top: 4px solid var(--candidate-color); border-radius: 8px; }
.report-summary-blank { --candidate-color: #8d9da3; }
.report-summary-invalid { --candidate-color: #c44753; }
.report-summary span, .report-summary strong, .report-summary small { display: block; }
.report-summary span { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.report-summary strong { margin-top: 4px; color: var(--navy); font-size: 22px; }
.report-summary small { color: var(--muted); }
.report-table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid #dbe6e8; border-radius: 10px; }
.report-table { width: 100%; border-collapse: collapse; min-width: 980px; font-size: 12px; }
.report-table th, .report-table td { padding: 11px 12px; border-bottom: 1px solid #e3eaec; text-align: left; white-space: nowrap; }
.report-table thead th { color: white; background: var(--navy); font-size: 11px; text-transform: uppercase; }
.report-table tbody tr:nth-child(even) { background: #f7fafb; }
.report-table tbody tr:hover { background: #edf8fa; }
.report-table .report-votes, .report-table .report-total { color: var(--navy); font-size: 14px; font-weight: 900; text-align: center; }
.report-table tfoot th { color: var(--navy); background: #e8f5f7; font-size: 13px; }
.report-table form { margin: 0; }
.observed-report-wrap { margin-top: 16px; }
.observed-reason-cell { max-width: 280px; white-space: normal; }
.observed-status { display: inline-flex; align-items: center; justify-content: center; min-width: 108px; padding: 6px 10px; border-radius: 999px; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.observed-status.pending { color: #7c5500; background: #fff2c7; border: 1px solid #efcf79; }
.observed-status.restored { color: #0b6b56; background: #daf5eb; border: 1px solid #98d8bf; }
.observed-restored-note { color: #0b6b56; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.observed-restore-location { grid-template-columns: 1.5fr .8fr .8fr .9fr 1.5fr; }
.observed-reason-editor { grid-column: auto; }
.report-totals-panel { display: grid; gap: 12px; margin-top: 14px; padding: 14px; background: #f8fbfc; border: 1px solid #dbe6e8; border-radius: 10px; }
.report-totals-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.report-totals-heading strong { color: var(--navy); font-size: 16px; }
.report-totals-heading span { color: var(--muted); font-size: 12px; font-weight: 700; text-align: right; }
.report-totals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.report-total-card { padding: 11px 12px; background: white; border-left: 4px solid var(--candidate-color); border-radius: 8px; box-shadow: 0 6px 14px rgb(23 67 77 / 7%); }
.report-total-card.neutral { --candidate-color: #8d9da3; }
.report-total-card.danger { --candidate-color: #c44753; }
.report-total-card.grand { --candidate-color: var(--gold); background: #fff8df; }
.report-total-card span, .report-total-card strong, .report-total-card small { display: block; }
.report-total-card span { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 900; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.report-total-card strong { margin-top: 5px; color: var(--navy); font-size: 22px; line-height: 1; }
.report-total-card small { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
.report-actions { display: flex; align-items: center; gap: 7px; }
.report-edit-row td { padding: 0; background: #f2f8fa; }
.report-edit-form { display: grid; gap: 14px; padding: 16px; border-left: 4px solid var(--sky); }
.report-edit-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.report-edit-heading strong { color: var(--navy); font-size: 16px; }
.report-edit-heading span { color: var(--muted); font-size: 12px; font-weight: 800; text-align: right; }
.report-edit-location { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.report-edit-votes { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 10px; }
.report-edit-form label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.report-edit-form label span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-edit-form input, .report-edit-form select { margin-top: 5px; }
.report-edit-form input[type="number"] { color: var(--navy); font-size: 17px; font-weight: 900; text-align: center; }
.report-edit-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.report-pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.report-pagination a, .report-pagination span { padding: 8px 12px; border-radius: 999px; font-size: 12px; font-weight: 900; text-decoration: none; }
.report-pagination a { color: var(--blue); background: #fff; border: 1px solid #b9d7e1; }
.report-pagination a:hover { color: white; background: var(--blue); }
.report-pagination span { color: var(--navy); background: #eaf5f7; }
.empty-report { display: grid; gap: 5px; margin-top: 20px; padding: 28px; color: var(--muted); background: #f5f9fa; border: 1px dashed #b9d1d6; border-radius: 10px; text-align: center; }
.empty-report strong { color: var(--navy); font-size: 17px; }
.candidate-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: -5px; }
.candidate-action { padding: 6px 9px; color: var(--blue); background: #f5f9fb; border: 1px solid #c9dbe5; border-radius: 6px; font-size: 11px; font-weight: 800; cursor: pointer; }
.candidate-action:hover { background: #e9f3f8; }
.candidate-action.danger { color: var(--danger); border-color: #ebc1c6; background: #fff7f8; }
.candidate-action:disabled { opacity: .35; cursor: not-allowed; }
.calculation-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 0; }
.calculation-preview > div { padding: 9px 11px; background: #f1f6f8; border-radius: 8px; border-left: 3px solid var(--sky); }
.calculation-preview span, .calculation-preview strong { display: block; }
.calculation-preview span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }
.calculation-preview strong { margin-top: 3px; color: var(--navy); font-size: 17px; }
.electors-grid { max-width: none; }
.editor-candidate-preview { display: flex; align-items: center; gap: 12px; padding: 11px; background: #f3f7f9; border-radius: 8px; }
.editor-candidate-preview img, .editor-candidate-preview > span { width: 55px; height: 55px; border-radius: 50%; object-fit: cover; overflow: hidden; }
.editor-candidate-preview > span { display: grid; place-items: center; color: white; background: var(--candidate-color); font-weight: 900; }
.editor-candidate-preview b, .editor-candidate-preview small { display: block; }
.editor-candidate-preview small { margin-top: 4px; color: var(--muted); }
.votes-input input { color: var(--navy); font-size: 22px; font-weight: 900; }
input[type="color"] { padding: 4px; }
input[type="file"] { padding: 8px; background: #f8fafb; }
.party-logo-editor { display: grid; grid-template-columns: 52px 1fr; gap: 9px; align-items: center; padding: 8px; background: #f5f9fa; border-radius: 8px; }
.party-logo-preview { display: grid; place-items: center; width: 48px; height: 48px; overflow: hidden; padding: 4px; background: #fff; border: 1px solid #d3e1e4; border-radius: 8px; }
.party-logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.party-logo-preview > span { width: 25px; height: 25px; border: 3px solid #aebdc1; border-radius: 5px; transform: rotate(45deg); }
.check-label { display: flex; grid-template-columns: none; align-items: center; gap: 8px; }
.check-label input { width: 17px; min-height: 17px; }
.publish-bar { position: sticky; bottom: 15px; z-index: 10; display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 17px 20px; color: white; background: rgb(23 67 77 / 96%); border-top: 4px solid var(--sky); border-radius: 12px; box-shadow: 0 12px 28px rgb(23 67 77 / 28%); backdrop-filter: blur(10px); }
.publish-bar label { width: 180px; color: white; }
.publish-bar > div { display: flex; align-items: center; gap: 20px; }
.publish-bar span { font-size: 12px; opacity: .85; }
.publish-bar .primary-button { color: #523d00; background: linear-gradient(135deg, #ffd95a, var(--gold)); }
.password-panel { margin-top: 24px; padding: 20px 24px; background: #fff; border: 1px solid #dce5ea; border-radius: 12px; }
.password-panel summary { color: var(--navy); font-weight: 800; cursor: pointer; }
.password-panel form { margin-top: 20px; align-items: end; }
.user-admin-grid { grid-template-columns: 1.2fr 1.2fr .9fr auto; align-items: end; }
.user-table-wrap { margin-top: 16px; }

@media (max-width: 1050px) {
  .main-nav a { padding: 0 12px; font-size: 14px; }
  .topbar-location { min-width: 175px; padding: 0 10px; }
  .brand { min-width: 240px; }
  .candidate-card { padding: 30px 22px; gap: 18px; }
  .portrait-ring { width: 202px; height: 202px; }
  .portrait { width: 152px; height: 152px; }
  .voter-summary { grid-template-columns: repeat(4, 1fr); }
  .voter-summary-main { grid-column: 1 / -1; }
  .candidate-create-grid { grid-template-columns: 1fr 1fr 100px 75px; }
  .candidate-create-grid .add-candidate-button { grid-column: span 2; }
  .candidate-fields-grid { grid-template-columns: 1fr 1fr; }
  .report-filters { grid-template-columns: 1fr 1fr 1fr; }
  .user-admin-grid { grid-template-columns: 1fr 1fr; }
  .user-admin-grid .primary-button { grid-column: 1 / -1; }
}

@media (max-width: 800px) {
  .topbar { height: auto; flex-wrap: wrap; }
  .brand { min-width: 0; flex: 1; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; border-top: 1px solid #e8edf0; }
  .main-nav a { min-height: 45px; white-space: nowrap; }
  .topbar-location { min-height: 45px; min-width: 190px; margin-left: 0; }
  .editor-link { margin-right: 12px; }
  .records-footer { align-items: flex-start; flex-direction: column; }
  .records-footer ul { flex-wrap: wrap; gap: 10px 16px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-status { justify-items: start; }
  .updated-note { text-align: left; }
  .candidates-grid { grid-template-columns: 1fr; }
  .candidate-card:nth-child(even) { border-left: 0; }
  .candidate-card:nth-child(n+2) { border-top: 1px solid #dce5ea; }
  .candidate-card, .candidate-card-right { flex-direction: row; text-align: left; }
  .candidate-card-right .candidate-party { justify-content: flex-start; }
  .candidate-card-right .candidate-rule { background: linear-gradient(90deg, var(--candidate-color), #d5dde2); }
  .results-page footer { grid-template-columns: 1fr; }
  .form-grid.three, .candidate-editor-grid { grid-template-columns: 1fr; }
  .electors-layout { grid-template-columns: 1fr; }
  .calculation-preview { grid-template-columns: 1fr 1fr; }
  .candidate-create-grid { grid-template-columns: 1fr 1fr; }
  .candidate-create-grid .add-candidate-button { grid-column: 1 / -1; }
  .vote-register-heading { align-items: flex-start; flex-direction: column; }
  .vote-toggle { width: 100%; }
  .location-candidate-list { grid-template-columns: 1fr; }
  .vote-location-fields { grid-template-columns: minmax(0, 1fr) 88px 88px; }
  .institution-selector { grid-column: 1 / -1; }
  .vote-observed-footer { align-items: stretch; flex-direction: column; }
  .observed-reason-footer { min-width: 0; width: 100%; }
  .vote-register-actions { width: 100%; justify-content: space-between; }
  .observed-restore-location { grid-template-columns: 1fr 1fr; }
  .report-filters { grid-template-columns: 1fr 1fr; }
  .editor-header { height: auto; align-items: center; }
  .editor-session > span { display: none; }
  .publish-bar, .publish-bar > div { align-items: stretch; flex-direction: column; }
  .publish-bar label { width: 100%; }
  .editor-session .outline-button { display: none; }
}

@media (max-width: 550px) {
  .results-page main { padding: 20px 14px 35px; }
  .brand { padding: 9px 12px; }
  .brand-mark { width: 44px; height: 44px; }
  .brand small { display: none; }
  .editor-link { padding: 8px 10px; font-size: 12px; }
  .results-filter-trigger { min-height: 38px; min-width: 60px; padding: 0 11px; }
  .results-filter-trigger-icon { width: 20px; height: 28px; }
  .results-filter-menu { min-width: 150px; }
  .records-card { grid-template-columns: 1fr; }
  .records-detail { margin-top: 12px; }
  .candidate-card, .candidate-card-right { flex-direction: column; text-align: center; padding: 30px 18px; }
  .candidate-party, .candidate-card-right .candidate-party { justify-content: center; }
  .candidate-name { min-height: 0; }
  .portrait-ring { width: 222px; height: 222px; }
  .portrait { width: 168px; height: 168px; }
  .voter-summary { grid-template-columns: 1fr 1fr; }
  .voter-summary-main { grid-column: 1 / -1; }
  .candidate-rule, .candidate-card-right .candidate-rule { background: linear-gradient(90deg, transparent, var(--candidate-color), transparent); }
  .editor-main { padding: 24px 14px 60px; }
  .editor-title { align-items: flex-start; flex-direction: column; }
  .editor-section { padding: 18px; }
  .candidate-create-heading { align-items: flex-start; flex-direction: column; }
  .candidate-create-grid { grid-template-columns: 1fr; }
  .candidate-create-grid .add-candidate-button { grid-column: auto; }
  .candidate-editor-summary { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .candidate-summary-result { min-width: 62px; }
  .candidate-summary-toggle { grid-column: 2 / -1; text-align: left; }
  .candidate-fields-grid, .candidate-media-grid { grid-template-columns: 1fr; }
  .user-admin-grid { grid-template-columns: 1fr; }
  .vote-location-fields, .report-filters { grid-template-columns: 1fr; }
  .report-totals-heading { align-items: flex-start; flex-direction: column; }
  .report-totals-heading span { text-align: left; }
  .report-edit-heading, .report-edit-footer { align-items: stretch; flex-direction: column; }
  .report-edit-heading span { text-align: left; }
  .report-edit-location { grid-template-columns: 1fr; }
  .observed-restore-location { grid-template-columns: 1fr; }
  .institution-selector { grid-template-columns: 1fr; }
  .institution-create-box > summary { width: 100%; }
  .location-candidate-row { align-items: flex-start; }
  .location-vote-input { flex-basis: 84px; }
  .vote-register-footer { align-items: stretch; flex-direction: column; }
  .vote-register-actions { align-items: stretch; flex-direction: column; }
  .editor-session { gap: 2px; padding-right: 6px; }
  .editor-session .text-button { padding: 8px; font-size: 12px; }
}

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