:root {
  color-scheme: light;
  --brand: #003366;
  --brand-2: #1578c1;
  --gold: #f4bb33;
  --ink: #17212b;
  --muted: #52606b;
  --line: #d9e3ea;
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-2: #eaf3fa;
  --danger: #96352f;
  --success: #2f7d61;
  --shadow: 0 16px 38px rgba(0, 35, 70, 0.1);
  --shadow-soft: 0 8px 20px rgba(0, 35, 70, 0.08);
  font-family: "Gantari", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 44%, #ffffff 100%);
  color: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.evote-shell {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.mode-switch,
.hero-actions,
.submit-row,
.section-heading,
.cycle-row,
.candidate-meta,
.result-head {
  display: flex;
  align-items: center;
}

.mode-switch {
  flex-wrap: wrap;
  gap: 8px;
}

.mode-button,
.primary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  font-weight: 800;
}

.mode-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  padding: 7px 11px;
  background: var(--surface);
  color: var(--brand);
}

.mode-button.active {
  border-color: var(--brand-2);
  background: var(--surface-2);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
  border-bottom: 6px solid var(--gold);
  padding: 28px 42px;
  background: linear-gradient(135deg, rgba(0, 51, 102, 0.98), rgba(21, 120, 193, 0.9));
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  align-content: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-2);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: var(--gold);
}

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

h1,
h2,
h3 {
  color: var(--brand);
  font-weight: 850;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 720px;
  margin-bottom: 10px;
  color: #ffffff;
  font-size: clamp(2.35rem, 4.05vw, 4.05rem);
  line-height: 1;
}

.lead {
  max-width: 760px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1rem;
  line-height: 1.45;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.hero-actions span,
.hero-info-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 0.93rem;
  font-weight: 750;
}

.hero-info-button:hover,
.hero-info-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.12);
  outline: 0;
}

.hero-panel,
.section-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.hero-panel {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 240px;
  padding: 22px 24px;
}

.hero-panel strong {
  color: var(--brand);
  font-size: 1.45rem;
  line-height: 1.08;
}

.hero-panel span,
.section-heading p,
.feedback,
.muted {
  color: var(--muted);
  line-height: 1.5;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.mini-metrics div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface-2);
}

.mini-metrics b {
  color: var(--brand);
  font-size: 1.65rem;
  line-height: 1;
}

.student-layout,
.staff-grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

.student-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin: 0 auto 22px;
  padding: 22px 0;
  border-block: 1px solid var(--line);
}

.student-intro h2 {
  margin-bottom: 6px;
  font-size: 1.65rem;
}

.student-intro p {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.student-intro-points {
  display: grid;
  gap: 8px;
  min-width: 280px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-intro-points li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--brand);
  font-weight: 800;
}

.student-intro-points .fa-icon {
  color: var(--brand-2);
}

.student-layout {
  grid-template-columns: minmax(0, 1fr);
}

.student-layout.ballot-active {
  grid-template-columns: minmax(0, 1fr);
}

.student-layout.ballot-active .ballot-panel,
.student-status {
  grid-column: 1 / -1;
}

.staff-grid {
  grid-template-columns: minmax(280px, 0.32fr) minmax(0, 1fr);
}

.staff-workspace {
  display: grid;
  gap: 18px;
}

.section-panel {
  padding: 22px;
}

.ballot-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: start;
  gap: 20px 24px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.ballot-panel > .section-heading,
.ballot-panel > .ballot-stack,
.ballot-panel > .submit-row,
.ballot-panel > .feedback {
  grid-column: 1;
}

.ballot-progress {
  position: sticky;
  top: 108px;
  grid-column: 2;
  grid-row: 1 / span 3;
  border: 1px solid rgba(217, 227, 234, 0.88);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 42px rgba(0, 35, 70, 0.12);
  backdrop-filter: blur(16px);
}

.ballot-progress strong {
  display: block;
  margin: 8px 0 10px;
  color: var(--brand);
  font-size: 2.1rem;
  line-height: 1;
}

.ballot-progress p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.progress-track {
  display: block;
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--brand-2));
  transition: width 180ms ease;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.section-heading h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.field,
.check-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  font-weight: 750;
}

.field span,
.check-field span {
  color: var(--brand);
  font-size: 0.9rem;
}

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

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 0;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(21, 120, 193, 0.14);
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.hero-login,
.admin-form {
  display: grid;
  gap: 14px;
}

.hero-login {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.hero-login .field {
  gap: 6px;
}

.hero-login .primary-button {
  width: 100%;
}

.hero-login-feedback {
  padding: 9px 10px;
  font-size: 0.92rem;
}

.ballot-loader {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(21, 120, 193, 0.18);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(110deg, rgba(234, 243, 250, 0.92), rgba(255, 255, 255, 0.98), rgba(244, 187, 51, 0.16)),
    #ffffff;
  background-size: 240% 100%;
  animation: loader-sheen 1.8s ease-in-out infinite;
}

.ballot-loader strong {
  display: block;
  color: var(--brand);
  line-height: 1.2;
}

.ballot-loader p {
  margin: 3px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.3;
}

.loader-ring {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(21, 120, 193, 0.18);
  border-top-color: var(--gold);
  border-right-color: var(--brand-2);
  border-radius: 999px;
  animation: loader-spin 880ms linear infinite;
}

.confirmation-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.confirmation-panel h2 {
  margin: 0;
  font-size: 1.3rem;
}

.confirmation-panel > strong {
  display: block;
  border: 1px dashed rgba(21, 120, 193, 0.36);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
  color: var(--brand);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: 0.08em;
  text-align: center;
}

.confirmation-panel p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

.confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.confirmation-actions .primary-button {
  flex: 1 1 160px;
}

.confirmation-actions .ghost-button {
  flex: 0 0 auto;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loader-sheen {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.primary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  padding: 9px 13px;
}

.primary-button {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--brand);
}

.ghost-button,
.icon-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--brand);
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  filter: brightness(0.97);
}

.primary-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.3);
  opacity: 0.62;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.feedback {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface-2);
  font-weight: 700;
}

.feedback.error {
  border-color: rgba(150, 53, 47, 0.28);
  background: #fae8e6;
  color: var(--danger);
}

.feedback.success {
  border-color: rgba(47, 125, 97, 0.28);
  background: #e4f4ec;
  color: var(--success);
}

.ballot-stack,
.cycle-list,
.detail-grid,
.results-grid {
  display: grid;
  gap: 12px;
}

.ballot-stack {
  gap: 28px;
}

.branch-group {
  display: grid;
  gap: 16px;
}

.branch-heading {
  border-bottom: 2px solid rgba(21, 120, 193, 0.18);
  padding-bottom: 10px;
}

.branch-heading h2 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(1.9rem, 3vw, 2.65rem);
  line-height: 1.02;
}

.branch-position-stack {
  display: grid;
  gap: 18px;
}

.ballot-position {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.ballot-position h3 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  line-height: 1.12;
}

.position-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.position-instruction {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.4;
}

.rank-status {
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid rgba(21, 120, 193, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.25;
}

.candidate-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  grid-auto-rows: 1fr;
  gap: 18px;
  margin-top: 18px;
}

.candidate-option {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 360px;
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.candidate-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0, 35, 70, 0.12);
}

.candidate-option input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.candidate-option:has(input:checked),
.candidate-option.ranked {
  border-color: var(--brand-2);
  background: var(--surface-2);
  box-shadow: 0 18px 36px rgba(0, 51, 102, 0.14);
}

.candidate-card-body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.candidate-card-head {
  display: grid;
  min-height: 72px;
  padding-right: 64px;
  gap: 9px;
  align-content: start;
}

.candidate-title-row {
  display: grid;
  gap: 8px;
  align-content: start;
}

.candidate-option strong {
  color: var(--brand);
  font-size: 1.28rem;
  line-height: 1.12;
}

.candidate-role {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1.25;
}

.candidate-card-copy {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
  display: -webkit-box;
  min-height: 86px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.candidate-staff-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 58px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.25;
}

.candidate-staff-details span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 7px;
  background: var(--surface-2);
}

.rank-marker {
  position: absolute;
  inset-block-start: 18px;
  inset-inline-end: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 38px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 900;
}

.candidate-option.ranked .rank-marker {
  background: var(--brand);
  color: #ffffff;
}

.platform-button,
.platform-detail {
  margin-top: auto;
}

.platform-button {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(21, 120, 193, 0.2);
  border-radius: 8px;
  padding: 9px 11px;
  background: #ffffff;
  color: var(--brand-2);
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(0, 35, 70, 0.07);
  cursor: pointer;
}

.platform-button:hover {
  border-color: var(--brand-2);
  filter: brightness(0.99);
}

.platform-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.platform-empty {
  color: var(--muted);
  font-weight: 800;
}

.party-pill,
.status-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--party-color, var(--surface-2));
  color: var(--party-ink, var(--brand));
  font-size: 0.78rem;
  font-weight: 850;
}

.submit-row {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.submit-row .primary-button {
  margin-inline-start: auto;
}

.platform-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.platform-modal[hidden] {
  display: none !important;
}

.platform-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 22, 44, 0.54);
  backdrop-filter: blur(10px);
}

.platform-modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(78vh, 760px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  padding: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 251, 0.98)),
    #ffffff;
  box-shadow: 0 34px 90px rgba(0, 22, 44, 0.32);
  outline: 0;
}

.platform-modal-card h2 {
  margin: 8px 110px 18px 0;
  color: var(--brand);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
}

.platform-modal-card p:last-child {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.65;
}

.privacy-modal-card {
  width: min(820px, 100%);
}

.privacy-detail-list {
  display: grid;
  gap: 14px;
}

.privacy-detail-list p {
  margin: 0;
  border: 1px solid rgba(217, 227, 234, 0.88);
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.privacy-detail-list strong {
  color: var(--brand);
}

.platform-modal-close {
  position: absolute;
  top: 22px;
  right: 22px;
}

.staff-rail {
  position: sticky;
  top: 120px;
}

.cycle-row {
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.cycle-row.active,
.cycle-row:hover {
  border-color: var(--brand-2);
  background: var(--surface-2);
}

.cycle-row strong {
  color: var(--brand);
}

.cycle-row span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

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

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

.position-card,
.party-card,
.candidate-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.position-card h3,
.party-card h3,
.candidate-card h3,
.result-card h3 {
  margin-bottom: 4px;
}

.candidate-meta {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.result-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.42fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.result-bar {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
}

.result-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-2);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

@media (max-width: 940px) {
  .hero,
  .student-intro,
  .student-layout,
  .ballot-panel,
  .staff-grid,
  .admin-columns,
  .cycle-form,
  .candidate-form {
    grid-template-columns: 1fr;
  }

  .ballot-panel > .section-heading,
  .ballot-panel > .ballot-stack,
  .ballot-panel > .submit-row,
  .ballot-panel > .feedback,
  .ballot-progress {
    grid-column: 1;
  }

  .ballot-progress {
    position: static;
    grid-row: auto;
    order: 2;
  }

  .ballot-stack {
    order: 3;
  }

  .submit-row,
  #ballotFeedback {
    order: 4;
  }

  .student-intro-points {
    min-width: 0;
  }

  .candidate-options {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .staff-rail {
    position: static;
  }
}

@media (max-width: 680px) {
  .evote-shell {
    width: min(100% - 24px, 1280px);
  }

  .hero {
    padding: 20px 18px;
  }

  .hero h1 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .position-head {
    flex-direction: column;
  }

  .rank-status {
    width: 100%;
  }

  .result-row {
    grid-template-columns: 1fr;
  }

  .candidate-options {
    grid-template-columns: 1fr;
  }

  .candidate-option {
    min-height: 280px;
    height: 280px;
  }

  .platform-modal {
    padding: 14px;
  }

  .platform-modal-card {
    padding: 26px 20px;
  }

  .platform-modal-close {
    position: static;
    margin-bottom: 18px;
  }

  .platform-modal-card h2 {
    margin-right: 0;
  }
}
