/* ==========================================================================
   SureVote - Secure Online Voting System (2026 Production Design System)
   assets/css/style.css
   
   Architecture:
     1. Design Tokens & CSS Custom Properties (Light & Dark Themes)
     2. Reset & Baseline Typography
     3. Layout & Application Shell (Sidebar Rail, Topbar, Container)
     4. Core Components (Buttons, Badges, Status Pills, User Chips)
     5. Form Elements & Accessible Controls
     6. Cards, Surfaces & Elevation
     7. Alerts, Flash Stack & Notices
     8. Data Tables, Pagination & Key-Value Displays
     9. Voter Experience (Tactile Ballot UI, Review Matrix, Digital Receipts)
    10. Administrator SOC Telemetry, Threat Stream & Charts
    11. CIA Security Verification Suite Components
    12. Modals, Drawers & Empty States
    13. Responsive Reflow & Breakpoints (320px - 1920px)
    14. Accessibility (Focus rings, High-contrast, Print, Reduced Motion)
   ========================================================================== */

/* ==========================================================================
   1. Design Tokens (Light & Dark Theme Variables)
   ========================================================================== */

:root {
  /* Brand Core: Civic Emerald & Electric Blue */
  --primary:            #059669;
  --primary-hover:      #047857;
  --primary-active:     #065f46;
  --primary-light:      #ecfdf5;
  --primary-border:     #a7f3d0;
  --primary-text:       #065f46;

  --accent:             #0284c7;
  --accent-hover:       #0369a1;
  --accent-light:       #f0f9ff;
  --accent-border:      #bae6fd;

  /* Semantic Status Colors */
  --success:            #059669;
  --success-hover:      #047857;
  --success-light:      #ecfdf5;
  --success-border:     #a7f3d0;
  --success-text:       #065f46;

  --warning:            #d97706;
  --warning-hover:      #b45309;
  --warning-light:      #fffbeb;
  --warning-border:     #fde68a;
  --warning-text:       #92400e;

  --danger:             #dc2626;
  --danger-hover:       #b91c1c;
  --danger-light:       #fef2f2;
  --danger-border:      #fecaca;
  --danger-text:        #991b1b;

  --info:               #0284c7;
  --info-hover:         #0369a1;
  --info-light:         #f0f9ff;
  --info-border:        #bae6fd;
  --info-text:          #075985;

  /* Surfaces & Backgrounds (Light Slate) */
  --bg:                 #f8fafc;
  --bg-sub:             #f1f5f9;
  --surface:            #ffffff;
  --surface-2:          #f8fafc;
  --surface-3:          #f1f5f9;
  --surface-hover:      #f1f5f9;
  --surface-glass:      rgba(255, 255, 255, 0.94);
  --surface-glass-border: rgba(226, 232, 240, 0.85);

  /* Typography Colors */
  --text:               #0f172a;
  --text-secondary:     #334155;
  --text-muted:         #64748b;
  --text-light:         #94a3b8;
  --text-inverse:       #ffffff;

  /* Borders & Dividers */
  --border:             #e2e8f0;
  --border-subtle:      #f1f5f9;
  --border-strong:      #cbd5e1;
  --border-interactive: #94a3b8;

  /* Sidebar Navigation Rail (Deep Slate Obsidian) */
  --sidebar-bg:         #0b0f17;
  --sidebar-surface:    #131924;
  --sidebar-text:       #f8fafc;
  --sidebar-muted:      #94a3b8;
  --sidebar-hover:      rgba(255, 255, 255, 0.08);
  --sidebar-active-bg:  rgba(16, 185, 129, 0.16);
  --sidebar-active-bar: #10b981;
  --sidebar-border:     rgba(255, 255, 255, 0.08);

  /* Focus & Glow System */
  --focus:              #059669;
  --focus-ring:         rgba(5, 150, 105, 0.28);
  --focus-ring-danger:  rgba(220, 38, 38, 0.25);
  --glow-primary:       rgba(5, 150, 105, 0.15);

  /* Radii Scale (Modern Curved Squares) */
  --radius-xs:          5px;
  --radius-sm:          9px;
  --radius-md:          14px;
  --radius-lg:          18px;
  --radius-xl:          24px;
  --radius-full:        9999px;

  /* Elevation Shadows */
  --shadow-xs:          0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:          0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md:          0 4px 14px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg:          0 12px 30px -4px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-xl:          0 24px 48px -8px rgba(15, 23, 42, 0.16), 0 8px 16px -3px rgba(15, 23, 42, 0.06);

  /* Spacing Scale (4px/8px modular scale) */
  --sp-1:               4px;
  --sp-2:               8px;
  --sp-3:               12px;
  --sp-4:               16px;
  --sp-5:               20px;
  --sp-6:               24px;
  --sp-8:               32px;
  --sp-10:              40px;
  --sp-12:              48px;
  --sp-16:              64px;

  /* Typography System */
  --font-sans:          "Plus Jakarta Sans", "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:          "SF Mono", "JetBrains Mono", Menlo, Consolas, Monaco, "Courier New", monospace;

  /* Layout Dimensions */
  --sidebar-w:          276px;
  --topbar-h:           72px;
  --content-max:        1360px;
  --content-form:       640px;

  /* Motion Transitions */
  --tr-fast:            140ms cubic-bezier(0.4, 0, 0.2, 1);
  --tr-base:            200ms cubic-bezier(0.4, 0, 0.2, 1);
  --tr-smooth:          280ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Backward Compatibility Aliases */
  --blue:               var(--primary);
  --blue-50:            var(--primary-light);
  --blue-100:           #d1fae5;
  --blue-200:           #a7f3d0;
  --blue-600:           var(--primary);
  --blue-700:           var(--primary-hover);
  --teal:               #10b981;
  --teal-50:            #ecfdf5;
  --teal-100:           #d1fae5;
  --navy:               #0f172a;
  --navy-600:           #1e293b;
  --navy-700:           #0f172a;
  --navy-800:           #090d16;
  --clr-primary:        var(--primary);
  --border-color:       var(--border);
  --bg-card:            var(--surface);
  --bg-card-sub:        var(--surface-2);
}

/* ==========================================================================
   Dark Theme (Sleek Obsidian Charcoal & High-Contrast Emerald)
   ========================================================================== */

[data-theme="dark"] {
  --primary:            #10b981;
  --primary-hover:      #34d399;
  --primary-active:     #059669;
  --primary-light:      rgba(16, 185, 129, 0.12);
  --primary-border:     rgba(16, 185, 129, 0.3);
  --primary-text:       #6ee7b7;

  --accent:             #38bdf8;
  --accent-hover:       #7dd3fc;
  --accent-light:       rgba(56, 189, 248, 0.12);
  --accent-border:      rgba(56, 189, 248, 0.3);

  --success:            #10b981;
  --success-hover:      #34d399;
  --success-light:      rgba(16, 185, 129, 0.12);
  --success-border:     rgba(16, 185, 129, 0.3);
  --success-text:       #6ee7b7;

  --warning:            #f59e0b;
  --warning-hover:      #fbbf24;
  --warning-light:      rgba(245, 158, 11, 0.12);
  --warning-border:     rgba(245, 158, 11, 0.3);
  --warning-text:       #fde68a;

  --danger:             #ef4444;
  --danger-hover:       #f87171;
  --danger-light:       rgba(239, 68, 68, 0.12);
  --danger-border:      rgba(239, 68, 68, 0.3);
  --danger-text:        #fca5a5;

  --info:               #38bdf8;
  --info-hover:         #7dd3fc;
  --info-light:         rgba(56, 189, 248, 0.12);
  --info-border:        rgba(56, 189, 248, 0.3);
  --info-text:          #bae6fd;

  --bg:                 #0b0d12;
  --bg-sub:             #10131a;
  --surface:            #141722;
  --surface-2:          #1a1f2e;
  --surface-3:          #22283a;
  --surface-hover:      #1e2436;
  --surface-glass:      rgba(20, 23, 34, 0.92);
  --surface-glass-border: rgba(255, 255, 255, 0.08);

  --text:               #f8fafc;
  --text-secondary:     #cbd5e1;
  --text-muted:         #94a3b8;
  --text-light:         #64748b;
  --text-inverse:       #0b0d12;

  --border:             #1e2436;
  --border-subtle:      #161b28;
  --border-strong:      #2a334a;
  --border-interactive: #475569;

  --sidebar-bg:         #07090e;
  --sidebar-surface:    #0f131c;
  --sidebar-border:     rgba(255, 255, 255, 0.06);

  --focus-ring:         rgba(16, 185, 129, 0.35);
  --focus-ring-danger:  rgba(239, 68, 68, 0.35);
  --glow-primary:       rgba(16, 185, 129, 0.2);

  --shadow-xs:          0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:          0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md:          0 6px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg:          0 14px 32px rgba(0, 0, 0, 0.6);
  --shadow-xl:          0 24px 48px rgba(0, 0, 0, 0.7);

  --blue:               var(--primary);
  --blue-50:            var(--primary-light);
  --blue-100:           rgba(16, 185, 129, 0.2);
  --blue-200:           rgba(16, 185, 129, 0.3);
  --teal:               var(--primary);
  --teal-50:            rgba(16, 185, 129, 0.12);
  --teal-100:           rgba(16, 185, 129, 0.25);
  --navy-600:           #1e293b;
  --border-color:       var(--border);
  --bg-card:            var(--surface);
  --bg-card-sub:        var(--surface-2);
}

/* ==========================================================================
   2. Reset & Baseline Typography
   ========================================================================== */

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.6rem, 2.5vw, 2.2rem); }
h2 { font-size: clamp(1.3rem, 2vw, 1.65rem); }
h3 { font-size: clamp(1.1rem, 1.5vw, 1.3rem); }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.95rem; }
h6 { font-size: 0.85rem; }

p {
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--tr-fast);
}

a:hover {
  color: var(--primary-hover);
}

a.link {
  text-decoration: underline;
  text-underline-offset: 3px;
}

code, kbd, samp, pre, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.88em;
  white-space: nowrap;
  word-break: keep-all;
}

code {
  display: inline-block;
  white-space: nowrap !important;
  word-break: keep-all !important;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--primary);
  line-height: 1.35;
}

ul, ol {
  list-style: none;
}

img, svg {
  vertical-align: middle;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

/* Accessibility Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  z-index: 9999;
  padding: var(--sp-2) var(--sp-4);
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transition: top var(--tr-fast);
}

.skip-link:focus {
  top: var(--sp-4);
  outline: 3px solid #ffffff;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==========================================================================
   3. Layout & Application Shell
   ========================================================================== */

.app-shell {
  min-height: 100vh;
  display: flex;
  background-color: var(--bg);
}

/* Authenticated Layout with Sidebar Rail */
.app-shell--app {
  display: flex;
}

.app-shell--app .shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--tr-base);
}

/* Portal / Public Layout (No Sidebar) */
.app-shell--portal .shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: 0;
}

/* Auth Layout (Centered Minimalist Surface) */
.app-shell--auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  padding: clamp(8px, 1.8vh, 20px) var(--sp-4);
  background: radial-gradient(circle at 50% 10%, var(--surface-2) 0%, var(--bg) 70%);
  overflow-y: auto;
  box-sizing: border-box;
}

.auth-layout {
  width: 100%;
  max-width: 440px;
  padding: 0;
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-main {
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Sidebar Navigation Rail */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  color: var(--sidebar-text);
  box-shadow: var(--shadow-sm);
}

.sidebar__head {
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar__close {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.sidebar .brand {
  color: #ffffff;
}

.brand__mark {
  color: var(--primary);
  flex-shrink: 0;
}

.brand__mark--sm {
  width: 20px;
  height: 20px;
}

.brand__word {
  font-weight: 800;
}

.brand__word span {
  color: var(--primary);
}

.brand--lg {
  font-size: 1.5rem;
}

/* Nav Groups & Items */
.nav {
  flex: 1;
  padding: var(--sp-5) var(--sp-3);
}

.nav__group {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  margin-top: var(--sp-2);
}

.nav__group:first-child {
  margin-top: 0;
}

.nav__list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--tr-fast);
  position: relative;
}

.nav__item:hover {
  color: #ffffff;
  background-color: var(--sidebar-hover);
}

.nav__item.is-active {
  color: #ffffff;
  background-color: var(--sidebar-active-bg);
  font-weight: 700;
}

.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  border-radius: var(--radius-full);
  background-color: var(--sidebar-active-bar);
}

.nav__icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.nav__item.is-active .nav__icon {
  opacity: 1;
  color: var(--sidebar-active-bar);
}

.nav__item--button {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

/* Sidebar Footer & User Chip */
.sidebar__foot {
  padding: var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--sidebar-border);
  background-color: var(--sidebar-surface);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.user-chip__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.user-chip__name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip__meta {
  font-size: 0.75rem;
  color: var(--sidebar-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background-color: var(--success);
  flex-shrink: 0;
}

.status-dot--online {
  background-color: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

/* Avatar Component */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.avatar--sm { width: 32px; height: 32px; font-size: 0.78rem; }
.avatar--md { width: 42px; height: 42px; font-size: 0.95rem; }
.avatar--lg { width: 56px; height: 56px; font-size: 1.25rem; }

/* Topbar Header */
.topbar {
  height: var(--topbar-h);
  background-color: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  padding: 0 clamp(var(--sp-4), 3vw, var(--sp-8));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-width: 0;
}

.topbar__menu {
  display: none;
}

.topbar__titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.breadcrumb__separator {
  display: inline-flex;
  color: var(--text-light);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  position: relative;
  overflow: hidden;
}

.theme-icon--sun { display: block; }
.theme-icon--moon { display: none; }

[data-theme="dark"] .theme-icon--sun { display: none; }
[data-theme="dark"] .theme-icon--moon { display: block; }

/* Main Content Area */
.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(var(--sp-4), 3vw, var(--sp-8));
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.content > * {
  min-width: 0;
  width: 100%;
}

/* ==========================================================================
   4. Core Components (Buttons, Badges, Icons)
   ========================================================================== */

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--tr-fast);
  user-select: none;
  white-space: nowrap;
  min-height: 42px;
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn:disabled, .btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn__icon {
  flex-shrink: 0;
}

/* Button Variants */
.btn--primary {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}

.btn--primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn--primary:active {
  background-color: var(--primary-active);
}

.btn--secondary {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.btn--secondary:hover {
  background-color: var(--surface-hover);
  border-color: var(--border-interactive);
  color: var(--text);
}

.btn--google {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

.btn--google:hover {
  background-color: var(--surface-hover);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.btn--success {
  background-color: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.btn--success:hover {
  background-color: var(--success-hover);
  color: #ffffff;
}

.btn--danger {
  background-color: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn--danger:hover {
  background-color: var(--danger-hover);
  color: #ffffff;
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn--ghost:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}

.btn--outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn--outline:hover {
  background-color: var(--primary-light);
}

/* Button Sizes */
.btn--xs {
  padding: 4px 10px;
  font-size: 0.78rem;
  min-height: 28px;
  border-radius: var(--radius-xs);
}

.btn--sm {
  padding: 6px 14px;
  font-size: 0.85rem;
  min-height: 36px;
  border-radius: var(--radius-xs);
}

.btn--lg {
  padding: 12px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  min-height: 48px;
  border-radius: var(--radius-md);
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn-group {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--tr-fast);
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-interactive);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Badge Component */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge--primary {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.badge--success {
  background-color: var(--success-light);
  color: var(--success);
  border-color: var(--success-border);
}

.badge--warning {
  background-color: var(--warning-light);
  color: var(--warning);
  border-color: var(--warning-border);
}

.badge--danger {
  background-color: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger-border);
}

.badge--info {
  background-color: var(--info-light);
  color: var(--info);
  border-color: var(--info-border);
}

.badge--neutral {
  background-color: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

.badge--teal {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge--navy {
  background-color: var(--navy-600);
  color: #ffffff;
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: currentColor;
}

/* Status Badge Component (Verification Suite & Telemetry) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  width: auto;
  height: auto;
}

.status-pill--pass {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.status-pill--warning {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.status-pill--fail {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.status-pill--not_testable {
  background-color: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

[data-theme="dark"] .status-pill--pass {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .status-pill--warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .status-pill--fail {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .status-pill--not_testable {
  background-color: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

/* ==========================================================================
   5. Form Elements & Accessible Controls
   ========================================================================== */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-4);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field--full {
  grid-column: 1 / -1;
}

.label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label__required {
  color: var(--danger);
  margin-left: 3px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  transition: all var(--tr-fast);
  box-shadow: var(--shadow-xs);
  min-height: 44px;
}

.input:hover, .select:hover, .textarea:hover {
  border-color: var(--border-interactive);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input.is-invalid, .select.is-invalid, .textarea.is-invalid {
  border-color: var(--danger);
  background-color: var(--danger-light);
}

.input.is-invalid:focus, .select.is-invalid:focus, .textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--focus-ring-danger);
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

.field-error {
  font-size: 0.82rem;
  color: var(--danger);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

.field__help, .help {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Password Toggle Field */
.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrap .input {
  padding-right: 46px;
}

.btn-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-password-toggle:hover {
  color: var(--text);
}

.btn-password-toggle:focus-visible {
  outline: 2px solid var(--focus);
}

/* Search Field */
.search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-field__icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-field .input {
  padding-left: 38px;
}

/* Auth Separator */
.auth-separator {
  position: relative;
  text-align: center;
  margin: clamp(6px, 1.2vh, 12px) 0;
}

.auth-separator::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--border);
}

.auth-separator span {
  position: relative;
  background-color: var(--surface);
  padding: 0 var(--sp-3);
  font-size: clamp(0.7rem, 1.1vh, 0.76rem);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.divider {
  height: 1px;
  background-color: var(--border);
  margin: clamp(6px, 1.2vh, 12px) 0;
}

/* ==========================================================================
   6. Cards, Surfaces & Elevation
   ========================================================================== */

.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}

.card--interactive:hover {
  border-color: var(--border-interactive);
  box-shadow: var(--shadow-md);
}

.card__header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.card__headings {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.card__subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.card__body {
  padding: var(--sp-6);
  flex: 1;
}

.card__footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background-color: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* Hero Card (Public Welcome Surface) */
.hero-card {
  background: radial-gradient(circle at 10% 20%, var(--surface-2) 0%, var(--surface) 80%);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--sp-8);
  border-radius: var(--radius-lg);
}

.hero-card__body {
  padding: clamp(var(--sp-6), 4vw, var(--sp-10));
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--sp-8);
  align-items: center;
}

.hero-title {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: var(--sp-3);
}

.hero-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.hero-pillars {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
}

.hero-pillars__title {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: var(--sp-4);
  color: var(--text);
}

.hero-pillars__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.hero-pillars__list li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.hero-pillars__icon {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Step Guide Cards */
.step-guide-card {
  padding: var(--sp-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.step-guide-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.step-guide-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* Auth Card Surface */
.auth-card {
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: clamp(14px, 2.2vh, 26px) clamp(16px, 3vw, 26px);
  box-shadow: var(--shadow-lg);
}

.auth-card__head {
  text-align: center;
  margin-bottom: clamp(6px, 1.2vh, 14px);
}

.auth-card__head .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: clamp(2px, 0.5vh, 6px);
}

.auth-card__head .brand svg {
  width: clamp(26px, 3.2vh, 32px);
  height: clamp(26px, 3.2vh, 32px);
}

.auth-card__head .brand__word {
  font-size: clamp(1.1rem, 1.8vh, 1.3rem);
}

.auth-card__title {
  font-size: clamp(1.2rem, 2vh, 1.45rem);
  font-weight: 800;
  margin-top: 2px;
  line-height: 1.2;
}

.auth-card__text {
  font-size: clamp(0.78rem, 1.2vh, 0.85rem);
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* Auth Alerts & Flash Stack */
.auth-layout .flash-stack {
  margin-bottom: clamp(6px, 1.2vh, 12px);
  gap: clamp(4px, 0.8vh, 8px);
}

.auth-layout .alert {
  padding: clamp(6px, 1vh, 10px) clamp(10px, 1.5vw, 14px);
  font-size: clamp(0.8rem, 1.2vh, 0.86rem);
  border-radius: var(--radius-sm);
}

/* Auth Card Forms & Inputs */
.auth-card .form {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.1vh, 10px);
}

.auth-card .form-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-card .label {
  font-size: clamp(0.76rem, 1.1vh, 0.82rem);
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.2;
}

.auth-card .input,
.auth-card .select {
  min-height: clamp(34px, 4.2vh, 38px);
  height: clamp(34px, 4.2vh, 38px);
  padding: 4px 12px;
  font-size: clamp(0.82rem, 1.2vh, 0.88rem);
}

.auth-card .input-password-wrap .btn-password-toggle {
  width: clamp(34px, 4.2vh, 38px);
  height: clamp(34px, 4.2vh, 38px);
}

.auth-card .btn--google {
  min-height: clamp(34px, 4.2vh, 40px);
  height: clamp(34px, 4.2vh, 40px);
  font-size: clamp(0.82rem, 1.2vh, 0.88rem);
  padding: 0 14px;
}

.auth-card .form-actions {
  margin-top: clamp(4px, 1vh, 8px);
}

.auth-card .form-actions .btn {
  min-height: clamp(36px, 4.4vh, 40px);
  height: clamp(36px, 4.4vh, 40px);
  font-size: clamp(0.84rem, 1.3vh, 0.9rem);
  padding: 0 16px;
}

.auth-card .stack-sm {
  margin-bottom: clamp(6px, 1.2vh, 10px);
}

.auth-card .stack-xs {
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.5vh, 5px);
}

.auth-card .text-center.stack-xs .text-sm {
  font-size: clamp(0.76rem, 1.1vh, 0.82rem);
  margin: 0;
}

.auth-card .btn--secondary {
  min-height: clamp(30px, 3.6vh, 36px);
  height: clamp(30px, 3.6vh, 36px);
  font-size: clamp(0.78rem, 1.2vh, 0.84rem);
  padding: 0 12px;
}

.auth-card .field-error {
  font-size: 0.74rem;
  margin-top: 2px;
}

/* Security and Legal Notice below card */
.auth-footnote {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  width: 100% !important;
  gap: 6px;
  font-size: clamp(0.74rem, 1.2vh, 0.8rem) !important;
  line-height: 1.35;
  margin-top: clamp(6px, 1vh, 10px) !important;
  opacity: 0.85;
}

.auth-footnote-sub {
  display: block !important;
  text-align: center !important;
  width: 100% !important;
  font-size: clamp(0.74rem, 1.2vh, 0.8rem) !important;
  line-height: 1.4;
  margin-top: clamp(3px, 0.6vh, 6px) !important;
  opacity: 0.85;
}

.auth-footnote-sub a {
  color: var(--text-secondary) !important;
  text-decoration: underline !important;
  transition: color var(--tr-fast);
}

.auth-footnote-sub a:hover {
  color: var(--primary) !important;
}

.auth-main > p.text-muted,
.auth-layout > p.text-muted {
  font-size: clamp(0.74rem, 1.2vh, 0.8rem);
  text-align: center;
  line-height: 1.35;
  margin-top: clamp(4px, 0.8vh, 8px);
  opacity: 0.85;
}

/* Specific enhancements for register page */
.page-register .password-checks {
  list-style: none;
  display: grid;
  gap: 2px;
  padding: 0;
  margin: 7px 0 0;
  font-size: 0.78rem;
  line-height: 1.3;
}

.page-register .password-checks li,
.page-register .password-checks__match {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text-muted);
}

.page-register .password-checks__match { margin-top: 7px; font-size: 0.78rem; line-height: 1.3; }
.page-register .password-checks__icon { flex: 0 0 17px; width: 17px; text-align: center; font-size: 1rem; font-weight: 800; line-height: 1; }
.page-register .password-checks li[data-state="pass"],
.page-register .password-checks__match[data-state="pass"] { color: var(--success-text); }
.page-register .password-checks li[data-state="fail"],
.page-register .password-checks__match[data-state="fail"] { color: var(--danger-text); }

.page-register .auth-layout {
  max-width: 520px;
}

.page-register .auth-card {
  max-width: 520px;
}

.page-register .auth-card .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(6px, 1vw, 10px);
}

@media (max-width: 480px) {
  .page-register .auth-card .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Extra Height-Constrained Media Query (e.g. Laptops < 650px height or split screens) */
@media (max-height: 650px) {
  .app-shell--auth {
    padding: 6px var(--sp-3);
  }
  .auth-card {
    padding: 12px 18px;
  }
  .auth-card__head {
    margin-bottom: 6px;
  }
  .auth-separator, .divider {
    margin: 4px 0;
  }
  .auth-card .form {
    gap: 4px;
  }
  .auth-card .input, .auth-card .select {
    min-height: 32px;
    height: 32px;
  }
  .auth-card .btn--google,
  .auth-card .form-actions .btn {
    min-height: 34px;
    height: 34px;
  }
}

/* ==========================================================================
   7. Alerts, Flash Stack & Notices
   ========================================================================== */

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.92rem;
  line-height: 1.5;
  box-shadow: var(--shadow-xs);
  position: relative;
  transition: opacity var(--tr-fast), transform var(--tr-fast);
}

.alert__icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.alert__text {
  flex: 1;
  color: inherit;
}

.alert__close {
  background: transparent;
  border: none;
  color: currentColor;
  opacity: 0.65;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.alert__close:hover {
  opacity: 1;
}

.alert--success {
  background-color: var(--success-light);
  border-color: var(--success-border);
  color: var(--success-text);
}

.alert--warning {
  background-color: var(--warning-light);
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.alert--danger {
  background-color: var(--danger-light);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.alert--info {
  background-color: var(--info-light);
  border-color: var(--info-border);
  color: var(--info-text);
}

/* Security Note & Notices */
.security-note, .notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   8. Data Tables, Pagination & Key-Value Displays
   ========================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.table th {
  padding: 12px var(--sp-4);
  background-color: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 14px var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
  line-height: 1.4;
}

.table td code,
.table th code {
  display: inline-block;
  white-space: nowrap !important;
  word-break: keep-all !important;
}

/* Draw a divider once per row so every column ends at the same height. */
.table:not(.profile-history-table):not(.voter-results-list-table) tbody tr {
  border-bottom: 1px solid var(--border);
}

.table:not(.profile-history-table):not(.voter-results-list-table) tbody tr:last-child {
  border-bottom: 0;
}

.table:not(.profile-history-table):not(.voter-results-list-table) tbody td {
  border-bottom: 0;
}

/* Keep legacy strong-text cells in the table grid while pages transition to inner spans. */
.table td.table__cell-strong {
  display: table-cell;
}

.table tr:hover td {
  background-color: var(--surface-hover);
}

.table--compact td {
  padding: 10px var(--sp-3);
  font-size: 0.84rem;
}

.table--compact th {
  padding: 9px var(--sp-3);
}

.table__cell-strong {
  display: block;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.table__cell-strong a {
  color: var(--primary);
  text-decoration: none;
}

.table__cell-strong a:hover {
  text-decoration: underline;
}

.table__cell-sub {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 3px;
}

.table__cell-sub.mono {
  font-family: var(--font-mono);
}

.table__cell-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.table td a:not(.btn):not(.badge) {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.table td a:not(.btn):not(.badge):hover {
  text-decoration: underline;
}

.table__actions-col {
  text-align: right;
  white-space: nowrap;
}

.table__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  white-space: nowrap;
}

.table__actions form {
  display: inline-flex;
  margin: 0;
}

.nowrap {
  white-space: nowrap !important;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  background-color: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  width: 100%;
}

.table-toolbar .search-field {
  flex: 1 1 240px;
  max-width: 360px;
  width: auto;
  min-width: 180px;
}

.table-toolbar .search-field .input {
  width: 100%;
  height: 38px;
  min-height: 38px;
  font-size: 0.88rem;
  padding: 6px 12px 6px 36px;
}

.table-toolbar .row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  flex: 1 1 auto;
  justify-content: flex-end;
  width: auto;
}

.table-toolbar .select {
  width: auto;
  min-width: 130px;
  max-width: 210px;
  height: 38px;
  min-height: 38px;
  font-size: 0.88rem;
  padding: 6px 28px 6px 10px;
  flex: 0 1 auto;
}

.table-toolbar input[type="date"] {
  width: auto;
  min-width: 130px;
  max-width: 155px;
  height: 38px;
  min-height: 38px;
  font-size: 0.88rem;
  padding: 6px 10px;
  flex: 0 1 auto;
}

.table-toolbar .btn {
  height: 38px;
  min-height: 38px;
  padding: 6px 14px;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.table-toolbar .btn--sm {
  height: 36px;
  min-height: 36px;
  padding: 6px 12px;
}

form.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

form.row .select {
  width: auto;
  max-width: 440px;
  flex: 1 1 240px;
}

.row > .select,
.row > .input {
  width: auto;
}

/* Key-Value (KV) Display */
.kv {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.kv__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.kv__row:last-child {
  border-bottom: none;
}

.kv__key {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.kv__value {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: right;
}

/* Grid Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
}

.stack-xs { display: flex; flex-direction: column; gap: var(--sp-1); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack    { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-md { display: flex; flex-direction: column; gap: var(--sp-6); }

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.row--between {
  justify-content: space-between;
}

.row--center {
  justify-content: center;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

/* Spacing & Margin Utilities */
.mb-1 { margin-bottom: var(--sp-1) !important; }
.mb-2 { margin-bottom: var(--sp-2) !important; }
.mb-3 { margin-bottom: var(--sp-3) !important; }
.mb-4 { margin-bottom: var(--sp-4) !important; }
.mb-5 { margin-bottom: var(--sp-5) !important; }
.mb-6 { margin-bottom: var(--sp-6) !important; }
.mb-8 { margin-bottom: var(--sp-8) !important; }
.mb-10 { margin-bottom: var(--sp-10) !important; }
.mb-12 { margin-bottom: var(--sp-12) !important; }

.mt-1 { margin-top: var(--sp-1) !important; }
.mt-2 { margin-top: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-3) !important; }
.mt-4 { margin-top: var(--sp-4) !important; }
.mt-5 { margin-top: var(--sp-5) !important; }
.mt-6 { margin-top: var(--sp-6) !important; }
.mt-8 { margin-top: var(--sp-8) !important; }
.mt-10 { margin-top: var(--sp-10) !important; }

.my-1 { margin-top: var(--sp-1) !important; margin-bottom: var(--sp-1) !important; }
.my-2 { margin-top: var(--sp-2) !important; margin-bottom: var(--sp-2) !important; }
.my-3 { margin-top: var(--sp-3) !important; margin-bottom: var(--sp-3) !important; }
.my-4 { margin-top: var(--sp-4) !important; margin-bottom: var(--sp-4) !important; }
.my-6 { margin-top: var(--sp-6) !important; margin-bottom: var(--sp-6) !important; }
.my-8 { margin-top: var(--sp-8) !important; margin-bottom: var(--sp-8) !important; }

.mx-auto { margin-left: auto !important; margin-right: auto !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: var(--sp-2) !important; }
.p-4 { padding: var(--sp-4) !important; }
.p-6 { padding: var(--sp-6) !important; }

/* ==========================================================================
   9. Voter Experience (Tactile Ballot UI, Review & Receipt)
   ========================================================================== */

/* Voter Code Badge & Reference Codes */
.voter-code-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  word-break: keep-all;
  flex-shrink: 0;
}

.reference-code {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.05em;
  white-space: nowrap;
  word-break: keep-all;
}

.reference-code--sm {
  font-size: 0.88rem;
  padding: 3px 8px;
}

.sec-code-badge {
  display: inline-block;
  white-space: nowrap !important;
  word-break: keep-all !important;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.03em;
}

/* Ballot Layout & Position Sections */
.ballot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

.ballot__position {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}

.ballot__position-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.ballot__position-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
}

.ballot__hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.ballot__counter {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ballot__counter.is-full {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Interactive Candidate Choice Cards */
.ballot__candidates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-4);
}

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--tr-fast);
  user-select: none;
}

.choice:hover {
  border-color: var(--border-interactive);
  background: var(--surface);
}

.choice__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.choice__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.choice__party {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.choice__bio {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.choice__tick {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  background: var(--surface);
  flex-shrink: 0;
  transition: all var(--tr-fast);
}

/* Choice Checked State */
.choice:has(.choice__input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.choice:has(.choice__input:checked) .choice__tick {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.bio-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  margin-top: 4px;
}

.candidate-bio-collapse {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--border-strong);
}

/* Ballot Sticky Foot */
.ballot__foot {
  position: sticky;
  bottom: var(--sp-4);
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-6);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.ballot__foot-note {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

/* Review Summary Metrics */
.review-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
}

.review-summary__metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  text-align: center;
}

.review-summary__metric-number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  font-family: var(--font-mono);
}

.review-summary__metric-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.candidate-summary-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.candidate-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.candidate-summary-item__name {
  font-weight: 700;
  color: var(--text);
}

.candidate-summary-item__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 700;
}

/* Confirmation Page */
.confirmation {
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.confirmation__icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--success-light);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-4);
  box-shadow: 0 0 0 8px rgba(5, 150, 105, 0.1);
}

.confirmation__title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: var(--sp-2);
}

.confirmation__text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
}

/* ==========================================================================
   10. Administrator SOC Telemetry, Threat Stream & Charts
   ========================================================================== */

/* SOC Header Card & Pulse Status */
.soc-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}

.soc-header-info {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.soc-pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.soc-pulse-badge--secure, .soc-pulse-badge--success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.soc-pulse-badge--warning, .soc-pulse-badge--warn {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.soc-pulse-badge--danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.soc-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: currentColor;
  box-shadow: 0 0 0 3px currentColor;
  opacity: 0.85;
}

/* SOC Status Banner */
.soc-status-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.soc-status-banner--secure { border-left: 5px solid var(--success); }
.soc-status-banner--warning { border-left: 5px solid var(--warning); }
.soc-status-banner--danger { border-left: 5px solid var(--danger); }

.soc-status-banner__left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex: 1;
  min-width: 280px;
}

.soc-status-banner__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.soc-status-banner__title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 2px 0;
}

.soc-status-banner__desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

/* SOC Stat Grid (Equal 4-Column Balanced Grid: 2 rows x 4 equal cards) */
.soc-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

@media (max-width: 1100px) {
  .soc-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .soc-stat-grid {
    grid-template-columns: 1fr;
  }
}

.soc-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.soc-stat-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.soc-stat-card__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--primary);
}

.soc-stat-card__icon--navy { background: var(--surface-2); color: var(--accent); border: 1px solid var(--border-strong); }
.soc-stat-card__icon--danger { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }
.soc-stat-card__icon--success { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.soc-stat-card__icon--warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.soc-stat-card__icon--teal { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }

.soc-stat-card__label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.soc-stat-card__value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.1;
  margin: 0;
}

.soc-stat-card__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* SOC System Health Grid */
.soc-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3);
}

@media (min-width: 1200px) {
  .soc-health-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.soc-health-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: all var(--tr-fast);
}

.soc-health-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-interactive);
}

.soc-health-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}

.soc-health-item__header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.soc-health-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--success);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
  flex-shrink: 0;
}

.soc-health-dot--warning {
  background-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

.soc-health-item__title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin: 0;
}

.soc-health-item__meta {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  word-break: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Time Range Filters */
.soc-range-pills {
  display: inline-flex;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 2px;
}

.soc-range-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  box-shadow: none;
  transition: all var(--tr-fast);
}

.soc-range-pill:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.soc-range-pill.is-active {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

/* SOC Chart Wrappers & Telemetry SVG */
.soc-chart-wrap {
  width: 100%;
  overflow-x: auto;
  padding: var(--sp-3) 0;
}

.soc-chart-svg {
  width: 100%;
  min-width: 480px;
  height: auto;
}

.soc-legend {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.soc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.soc-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-xs);
}

/* SOC Metrics List */
.soc-metric-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.soc-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.soc-metric-row:last-child {
  border-bottom: none;
}

.soc-metric-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.soc-metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

/* SOC Live Feed Stream */
.soc-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.soc-feed-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 120px 150px 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  font-size: 0.86rem;
}

.soc-feed-item:last-child {
  border-bottom: none;
}

.soc-feed-time {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.soc-feed-actor {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.soc-feed-user {
  font-weight: 700;
  color: var(--text);
}

.soc-feed-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.soc-feed-desc {
  color: var(--text-secondary);
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.soc-feed-ip {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}

@media (max-width: 768px) {
  .soc-feed-item {
    grid-template-columns: 100px 1fr auto;
  }
  .soc-feed-desc {
    display: none;
  }
}

/* ==========================================================================
   11. CIA Security Verification Suite Components
   ========================================================================== */

.cia-hub {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  margin-bottom: var(--sp-8);
}

.cia-triad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
}

.cia-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-4);
}

.cia-card--c { border-top: 4px solid var(--primary); }
.cia-card--i { border-top: 4px solid var(--accent); }
.cia-card--a { border-top: 4px solid var(--teal); }

.cia-card__letter {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.cia-card__title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
}

.cia-card__desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.cia-pills {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.cia-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
  transition: all var(--tr-fast);
}

.cia-pill:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.cia-pill.is-active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  font-weight: 700;
}

.cia-check-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.cia-check-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.test-detail-box {
  padding: var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ==========================================================================
   12. Modals, Drawers & Empty States
   ========================================================================== */

/* Modal Backdrop & Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 15, 23, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}

dialog.modal {
  position: fixed;
  inset: 0;
  margin: auto;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 48px);
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  color: var(--text);
  z-index: 1000;
  overflow: hidden;
}

dialog.modal:not([open]) {
  display: none;
}

dialog.modal[open] {
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

dialog.modal::backdrop {
  background-color: rgba(11, 15, 23, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: backdropFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal > form {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  margin: 0;
}

.modal__header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--surface);
}

.modal__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.modal__body {
  padding: var(--sp-6);
  overflow-y: auto;
  max-height: 65vh;
}

.modal__footer {
  padding: var(--sp-4) var(--sp-6);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Empty States */
.empty-state {
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-state__icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-4);
}

.empty-state__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-1);
}

.empty-state__text {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 440px;
}

.empty-state--inline {
  padding: var(--sp-6) var(--sp-4);
}

/* Stat Grid & Metric Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.stat-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.stat-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1100px) {
  .stat-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 800px) {
  .stat-grid--3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .stat-grid--4 {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
}

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--primary);
  flex-shrink: 0;
}

.stat-card__icon--navy { background: var(--surface-2); color: var(--accent); border: 1px solid var(--border-strong); }
.stat-card__icon--warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.stat-card__icon--teal { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.stat-card__icon--success { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }

.stat-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-card__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.15;
  margin: 2px 0;
}

.stat-card__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* Review Items */
.review-item {
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--tr-fast);
}

.review-item:hover {
  border-color: var(--border-interactive);
}

.review-item__choice {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.review-item__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Results Tally Groups & Candidate Progress Bars */
.result-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.result-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: all var(--tr-fast);
}

.result-row--winner {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary-border);
}

.result-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.result-row__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-row__meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.result-row__count {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

.progress {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress__bar {
  display: block;
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress__bar--winner {
  background: linear-gradient(90deg, var(--primary), #10b981) !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.progress__label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: var(--sp-2);
  line-height: 1.5;
}

/* Tabs & Pagination */
.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  box-shadow: none;
  transition: all var(--tr-fast);
}

.tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.tab.is-active {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
  flex-wrap: wrap;
}

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

.pagination__controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination__page {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.pagination__page.is-active, .pagination__page[aria-current="page"] {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==========================================================================
   13. Responsive Reflow & Breakpoints
   ========================================================================== */

/* Mobile Drawer Backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 15, 23, 0.65);
  backdrop-filter: blur(4px);
  z-index: 95;
}

/* Desktop Sidebar & Shell Fixed Rail (>= 901px) */
@media (min-width: 901px) {
  .app-shell--app .shell {
    margin-left: var(--sidebar-w) !important;
  }

  .sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: var(--sidebar-w) !important;
    transform: none !important;
  }

  .topbar__menu {
    display: none !important;
  }

  .sidebar__close {
    display: none !important;
  }

  .sidebar-backdrop {
    display: none !important;
  }
}

/* Tablet & Mobile Drawer (< 901px) */
@media (max-width: 900px) {
  .app-shell--app .shell {
    margin-left: 0 !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--tr-smooth);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar.is-open .sidebar__close {
    display: inline-flex !important;
  }

  .sidebar:not(.is-open) .sidebar__close {
    display: none !important;
  }

  .topbar__menu {
    display: inline-flex !important;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }

  .cia-triad-grid {
    grid-template-columns: 1fr;
  }
}

/* Smartphone (< 640px) */
@media (max-width: 640px) {
  :root {
    --topbar-h: 64px;
  }

  .content {
    padding: var(--sp-4);
  }

  .card__header, .card__body, .card__footer {
    padding: var(--sp-4);
  }

  .hero-card__body {
    padding: var(--sp-5);
  }

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

  .ballot__foot .btn-group {
    display: flex;
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .topbar .btn {
    width: auto;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: var(--sp-4);
    gap: var(--sp-3);
  }

  .table-toolbar .search-field {
    max-width: 100%;
    width: 100%;
  }

  .table-toolbar .row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: var(--sp-2);
  }

  .table-toolbar .select,
  .table-toolbar input[type="date"],
  .table-toolbar .btn {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ==========================================================================
   14. Footer
   ========================================================================== */

.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text-muted);
  font-size: 0.8125rem;
  padding: var(--sp-4) clamp(var(--sp-4), 3vw, var(--sp-8));
  position: relative;
  z-index: 10;
}

.app-footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  max-width: var(--container-max);
  margin: 0 auto;
}

.app-footer__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.app-footer__title {
  font-weight: 700;
  color: var(--text);
  font-size: 0.875rem;
}

.app-footer__ver {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.app-footer__legal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.app-footer__links {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.app-footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--tr-fast);
}

.app-footer__links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .app-footer__row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }

}

/* ==========================================================================
   14. Accessibility, Print & Motion Settings
   ========================================================================== */

/* Focus Rings */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print Stylesheet for Official Receipts & Certified Tallies */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .sidebar, .topbar, .app-footer, .btn, .theme-toggle-btn, .sidebar-backdrop {
    display: none !important;
  }

  .app-shell--app .shell {
    margin-left: 0 !important;
  }

  .card {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
  }

  .reference-code {
    border: 2px solid #000000 !important;
    color: #000000 !important;
    background: transparent !important;
  }
}

.alert-tab-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
