/* ========================================================================
PRO-CONTRA — POLLING & DECISION MAKER (Refactored)
Target: RO / DACH / EN | Psychological: Trust + Clarity + Collaboration
======================================================================== */

/* 1. VARIABLES & THEME =================================================== */
:root {
  /* Colors */
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-surface: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --warm: #D97706;
  --success: #10B981;
  --error: #EF4444;
  --error-bg: #FEE2E2;
  --warning: #F59E0B;
  --info: #3B82F6;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.12);
  --focus-ring: 0 0 0 3px rgba(37,99,235,0.25);
  /* Poll-specific */
  --poll-yes: #10B981;
  --poll-maybe: #F59E0B;
  --poll-no: #EF4444;
  --poll-bar: #2563EB;
  --poll-bar-2: #7C3AED;
  --poll-bar-3: #D97706;
  --poll-bar-4: #10B981;
  --poll-bar-5: #EF4444;
  --poll-bar-6: #EC4899;
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  /* Layout */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --max-width: 1200px;
  --header-height: 64px;
  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
  --text-base: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);
  --text-lg: clamp(1rem, 0.9rem + 0.4vw, 1.125rem);
  --text-xl: clamp(1.25rem, 1rem + 1vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
  --text-3xl: clamp(1.875rem, 1.5rem + 1.5vw, 2.25rem);
  /* Motion */
  --ease: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-slow: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) {
    --bg-page: #0B1120;
    --bg-card: #111827;
    --bg-surface: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --border: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --error-bg: #7F1D1D;
  }
}
html.theme-dark {
  --bg-page: #0B1120;
  --bg-card: #111827;
  --bg-surface: #1E293B;
  --text-primary: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #64748B;
  --border: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --error-bg: #7F1D1D;
}

/* 2. BASE & RESET ======================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 100px;
}
img, svg { max-width: 100%; height: auto; display: block; }
.social-share-btn svg { display: inline-block; width: 18px; height: 18px; max-width: 18px; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }
ul, ol { list-style: none; }

/* Focus-visible styles for keyboard accessibility */
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.form-input:focus-visible,
.form-textarea:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 3. LAYOUT & CONTAINERS ================================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: var(--space-lg);
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-primary);
  font-size: var(--text-lg);
  line-height: 1.2;
  transition: opacity var(--ease);
}
.logo:hover { opacity: 0.9; }
.logo-img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: block;
  border-radius: var(--radius-sm);
}
.logo strong {
  font-weight: 700;
  letter-spacing: -0.02em;
}
main { flex: 1; padding-block: var(--space-2xl); }

/* 4. TYPOGRAPHY & UTILITIES ============================================= */
h1, h2, h3, h4 {
  text-wrap: balance;
  line-height: 1.2;
  font-weight: 600;
}
h1 { font-size: var(--text-3xl); margin-bottom: var(--space-md); }
h2 { font-size: var(--text-2xl); margin-bottom: var(--space-lg); }
h3 { font-size: var(--text-xl); }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* 5. COMPONENTS ========================================================= */
/* Language Switcher - Pill Design */
.lang-switch {
  display: inline-flex;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
  align-items: center;
  width: auto;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}
.lang-btn:hover { color: var(--text-primary); }
.lang-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}
/* Theme Toggle */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  display: grid; place-items: center;
  font-size: 1.1rem;
}
/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  transition: var(--ease);
}
.btn:hover { background: var(--accent-hover); }
.btn--outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn--outline:hover { background: var(--bg-surface); }
.btn--sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
}
.btn--danger {
  background: var(--error);
}
.btn--danger:hover {
  background: #DC2626;
}
.btn--success {
  background: var(--success);
}
.btn--success:hover {
  background: #059669;
}
.btn--warning {
  background: var(--warning);
  color: #111;
}
.btn--warning:hover {
  background: #D97706;
}
/* Close Poll Button */
.btn-close-poll {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--ease);
}
.btn-close-poll:hover {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}
html.theme-dark .btn-close-poll {
  background: #334155;
  color: #CBD5E1;
  border-color: #475569;
}
html.theme-dark .btn-close-poll:hover {
  background: #991B1B;
  color: #FCA5A5;
  border-color: #991B1B;
}
/* Forms */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: var(--ease);
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}
.form-input.is-error, .form-textarea.is-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}
.form-help { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-xs); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: auto; cursor: pointer; }
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.form-error {
  font-size: var(--text-xs);
  color: var(--error);
  margin-top: var(--space-xs);
}

/* Tool Card */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--ease-slow);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: relative;
  contain: layout style;
}

/* 6. TOOL-SPECIFIC — POLLING ============================================ */
/* Poll Type Tabs */
.poll-type-tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--bg-surface);
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-lg);
}
.poll-type-tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--ease);
  text-align: center;
}
.poll-type-tab:hover { color: var(--text-primary); background: var(--bg-card); }
.poll-type-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.poll-type-tab .tab-icon { display: block; font-size: 1.4em; margin-bottom: 2px; }

/* Option row (simple/ranked) */
.option-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.option-row .form-input { flex: 1; }
.option-remove {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: var(--ease);
}
.option-remove:hover { background: var(--error); color: #fff; border-color: var(--error); }

/* Schedule Slots */
.schedule-slot-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}
.schedule-slot-row .form-input { flex: 1; min-width: 140px; }

/* Schedule best-slot row (replaces inline background:#D1FAE5) */
.schedule-best-slot { background: #D1FAE5; font-weight: 700; }
html.theme-dark .schedule-best-slot { background: #065F46; }

/* Poll list / cards */
.poll-list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: var(--ease);
  cursor: pointer;
}
.poll-list-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.poll-list-item .poll-question {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.poll-list-item .poll-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  align-items: center;
}
.poll-type-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.poll-type-badge--simple { background: #DBEAFE; color: #1E40AF; }
.poll-type-badge--ranked { background: #EDE9FE; color: #6D28D9; }
.poll-type-badge--schedule { background: #FEF3C7; color: #92400E; }
.poll-type-badge--multiple { background: #DBEAFE; color: #1E40AF; }
.poll-type-badge--date { background: #FEF3C7; color: #92400E; }
html.theme-dark .poll-type-badge--simple { background: #1E3A5F; color: #93C5FD; }
html.theme-dark .poll-type-badge--ranked { background: #3B1F6E; color: #C4B5FD; }
html.theme-dark .poll-type-badge--schedule { background: #5C3D0E; color: #FCD34D; }
html.theme-dark .poll-type-badge--multiple { background: #1E3A5F; color: #93C5FD; }
html.theme-dark .poll-type-badge--date { background: #5C3D0E; color: #FCD34D; }

/* Poll status badges */
.poll-status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.poll-status-badge--active { background: #D1FAE5; color: #065F46; }
.poll-status-badge--closed { background: #FEE2E2; color: #991B1B; }
.poll-status-badge--expired { background: #FEF3C7; color: #92400E; }
html.theme-dark .poll-status-badge--active { background: #065F46; color: #D1FAE5; }
html.theme-dark .poll-status-badge--closed { background: #7F1D1D; color: #FCA5A5; }
html.theme-dark .poll-status-badge--expired { background: #5C3D0E; color: #FCD34D; }

/* Poll status (inline text) */
.poll-status--active { color: #065F46; font-weight: 600; }
.poll-status--closed { color: #991B1B; font-weight: 600; }
.poll-status--expired { color: #92400E; font-weight: 600; }
html.theme-dark .poll-status--active { color: #6EE7B7; }
html.theme-dark .poll-status--closed { color: #FCA5A5; }
html.theme-dark .poll-status--expired { color: #FCD34D; }

/* Vote section */
.vote-section {
  margin-top: var(--space-lg);
}
.vote-options { display: flex; flex-direction: column; gap: var(--space-sm); }
.vote-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--ease);
  background: var(--bg-card);
}
.vote-option:hover { border-color: var(--accent); background: var(--bg-surface); }
.vote-option.selected { border-color: var(--accent); background: #EFF6FF; }
html.theme-dark .vote-option.selected { background: #1E293B; }
.vote-option input { accent-color: var(--accent); width: 18px; height: 18px; cursor: pointer; }
.vote-option label { flex: 1; cursor: pointer; font-size: var(--text-base); }

/* Ranked choice voting */
.ranked-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  margin-bottom: var(--space-xs);
  cursor: grab;
  transition: var(--ease);
  user-select: none;
}
.ranked-item:active { cursor: grabbing; }
.ranked-item.dragging { opacity: 0.5; border-color: var(--accent); }
.ranked-item .rank-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}
.ranked-item .rank-label { flex: 1; font-size: var(--text-base); }
.ranked-item .rank-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ranked-item .rank-arrow {
  width: 24px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 10px;
  cursor: pointer;
  transition: var(--ease);
}
.ranked-item .rank-arrow:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Schedule grid */
.schedule-grid {
  overflow-x: auto;
  margin-top: var(--space-md);
}
.schedule-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 400px;
  font-size: var(--text-sm);
}
.schedule-table th,
.schedule-table td {
  border: 1px solid var(--border);
  padding: var(--space-sm);
  text-align: center;
}
.schedule-table th {
  background: var(--bg-surface);
  font-weight: 600;
  white-space: nowrap;
}
.schedule-table td { cursor: pointer; transition: var(--ease); }
.schedule-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
}
.schedule-cell--yes { background: #D1FAE5; color: #065F46; }
.schedule-cell--maybe { background: #FEF3C7; color: #92400E; }
.schedule-cell--no { background: #FEE2E2; color: #991B1B; }
html.theme-dark .schedule-cell--yes { background: #065F46; color: #D1FAE5; }
html.theme-dark .schedule-cell--maybe { background: #5C3D0E; color: #FCD34D; }
html.theme-dark .schedule-cell--no { background: #7F1D1D; color: #FCA5A5; }

/* Vote buttons row for schedule cells */
.schedule-cell-btns {
  display: flex;
  gap: 2px;
}
.schedule-cell-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
  background: var(--bg-card);
  color: var(--text-secondary);
}
.schedule-cell-btn--yes.active { background: var(--poll-yes); color: #fff; border-color: var(--poll-yes); }
.schedule-cell-btn--maybe.active { background: var(--poll-maybe); color: #111; border-color: var(--poll-maybe); }
.schedule-cell-btn--no.active { background: var(--poll-no); color: #fff; border-color: var(--poll-no); }
.schedule-cell-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Results */
.results-section { margin-top: var(--space-xl); }
.result-bar-wrap { margin-bottom: var(--space-md); }
.result-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
}
.result-bar-label span:first-child { font-weight: 500; }
.result-bar-label span:last-child { color: var(--text-muted); }
.result-bar {
  height: 28px;
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  overflow: hidden;
  position: relative;
}
.result-bar-fill {
  height: 100%;
  border-radius: var(--radius-xs);
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  padding-left: var(--space-sm);
  font-size: var(--text-xs);
  color: #fff;
  font-weight: 600;
  min-width: 0;
}
.result-bar-fill:nth-child(1) { background: var(--poll-bar); }
.result-bar-fill.bar-2 { background: var(--poll-bar-2); }
.result-bar-fill.bar-3 { background: var(--poll-bar-3); }
.result-bar-fill.bar-4 { background: var(--poll-bar-4); }
.result-bar-fill.bar-5 { background: var(--poll-bar-5); }
.result-bar-fill.bar-6 { background: var(--poll-bar-6); }

/* Ranked results */
.ranked-round {
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
}
.ranked-round h4 { font-size: var(--text-sm); margin-bottom: var(--space-sm); }
.eliminated { text-decoration: line-through; color: var(--text-muted); }
.winner-highlight {
  background: #D1FAE5;
  color: #065F46;
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: var(--text-lg);
  text-align: center;
  margin-bottom: var(--space-md);
}
html.theme-dark .winner-highlight { background: #065F46; color: #D1FAE5; }

/* Share section */
.share-section {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.share-link-row {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.share-link-row .form-input {
  flex: 1;
  font-family: monospace;
  font-size: var(--text-sm);
  background: var(--bg-card);
}
.qr-container {
  text-align: center;
  margin-top: var(--space-md);
}
.qr-container svg {
  display: inline-block;
  max-width: 100%;
  height: auto;
  border: 4px solid #fff;
  border-radius: var(--radius-sm);
  /* Prevent anti-aliasing when browser scales the SVG */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}
html.theme-dark .qr-container svg { border-color: var(--bg-card); }

/* View toggle (create / results) */
.view-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.view-tab {
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--ease);
}
.view-tab:hover { color: var(--text-primary); }
.view-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Voter list */
.voter-list {
  margin-top: var(--space-md);
  font-size: var(--text-sm);
}
.voter-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border);
}
.voter-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}

/* Inline message */
.inline-msg {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  margin-top: var(--space-sm);
  display: none;
}
.inline-msg.is-visible { display: block; }
.inline-msg--success { background: #D1FAE5; color: #065F46; }
.inline-msg--error { background: #FEE2E2; color: #991B1B; }
.inline-msg--info { background: #DBEAFE; color: #1E40AF; }
html.theme-dark .inline-msg--success { background: #065F46; color: #D1FAE5; }
html.theme-dark .inline-msg--error { background: #7F1D1D; color: #FCA5A5; }
html.theme-dark .inline-msg--info { background: #1E3A5F; color: #93C5FD; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: var(--space-md); }

/* Section divider */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

/* Poll header in view mode */
.poll-header {
  margin-bottom: var(--space-lg);
}
.poll-header h2 {
  margin-bottom: var(--space-xs);
  font-size: var(--text-2xl);
}
.poll-header .poll-desc {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin-bottom: var(--space-sm);
}

/* Auto-refresh indicator */
.refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.refresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════
   6B. AUTH — LOGIN / REGISTER
   ═══════════════════════════════════════════════════════════════════════ */

/* Header auth area */
.header-auth {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.header-auth .btn--sm {
  font-size: var(--text-xs);
}
.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.user-info .user-name {
  font-weight: 600;
  color: var(--accent);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Auth modal */
.auth-modal-container {
  width: 100%;
  max-width: 420px;
}
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-xl);
}
.auth-tab {
  flex: 1;
  padding: var(--space-md) 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .2s, border-color .2s;
  text-align: center;
  letter-spacing: .3px;
}
.auth-tab:hover { color: var(--text-secondary); }
.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-error {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-md);
  background: var(--error-bg);
  color: #991B1D;
}
html.theme-dark .auth-error { background: var(--error-bg); color: #FCA5A5; }
.auth-error:empty { display: none; }
.auth-switch {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.auth-switch a {
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* Delete poll button */
.btn-delete-poll {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background .2s, color .2s;
}
.btn-delete-poll:hover {
  background: var(--error);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════
   6C. MY POLLS / POLL MANAGEMENT
   ═══════════════════════════════════════════════════════════════════════ */

.my-polls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}
.poll-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}
.poll-expiry-info {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Close poll button in poll view */
.poll-creator-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* Home buttons row */
.home-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

/* 7. STICKY DONATE ====================================================== */
.sticky-donate-wrapper {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--ease), transform var(--ease);
  pointer-events: none;
}
.sticky-donate-wrapper.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.sticky-donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #FFDD00;
  color: #111;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  border: none;
  text-decoration: none;
  transition: transform var(--ease), box-shadow var(--ease);
}
.sticky-donate-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 16px rgba(255, 205, 0, 0.3);
}
.sticky-donate-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.donate-icon { font-size: 1.2em; }
@media (max-width: 640px) {
  .sticky-donate-wrapper { bottom: 16px; right: 16px; }
  .sticky-donate-btn { padding: 8px 14px; font-size: var(--text-xs); border-radius: 999px; }
  .sticky-donate-btn .donate-text { display: inline-flex !important; }
}
@media (prefers-reduced-motion: reduce) {
  .sticky-donate-wrapper, .sticky-donate-btn {
    transition: none !important;
    animation: none !important;
  }
}

/* 8. MODAL =============================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}
.modal-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  z-index: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}
.modal-close:hover { background: var(--bg-surface); color: var(--text-primary); }
.modal-content {
  padding: var(--space-2xl);
  overflow-y: auto;
  max-height: 80vh;
}
.modal-loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

/* 9. ANIMATIONS ========================================================== */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

/* 10. RESPONSIVE ========================================================= */
@media (max-width: 640px) {
  :root {
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
  }
  .tool-card { padding: var(--space-md); }
  .poll-type-tabs { flex-direction: column; }
  .poll-type-tab { padding: var(--space-sm); }
  .share-link-row { flex-direction: column; }
  .social-share-row { gap: var(--space-xs); }
  .social-share-btn { padding: 8px 10px; font-size: var(--text-xs); }
  .social-share-btn svg { width: 20px; height: 20px; max-width: 20px; }
  .option-row { flex-wrap: wrap; }
  .schedule-slot-row { flex-direction: column; }
  .lang-btn span { display: none; }
  .lang-btn { padding: 6px 8px; font-size: 1.2rem; }
  .schedule-table { font-size: var(--text-xs); }
  .schedule-table th, .schedule-table td { padding: 4px; }
  .vote-option { padding: var(--space-xs) var(--space-sm); }
  .ranked-item { padding: var(--space-xs) var(--space-sm); }
  .header-auth .user-name { max-width: 80px; }
  .auth-modal-container { max-width: 95vw; }
  .home-actions { flex-direction: column; align-items: center; }
  /* Fix: Schedule table horizontal scroll on mobile */
  .schedule-grid { -webkit-overflow-scrolling: touch; }
  /* Fix: QR code responsive sizing — use 100% width, natural scaling */
  .qr-container svg { max-width: 100%; }
  /* Fix: Auth modal full width on very small screens */
  .modal-container { margin: 8px; }
  /* Fix: Vote options touch target size */
  .vote-option { min-height: 44px; }
  .ranked-item { min-height: 44px; }
}

@media (max-width: 380px) {
  :root {
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.25rem;
  }
  .poll-type-tab .tab-icon { font-size: 1.1em; }
  .lang-btn { padding: 4px 6px; font-size: 1rem; }
  .auth-area .btn { padding: 2px 8px; font-size: var(--text-xs); }
}

/* 11. REDUCED MOTION ===================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 12. PRINT ============================================================== */
@media print {
  .site-header, .subsite-banner, .btn, .theme-toggle, .lang-switch,
  .sticky-donate-wrapper, .subsite-legal-footer, .share-section,
  .social-share-row, .poll-type-tabs, .view-tabs, .refresh-indicator, .header-auth,
  .poll-creator-actions, .poll-actions { display: none !important; }
  body { background: #fff; color: #000; padding-bottom: 0; }
  .tool-card { break-inside: avoid; box-shadow: none; border: 1px solid #000; }
}
