:root {
  --bg-primary: #f5f3ee;
  --bg-secondary: #ffffff;
  --bg-tertiary: #ebe7df;
  --ink: #1a1814;
  --ink-soft: #4a463e;
  --ink-muted: #8a8478;
  --line: #d8d3c8;
  --line-soft: #e8e3d8;
  --accent: #2d5d3f;
  --accent-soft: #e0ebe2;
  --gold: #b8954a;
  --danger: #a83232;
  --danger-soft: #f4e0e0;
  --warn: #b87333;
  --warn-soft: #fbeed5;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--ink);
  background-image: radial-gradient(circle at 1px 1px, rgba(26,24,20,0.03) 1px, transparent 0);
  background-size: 24px 24px;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

.font-display { font-family: 'Fraunces', serif; font-feature-settings: 'ss01'; letter-spacing: -0.01em; }
.font-mono { font-family: 'Geist Mono', monospace; }
.italic { font-style: italic; font-weight: 300; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ===================== HEADER & NAV ===================== */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-title { font-family: 'Fraunces', serif; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.logo-sub { font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ink-muted); }
.header-right { display: flex; align-items: center; gap: 24px; }
.header-scrutin { text-align: right; }
.header-ref { font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ink-muted); }
.header-title { font-size: 14px; font-weight: 500; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-divider { width: 1px; height: 40px; background: var(--line); }
.header-user { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.user-name { font-size: 13px; font-weight: 500; line-height: 1.2; }
.user-role { font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ink-muted); }
.logout-link { font-size: 12px; color: var(--ink-muted); margin-left: 8px; }
.logout-link:hover { color: var(--ink); }

.app-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
}
.nav-inner { display: flex; gap: 28px; }
.nav-link {
  padding: 14px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  position: relative;
  transition: color 0.15s ease;
}
.nav-link:hover { color: var(--ink-soft); }
.nav-link.active { color: var(--ink); }
.nav-link.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
}

.app-main { padding-bottom: 60px; }

/* ===================== FLASH MESSAGES ===================== */
.flash {
  margin: 12px 32px 0;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}
.flash-success { background: var(--accent-soft); color: var(--accent); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }

.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--accent-soft); color: var(--accent); }
.alert-info { background: var(--bg-tertiary); color: var(--ink-soft); }

/* ===================== CARD & BASIC ===================== */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.page-wrap { padding: 32px; }
.page-wrap-narrow { padding: 32px; max-width: 1100px; }

.page-title-section { margin-bottom: 32px; }
.page-eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.page-title { font-family: 'Fraunces', serif; font-size: 36px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; margin: 0; }
.page-subtitle { font-size: 13px; color: var(--ink-soft); margin-top: 12px; max-width: 600px; }

.stat-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin: 0;
}

/* ===================== BOUTONS ===================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 3px; font-size: 13px; font-weight: 500; transition: all 0.15s ease; cursor: pointer; }
.btn-primary { background: var(--ink); color: var(--bg-primary); padding: 10px 20px; border-radius: 3px; font-size: 13px; font-weight: 500; }
.btn-primary:hover { background: var(--accent); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-success { background: var(--accent); color: white; padding: 12px 20px; border-radius: 3px; font-size: 14px; font-weight: 500; }
.btn-success:hover { background: #244d33; }
.btn-danger { background: var(--danger); color: white; padding: 12px 20px; border-radius: 3px; font-size: 14px; font-weight: 500; }
.btn-danger:hover { background: #8a2828; }
.btn-outline { padding: 10px 20px; border-radius: 3px; font-size: 13px; font-weight: 500; border: 1px solid var(--line); background: var(--bg-secondary); color: var(--ink); }
.btn-outline:hover { background: var(--bg-tertiary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; padding: 14px 20px; }

/* ===================== FORMULAIRES ===================== */
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-muted); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-secondary);
  font-size: 13px;
  transition: border 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: none; }
.field input:disabled, .field select:disabled { opacity: 0.6; cursor: not-allowed; }
.field-help { font-size: 11px; color: var(--ink-muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.input-mono { font-family: 'Geist Mono', monospace; }

.input-readonly {
  width: 100%;
  padding: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: 'Geist Mono', monospace;
  font-weight: 600;
  font-size: 18px;
  border-radius: 3px;
}

/* ===================== TABLES ===================== */
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg-tertiary); border-bottom: 1px solid var(--line); padding: 12px 16px; text-align: left; font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-muted); font-weight: 500; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
tr:hover { background: var(--bg-tertiary); }

/* ===================== BADGES ===================== */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-family: 'Geist Mono', monospace; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-default { background: var(--bg-tertiary); color: var(--ink-soft); }
.badge-success { background: var(--accent-soft); color: var(--accent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-gold { background: #f5edd9; color: var(--gold); }

/* ===================== STATS GRID ===================== */
.stats-grid { display: grid; gap: 12px; margin-bottom: 32px; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stats-5 { grid-template-columns: repeat(5, 1fr); }
.stats-6 { grid-template-columns: repeat(6, 1fr); }
.stats-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
}
.stat-card-value {
  font-family: 'Fraunces', serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* ===================== LOGIN ===================== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-wrap { width: 100%; max-width: 440px; }
.login-header { text-align: center; margin-bottom: 36px; }
.login-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; background: var(--accent); border-radius: 4px; margin-bottom: 18px; }
.login-tag { font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.3em; color: var(--ink-muted); margin-bottom: 8px; }
.login-title { font-size: 28px; line-height: 1.2; font-weight: 600; }
.login-card { padding: 28px; }
.login-footer { text-align: center; margin-top: 24px; font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ink-muted); }

/* ===================== DASHBOARD specifics ===================== */
.bandeau-general {
  background: var(--bg-secondary);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 20px;
  border-radius: 4px;
  margin-bottom: 24px;
}
.bandeau-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.bandeau-item .stat-label { margin-bottom: 4px; }
.bandeau-item-value { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bandeau-highlight { background: var(--accent-soft); margin: -8px -4px; padding: 8px 12px; border-radius: 3px; }
.bandeau-highlight .stat-label, .bandeau-highlight .bandeau-item-value { color: var(--accent); }

.progress-card { padding: 24px; margin-bottom: 32px; }
.progress-bar-wrap {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s ease;
}

.coherence-warning {
  margin-top: 16px;
  padding: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
}

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.top-list { padding: 0; }
.top-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.top-rank { width: 28px; height: 28px; border-radius: 3px; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; font-family: 'Geist Mono', monospace; font-size: 12px; font-weight: 600; }
.top-name { flex: 1; min-width: 0; }
.top-name-text { font-size: 13px; font-weight: 500; }
.top-bar-wrap { height: 6px; background: var(--bg-tertiary); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.top-bar-fill { height: 100%; background: var(--accent); transition: width 0.5s ease; }
.top-voix { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }

.recent-list { padding: 0; }
.recent-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.recent-row:last-child { border-bottom: none; }
.recent-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; }
.recent-dot.valide { background: var(--accent); }
.recent-dot.non-valide { background: var(--danger); }
.recent-info { flex: 1; min-width: 0; }
.recent-id { font-family: 'Geist Mono', monospace; font-size: 12px; }
.recent-meta { font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--ink-muted); margin-top: 2px; }

/* ===================== SCRUTIN ===================== */
.scrutin-section { margin-bottom: 28px; }
.scrutin-section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.scrutin-bullet {
  width: 28px; height: 28px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 700;
}
.bullet-1 { background: var(--ink); color: var(--bg-primary); }
.bullet-1bis { background: var(--accent); color: white; }

.coherence-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.coherence-card { padding: 14px; border-radius: 3px; background: var(--bg-tertiary); }
.coherence-card.danger { background: var(--danger-soft); }
.coherence-card.success { background: var(--accent-soft); }
.coherence-card-label { font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-muted); margin-bottom: 6px; }
.coherence-card-value { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }

.border-l-accent { border-left: 2px solid var(--accent); padding-left: 16px; }

/* ===================== CANDIDATS ===================== */
.actions-cell { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn { padding: 6px 8px; border-radius: 3px; font-size: 12px; background: transparent; border: 1px solid transparent; }
.icon-btn:hover { background: var(--bg-tertiary); border-color: var(--line); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ===================== MODAL ===================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px;
}
.modal { background: var(--bg-secondary); border: 1px solid var(--line); border-radius: 4px; padding: 28px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-large { max-width: 950px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; margin: 0; }
.modal-close { font-size: 24px; color: var(--ink-muted); cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* ===================== DEPOUILLEMENT ===================== */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--bg-tertiary); color: var(--ink-muted); }
.stepper-item.active { background: var(--ink); color: var(--bg-primary); }
.stepper-item.done { background: var(--accent); color: white; }
.stepper-line { width: 24px; height: 1px; background: var(--line); }
.stepper-line.done { background: var(--accent); }

.capture-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.capture-zone {
  aspect-ratio: 3/4;
  border: 2px dashed var(--line);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  background: rgba(235, 231, 223, 0.4);
  text-align: center;
  padding: 32px;
}
.capture-icon { font-size: 48px; margin-bottom: 12px; }
.capture-title { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; }
.capture-desc { font-size: 12px; color: var(--ink-muted); margin-top: 8px; }

.validation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bulletin-image-card { padding: 16px; }
.bulletin-image-wrap { background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; min-height: 500px; display: flex; align-items: center; justify-content: center; }
.bulletin-image-wrap img { max-width: 100%; max-height: 600px; object-fit: contain; }

.candidates-list { max-height: calc(100vh - 250px); overflow-y: auto; padding: 12px; }
.cand-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 3px;
  border: 1px solid var(--line-soft);
  background: var(--bg-secondary);
  margin-bottom: 6px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cand-item:hover { border-color: var(--line); }
.cand-item.selected { background: var(--accent-soft); border-color: var(--accent); }
.cand-item.low-confidence { border-left: 3px solid var(--warn); background: #fbeed533; }
.cand-item.low-confidence.selected { border-left: 3px solid var(--warn); background: var(--accent-soft); }
.cand-checkbox {
  width: 20px; height: 20px;
  border: 2px solid var(--line);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cand-item.selected .cand-checkbox { background: var(--accent); border-color: var(--accent); }
.cand-ordre { font-family: 'Geist Mono', monospace; font-size: 12px; font-weight: 600; width: 28px; color: var(--ink-muted); }
.cand-info { flex: 1; min-width: 0; }
.cand-name { font-size: 13px; font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.cand-ville { font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); }
.cand-ai { font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--ink-muted); margin-top: 2px; }
.cand-changed { color: var(--warn); margin-left: 8px; }

.scan-overlay { position: relative; }
.scan-overlay::after {
  content: ''; position: absolute; left: 0; right: 0; height: 3px;
  background: var(--accent);
  box-shadow: 0 0 20px rgba(45,93,63,0.6);
  animation: scan 1.5s linear infinite;
}
@keyframes scan {
  0% { transform: translateY(0); opacity: 0.8; }
  50% { opacity: 1; }
  100% { transform: translateY(500px); opacity: 0.8; }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.pulse { animation: pulse-soft 1.6s ease-in-out infinite; }

.validate-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px; border-top: 1px solid var(--line-soft); }

/* ===================== RESULTATS ===================== */
.gold-bg { background: var(--gold) !important; color: white !important; }
.silver-bg { background: var(--ink-soft) !important; color: white !important; }
.bronze-bg { background: #a87b5c !important; color: white !important; }
.elu-bg { background: var(--accent-soft) !important; color: var(--accent) !important; border: 1px solid var(--accent); }

.rank-cell { width: 28px; height: 28px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; font-family: 'Geist Mono', monospace; font-size: 12px; font-weight: 700; background: var(--bg-tertiary); color: var(--ink-soft); }

.bar-cell { width: 280px; }
.bar-track { height: 6px; background: var(--bg-tertiary); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); transition: width 0.5s ease; }

/* ===================== UTILITIES ===================== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end { display: flex; justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--ink-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-semi { font-weight: 600; }
.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }

.empty-state { padding: 48px 16px; text-align: center; color: var(--ink-muted); font-size: 13px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* Print (PDF export) */
@media print {
  .no-print { display: none !important; }
  body { background: white; padding: 0; }
  .print-page { padding: 24px; }
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

/* Burger menu */
.burger-btn { display: none; background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; cursor: pointer; font-size: 20px; }

/* Tablette */
@media (max-width: 1024px) {
  .stats-6 { grid-template-columns: repeat(3, 1fr); }
  .stats-5 { grid-template-columns: repeat(3, 1fr); }
  .bandeau-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .validation-grid { grid-template-columns: 1fr; }
  .candidates-list { max-height: 600px; }
  .field-row-3 { grid-template-columns: 1fr 1fr; }
  .header-title { max-width: 240px; }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {
  body { font-size: 13px; }

  /* Header compact */
  .header-inner { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .header-right { gap: 12px; flex: 1; justify-content: flex-end; }
  .header-scrutin { display: none; }
  .header-divider { display: none; }
  .header-user { gap: 8px; }
  .user-avatar { width: 32px; height: 32px; font-size: 11px; }
  .user-name, .user-role { display: none; }
  .logout-link { font-size: 11px; margin-left: 0; }
  .logo-sub { display: none; }
  .logo-title { font-size: 14px; }

  /* Navigation : burger menu */
  .app-nav { padding: 0; position: relative; }
  .burger-btn { display: block; margin: 8px 16px; }
  .nav-inner { display: none; flex-direction: column; gap: 0; padding: 8px 0; background: var(--bg-secondary); border-top: 1px solid var(--line); position: absolute; top: 100%; left: 0; right: 0; z-index: 40; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
  .nav-inner.is-open { display: flex; }
  .nav-link { padding: 14px 20px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
  .nav-link.active::after { display: none; }
  .nav-link.active { background: var(--accent-soft); color: var(--accent); border-left: 3px solid var(--accent); }

  /* Pages : padding réduit */
  .page-wrap, .page-wrap-narrow { padding: 16px; }
  .page-title { font-size: 24px; }
  .page-title-section { margin-bottom: 20px; }
  .page-subtitle { font-size: 12px; }

  /* Grilles en colonne unique */
  .stats-grid { gap: 8px; margin-bottom: 20px; }
  .stats-3, .stats-4, .stats-5, .stats-6 { grid-template-columns: repeat(2, 1fr); }
  .bandeau-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; gap: 8px; }
  .coherence-grid { grid-template-columns: 1fr; }

  .stat-card { padding: 12px; }
  .stat-card-value { font-size: 22px; }
  .bandeau-item-value { font-size: 18px; }

  /* Boutons : pleine largeur sur mobile */
  .btn-primary, .btn-success, .btn-danger, .btn-outline { padding: 12px 16px; font-size: 13px; }
  .flex-end { flex-direction: column; gap: 8px; }
  .flex-end .btn-primary, .flex-end .btn-outline { width: 100%; }

  /* Cards plus aérées */
  .card { border-radius: 4px; }

  /* Tables : scroll horizontal */
  .card table { min-width: 600px; }
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Stepper compact */
  .stepper { flex-wrap: wrap; }
  .stepper-item { font-size: 11px; padding: 4px 8px; }
  .stepper-line { width: 12px; }

  /* Capture (dépouillement) */
  .capture-grid { grid-template-columns: 1fr; gap: 12px; }
  .capture-zone { aspect-ratio: auto; padding: 24px; }
  .capture-icon { font-size: 36px; }
  .capture-title { font-size: 16px; }

  /* Bulletin image */
  .bulletin-image-wrap { min-height: 320px; }
  .bulletin-image-wrap img { max-height: 400px; }

  /* Liste candidats : items plus tactiles */
  .cand-item { padding: 12px 10px; }
  .cand-checkbox { width: 24px; height: 24px; }
  .candidates-list { max-height: 60vh; }

  /* Validation actions */
  .validate-actions { grid-template-columns: 1fr; gap: 8px; }

  /* Modals plein écran */
  .modal { padding: 20px; max-width: calc(100vw - 24px); }
  .modal-large { max-width: calc(100vw - 16px); }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn-primary, .modal-actions .btn-outline, .modal-actions .btn-danger { width: 100%; padding: 12px; }

  /* Filtres bulletins */
  .flex.gap-2 { flex-wrap: wrap; }

  /* Flash compact */
  .flash { margin: 8px 16px 0; padding: 10px 12px; font-size: 12px; }

  /* Coherence cards */
  .coherence-card { padding: 12px; }
  .coherence-card-value { font-size: 20px; }

  /* Page eyebrow */
  .page-eyebrow { font-size: 9px; }

  /* Login mobile */
  .login-wrap { max-width: 100%; }
  .login-title { font-size: 22px; }
  .login-card { padding: 20px; }
}

/* Très petit (≤ 480px) */
@media (max-width: 480px) {
  .stats-3, .stats-4, .stats-5, .stats-6 { grid-template-columns: 1fr 1fr; }
  .bandeau-grid { grid-template-columns: 1fr; }
  .stat-card-value { font-size: 20px; }
  .page-title { font-size: 20px; }
  .scrutin-section-header { flex-wrap: wrap; }
  .scrutin-section-header h2 { font-size: 18px !important; }
  .header-right .header-user { gap: 4px; }
  .logout-link { padding: 4px 8px; border: 1px solid var(--line); border-radius: 3px; }
}

/* Touch / mobile : zones tactiles plus larges */
@media (pointer: coarse) {
  .icon-btn { padding: 10px 12px; min-width: 40px; min-height: 40px; }
  .nav-link { padding: 16px 20px; }
  .field input, .field select, .field textarea { padding: 12px 14px; font-size: 14px; }
  button { min-height: 40px; }
}
