/* ==============================================================================
   ASSOCIATION OF INTERN PHARMACISTS UGANDA - MODERN INSTITUTIONAL DESIGN SYSTEM
   Version 3.0: Multi-Office Ballot, Dedicated Voter Status Roll & CSP-Immune Architecture
   ============================================================================== */

:root {
  /* Light Mode Palette (Default) */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-input: #ffffff;
  
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #00873e;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --brand-green: #00873e;
  --brand-green-hover: #007033;
  --brand-green-tint: rgba(0, 135, 62, 0.08);
  --brand-blue: #00529b;
  --brand-blue-hover: #003e75;
  --brand-blue-tint: rgba(0, 82, 155, 0.08);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 14px 28px -4px rgba(0, 0, 0, 0.08);

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  /* Dark Mode Palette */
  --bg-page: #0b0f19;
  --bg-card: #151c2c;
  --bg-subtle: #1e283d;
  --bg-input: #0e1422;
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
  --border-focus: #10b981;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --brand-green: #10b981;
  --brand-green-hover: #059669;
  --brand-green-tint: rgba(16, 185, 129, 0.14);
  --brand-blue: #3b82f6;
  --brand-blue-hover: #2563eb;
  --brand-blue-tint: rgba(59, 130, 246, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 16px 32px -4px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-page);
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 135, 62, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(0, 82, 155, 0.05) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(0, 135, 62, 0.02) 0px, transparent 60%);
  background-attachment: fixed;
  background-size: 140% 140%;
  animation: ambientDrift 30s ease infinite alternate;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

[data-theme="dark"] body {
  background-color: var(--bg-page);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.06) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.07) 0px, transparent 50%),
    radial-gradient(at 50% 40%, rgba(99, 102, 241, 0.03) 0px, transparent 60%);
}

@keyframes ambientDrift {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

/* Minimalist Live Wallpaper Canvas */
.live-wallpaper-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
}

.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 20px 48px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==============================================================================
   UTILITY BAR (Theme Toggle)
   ============================================================================== */
.utility-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.theme-icon {
  display: flex;
  align-items: center;
}

/* ==============================================================================
   INSTITUTIONAL HEADER (Logo Perspective Hierarchy)
   ============================================================================== */
.main-header {
  text-align: center;
  margin-bottom: 24px;
}

.logos-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin-bottom: 16px;
}

.logo-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.side-logo-item {
  opacity: 0.88;
  transition: opacity 0.2s, transform 0.2s;
}

.side-logo-item:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.primary-logo-item {
  position: relative;
  z-index: 2;
  transition: transform 0.25s ease;
}

.primary-logo-item:hover {
  transform: scale(1.05);
}

.inst-logo {
  object-fit: contain;
}

.moh-logo {
  height: 44px;
  width: auto;
}

.psu-logo {
  height: 42px;
  width: auto;
}

.assoc-logo {
  height: 64px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 135, 62, 0.15));
}

[data-theme="dark"] .assoc-logo {
  filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.35));
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.org-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.election-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==============================================================================
   NAVIGATION TABS (4 Responsive Tabs)
   ============================================================================== */
.portal-nav {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 24px;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.portal-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.tab-icon {
  display: flex;
  align-items: center;
}

.tab-label-short {
  display: none;
}

.tab-label-full {
  display: inline;
}

/* ==============================================================================
   VIEW PANELS & CARDS
   ============================================================================== */
.view-panel {
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.view-panel.active {
  display: block;
  opacity: 1;
}

/* Card visibility rules */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* Ergonomic Axis of Interaction (Joel Marsh - UX for Beginners) */
#stepCode,
#stepOtp {
  max-width: 520px;
}

/* Wizard step cards within Vote view are controlled by active class */
#viewVote .form-card {
  display: none;
}

#viewVote .form-card.active {
  display: block;
}

/* Directory, Results, Dedicated Voter Roll, and Ledger Explorer cards expand wider for comprehensive review */
.directory-card,
.results-card,
.voter-roll-card,
.verify-card {
  display: block !important;
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

/* Step 3 Ballot Card fits cleanly within device viewport */
.ballot-card {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  padding: 28px 28px;
}

.card-heading {
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: -0.015em;
  text-align: center;
}

.card-subheading {
  font-size: clamp(0.88rem, 1.8vw, 0.98rem);
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.55;
  text-align: center;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* Inputs & Form Elements */
.field-group {
  margin-bottom: 22px;
}

.field-group.centered-field {
  text-align: center;
}

.field-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
  text-align: center;
}

.text-input {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 13px 18px;
  font-family: var(--font-family);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  letter-spacing: 1.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3.5px rgba(0, 135, 62, 0.15);
}

/* Test Helper Chips */
.test-helper-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 24px;
  text-align: center;
}

.test-helper-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
  text-align: center;
}

.test-chips-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.test-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.test-chip:hover {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
  transform: translateY(-1px);
}

/* Dev OTP Banner */
.dev-otp-banner {
  background: var(--brand-blue-tint);
  border: 1px solid rgba(0, 82, 155, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-main);
}

.autofill-otp-btn {
  background: var(--brand-blue);
  color: #ffffff;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.autofill-otp-btn:hover {
  opacity: 0.9;
}

/* Buttons */
.submit-btn {
  width: 100%;
  background: var(--brand-green);
  color: #ffffff;
  border: none;
  border-radius: 11px;
  padding: 13px 20px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.submit-btn:hover:not(:disabled) {
  background: var(--brand-green-hover);
  transform: translateY(-1px);
}

.submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.actions-row {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.flex-grow {
  flex: 1;
}

.back-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 11px;
  padding: 13px 18px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.back-btn:hover {
  background: var(--border-color);
  color: var(--text-main);
}

/* OTP row */
.otp-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.otp-box {
  width: 48px;
  height: 56px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.otp-box:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 135, 62, 0.15);
}

.otp-helpers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.82rem;
}

.timer-text {
  color: var(--text-muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--brand-blue);
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.link-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.link-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mono-phone {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ==============================================================================
   BALLOT SHEET (Multi-Office, Hierarchy, Photos, Independent Per-Office Choice)
   ============================================================================== */
/* ==============================================================================
   LOCKOUT BANNER (Shared Device Cooldown Timer)
   ============================================================================== */
.lockout-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 24px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  animation: bannerFadeIn 0.3s ease;
}

@keyframes bannerFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.lockout-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.2);
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .lockout-icon {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.25);
}

.lockout-content {
  flex: 1;
  min-width: 0;
}

.lockout-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.lockout-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 10px;
}

.lockout-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  border-radius: 8px;
  padding: 5px 12px;
}

.timer-digits {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: #d97706;
}

[data-theme="dark"] .timer-digits {
  color: #fbbf24;
}

.timer-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ==============================================================================
   VIEWPORT-FIT BALLOT WIZARD
   ============================================================================== */
.ballot-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.ballot-auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-green-tint);
  color: var(--brand-green);
  border: 1px solid rgba(0, 135, 62, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-green);
}

.wizard-progress-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
}

.wizard-progress-bar::-webkit-scrollbar {
  display: none;
}

.wizard-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
  cursor: pointer;
}

.wizard-step-pill .step-num {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-main);
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.wizard-step-pill.active {
  background: var(--brand-green-tint);
  border-color: var(--brand-green);
  color: var(--brand-green);
}

.wizard-step-pill.active .step-num {
  background: var(--brand-green);
  color: #ffffff;
}

.wizard-step-pill.completed {
  background: var(--bg-card);
  border-color: rgba(0, 135, 62, 0.4);
  color: var(--text-main);
}

.wizard-step-pill.completed .step-num {
  background: rgba(0, 135, 62, 0.2);
  color: var(--brand-green);
}

/* Wizard Office View */
.wizard-office-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-office-header {
  text-align: center;
  margin-bottom: 4px;
}

.office-index-indicator {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--brand-blue);
  background: var(--brand-blue-tint);
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
}

.active-office-name {
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.active-office-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Candidate Cards Grid (fits cleanly on viewport) */
.wizard-candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  max-height: calc(100vh - 360px);
  min-height: 200px;
  overflow-y: auto;
  padding: 4px 2px;
}

/* Individual Candidate Card in Wizard */
.wizard-candidate-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.wizard-candidate-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card);
}

.wizard-candidate-card.selected {
  border-color: var(--brand-green);
  background: var(--brand-green-tint);
  box-shadow: 0 0 0 2px var(--brand-green);
}

.cand-top-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.cand-portrait-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--border-color);
  flex-shrink: 0;
  cursor: zoom-in !important;
  background: var(--bg-subtle);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cand-portrait-wrap:hover {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px var(--brand-blue-tint);
}

.cand-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none !important;
  transition: transform 0.3s ease;
}

.cand-portrait-wrap:hover .cand-portrait-img {
  transform: scale(1.08);
}

.portrait-zoom-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0.85;
  pointer-events: none;
}

.cand-info-box {
  flex: 1;
  min-width: 0;
}

.cand-name-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 3px;
}

.cand-office-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 750;
  color: var(--brand-blue);
  background: var(--brand-blue-tint);
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.cand-manifesto-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
  flex: 1;
}

.cand-select-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.cand-select-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.wizard-candidate-card.selected .cand-select-label {
  color: var(--brand-green);
}

.radio-indicator-wrap {
  display: flex;
  align-items: center;
}

.custom-radio-circle {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: transparent;
  transition: all 0.2s ease;
}

.custom-radio-circle.active,
.wizard-candidate-card.selected .custom-radio-circle {
  border-color: var(--brand-green);
  background: var(--brand-green);
  box-shadow: inset 0 0 0 3px #ffffff;
}

[data-theme="dark"] .custom-radio-circle.active,
[data-theme="dark"] .wizard-candidate-card.selected .custom-radio-circle {
  box-shadow: inset 0 0 0 3px var(--bg-card);
}

.review-card-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.btn-review-remove {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-review-remove:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #dc2626;
  transform: translateY(-1px);
}

.btn-review-choose {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--brand-blue);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-review-choose:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--brand-blue);
  transform: translateY(-1px);
}

/* Wizard Navigation Row */
.wizard-nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.wizard-nav-spacer {
  flex: 1;
}

.wizard-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 11px;
  font-family: var(--font-family);
  font-size: 0.92rem;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wizard-btn.prev-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.wizard-btn.prev-btn:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.wizard-btn.next-btn {
  background: var(--brand-green);
  border: none;
  color: #ffffff;
}

.wizard-btn.next-btn:hover {
  background: var(--brand-green-hover);
  transform: translateY(-1px);
}

/* Review Slate View */
.wizard-review-view {
  text-align: center;
}

.review-header {
  margin-bottom: 16px;
}

.review-heading {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.review-subheading {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
}

.review-slate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}

.review-slate-card {
  background: var(--bg-card);
  border: 1.5px solid rgba(0, 135, 62, 0.35);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.review-portrait-wrap {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  cursor: zoom-in;
}

.review-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-card-info {
  flex: 1;
  min-width: 0;
}

.review-office-tag {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-blue);
}

.review-cand-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-actions-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ==============================================================================
   RECEIPT EXPLANATION & INSTANT LEDGER PROOF
   ============================================================================== */
.receipt-card {
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}

.success-icon {
  width: 56px;
  height: 56px;
  background: var(--brand-green-tint);
  color: var(--brand-green);
  border: 2px solid var(--brand-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.receipt-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 20px 0;
  text-align: left;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.88rem;
}

.receipt-label {
  color: var(--text-muted);
  font-weight: 600;
}

.receipt-value {
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.receipt-hash {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--brand-blue);
  word-break: break-all;
  max-width: 65%;
  text-align: right;
  font-weight: 600;
}

.receipt-explanation-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 20px 0;
  text-align: left;
}

.receipt-expl-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-blue);
  margin-bottom: 8px;
}

.receipt-expl-header h4 {
  font-size: 0.92rem;
  font-weight: 800;
  margin: 0;
}

.receipt-expl-body {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.receipt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 11px;
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn.secondary {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
}

.action-btn.secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-hover);
}

.action-btn.primary {
  background: var(--brand-blue);
  border: none;
  color: #ffffff;
}

.action-btn.primary:hover {
  background: #004380;
}

.action-btn.outline {
  background: var(--brand-green);
  border: none;
  color: #ffffff;
}

.action-btn.outline:hover {
  background: var(--brand-green-hover);
}

/* Ledger Proof Card */
.ledger-proof-card {
  background: var(--brand-green-tint);
  border: 1.5px solid var(--brand-green);
  border-radius: 14px;
  padding: 18px 20px;
  margin-top: 20px;
  text-align: left;
  animation: bannerFadeIn 0.3s ease;
}

.ledger-proof-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.proof-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-green);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.proof-time {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.ledger-proof-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}

.proof-row {
  display: flex;
  justify-content: space-between;
}

.proof-key {
  color: var(--text-muted);
  font-weight: 600;
}

.proof-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
}

/* ==============================================================================
   IMAGE MAGNIFIER LIGHTBOX MODAL (Greatly Expanded Hover & Tap)
   ============================================================================== */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFadeIn 0.22s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 20, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

/* Hover Preview Mode: Complete mouse/click transparency so hover never flickers or steals focus */
.lightbox-modal.hover-preview,
.lightbox-modal.hover-preview * {
  pointer-events: none !important;
  cursor: zoom-in !important;
  user-select: none;
}

.lightbox-dialog {
  position: relative;
  z-index: 100000;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 22px;
  padding: 26px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: dialogPop 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialogPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.lightbox-close-btn:hover {
  background: var(--border-color);
  transform: scale(1.08);
}

.lightbox-photo-wrap {
  width: 100%;
  height: 440px;
  max-height: 62vh;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.lightbox-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lightbox-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.lightbox-badge {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-blue);
  background: var(--brand-blue-tint);
  padding: 4px 12px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.lightbox-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.lightbox-dismiss-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

/* ==============================================================================
   CANDIDATE MANIFESTO HOVER EXPANSION & READER MODAL
   ============================================================================== */

/* Card Manifesto Teaser Area */
.cand-manifesto-wrap {
  margin: 10px 0 14px;
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.cand-manifesto-wrap:hover {
  background: var(--bg-surface);
  border-color: var(--brand-green);
  box-shadow: 0 4px 14px rgba(0, 135, 62, 0.12);
  transform: translateY(-1px);
}

.cand-manifesto-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}

.cand-manifesto-wrap:hover .cand-manifesto-text {
  color: var(--text-main);
}

.cand-manifesto-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}

.btn-read-manifesto {
  background: transparent;
  border: none;
  color: var(--brand-green);
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  cursor: pointer;
  transition: gap 0.2s, color 0.15s;
}

.cand-manifesto-wrap:hover .btn-read-manifesto {
  color: #00a84d;
  gap: 7px;
}

.manifesto-hover-pill {
  font-size: 0.70rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Directory Card Manifesto Area */
.dir-manifesto-wrap {
  margin: 10px 0 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  transition: all 0.22s ease;
  cursor: pointer;
}

.dir-manifesto-wrap:hover {
  border-color: var(--brand-green);
  box-shadow: 0 4px 14px rgba(0, 135, 62, 0.12);
  transform: translateY(-1px);
}

.dir-cand-manifesto {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dir-manifesto-wrap:hover .dir-cand-manifesto {
  color: var(--text-main);
}

/* FULL MANIFESTO READER MODAL */
.manifesto-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFadeIn 0.24s ease-out;
}

.manifesto-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 20, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}

.manifesto-dialog {
  position: relative;
  z-index: 100001;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 22px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  animation: dialogPop 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.manifesto-dialog-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.manifesto-author-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.manifesto-author-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--brand-green);
  box-shadow: 0 4px 12px rgba(0, 135, 62, 0.2);
}

.manifesto-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.manifesto-office-badge {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-blue);
  background: var(--brand-blue-tint);
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.4px;
}

.manifesto-verified-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-green);
  background: rgba(0, 135, 62, 0.12);
  padding: 3px 9px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.manifesto-author-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.manifesto-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.manifesto-close-btn:hover {
  background: var(--border-color);
  transform: scale(1.08);
}

.manifesto-dialog-body {
  padding: 24px 28px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-main);
  background: var(--bg-card);
}

/* Markdown prose styling */
.manifesto-dialog-body h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--border-color);
}

.manifesto-dialog-body h3:first-child {
  margin-top: 0;
}

.manifesto-dialog-body h4 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin: 16px 0 8px;
}

.manifesto-dialog-body p {
  margin: 0 0 14px;
  color: var(--text-muted);
}

.manifesto-dialog-body ul,
.manifesto-dialog-body ol {
  margin: 8px 0 16px 20px;
  padding: 0;
}

.manifesto-dialog-body li {
  margin-bottom: 8px;
  color: var(--text-main);
}

.manifesto-dialog-body li strong {
  color: var(--brand-green);
}

.manifesto-dialog-body hr {
  border: none;
  border-top: 1px dashed var(--border-color);
  margin: 20px 0;
}

.manifesto-dialog-body blockquote {
  margin: 16px 0;
  padding: 12px 18px;
  background: var(--bg-subtle);
  border-left: 3.5px solid var(--brand-green);
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: var(--text-main);
}

.manifesto-dialog-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.manifesto-footer-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.manifesto-dialog-close {
  padding: 8px 18px;
  font-size: 0.85rem;
}

/* ==============================================================================
   CANDIDATES DIRECTORY TAB
   ============================================================================== */
.directory-top {
  margin-bottom: 20px;
}

.position-filters {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-bottom: 24px;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.position-filters::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.filter-pill.active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #ffffff;
}

.directory-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.directory-item-card,
.dir-candidate-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  transition: all 0.2s ease;
}

.directory-item-card:hover,
.dir-candidate-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.directory-photo-wrap,
.dir-cand-photo-wrap {
  width: 76px;
  height: 76px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--border-color);
  background: var(--bg-subtle);
  flex-shrink: 0;
  position: relative;
  cursor: zoom-in !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.directory-photo-wrap:hover,
.dir-cand-photo-wrap:hover {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px var(--brand-blue-tint);
}

.directory-photo,
.dir-cand-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none !important;
  transition: transform 0.3s ease;
}

.directory-photo-wrap:hover .directory-photo,
.dir-cand-photo-wrap:hover .dir-cand-photo {
  transform: scale(1.08);
}

/* Universal rule for zoomable portrait thumbnails */
[data-zoom-src] {
  cursor: zoom-in !important;
}

[data-zoom-src] * {
  pointer-events: none !important;
  cursor: zoom-in !important;
}

.directory-details,
.dir-cand-content {
  flex: 1;
}

.directory-meta,
.dir-cand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.directory-pos-badge,
.dir-cand-pos {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand-blue);
  background: var(--brand-blue-tint);
  padding: 3px 9px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.directory-name,
.dir-cand-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.directory-manifesto,
.dir-cand-manifesto {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 6px;
}

.directory-card-actions,
.dir-cand-footer {
  margin-top: 12px;
}

.vote-from-directory-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--brand-green);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.vote-from-directory-btn:hover {
  background: var(--brand-green);
  color: #ffffff;
}

.tally-thumb-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  cursor: zoom-in;
}

.tally-thumb-wrap:hover .tally-thumb {
  transform: scale(1.1);
}

.tally-thumb-wrap .tally-thumb {
  width: 100%;
  height: 100%;
  border: none;
  transition: transform 0.25s ease;
}

/* ==============================================================================
   LIVE RESULTS TAB
   ============================================================================== */
.results-top-centered {
  text-align: center;
  margin-bottom: 24px;
}

.results-header-text {
  text-align: center;
  margin-bottom: 18px;
}

.results-header-text .card-heading {
  text-align: center;
  margin-bottom: 8px;
}

.results-header-text .card-subheading {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 520px;
}

.results-stat-badges {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 auto;
}

.stat-badge {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 28px;
  text-align: center;
  min-width: 180px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, border-color 0.2s;
}

.stat-badge:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  text-align: center;
  margin-bottom: 6px;
}

.stat-val {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: var(--font-mono);
  text-align: center;
  line-height: 1.2;
}

.stat-highlight {
  color: var(--brand-green);
}

/* Overall Progress Bar */
.overall-progress-wrapper {
  max-width: 640px;
  margin: 0 auto 28px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-green));
  border-radius: 999px;
  transition: width 0.6s ease;
}

.result-group {
  margin-bottom: 24px;
}

.result-group-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.office-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
}

.result-group-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.office-vote-count {
  margin-left: auto;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.tally-row {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.tally-cand-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.tally-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.tally-labels {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.tally-cand-name {
  font-weight: 700;
  color: var(--text-main);
}

.tally-votes {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand-green);
  font-size: 0.85rem;
}

.bar-bg {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--brand-green);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ==============================================================================
   VOTER PARTICIPATION & TURNOUT ROLL
   ============================================================================== */
.voter-roll-section {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 2px solid var(--border-color);
}

.voter-roll-header-centered {
  text-align: center;
  margin-bottom: 24px;
}

.voter-roll-header-centered .card-heading {
  text-align: center;
  margin-bottom: 8px;
}

.voter-roll-header-centered .card-subheading {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 540px;
  margin-bottom: 0;
}

.voter-roll-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.voter-search-wrap {
  position: relative;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  z-index: 2;
}

.voter-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 9px 14px 9px 36px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.voter-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 135, 62, 0.12);
}

.voter-roll-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.roll-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.roll-pill:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.roll-pill.active {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
}

.voter-roll-list {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
}

.voter-roll-table-header {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 12px 20px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .voter-roll-table-header {
  background: rgba(255, 255, 255, 0.03);
}

.voter-roll-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
  transition: background-color 0.15s;
}

.voter-roll-row:last-child {
  border-bottom: none;
}

.voter-roll-row:hover {
  background: var(--bg-card);
}

.voter-name-col {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voter-avatar-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-blue-tint);
  color: var(--brand-blue);
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.voter-name-text {
  font-weight: 700;
  color: var(--text-main);
}

.voter-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.text-right {
  text-align: right;
  justify-content: flex-end;
}

.badge-voted {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--brand-green-tint);
  color: var(--brand-green);
  border: 1px solid rgba(0, 135, 62, 0.25);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-pending {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

[data-theme="dark"] .badge-pending {
  color: #fbbf24;
}

.privacy-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.privacy-notice svg {
  color: var(--brand-blue);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==============================================================================
   LOADING & TOAST NOTIFICATIONS
   ============================================================================== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 0;
  color: var(--text-muted);
  gap: 10px;
  font-size: 0.85rem;
}

.loader-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--brand-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-msg {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast-msg {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.2s ease forwards;
}

.toast-icon {
  display: flex;
  align-items: center;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-error {
  border-left: 3px solid #ef4444;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-success {
  border-left: 3px solid var(--brand-green);
}

.toast-success .toast-icon {
  color: var(--brand-green);
}

.toast-info {
  border-left: 3px solid var(--brand-blue);
}

.toast-info .toast-icon {
  color: var(--brand-blue);
}

/* ==============================================================================
   CRYPTOGRAPHIC LEDGER EXPLORER & BALLOT VERIFIER (TAB 5)
   ============================================================================== */
.verify-card {
  text-align: left;
}

.verify-header {
  text-align: center;
  margin-bottom: 24px;
}

/* Voter-Friendly Guide Card */
.verify-guide-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 22px;
  margin: 0 auto 26px;
  max-width: 680px;
  text-align: left;
}

.guide-intro {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border-color);
}

.guide-intro-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-green-tint);
  color: var(--brand-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-intro-text h4 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.guide-intro-text p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-step {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guide-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-green);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-step-text {
  font-size: 0.84rem;
  color: var(--text-main);
  line-height: 1.45;
}

.guide-step-text strong {
  color: var(--brand-green);
}

.verify-search-form {
  max-width: 680px;
  margin: 0 auto 28px;
  text-align: left;
}

.search-input-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.hash-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mono-input {
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 44px !important;
  font-family: var(--font-mono) !important;
  font-size: 0.88rem !important;
  letter-spacing: 0.03em !important;
  text-align: left !important;
}

.primary-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  font-size: 0.95rem;
  font-weight: 750;
  cursor: pointer;
}

.hash-result-box {
  margin: 24px auto 32px;
  max-width: 780px;
  border-radius: 16px;
  padding: 24px;
  text-align: left;
  animation: modalFadeIn 0.25s ease-out;
}

.hash-result-box.verified {
  background: var(--brand-green-tint);
  border: 1.5px solid var(--brand-green);
}

.hash-result-box.not-found {
  background: rgba(239, 68, 68, 0.08);
  border: 1.5px solid #ef4444;
}

.hash-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.hash-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-verified {
  background: var(--brand-green);
  color: #ffffff;
}

.status-unverified {
  background: #ef4444;
  color: #ffffff;
}

.hash-proof-time {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hash-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hash-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hash-field-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.hash-field-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--text-main);
  background: var(--bg-card);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  user-select: all;
}

.hash-field-val.highlight-val {
  color: var(--brand-blue);
  font-weight: 700;
}

.proof-explanation-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

[data-theme="dark"] .proof-explanation-box {
  background: rgba(255, 255, 255, 0.04);
}

/* Recent Blocks Section */
.recent-blocks-section {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 2px solid var(--border-color);
  text-align: left;
}

.recent-blocks-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.recent-blocks-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.recent-blocks-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.refresh-blocks-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--brand-blue);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-blocks-btn:hover {
  background: var(--brand-blue);
  color: #ffffff;
}

.recent-blocks-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.block-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.2s ease;
}

.block-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card);
  box-shadow: var(--shadow-hover);
}

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

.block-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--brand-blue-tint);
  color: var(--brand-blue);
  padding: 6px 10px;
  border-radius: 8px;
  flex-shrink: 0;
}

.block-meta {
  min-width: 0;
  flex: 1;
}

.block-hash-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block-timestamp {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.audit-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--brand-green);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.audit-chip-btn:hover {
  background: var(--brand-green);
  color: #ffffff;
  border-color: var(--brand-green);
}

.simple-footer {
  margin-top: auto;
  text-align: center;
  padding-top: 32px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.refresh-icon {
  transition: transform 0.25s ease;
}

.refresh-icon.refreshing {
  animation: spin 0.7s linear infinite;
}

/* ==============================================================================
   COMPREHENSIVE MOBILE & TABLET RESPONSIVE SUITE (iOS, Android, Tablet)
   ============================================================================== */

@media (max-width: 768px) {
  html {
    font-size: 14.5px;
  }

  .app-wrapper {
    padding: 12px 14px 44px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  /* Fully fitted responsive tab bar - fits mobile viewport without horizontal swiping */
  .portal-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
    overflow-x: visible;
    padding: 3px;
    gap: 3px;
    border-radius: 12px;
    margin-bottom: 18px;
    box-sizing: border-box;
  }
  .portal-nav::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    padding: 6px 2px;
    min-height: 42px;
    border-radius: 8px;
    gap: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tab-icon svg {
    width: 15px;
    height: 15px;
  }
  .tab-label-short {
    display: inline;
  }
  .tab-label-full {
    display: none;
  }

  .position-filters {
    display: flex;
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 6px 5px;
    margin-bottom: 14px;
    padding-bottom: 0;
    width: 100%;
  }

  .directory-card,
  .results-card,
  .voter-roll-card,
  .verify-card {
    padding: 18px 16px;
    border-radius: 16px;
  }
}

@media (max-width: 650px) {
  html {
    font-size: 14px;
  }

  /* Header & Emblem Hierarchy - Open and airy with smaller footprint */
  .main-header {
    margin-bottom: 16px;
  }
  .logos-row {
    gap: 12px;
    margin-bottom: 10px;
  }
  .moh-logo {
    height: 28px;
  }
  .assoc-logo {
    height: 48px;
  }
  .psu-logo {
    height: 26px;
  }
  .org-title {
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
  }
  .election-subtitle {
    font-size: 0.72rem;
    margin-top: 3px;
  }

  /* Form & Interactive Cards - Spacious padding with small typography gives huge breathing room */
  .form-card {
    padding: 18px 14px;
    border-radius: 14px;
    margin-bottom: 18px;
  }
  .card-heading {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
  }
  .card-subheading {
    font-size: 0.76rem;
    margin-bottom: 14px;
    line-height: 1.48;
    color: var(--text-muted);
  }

  /* Form Controls */
  .field-group {
    margin-bottom: 14px;
  }
  .field-label {
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
  }
  .field-help {
    font-size: 0.70rem;
    margin-top: 4px;
  }
  .text-input {
    max-width: 100%;
    font-size: 0.88rem;
    padding: 10px 12px;
    height: 40px;
    border-radius: 9px;
  }
  .submit-btn {
    max-width: 100%;
    width: 100%;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 10px 14px;
    min-height: 42px;
    border-radius: 9px;
  }

  /* OTP Boxes — Fluid Responsive Grid fitting cleanly without crowding */
  .otp-boxes-group {
    display: flex;
    justify-content: center;
    gap: 5px;
    width: 100%;
    max-width: 100%;
  }
  .otp-box {
    width: clamp(32px, 11vw, 40px);
    height: clamp(40px, 13vw, 48px);
    font-size: 1.08rem;
    border-radius: 8px;
  }

  /* Ballot Wizard Layout */
  .ballot-card {
    padding: 15px 12px;
    border-radius: 14px;
  }
  .ballot-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 12px;
  }
  .ballot-header h2 {
    font-size: 1.02rem;
  }
  .wizard-progress-bar {
    gap: 4px;
    padding-bottom: 6px;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
  }
  .wizard-step-pill {
    padding: 4px 8px;
    font-size: 0.66rem;
    border-radius: 20px;
  }
  .wizard-step-pill .step-num {
    width: 15px;
    height: 15px;
    font-size: 0.58rem;
  }
  .wizard-candidates-grid {
    grid-template-columns: 1fr;
    max-height: none;
    min-height: auto;
    gap: 10px;
    overflow-y: visible;
    padding: 0;
  }
  .wizard-candidate-card {
    padding: 12px;
    border-radius: 12px;
  }
  .cand-top-row {
    gap: 10px;
  }
  .cand-portrait-wrap {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 10px;
  }
  .cand-name-title {
    font-size: 0.86rem;
    font-weight: 700;
  }
  .cand-office-pill {
    font-size: 0.58rem;
    padding: 2px 6px;
  }
  .cand-manifesto-text {
    font-size: 0.72rem;
    line-height: 1.42;
    -webkit-line-clamp: 2;
  }
  .cand-manifesto-footer {
    margin-top: 5px;
  }
  .btn-read-manifesto {
    font-size: 0.68rem;
    padding: 3px 6px;
  }
  .manifesto-hover-pill {
    font-size: 0.58rem;
  }
  .wizard-nav-bar {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
  }
  .wizard-btn {
    flex: 1;
    min-height: 40px;
    padding: 9px 12px;
    font-size: 0.80rem;
    border-radius: 9px;
  }

  /* Slate Review on Mobile */
  .review-slate-card {
    padding: 9px 11px;
    gap: 9px;
    border-radius: 10px;
  }
  .review-portrait-wrap {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }
  .review-cand-name {
    font-size: 0.80rem;
  }
  .review-cand-office {
    font-size: 0.64rem;
  }
  .review-actions-row {
    flex-direction: column-reverse;
    gap: 8px;
    width: 100%;
  }
  .review-actions-row button {
    width: 100%;
    min-height: 40px;
    font-size: 0.80rem;
  }

  /* Receipt Card */
  .receipt-box {
    padding: 11px 12px;
    border-radius: 10px;
  }
  .receipt-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 5px 0;
  }
  .receipt-label {
    font-size: 0.66rem;
  }
  .receipt-val {
    font-size: 0.74rem;
  }
  .receipt-hash {
    max-width: 100%;
    text-align: left;
    font-size: 0.66rem;
    word-break: break-all;
  }
  .receipt-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .action-btn {
    width: 100%;
    min-height: 38px;
    font-size: 0.78rem;
    padding: 8px 12px;
  }

  /* Candidates Directory position filters - wrap cleanly to fit viewport without horizontal swiping */
  .position-filters {
    display: flex;
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 6px 5px;
    margin-bottom: 14px;
    padding-bottom: 0;
    width: 100%;
  }
  .filter-pill {
    font-size: 0.66rem;
    font-weight: 600;
    padding: 4px 9px;
    min-height: 28px;
    border-radius: 14px;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .directory-item-card,
  .dir-candidate-card {
    padding: 12px;
    gap: 10px;
    border-radius: 12px;
  }
  .directory-photo-wrap,
  .dir-cand-photo-wrap {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 10px;
  }
  .dir-cand-name {
    font-size: 0.85rem;
  }
  .dir-cand-pos {
    font-size: 0.60rem;
  }
  .dir-cand-manifesto {
    font-size: 0.72rem;
    line-height: 1.42;
    -webkit-line-clamp: 2;
  }
  .vote-from-directory-btn {
    width: 100%;
    min-height: 36px;
    font-size: 0.76rem;
    padding: 8px 12px;
  }

  /* Live Results */
  .results-stat-badges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-bottom: 12px;
  }
  .stat-badge {
    min-width: 0;
    padding: 8px 6px;
    border-radius: 9px;
  }
  .stat-label {
    font-size: 0.60rem;
    letter-spacing: 0.03em;
  }
  .stat-val {
    font-size: 1.00rem;
    font-weight: 700;
  }
  .result-group-header {
    flex-wrap: wrap;
    gap: 3px 6px;
    margin-bottom: 6px;
  }
  .office-vote-count {
    margin-left: 0;
    width: 100%;
    font-size: 0.66rem;
  }
  .tally-row {
    padding: 7px 9px;
    border-radius: 8px;
  }
  .tally-thumb {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }
  .tally-labels {
    flex-wrap: wrap;
    gap: 2px 6px;
    font-size: 0.74rem;
  }
  .tally-cand-name {
    font-size: 0.76rem;
  }
  .tally-votes {
    font-size: 0.68rem;
  }
  .results-progress-bar {
    height: 6px;
  }

  /* Dedicated Voter Roll Tab */
  .voter-roll-controls-row {
    flex-direction: column;
    gap: 9px;
    align-items: stretch;
    margin-bottom: 12px;
  }
  .voter-search-wrap {
    width: 100%;
    min-width: 100%;
  }
  .voter-search-wrap input {
    font-size: 0.78rem;
    height: 36px;
    padding: 8px 12px 8px 34px;
  }
  .search-icon {
    left: 11px;
    width: 14px;
    height: 14px;
  }
  .voter-roll-filter-row {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0;
    gap: 5px 4px;
  }
  .roll-pill {
    flex-shrink: 0;
    padding: 3px 7px;
    font-size: 0.66rem;
  }
  .voter-roll-table-header,
  .voter-roll-row {
    grid-template-columns: 1fr auto;
    padding: 7px 9px;
    font-size: 0.72rem;
    gap: 6px;
  }
  .voter-name-text {
    font-size: 0.74rem;
  }
  .voter-inst-text {
    font-size: 0.62rem;
  }
  .badge-voted,
  .badge-pending {
    font-size: 0.62rem;
    padding: 2px 6px;
  }

  /* Verify Tab */
  .verify-guide-card {
    padding: 12px 10px;
    margin-bottom: 12px;
    border-radius: 11px;
  }
  .guide-intro {
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }
  .guide-intro-icon {
    width: 28px;
    height: 28px;
  }
  .guide-intro-text h4 {
    font-size: 0.78rem;
  }
  .guide-intro-text p {
    font-size: 0.70rem;
    line-height: 1.40;
  }
  .guide-step-item {
    gap: 7px;
    margin-bottom: 5px;
  }
  .guide-step-num {
    width: 16px;
    height: 16px;
    min-width: 16px;
    font-size: 0.58rem;
  }
  .guide-step-text {
    font-size: 0.70rem;
    line-height: 1.40;
  }
  .verify-search-form {
    width: 100%;
    margin-bottom: 12px;
  }
  .search-input-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
  }
  .hash-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    pointer-events: none;
    z-index: 2;
  }
  .mono-input {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 0.76rem !important;
    height: 42px;
    padding: 10px 12px 10px 36px !important;
  }
  .verify-btn {
    width: 100%;
    min-height: 38px;
    font-size: 0.78rem;
  }

  /* Modals (Lightbox & Manifesto) */
  .lightbox-dialog {
    padding: 12px 10px;
    width: calc(100% - 24px);
    max-height: 85vh;
    border-radius: 12px;
    margin: auto;
  }
  .lightbox-photo-wrap {
    height: 240px;
    max-height: 42vh;
  }
  .lightbox-name {
    font-size: 0.98rem;
  }
  .lightbox-role {
    font-size: 0.68rem;
  }
  .manifesto-dialog {
    width: calc(100% - 20px);
    max-height: 88vh;
    border-radius: 12px;
    margin: auto;
  }
  .manifesto-dialog-header {
    padding: 10px 12px;
  }
  .manifesto-author-thumb {
    width: 36px;
    height: 36px;
  }
  .manifesto-author-name {
    font-size: 0.88rem;
  }
  .manifesto-author-office {
    font-size: 0.64rem;
  }
  .manifesto-dialog-body {
    padding: 12px;
    font-size: 0.76rem;
    line-height: 1.50;
  }
  .manifesto-dialog-body h3 {
    font-size: 0.84rem;
    margin-top: 8px;
    margin-bottom: 4px;
  }
  .manifesto-dialog-body blockquote {
    font-size: 0.72rem;
    padding: 6px 8px;
    margin: 6px 0;
  }
  .manifesto-dialog-footer {
    padding: 8px 12px;
  }
  .btn-dismiss-manifesto {
    font-size: 0.74rem;
    padding: 6px 12px;
  }

  .toast-msg {
    font-size: 0.74rem;
    padding: 8px 12px;
    max-width: calc(100vw - 28px);
  }
}

/* Extra small devices (<400px: iPhone SE, compact Androids) */
@media (max-width: 400px) {
  html {
    font-size: 13px;
  }
  .app-wrapper {
    padding: 8px 8px 32px;
  }
  .logos-row {
    gap: 8px;
  }
  .moh-logo {
    height: 24px;
  }
  .assoc-logo {
    height: 40px;
  }
  .psu-logo {
    height: 22px;
  }
  .org-title {
    font-size: 0.88rem;
  }
  .election-subtitle {
    font-size: 0.66rem;
  }

  .form-card {
    padding: 14px 10px;
    border-radius: 11px;
  }
  .card-heading {
    font-size: 0.95rem;
  }
  .card-subheading {
    font-size: 0.70rem;
  }

  .directory-item-card,
  .dir-candidate-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
  }
  .dir-cand-photo-wrap,
  .directory-photo-wrap {
    width: 42px;
    height: 42px;
  }

  .otp-box {
    width: 30px;
    height: 38px;
    font-size: 1.00rem;
    gap: 2px;
  }

  .portal-nav {
    gap: 2px;
    padding: 2px;
  }
  .tab-btn {
    font-size: 0.58rem;
    padding: 4px 1px;
    min-height: 38px;
    gap: 1px;
  }
  .tab-icon svg {
    width: 13px;
    height: 13px;
  }
  .hash-input-icon {
    left: 10px;
    width: 14px;
    height: 14px;
  }
  .mono-input {
    font-size: 0.72rem !important;
    height: 38px;
    padding: 8px 10px 8px 32px !important;
  }
}

