/* ==========================================================================
   e·Voto — Application Stylesheet
   Design system: Ammodo-inspired, monochrome, typography-led, no decoration.
   Architecture: Tokens → Reset → Utilities → Typography → Focus →
                 Layout → Components → Pages → Responsive
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  /* Brand palette */
  --color-brand-1: #000000;
  --color-brand-2: #262626;
  --color-brand-3: #c0c0c0;
  --color-brand-4: #e2e2e2;

  /* Neutral scale */
  --color-black:   #000000;
  --color-grey900: #111111;
  --color-grey800: #222222;
  --color-grey700: #333333;
  --color-grey600: #444444;
  --color-grey500: #666666;
  --color-grey400: #888888;
  --color-grey300: #aaaaaa;
  --color-grey200: #d4d4d4;
  --color-grey150: #ebebeb;
  --color-grey100: #f4f4f4;
  --color-white:   #ffffff;

  /* Semantic — backgrounds */
  --bg-primary:   #ffffff;
  --bg-secondary: #f4f4f4;
  --bg-alternate: #000000;
  --bg-error:     #fef3f2;
  --bg-success:   #ecfdf3;
  --bg-warning:   #fffbeb;
  --bg-info:      #eff6ff;

  /* Semantic — text */
  --text-primary:   #000000;
  --text-secondary: #444444;
  --text-muted:     #666666;
  --text-disabled:  #aaaaaa;
  --text-white:     #ffffff;
  --text-error:     #b42318;
  --text-success:   #027a48;
  --text-warning:   #92400e;
  --text-info:      #1e40af;

  /* Semantic — borders */
  --border-primary:   #000000;
  --border-secondary: #d4d4d4;
  --border-muted:     #ebebeb;
  --border-error:     #fda29b;
  --border-success:   #6ce9a6;

  /* Semantic — status colors */
  --status-draft:      #666666;
  --status-scheduled:  #1e40af;
  --status-open:       #027a48;
  --status-closed:     #5b21b6;
  --status-cancelled:  #b42318;

  /* System feedback */
  --color-error:   #b42318;
  --color-success: #027a48;
  --color-warning: #d97706;
  --color-info:    #1e40af;

  /* Accent (used only for trust indicators / highlights) */
  --accent-pink:  #ff2397;
  --accent-blue:  #084df9;
  --accent-green: #3ecc44;

  /* Focus ring — distinct from monochromatic palette */
  --focus-ring: #4d65ff;

  /* Typography */
  --font-primary: 'Inter', Arial, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;

  /* Spacing scale */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Layout */
  --max-width-content: 1200px;
  --max-width-narrow:  720px;
  --sidebar-width:     240px;
  --header-height:     4rem;

  /* Transitions */
  --duration-fast:   150ms;
  --duration-normal: 250ms;
  --ease-standard: ease;
}

/* ==========================================================================
   2. RESET
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  min-height: 100%;
}

img, svg {
  display: block;
  max-width: 100%;
}

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

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

p {
  letter-spacing: -0.01em;
}

strong {
  font-weight: 600;
}

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

/* ==========================================================================
   3. FOCUS STATES
   ========================================================================== */

*:focus-visible {
  outline: 0.125rem solid var(--focus-ring);
  outline-offset: 0.125rem;
}

/* ==========================================================================
   4. REDUCED MOTION
   ========================================================================== */

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

/* ==========================================================================
   5. UTILITIES
   ========================================================================== */

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

.text-muted    { color: var(--text-muted); }
.text-error    { color: var(--text-error); }
.text-success  { color: var(--text-success); }
.text-mono     { font-family: var(--font-mono); font-size: 0.875rem; }

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2         { gap: var(--space-2); }
.gap-4         { gap: var(--space-4); }
.gap-6         { gap: var(--space-6); }

/* ==========================================================================
   6. TYPOGRAPHY
   ========================================================================== */

.heading-xl {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.heading-lg {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.heading-md {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.heading-sm {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ==========================================================================
   7. LAYOUT — APP SHELL
   ========================================================================== */

/* Splash screen shown while JS loads */
.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  z-index: 9999;
}

.splash__logo {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Two-column layout: sidebar + main content */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-shell__sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-muted);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 10;
}

.app-shell__main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* Full-width layout (login, public panels) */
.page-centered {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-5);
}

.page-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-muted);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  gap: var(--space-6);
  position: sticky;
  top: 0;
  z-index: 5;
}

.page-content {
  padding: var(--space-8);
  max-width: var(--max-width-content);
}

/* ==========================================================================
   8. COMPONENTS — BUTTONS
   No border-radius. Outlined style by default.
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem var(--space-5);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: lowercase;
  border: 1px solid transparent;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 0;
}

.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary: solid black */
.btn--primary {
  background: var(--color-black);
  color: var(--color-white);
  border-color: var(--color-black);
}

.btn--primary:hover {
  background: var(--color-grey800);
  border-color: var(--color-grey800);
  text-decoration: none;
}

/* Outline: transparent, black border */
.btn--outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-primary);
}

.btn--outline:hover {
  background: var(--bg-secondary);
  text-decoration: none;
}

/* Ghost: no border */
.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: transparent;
}

.btn--ghost:hover {
  background: var(--bg-secondary);
  text-decoration: none;
}

/* Destructive */
.btn--danger {
  background: var(--color-error);
  color: var(--color-white);
  border-color: var(--color-error);
}

.btn--danger:hover {
  background: #991b12;
  border-color: #991b12;
  text-decoration: none;
}

/* Sizes */
.btn--sm {
  padding: 0.375rem var(--space-4);
  font-size: 0.8125rem;
}

.btn--lg {
  padding: 0.875rem var(--space-8);
  font-size: 1rem;
}

.btn--full {
  width: 100%;
}

/* Loading spinner inside button */
.btn__spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ==========================================================================
   9. COMPONENTS — FORMS
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem var(--space-4);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-secondary);
  border-radius: 0;
  transition: border-color var(--duration-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-disabled);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-primary);
}

.form-input.is-invalid,
.form-textarea.is-invalid,
.form-select.is-invalid {
  border-color: var(--color-error);
  background: var(--bg-error);
}

.form-textarea {
  resize: vertical;
  min-height: 6rem;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23444' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.form-error {
  font-size: 0.8125rem;
  color: var(--text-error);
  display: none;
}

.form-error.is-visible {
  display: block;
}

/* Checkbox and radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.form-check__input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.125rem;
  flex-shrink: 0;
  border: 1px solid var(--border-secondary);
  cursor: pointer;
  accent-color: var(--color-black);
}

.form-check__label {
  font-size: 0.9375rem;
  color: var(--text-primary);
  cursor: pointer;
}

/* OTP code input */
.otp-input {
  width: 100%;
  padding: 1rem;
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.5em;
  text-align: center;
  border: 1px solid var(--border-secondary);
  border-radius: 0;
  transition: border-color var(--duration-fast);
}

.otp-input:focus {
  outline: none;
  border-color: var(--border-primary);
}

/* ==========================================================================
   10. COMPONENTS — CARDS
   Flat. Background color contrast, no shadows, no radius.
   ========================================================================== */

.card {
  background: var(--bg-primary);
  padding: var(--space-6);
}

.card--bordered {
  border: 1px solid var(--border-muted);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.card__title {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.card__body {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ==========================================================================
   11. COMPONENTS — STATUS BADGES
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2rem var(--space-3);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.badge::before {
  content: '';
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge--draft     { color: var(--status-draft);     background: var(--bg-secondary); }
.badge--scheduled { color: var(--status-scheduled); background: var(--bg-info); }
.badge--open      { color: var(--status-open);      background: var(--bg-success); }
.badge--closed    { color: var(--status-closed);    background: #f5f3ff; }
.badge--cancelled { color: var(--status-cancelled); background: var(--bg-error); }

/* ==========================================================================
   12. COMPONENTS — PROGRESS BAR
   ========================================================================== */

.progress {
  height: 0.25rem;
  background: var(--bg-secondary);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--color-black);
  transition: width var(--duration-normal) var(--ease-standard);
}

.progress__bar--success { background: var(--color-success); }

/* ==========================================================================
   13. COMPONENTS — HEADER
   ========================================================================== */

.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-muted);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-6);
}

.header__logo {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.header__logo:hover {
  text-decoration: none;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex: 1;
}

.header__nav-link {
  font-size: 0.875rem;
  font-weight: 400;
  text-transform: lowercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.header__nav-link:hover,
.header__nav-link.is-active {
  color: var(--text-primary);
  text-decoration: none;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
}

/* ==========================================================================
   14. COMPONENTS — SIDEBAR
   ========================================================================== */

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-6) 0;
}

.sidebar__logo {
  padding: 0 var(--space-5);
  margin-bottom: var(--space-8);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar__logo-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: block;
}

.sidebar__section {
  margin-bottom: var(--space-8);
}

.sidebar__section-label {
  padding: 0 var(--space-5);
  margin-bottom: var(--space-2);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-disabled);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
}

.sidebar__nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem;
  font-weight: 400;
  text-transform: lowercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--duration-fast), background var(--duration-fast);
}

.sidebar__nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  text-decoration: none;
}

.sidebar__nav-link.is-active {
  color: var(--text-primary);
  font-weight: 500;
}

.sidebar__nav--sub .sidebar__nav-link {
  padding-left: 1.5rem;
  font-size: 0.8125rem;
}

/* Upgrade button variant — outlined with accent */
.btn--upgrade {
  background: transparent;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.btn--upgrade:hover {
  background: rgba(8, 77, 249, 0.06);
  text-decoration: none;
}

.sidebar__upgrade {
  margin-bottom: var(--space-3);
}

.sidebar__footer {
  margin-top: auto;
  padding: var(--space-5);
  border-top: 1px solid var(--border-muted);
}

.sidebar__user {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  word-break: break-all;
}

/* Mobile sidebar overlay state */
.app-shell__sidebar--open {
  display: block !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 200;
}

/* Scrim shown behind sidebar when open on mobile */
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 199;
}

.sidebar-scrim--visible {
  display: block;
}

/* Hamburger toggle button — hidden on desktop, shown on mobile via responsive rules */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  color: var(--text-primary);
}

.sidebar-toggle__icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 18px;
}

.sidebar-toggle__icon span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

/* ==========================================================================
   15. COMPONENTS — LOCALE SWITCHER
   ========================================================================== */

.locale-switcher {
  position: relative;
}

.locale-switcher__btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 400;
  text-transform: lowercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-muted);
  cursor: pointer;
  border-radius: 0;
}

.locale-switcher__btn:hover {
  color: var(--text-primary);
  border-color: var(--border-secondary);
}

.locale-switcher__dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-secondary);
  min-width: 8rem;
  z-index: 100;
  display: none;
}

.locale-switcher__dropdown.is-open {
  display: block;
}

.locale-switcher__option {
  display: block;
  padding: var(--space-3) var(--space-4);
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-transform: lowercase;
}

.locale-switcher__option:hover,
.locale-switcher__option.is-active {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ==========================================================================
   16. COMPONENTS — TOAST NOTIFICATIONS
   ========================================================================== */

#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-primary);
  border: 1px solid var(--border-secondary);
  border-left: 3px solid var(--border-primary);
  min-width: 18rem;
  max-width: 26rem;
  pointer-events: all;
  animation: toastIn var(--duration-normal) var(--ease-standard);
}

.toast--success { border-left-color: var(--color-success); }
.toast--error   { border-left-color: var(--color-error); }
.toast--info    { border-left-color: var(--color-info); }

.toast__message {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.toast__close {
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  background: none;
  border: none;
}

.toast__close:hover {
  color: var(--text-primary);
}

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

/* ==========================================================================
   17. COMPONENTS — MODAL
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.modal-overlay[aria-hidden="true"] {
  display: none;
}

.modal {
  background: var(--bg-primary);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-8);
}

.modal__header {
  margin-bottom: var(--space-5);
}

.modal__title {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.modal__body {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: var(--space-8);
  line-height: 1.6;
}

.modal__footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ==========================================================================
   18. COMPONENTS — SKELETON LOADING
   ========================================================================== */

.skeleton {
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton--text {
  height: 1em;
  border-radius: 0;
}

.skeleton--heading {
  height: 1.5em;
  border-radius: 0;
}

.skeleton--card {
  height: 8rem;
  border-radius: 0;
}

.skeleton--avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}

/* ==========================================================================
   19. COMPONENTS — TABLES
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-muted);
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-muted);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: var(--bg-secondary);
}

.table tbody tr.is-highlighted td {
  background: #fef9c3;
  transition: background 2s ease;
}

/* ==========================================================================
   20. COMPONENTS — TABS
   ========================================================================== */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-muted);
  gap: 0;
  margin-bottom: var(--space-6);
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem;
  font-weight: 400;
  text-transform: lowercase;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration-fast), border-color var(--duration-fast);
}

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

.tab.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--color-black);
  font-weight: 500;
}

/* ==========================================================================
   21. COMPONENTS — STEP WIZARD
   ========================================================================== */

.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: var(--space-5);
  overflow-x: auto;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.wizard-step__connector {
  width: var(--space-8);
  height: 1px;
  background: var(--border-muted);
  flex-shrink: 0;
}

.wizard-step__number {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-secondary);
  color: var(--text-muted);
  flex-shrink: 0;
}

.wizard-step__label {
  font-size: 0.8125rem;
  text-transform: lowercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.wizard-step.is-active .wizard-step__number {
  background: var(--color-black);
  border-color: var(--color-black);
  color: var(--color-white);
}

.wizard-step.is-active .wizard-step__label {
  color: var(--text-primary);
  font-weight: 500;
}

.wizard-step.is-done .wizard-step__number {
  background: var(--color-grey150);
  border-color: var(--color-grey150);
  color: var(--text-muted);
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-muted);
}

/* ==========================================================================
   22. COMPONENTS — ELECTION CARDS (DASHBOARD)
   ========================================================================== */

.election-card {
  background: var(--bg-primary);
  padding: var(--space-5) var(--space-6);
  border-left: 3px solid var(--border-muted);
  margin-bottom: var(--space-3);
  transition: border-left-color var(--duration-fast);
  cursor: pointer;
}

.election-card:hover {
  border-left-color: var(--color-black);
}

.election-card--draft     { border-left-color: var(--status-draft); }
.election-card--scheduled { border-left-color: var(--status-scheduled); }
.election-card--open      { border-left-color: var(--status-open); }
.election-card--closed    { border-left-color: var(--status-closed); }
.election-card--cancelled { border-left-color: var(--status-cancelled); }

.election-card__title {
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}

.election-card__meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.election-card__turnout {
  margin-top: var(--space-3);
}

.election-card__turnout-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

/* ==========================================================================
   23. PAGE — LOGIN
   ========================================================================== */

.login-container {
  width: 100%;
  max-width: 22rem;
}

.login-logo {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-10);
  color: var(--text-primary);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-2);
}

.login-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: var(--space-8);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--text-disabled);
  font-size: 0.8125rem;
  text-transform: lowercase;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-muted);
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: 0.625rem var(--space-5);
  font-size: 0.875rem;
  font-weight: 400;
  text-transform: lowercase;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border-secondary);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: var(--space-3);
  transition: border-color var(--duration-fast), background var(--duration-fast);
  border-radius: 0;
}

.oauth-btn:hover {
  border-color: var(--border-primary);
  background: var(--bg-secondary);
  text-decoration: none;
}

.oauth-btn__icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

/* ==========================================================================
   24. PAGE — VOTING UI
   ========================================================================== */

.ballot-container {
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
}

.ballot-header {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-muted);
}

.ballot-election-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.ballot-section-title {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.ballot-section-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

.ballot-progress {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-transform: lowercase;
  margin-bottom: var(--space-3);
}

.candidate-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.candidate-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-primary);
  border: 1px solid var(--border-muted);
  cursor: pointer;
  transition: border-color var(--duration-fast);
}

.candidate-card:hover {
  border-color: var(--border-secondary);
}

.candidate-card.is-selected {
  border-color: var(--color-black);
  background: var(--bg-secondary);
}

.candidate-card__check {
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid var(--border-secondary);
  flex-shrink: 0;
  margin-top: 0.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.candidate-card.is-selected .candidate-card__check {
  background: var(--color-black);
  border-color: var(--color-black);
}

.candidate-card__check-icon {
  color: var(--color-white);
  font-size: 0.75rem;
  display: none;
}

.candidate-card.is-selected .candidate-card__check-icon {
  display: block;
}

.candidate-card__photo {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--bg-secondary);
}

.candidate-card__info {
  flex: 1;
}

.candidate-card__name {
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-1);
}

.candidate-card__bio {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.candidate-card__expand {
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
}

.blank-vote-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px dashed var(--border-muted);
  cursor: pointer;
  transition: border-color var(--duration-fast);
}

.blank-vote-card:hover {
  border-color: var(--border-secondary);
}

.blank-vote-card.is-selected {
  border-color: var(--color-black);
  border-style: solid;
}

/* Ballot review */
.ballot-review {
  padding: var(--space-6);
  background: var(--bg-primary);
  border: 1px solid var(--border-muted);
  margin-bottom: var(--space-6);
}

.ballot-review__section {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-muted);
}

.ballot-review__section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.ballot-review__section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.ballot-review__choices {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

/* Confirmation */
.vote-confirmed {
  text-align: center;
  padding: var(--space-12) var(--space-5);
}

.vote-confirmed__icon {
  font-size: 3rem;
  margin-bottom: var(--space-6);
  color: var(--color-success);
}

.vote-confirmed__title {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
}

.vote-confirmed__token {
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  text-align: left;
}

.vote-confirmed__anonymity {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-6);
  padding: var(--space-4);
  border-left: 3px solid var(--border-muted);
  text-align: left;
}

/* ==========================================================================
   25. PAGE — PUBLIC PANELS (Zerésima, Results)
   ========================================================================== */

.public-panel {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
}

.public-panel__header {
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-muted);
}

.public-panel__tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.public-panel__title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-3);
}

.public-panel__meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.token-search {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  max-width: 32rem;
}

.token-search__input {
  flex: 1;
  padding: 0.625rem var(--space-4);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  border: 1px solid var(--border-secondary);
  border-radius: 0;
}

.token-search__input:focus {
  outline: none;
  border-color: var(--border-primary);
}

/* ==========================================================================
   26. PAGE — DASHBOARD
   ========================================================================== */

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.org-selector {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.org-selector__select {
  padding: var(--space-2) var(--space-4);
  padding-right: var(--space-8);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border-muted);
  background: var(--bg-primary);
  border-radius: 0;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23444' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.empty-state {
  text-align: center;
  padding: var(--space-20) var(--space-5);
  color: var(--text-muted);
}

.empty-state__title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.empty-state__body {
  font-size: 0.875rem;
  margin-bottom: var(--space-6);
}

/* ==========================================================================
   27. PAGE — NOT FOUND
   ========================================================================== */

.not-found {
  text-align: center;
  padding: var(--space-20) var(--space-5);
}

.not-found__code {
  font-size: 6rem;
  font-weight: 300;
  letter-spacing: -0.05em;
  color: var(--text-disabled);
  margin-bottom: var(--space-4);
}

.not-found__message {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: var(--space-8);
}

/* ==========================================================================
   28. RESPONSIVE
   ========================================================================== */

/* Mobile (< 768px) — sidebar collapses, single column */
@media (max-width: 767px) {
  .app-shell__sidebar {
    display: none;
  }

  .app-shell__main {
    margin-left: 0;
  }

  .page-content {
    padding: var(--space-5);
  }

  .sidebar-toggle {
    display: flex;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  #toast-container {
    bottom: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  .wizard-steps {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal {
    max-height: 100vh;
    border-radius: 0;
  }
}

/* Tablet (768px – 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .app-shell__sidebar {
    width: 200px;
  }

  .app-shell__main {
    margin-left: 200px;
  }

  .page-content {
    padding: var(--space-6);
  }
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
  .page-content {
    padding: var(--space-10) var(--space-8);
  }
}

/* ==========================================================================
   29. PLANS PAGE
   ========================================================================== */

.plans-page {
  max-width: 52rem;
}

.plans-page__title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-8);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-7);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.plan-card--pro {
  border-color: var(--text-primary);
}

.plan-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}

.plan-card__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.plan-card__badge {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.125rem 0.5rem;
  white-space: nowrap;
}

.plan-card__price {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.plan-card__price-note {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0;
}

.plan-card__features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-7);
  flex: 1;
}

.plan-card__feature {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.plan-card__feature::before {
  content: "✓";
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--base-color-neutral--grey300);
  flex-shrink: 0;
  min-width: 1rem;
  background: none;
}

.plan-card__feature--included::before {
  color: var(--base-color-neutral--black);
}

.plan-card__feature:last-child {
  border-bottom: none;
}

.plan-card__cta {
  margin-top: auto;
}

/* Skeleton state */
.plan-card--skeleton {
  pointer-events: none;
}

/* Standalone (unauthenticated) */
.page-content--standalone {
  max-width: 60rem;
  margin: 0 auto;
  padding: var(--space-10) var(--space-6);
}

@media (max-width: 767px) {
  .plans-grid {
    grid-template-columns: 1fr;
  }
}

/* Print styles for public panels */
@media print {
  .app-shell__sidebar,
  .btn,
  #toast-container,
  .token-search,
  .header__actions {
    display: none !important;
  }

  .app-shell__main {
    margin-left: 0;
  }

  body {
    background: white;
  }
}
