/* WhoVotedForThis — Mobile-first CSS */

:root {
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --border: #e0e0e0;
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --accent: #0f766e;
  --accent-light: #ccfbf1;
  --for-color: #16a34a;
  --for-bg: #dcfce7;
  --against-color: #dc2626;
  --against-bg: #fee2e2;
  --abstain-color: #9333ea;
  --abstain-bg: #f3e8ff;
  --nav-height: 64px;
  --top-bar-height: 52px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --surface: #ffffff;
  --primary-hover: #1d4ed8;
  --bg-hover: #eef2f7;
  --overlay-bg: rgba(0,0,0,0.5);
  --group-ppe: #003399;
  --group-sd: #cc0000;
  --group-renew: #ffaa00;
  --group-verts: #009933;
  --group-ecr: #0054a5;
  --group-left: #990000;
  --group-pfe: #2e3b4e;
  --group-ni: #999;
  --group-esn: #1a1a2e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111827;
    --bg-card: #1f2937;
    --text: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #374151;
    --primary: #60a5fa;
    --primary-light: #1e3a5f;
    --accent: #14b8a6;
    --accent-light: #134e4a;
    --for-color: #4ade80;
    --for-bg: #14532d;
    --against-color: #f87171;
    --against-bg: #7f1d1d;
    --abstain-color: #c084fc;
    --abstain-bg: #3b0764;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
    --surface: #1f2937;
    --primary-hover: #3b82f6;
    --bg-hover: #374151;
    --overlay-bg: rgba(0,0,0,0.7);
    --group-ppe: #5b8def;
    --group-sd: #f87171;
    --group-renew: #fbbf24;
    --group-verts: #4ade80;
    --group-ecr: #60a5fa;
    --group-left: #f87171;
    --group-pfe: #94a3b8;
    --group-ni: #9ca3af;
    --group-esn: #a5b4fc;
  }
}

[data-theme="dark"] {
  --bg: #111827;
  --bg-card: #1f2937;
  --text: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: #374151;
  --primary: #60a5fa;
  --primary-light: #1e3a5f;
  --accent: #14b8a6;
  --accent-light: #134e4a;
  --for-color: #4ade80;
  --for-bg: #14532d;
  --against-color: #f87171;
  --against-bg: #7f1d1d;
  --abstain-color: #c084fc;
  --abstain-bg: #3b0764;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
  --surface: #1f2937;
  --primary-hover: #3b82f6;
  --bg-hover: #374151;
  --overlay-bg: rgba(0,0,0,0.7);
  --group-ppe: #5b8def;
  --group-sd: #f87171;
  --group-renew: #fbbf24;
  --group-verts: #4ade80;
  --group-ecr: #60a5fa;
  --group-left: #f87171;
  --group-pfe: #94a3b8;
  --group-ni: #9ca3af;
  --group-esn: #a5b4fc;
}

:root { color-scheme: light dark; }
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

* { margin: 0; padding: 0; box-sizing: border-box; }
[data-theme] *, [data-theme] *::before, [data-theme] *::after {
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: var(--nav-height);
  padding-top: var(--top-bar-height);
  -webkit-font-smoothing: antialiased;
}

/* Top bar */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-bar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
  text-decoration: none;
}

#desktop-nav { display: none; }

@media (min-width: 768px) {
  #desktop-nav {
    display: flex;
    gap: 24px;
  }
  #desktop-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
  }
  #desktop-nav a:hover, #desktop-nav a.active { color: var(--primary); }
  #desktop-nav a.active { font-weight: 600; }
  #bottom-nav { display: none; }
  body { padding-bottom: 0; }
}

#theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}
#theme-toggle:hover {
  color: var(--text);
  background: var(--border);
}

/* Footer */
#site-footer { background: var(--bg); border-top: 1px solid var(--border); padding: 32px 16px 96px; text-align: center; font-size: 13px; color: var(--text-muted); }
@media (min-width: 768px) { #site-footer { padding-bottom: 32px; } }
.footer-inner { max-width: 600px; margin: 0 auto; }
.footer-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--primary); }
.footer-data { margin-bottom: 4px; }
.footer-data a { color: var(--primary); text-decoration: none; }
.footer-copy { font-size: 12px; }

/* Bottom navigation (mobile) */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  padding: 8px 12px;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--primary); }
.nav-item svg { width: 22px; height: 22px; }

/* Main content */
#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
  min-height: calc(100vh - var(--top-bar-height) - var(--nav-height));
  outline: none;
}

@media (min-width: 768px) {
  #app { padding: 24px; }
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 32px 16px;
}
.hero h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero p {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 500px;
  margin: 0 auto 24px;
}

/* Home search */
.home-search-wrap { position: relative; max-width: 420px; margin: 0 auto 20px; }
.home-search {
  width: 100%; padding: 12px 16px; font-size: 15px; border: 2px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--text); outline: none;
  box-sizing: border-box;
}
.home-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.home-search-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  margin-top: 4px; overflow-y: auto; max-height: 400px; box-shadow: var(--shadow-lg);
}
.home-search-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border);
}
.home-search-item:last-child { border-bottom: none; }
.home-search-item:hover, .home-search-item.kb-active { background: var(--bg); }
.home-search-empty { padding: 12px 14px; color: var(--text-muted); font-size: 14px; }
.search-section-label { padding: 6px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg); }
.search-vote-icon { font-size: 18px; width: 32px; text-align: center; flex-shrink: 0; }
.home-search-item .mep-name { flex: 1; min-width: 0; }
.home-search-item .mep-meta { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
.mep-photo-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

@media (min-width: 768px) {
  .hero { padding: 48px 24px; }
  .hero h1 { font-size: 36px; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: var(--bg-card);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-for {
  background: var(--for-bg);
  color: var(--for-color);
  border: 2px solid transparent;
}
.btn-for:hover, .btn-for.selected { border-color: var(--for-color); background: var(--for-color); color: var(--bg-card); }
.btn-against {
  background: var(--against-bg);
  color: var(--against-color);
  border: 2px solid transparent;
}
.btn-against:hover, .btn-against.selected { border-color: var(--against-color); background: var(--against-color); color: var(--bg-card); }
.btn-skip {
  background: var(--bg);
  color: var(--text-muted);
  border: 2px solid transparent;
}
.btn-skip:hover, .btn-skip.selected { border-color: var(--text-muted); }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; }

/* Search */
.search-box {
  position: relative;
  margin-bottom: 16px;
}
.search-box input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.15s;
}
.search-box input:focus { border-color: var(--primary); }
.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 20px;
  height: 20px;
}

/* Filters */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.filters::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.filter-chip.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

select.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 120px;
}

/* MEP list */
.mep-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
}
.mep-row:hover { box-shadow: var(--shadow-lg); }

.mep-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}
.mep-photo-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
}
.mep-info { flex: 1; min-width: 0; }
.mep-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mep-meta {
  font-size: 13px;
  color: var(--text-secondary);
}
.mep-stats {
  text-align: right;
  flex-shrink: 0;
}
.mep-stat-value {
  font-weight: 700;
  font-size: 16px;
}
.mep-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Profile */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.profile-name {
  font-size: 22px;
  font-weight: 700;
}
.profile-meta {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Stats grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Topic bars */
.topic-bar {
  margin-bottom: 10px;
}
.topic-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}
.topic-bar-name { font-weight: 500; }
.topic-bar-value { color: var(--text-secondary); }
.topic-bar-track {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}
.topic-bar-fill-for {
  background: var(--for-color);
  height: 100%;
  transition: width 0.3s;
}
.topic-bar-fill-against {
  background: var(--against-color);
  height: 100%;
  transition: width 0.3s;
}
.topic-bar-fill-abstain {
  background: var(--abstain-color);
  height: 100%;
  transition: width 0.3s;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s;
}

/* Quiz */
.quiz-question {
  text-align: center;
  padding: 24px 0;
}
.quiz-topic {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.quiz-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 8px;
}
.quiz-result-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.quiz-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  margin: 0 auto;
}
.quiz-buttons .btn {
  padding: 14px;
  font-size: 16px;
}
.quiz-counter {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.quiz-shortcuts { font-size: 12px; color: var(--text-muted); margin-top: 16px; text-align: center; }
.quiz-shortcuts kbd { display: inline-block; padding: 2px 6px; font-size: 11px; font-family: inherit; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; }
@media (max-width: 767px) { .quiz-shortcuts { display: none; } }

/* Quiz results */
.match-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.match-score {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  min-width: 48px;
  text-align: center;
}

/* Chart (simple inline SVG) */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 40px;
}
.mini-chart-bar {
  flex: 1;
  background: var(--primary-light);
  border-radius: 2px 2px 0 0;
  min-width: 4px;
  transition: height 0.3s;
}

/* Legend */
.legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* Loading */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}
.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Page transition */
#app.page-enter { animation: fadeIn 0.18s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Section headers */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}
.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  padding: 8px 0;
  -webkit-tap-highlight-color: transparent;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-group {
  background: var(--primary-light);
  color: var(--primary);
}

/* About page */
.about-section { margin-bottom: 24px; }
.about-section h2 {
  font-size: 20px;
  margin-bottom: 8px;
}
.about-section p, .about-section li {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}
.about-section ul, .about-section ol { padding-left: 20px; }
.about-section li { margin-bottom: 4px; }
.about-section h3 {
  font-size: 16px;
  margin: 16px 0 6px;
  color: var(--text);
}
.about-section em {
  font-style: italic;
  color: var(--text);
  background: var(--primary-light);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Stats overview cards */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.overview-stat {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.overview-stat .stat-value { color: var(--primary); }

/* Utility */
.text-center { text-align: center; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none; }

/* Scroll to top on route change */
html { scroll-behavior: smooth; }

/* Skip link */
.skip-link { position: absolute; top: -100%; left: 50%; transform: translateX(-50%); padding: 8px 16px; background: var(--primary); color: var(--bg-card); border-radius: 0 0 8px 8px; z-index: 2000; font-size: 14px; text-decoration: none; }
.skip-link:focus { top: 0; }

.scroll-sentinel { height: 1px; }

/* Back to top */
#back-to-top { position: fixed; bottom: 80px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer; opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; box-shadow: var(--shadow); z-index: 500; }
#back-to-top.visible { opacity: 1; visibility: visible; }
@media (min-width: 768px) { #back-to-top { bottom: 24px; right: 24px; } }

/* Year chart for profile */
.year-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 60px;
  padding: 4px 0;
}
.year-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.year-bar-fill {
  width: 100%;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  opacity: 0.7;
}
.year-bar-label {
  font-size: 9px;
  color: var(--text-muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  height: 24px;
}

/* Group colors */
.group-PPE { color: var(--group-ppe); }
.group-SD { color: var(--group-sd); }
.group-Renew { color: var(--group-renew); }
.group-Verts { color: var(--group-verts); }
.group-ECR { color: var(--group-ecr); }
.group-Left { color: var(--group-left); }
.group-PfE { color: var(--group-pfe); }
.group-NI { color: var(--group-ni); }
.group-ESN { color: var(--group-esn); }

/* Vote items */
.page-title { margin: 0 0 4px; font-size: 1.5rem; }
.page-subtitle { color: var(--text-secondary); margin: 0 0 16px; font-size: 0.9rem; }
.results-count { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 12px; }
.vote-list { display: flex; flex-direction: column; gap: 8px; }
.vote-card { padding: 12px 16px; }
.vote-card-link { text-decoration: none; color: inherit; display: block; transition: box-shadow 0.15s; cursor: pointer; }
.vote-card-link:hover { box-shadow: var(--shadow-lg); }
.vote-description { font-size: 0.95rem; line-height: 1.4; margin-bottom: 8px; }
.vote-counts { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.vc-for { color: var(--for-color); font-weight: 600; }
.vc-against { color: var(--against-color); font-weight: 600; }
.vc-abstain { color: var(--text-muted); }
.vote-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.8rem; color: var(--text-secondary); }
.vote-outcome { font-weight: 600; font-size: 0.75rem; padding: 2px 8px; border-radius: 12px; }
.vote-outcome.adopted { background: var(--for-bg); color: var(--for-color); }
.vote-outcome.rejected { background: var(--against-bg); color: var(--against-color); }

/* Vote result bar (inline in cards) */
.vote-result-bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; display: flex; margin-bottom: 8px; }
.vote-result-bar-lg { height: 12px; border-radius: 6px; }
.vote-result-for { background: var(--for-color); height: 100%; transition: width 0.3s; }
.vote-result-against { background: var(--against-color); height: 100%; transition: width 0.3s; }
.vote-result-abstain { background: var(--abstain-color); height: 100%; transition: width 0.3s; }

/* Vote detail page */
.vote-detail-header { margin-bottom: 16px; }
.vote-detail-title { font-size: 1.4rem; font-weight: 700; line-height: 1.3; margin: 8px 0; }
.vote-detail-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--text-secondary); font-size: 0.9rem; }

.vote-result-summary { display: flex; gap: 8px; margin-bottom: 12px; }
.vote-result-num { flex: 1; text-align: center; padding: 12px 8px; border-radius: 8px; }
.vote-result-num.for { background: var(--for-bg); }
.vote-result-num.against { background: var(--against-bg); }
.vote-result-num.abstain { background: var(--abstain-bg); }
.vote-result-count { display: block; font-size: 1.4rem; font-weight: 700; }
.vote-result-num.for .vote-result-count { color: var(--for-color); }
.vote-result-num.against .vote-result-count { color: var(--against-color); }
.vote-result-num.abstain .vote-result-count { color: var(--abstain-color); }
.vote-result-label { display: block; font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

/* Group vote breakdown */
.group-vote-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.group-vote-name { min-width: 100px; font-size: 0.85rem; font-weight: 500; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.group-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.group-vote-total { color: var(--text-muted); font-size: 0.75rem; font-weight: 400; }
.group-vote-bar-wrap { flex: 1; min-width: 0; }
.group-vote-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; display: flex; margin-bottom: 2px; }
.group-vote-nums { display: flex; gap: 8px; font-size: 0.7rem; }
.for-num { color: var(--for-color); font-weight: 600; }
.against-num { color: var(--against-color); font-weight: 600; }
.abstain-num { color: var(--abstain-color); font-weight: 600; }

/* Country highlight */
.my-country-highlight { background: var(--primary-bg, rgba(37, 99, 235, 0.08)); border-radius: 6px; padding: 4px 6px; margin: -4px -6px; margin-bottom: 10px; }

/* Sub-votes */
.sub-vote { padding: 10px 12px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: background 0.15s; }
.sub-vote:hover { background: var(--bg-hover); }
.sub-vote-main { border-left: 3px solid var(--primary); }
.sub-vote-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.sub-vote-desc { font-size: 0.85rem; font-weight: 500; }
.sub-vote-counts { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; }
.sub-vote-groups { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

/* Individual MEP votes on vote detail page */
.position-section { margin-bottom: 16px; }
.position-header { font-weight: 600; font-size: 0.9rem; padding: 6px 0; border-bottom: 2px solid var(--border); margin-bottom: 8px; }
.position-header.for { border-color: var(--for-color); color: var(--for-color); }
.position-header.against { border-color: var(--against-color); color: var(--against-color); }
.position-header.abstain { border-color: var(--abstain-color); color: var(--text-muted); }
.mep-vote-list { display: flex; flex-wrap: wrap; gap: 2px 0; }
.mep-vote-link {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 0.8rem;
  color: var(--text); text-decoration: none; border-radius: 6px; width: 100%;
}
.mep-vote-link:hover { background: var(--bg); }
.mep-meta-inline { font-size: 0.7rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
@media (min-width: 600px) {
  .mep-vote-list { display: grid; grid-template-columns: 1fr 1fr; }
}

/* Vote history on MEP profile */
.vote-history-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text);
}
.vote-history-item:last-child { border-bottom: none; }
.vote-history-item:hover { background: var(--bg); margin: 0 -12px; padding: 10px 12px; border-radius: 8px; }
.position-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.position-dot.for { background: var(--for-color); }
.position-dot.against { background: var(--against-color); }
.position-dot.abstain { background: var(--abstain-color); }
.vote-history-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vote-history-desc { font-size: 0.85rem; font-weight: 500; line-height: 1.3; }
.vote-history-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

.topic-tag {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 500; background: var(--bg); color: var(--text-secondary);
}
.topic-tag.topic-climate_environment { background: #dcfce7; color: #166534; }
.topic-tag.topic-economy_trade { background: #dbeafe; color: #1e40af; }
.topic-tag.topic-civil_rights { background: #fef3c7; color: #92400e; }
.topic-tag.topic-digital_technology { background: #ede9fe; color: #5b21b6; }
.topic-tag.topic-health_consumers { background: #fce7f3; color: #9d174d; }
.topic-tag.topic-foreign_policy { background: #e0e7ff; color: #3730a3; }
.topic-tag.topic-migration_asylum { background: #ffedd5; color: #9a3412; }
.topic-tag.topic-energy_transport { background: #fef9c3; color: #854d0e; }
.topic-tag.topic-social_employment { background: #f3e8ff; color: #6b21a8; }
.topic-tag.topic-agriculture_food { background: #ecfccb; color: #3f6212; }
.topic-tag.topic-procedural { background: #f1f5f9; color: #475569; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topic-tag.topic-climate_environment { background: #14532d; color: #86efac; }
  :root:not([data-theme="light"]) .topic-tag.topic-economy_trade { background: #1e3a5f; color: #93c5fd; }
  :root:not([data-theme="light"]) .topic-tag.topic-civil_rights { background: #451a03; color: #fcd34d; }
  :root:not([data-theme="light"]) .topic-tag.topic-digital_technology { background: #2e1065; color: #c4b5fd; }
  :root:not([data-theme="light"]) .topic-tag.topic-health_consumers { background: #500724; color: #f9a8d4; }
  :root:not([data-theme="light"]) .topic-tag.topic-foreign_policy { background: #1e1b4b; color: #a5b4fc; }
  :root:not([data-theme="light"]) .topic-tag.topic-migration_asylum { background: #431407; color: #fdba74; }
  :root:not([data-theme="light"]) .topic-tag.topic-energy_transport { background: #422006; color: #fde047; }
  :root:not([data-theme="light"]) .topic-tag.topic-social_employment { background: #3b0764; color: #d8b4fe; }
  :root:not([data-theme="light"]) .topic-tag.topic-agriculture_food { background: #1a2e05; color: #bef264; }
  :root:not([data-theme="light"]) .topic-tag.topic-procedural { background: #1e293b; color: #94a3b8; }
}
[data-theme="dark"] .topic-tag.topic-climate_environment { background: #14532d; color: #86efac; }
[data-theme="dark"] .topic-tag.topic-economy_trade { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .topic-tag.topic-civil_rights { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .topic-tag.topic-digital_technology { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .topic-tag.topic-health_consumers { background: #500724; color: #f9a8d4; }
[data-theme="dark"] .topic-tag.topic-foreign_policy { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .topic-tag.topic-migration_asylum { background: #431407; color: #fdba74; }
[data-theme="dark"] .topic-tag.topic-energy_transport { background: #422006; color: #fde047; }
[data-theme="dark"] .topic-tag.topic-social_employment { background: #3b0764; color: #d8b4fe; }
[data-theme="dark"] .topic-tag.topic-agriculture_food { background: #1a2e05; color: #bef264; }
[data-theme="dark"] .topic-tag.topic-procedural { background: #1e293b; color: #94a3b8; }

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay-bg); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--bg-card); border-radius: 12px; padding: 20px; width: 100%;
  max-width: 400px; max-height: 70vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: var(--text-muted); padding: 0 4px; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.compare-results { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }

/* Small button variant */
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* Compare page */
.compare-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.compare-mep-card {
  flex: 1; min-width: 120px; max-width: 180px; text-align: center; text-decoration: none;
  color: var(--text); padding: 16px 12px; background: var(--bg-card); border-radius: 12px;
  box-shadow: var(--shadow); transition: box-shadow 0.15s;
}
.compare-mep-card:hover { box-shadow: var(--shadow-lg); }
.compare-photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; }
.compare-mep-name { font-weight: 600; font-size: 0.95rem; line-height: 1.2; margin-bottom: 4px; }
.compare-mep-meta { font-size: 0.75rem; color: var(--text-secondary); }
.compare-vs { font-weight: 800; font-size: 1.2rem; color: var(--text-muted); flex-shrink: 0; }

.compare-stat-row {
  display: flex; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.compare-stat-row:last-child { border-bottom: none; }
.compare-val { flex: 1; font-size: 1.1rem; font-weight: 600; }
.compare-val:first-child { text-align: left; }
.compare-val:last-child { text-align: right; }
.compare-label { flex: 1; text-align: center; font-size: 0.8rem; color: var(--text-secondary); }

.compare-agreement { text-align: center; padding: 8px 0; }
.compare-agree-pct { font-size: 2.5rem; font-weight: 800; color: var(--primary); }
.compare-agree-label { font-size: 0.85rem; color: var(--text-secondary); }

.compare-topics { display: flex; gap: 16px; }
.compare-topic-col { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.compare-topic-header { font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; }

.compare-votes-list { display: flex; flex-direction: column; gap: 2px; }
.compare-vote-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text);
}
.compare-vote-row:last-child { border-bottom: none; }
.compare-vote-row:hover { background: var(--bg); margin: 0 -12px; padding: 8px 12px; border-radius: 8px; }
.compare-vote-desc { flex: 1; font-size: 0.85rem; line-height: 1.3; min-width: 0; }
.compare-vote-positions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

/* Responsive profile */
@media (min-width: 768px) {
  .profile-header { gap: 24px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .overview-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 6px;
  display: inline-block;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0s !important; transition-duration: 0s !important; }
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Small screen fixes */
@media (max-width: 480px) {
  .vote-detail-meta { flex-wrap: wrap; gap: 6px 10px; }
  .vote-result-count { font-size: 1.1rem; }
  .vote-result-num { padding: 10px 4px; }
  .group-vote-name { min-width: 70px; font-size: 0.75rem; }
  .group-vote-nums { gap: 4px; font-size: 0.65rem; }
  .compare-vote-row { flex-direction: column; gap: 6px; }
  .compare-vote-positions { justify-content: flex-end; }
}
