/* Judgement Day — minimalist black/white aesthetic */
:root {
  --bg: #fafaf8;
  --fg: #111;
  --muted: #666;
  --line: #e5e5e0;
  --accent: #111;
  --accent-fg: #fff;
  --warn: #b33;
  --ok: #059669;
  --green: #10b981;
  --green-dark: #059669;
  --green-bg: #ecfdf5;
  --green-border: #a7f3d0;
  --sidebar-bg: #fff;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100vh; display: flex; flex-direction: column; }

/* Layout */
.layout { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: var(--sidebar-w);
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  padding: 18px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  transition: width 0.25s ease, padding 0.25s ease;
  position: relative;
}
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
  padding: 18px 4px;
}
.sidebar.collapsed .brand,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-foot,
.sidebar.collapsed .imp-section { display: none; }
.sidebar.collapsed .nav-item .nav-text { display: none; }
.sidebar.collapsed .nav-item {
  padding: 8px 0;
  justify-content: center;
  gap: 0;
  font-size: 20px;
  line-height: 1;
}
.sidebar.collapsed .nav-item.is-results {
  opacity: 0.5;
  border-bottom: 2px solid var(--fg);
  border-radius: 0;
  margin-top: -2px;
}
.sidebar.collapsed .nav-item.active { background: var(--fg); color: var(--accent-fg); }
.sidebar-toggle {
  position: absolute;
  top: 14px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  padding: 0;
  z-index: 2;
  transition: background 0.15s, color 0.15s;
}
.sidebar-toggle:hover { background: #f1f0eb; color: var(--fg); }
.sidebar.collapsed .sidebar-toggle { right: 10px; top: 14px; }
.brand { padding-right: 36px; }

.main { flex: 1; overflow-y: auto; padding: 24px 28px; }
.main.battle-view { padding: 16px 20px; }
.main.battle-view h1 { font-size: 22px; margin-bottom: 2px; }
.main.battle-view .subtitle { font-size: 12px; margin-bottom: 14px; }

/* Sidebar */
.brand { font-weight: 600; letter-spacing: -0.01em; font-size: 16px; margin-bottom: 24px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-section { margin-bottom: 24px; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 8px; padding-left: 8px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  transition: background 0.12s;
}
.nav-item .nav-icon {
  font-size: 16px;
  line-height: 1;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.nav-item .nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item.is-results .nav-icon { opacity: 0.55; filter: saturate(0.7); }
.nav-item.is-results .nav-text::after {
  content: ' · résultats';
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.nav-item:hover { background: #f1f0eb; }
.nav-item.active { background: var(--fg); color: var(--accent-fg); }
.nav-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.nav-foot a { color: var(--muted); text-decoration: none; display: block; padding: 4px 8px; }
.nav-foot a:hover { color: var(--fg); }

/* Main */
h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px 0; }
h2 { font-size: 20px; font-weight: 600; margin: 24px 0 12px 0; letter-spacing: -0.01em; }
h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px 0; }
.subtitle { color: var(--muted); margin-bottom: 24px; }

/* Forms */
form.stack { display: flex; flex-direction: column; gap: 10px; max-width: 320px; }
label { font-size: 12px; color: var(--muted); }
input[type=email], input[type=password], input[type=text], input[type=number], select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--fg); }
button {
  padding: 10px 16px;
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--accent-fg);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  transition: opacity 0.12s;
}
button:hover:not(:disabled) { opacity: 0.85; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.ghost { background: #fff; color: var(--fg); border: 1px solid var(--line); }
button.ghost:hover:not(:disabled) { background: #f1f0eb; opacity: 1; }
button.warn { background: #fff; color: var(--warn); border-color: var(--warn); }

/* Card */
.card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-title { font-weight: 600; font-size: 16px; margin: 0; }
.card-sub { color: var(--muted); font-size: 12px; }

/* Grid — user-controlled column count via .grid-size-N */
.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.grid.grid-size-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.grid-size-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.grid-size-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.grid-size-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.grid-size-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 520px) {
  .grid, .grid[class*="grid-size-"] { grid-template-columns: 1fr !important; }
}

/* Floating zoom FAB — bottom-left */
.grid-zoom-fab {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  font-size: 11px;
}
.zoom-fab-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 13px;
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  border: none;
  cursor: pointer;
  line-height: 1;
}
.zoom-fab-btn:hover:not(:disabled) { background: var(--green-bg); color: var(--green-dark); }
.zoom-fab-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.zoom-fab-info {
  color: var(--muted);
  padding: 0 2px;
  min-width: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* Sidebar collapsed — shift fab right */
.sidebar.collapsed ~ .grid-zoom-fab,
.grid-zoom-fab { left: 16px; }

/* Thumb zoom button — always visible, explicit */
.thumb-wrap { position: relative; }
.thumb-zoom {
  position: absolute !important;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  font-size: 12px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: background 0.15s, transform 0.15s;
  cursor: zoom-in;
  z-index: 10;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.thumb-zoom:hover { background: var(--green); transform: scale(1.08); }

/* Lightbox */
.lightbox {
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.94);
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
  animation: lbFadeIn 0.18s ease-out;
}
.lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 100px);
  object-fit: contain;
  cursor: default;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  border-radius: 4px;
}
.lightbox-caption {
  color: #fff;
  margin-top: 16px;
  font-size: 14px;
  opacity: 0.85;
  text-align: center;
}
.lightbox-error {
  color: #fff;
  background: rgba(255,255,255,0.08);
  padding: 32px 48px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.lightbox-close:hover { background: rgba(255,255,255,0.35); }
@keyframes lbFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Project card — thumbnail dominant, vote block compact */
.project-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.project-card .card-head,
.project-card .project-body,
.project-card .vote-grid { padding-left: 10px; padding-right: 10px; }
.project-card .card-head {
  padding-top: 10px;
  padding-bottom: 8px;
  gap: 8px;
  cursor: pointer;
  align-items: baseline;
}
.project-card .card-title { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin: 0; line-height: 1.15; }
.title-block {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.team-badge {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.team-badge-icon {
  font-size: 13px;
  line-height: 1;
}
.card-head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.project-card .card-head a { font-size: 11px; color: var(--muted); white-space: nowrap; }
.project-card .card-head a:hover { color: var(--fg); }
.project-card .project-body { padding-bottom: 6px; font-size: 11px; color: var(--muted); }

/* Optional project fields (slogan, big idea, 5s pitch) — uniform typography */
.project-extra {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 2px 10px 2px;
  line-height: 1.4;
}
.project-extra:first-of-type { padding-top: 4px; }
.project-extra:last-of-type { padding-bottom: 10px; }

/* Labels: small, uppercase, muted — min 40% so they align nicely across rows */
.project-extra .extra-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 40%;
  padding-top: 2px;
}

/* Values: same font/size/weight/color across all rows */
.project-extra .extra-value {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 400;
  font-style: normal;
  color: var(--fg);
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.project-card .vote-grid {
  display: none;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 4px 10px 10px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  animation: none;
}
.project-card.expanded .vote-grid {
  display: grid;
  animation: voteFadeIn 0.18s ease;
}
@keyframes voteFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chevron indicator */
.card-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f0eb;
  color: var(--fg);
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.3s ease, background 0.2s;
  flex-shrink: 0;
}
.project-card:hover .card-chevron { background: #e5e5e0; }
.project-card.expanded .card-chevron { transform: rotate(180deg); background: var(--green); color: #fff; }

.thumb-wrap {
  display: block;
  aspect-ratio: 4 / 3;
  background: #f1f0eb;
  overflow: visible;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--muted);
  position: relative;
  cursor: pointer;
}
.thumb-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

/* Logo — straddling image & text area (50% on image, 50% on text area) */
.project-logo {
  position: absolute;
  left: 12px;
  bottom: 0;
  transform: translateY(50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--fg);
  border: 3px solid #fff;
  box-shadow: 0 3px 14px rgba(0,0,0,0.3);
  z-index: 4;
  box-sizing: border-box;
}
.logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
}

/* When card has a logo, push card-head below the overhanging logo's lower half */
.project-card.has-logo .card-head { padding-top: 44px; }
.thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.project-card:hover .thumb { transform: scale(1.03); }
.thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Pills */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #f1f0eb;
  color: var(--muted);
  margin-right: 4px;
}
.pill.strong { background: var(--fg); color: var(--accent-fg); }
.own-team-pill {
  background: #fef3c7;
  color: #92400e;
  font-weight: 500;
}

/* Impersonation in sidebar */
.imp-section { display: flex; flex-direction: column; gap: 8px; }
.imp-select {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.imp-select:focus { border-color: var(--fg); outline: none; }
.imp-empty { color: var(--muted); font-size: 11px; padding: 6px 10px; line-height: 1.4; }
.imp-empty.err { color: var(--warn); }
.imp-stop { width: 100%; font-size: 12px; padding: 6px 10px; }

/* Impersonation banner on battle page */
.imp-banner {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  margin-bottom: 10px;
}
.imp-banner strong { font-weight: 600; }

/* Search bar + zoom controls row */
.search-wrap {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search-input {
  width: 50%;
  min-width: 200px;
  max-width: 420px;
  padding: 8px 12px;
  font-size: 13px;
}

/* Own-team card (disabled) */
.project-card.own-team { opacity: 0.62; }
.project-card.own-team .thumb-wrap { cursor: default; }
.project-card.own-team:hover { transform: none; box-shadow: none; }
.project-card.own-team:hover .thumb { transform: none; }
.project-card.own-team .card-head { cursor: default; }

/* Vote block — compact row per critère */
.vote-grid { display: grid; grid-template-columns: 1fr; gap: 3px; }
.vote-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding: 5px 4px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  min-height: 32px;
  transition: background 0.15s;
}
.vote-row:last-child { border-bottom: none; }
.vote-row > div:first-child {
  flex: 0 0 40%;
  width: 40%;
  min-width: 0;
  padding-right: 4px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.2;
}
.vote-row strong { font-weight: 500; font-size: 12px; word-break: break-word; }
.vote-row .meta { color: var(--muted); font-size: 11px; }
.vote-row.has-points {
  background: var(--green-bg);
  border-bottom-color: var(--green-border);
  box-shadow: inset 2px 0 0 0 var(--green);
}
.vote-row.has-points strong { color: var(--green-dark); }
.vote-row.has-points .pm-count {
  color: var(--green-dark);
  font-weight: 700;
}

/* +/- controls — 60% of row, with input = 30% of row (= 50% of this container) */
.pm-controls {
  flex: 1 1 60%;
  width: 60%;
  display: flex;
  align-items: center;
  gap: 3px;
}
.pm-btn {
  flex: 1 1 0;
  min-width: 22px;
  max-width: 28px;
  height: 22px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border-width: 1px;
}
.pm-btn:disabled { opacity: 0.25; }
.pm-count {
  min-width: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 12px;
  color: var(--fg);
}
.pm-input {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  height: 22px;
  padding: 0 2px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 12px;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  -moz-appearance: textfield;
}
.pm-input::-webkit-outer-spin-button,
.pm-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pm-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 2px var(--green-bg); }
.vote-row.has-points .pm-input { color: var(--green-dark); font-weight: 700; border-color: var(--green-border); }
/* Read-only for non-jury: looks like a display, not clickable */
.pm-input.readonly {
  background: #fafaf8;
  cursor: default;
  pointer-events: none;
  user-select: none;
  color: var(--fg);
}

/* Floating budget bubble (bottom-right, cool green) */
.budget-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px 10px 18px;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.28), 0 2px 6px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.1;
  transition: background 0.2s, transform 0.2s ease, box-shadow 0.2s;
  max-width: calc(100vw - 40px);
  animation: bubble-in 0.25s ease-out;
}
.budget-bubble:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(16, 185, 129, 0.34), 0 2px 6px rgba(0,0,0,0.08); }
.budget-bubble.empty { background: #6b7280; box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
.budget-bubble-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.budget-bubble-main strong { font-weight: 600; font-size: 13px; }
.budget-bubble-main .budget-sub { opacity: 0.85; font-weight: 400; font-size: 11px; }
.budget-bubble-reset {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-size: 14px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.budget-bubble-reset:hover { background: rgba(255,255,255,0.32); }

@keyframes bubble-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Toast / banners */
.banner { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.banner.err { background: #fde8e8; color: var(--warn); border: 1px solid #f5c6c6; }
.banner.ok  { background: #e6f5ee; color: var(--ok); border: 1px solid #bfe3cf; }
.banner.info { background: #f1f0eb; color: var(--muted); border: 1px solid var(--line); }

/* Login screen */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; padding: 20px; }
.login-card { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 36px; width: 100%; max-width: 380px; }
.login-card h1 { margin-bottom: 4px; font-size: 24px; }
.login-card .subtitle { margin-bottom: 24px; font-size: 13px; }
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px; }
.tab.active { color: var(--fg); border-bottom-color: var(--fg); font-weight: 500; }

/* Results: global chart + stats side-by-side */
.results-top-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.results-top-row .chart-global {
  flex: 3 1 600px;
  max-width: none;
  margin-bottom: 0;
  min-width: 0;
}
.results-top-row .stats-box {
  flex: 0 0 220px;
  flex-direction: column;
  margin-bottom: 0;
  gap: 8px;
}
.results-top-row .stat-item { flex: 1 1 auto; min-width: 0; }
@media (max-width: 900px) {
  .results-top-row .stats-box { flex: 1 1 100%; flex-direction: row; }
}

/* Stats box (results page) */
.stats-box {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.stat-item {
  flex: 1 1 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  position: relative;
}
.stat-item.with-donut {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 32px;
}
.stat-donut {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  line-height: 1.1;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.stat-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  opacity: 0.85;
}
.stat-info {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-info:hover { background: #f1f0eb; color: var(--fg); }

/* Voters modal */
.voters-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: lbFadeIn 0.18s ease-out;
}
.voters-modal-content {
  background: #fff;
  border-radius: 10px;
  max-width: 720px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px 28px;
  position: relative;
}
.voters-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
}
.voters-modal-close:hover { background: #f1f0eb; color: var(--fg); }
.voters-modal-title { margin: 0 0 4px; font-size: 16px; font-weight: 600; text-transform: capitalize; }
.voters-modal-sub { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.voters-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 600px) { .voters-cols { grid-template-columns: 1fr; } }
.voters-col h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.voters-col.voted h4 { color: var(--green-dark); }
.voters-col.not-voted h4 { color: var(--warn); }
.voters-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.voter-item {
  padding: 6px 10px;
  border-radius: 5px;
  background: #fafaf8;
  font-size: 12px;
}
.voter-item.complete { background: var(--green-bg); box-shadow: inset 3px 0 0 0 var(--green); }
.voter-name { font-weight: 500; color: var(--fg); }
.voter-meta { font-size: 10px; color: var(--muted); margin-top: 1px; }
.voters-empty { font-size: 12px; color: var(--muted); padding: 8px 0; }

/* Team legend (results page) */
.team-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}
.team-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.team-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.team-legend-icon {
  font-size: 14px;
  line-height: 1;
}
.team-legend-team {
  color: var(--muted);
  font-size: 11px;
}
.team-legend-team::before { content: "· "; }

/* Charts */
.chart-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.chart-wrap h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.chart-wrap.chart-global { max-width: 720px; }

/* Critères: auto-fit so every box has identical width whatever the count */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  align-items: stretch;
}
.chart-wrap.chart-small {
  margin-bottom: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chart-wrap.chart-small h3 { font-size: 12px; }
.chart-wrap.chart-small > canvas { flex: 1; min-height: 0; }
canvas { max-width: 100%; }

/* Admin */
.admin-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.admin-row .field { display: flex; flex-direction: column; gap: 4px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Helpers */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .main { padding: 20px; }
}
