/* EVM Vote — feuille de style (écran + impression) */
:root {
  --blue: #0b5ea8; --blue-d: #084a86; --red: #c92d4b; --green: #2e9b3e; --orange: #e8742a; --yellow: #f2b705;
  --ink: #1b2430; --muted: #5d6b7a; --line: #dfe5ec; --bg: #f4f7fb; --card: #ffffff; --grey: #9aa4ae;
  --radius: 12px; --shadow: 0 2px 10px rgba(16, 38, 66, .07);
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
body.modal-open { overflow: hidden; }
a { color: var(--blue); }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; }
h2 { font-size: 1.2rem; margin: 0 0 .7em; }
h2 small { font-weight: 400; color: var(--muted); font-size: .8rem; }
h3 { font-size: 1rem; margin: 1em 0 .5em; }
code { font-family: ui-monospace, Consolas, monospace; background: #eef2f7; padding: .1em .4em; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .center { text-align: center; } .right { text-align: right; }
.lead { font-size: 1.1rem; }
.print-only { display: none; }

/* Barre supérieure */
.topbar { background: #fff; border-bottom: 4px solid transparent; border-image: linear-gradient(90deg, var(--red), var(--blue), #6cbf2e, var(--orange), var(--yellow)) 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 1rem; flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand img { height: 36px; width: auto; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { color: var(--muted); font-size: .78rem; }
.mainnav { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.mainnav a { text-decoration: none; color: var(--ink); padding: .45rem .75rem; border-radius: 8px; font-weight: 500; }
.mainnav a:hover { background: #eef3f9; }
.mainnav a.active { background: var(--blue); color: #fff; }
.who { color: var(--muted); font-size: .85rem; margin: 0 .5rem; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.3rem; padding: .2rem .6rem; cursor: pointer; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem; flex: 1; }
.container.narrow { max-width: 760px; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

/* Cartes */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin-bottom: 1rem; border: 1px solid var(--line); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 1rem; }
.warn-card { border-left: 5px solid var(--yellow); }
.error-card { border-left: 5px solid var(--red); }
.danger-zone { border-left: 5px solid var(--red); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 9px; padding: .6rem 1rem; cursor: pointer; text-decoration: none; line-height: 1.2; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: #e7eef7; color: var(--blue-d); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-warning { background: var(--yellow); color: #3a2c00; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn-lg { padding: .85rem 1.4rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: .8rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 1rem; }
.form-row > input, .form-row > select { flex: 1; min-width: 180px; }
input, select, textarea { font: inherit; font-weight: 400; padding: .6rem .7rem; border: 1px solid #c9d3de; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(11, 94, 168, .2); border-color: var(--blue); }
label.check { flex-direction: row !important; align-items: center; gap: .5rem !important; font-weight: 500 !important; }
label.check input { width: auto; }

/* Connexion */
.login-wrap { display: flex; justify-content: center; padding-top: 2vh; }
.login-card { max-width: 420px; width: 100%; text-align: center; }
.login-card .form { text-align: left; margin: 1rem 0; }
.login-logo { width: 180px; height: auto; margin: 0 auto .4rem; display: block; }

/* États */
.state-card { text-align: center; padding: 2rem 1.3rem; }
.state-card.ok { border-top: 5px solid var(--green); }
.state-icon { font-size: 2.6rem; }
.state-icon.big { font-size: 4rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: #e7eef7; color: var(--blue-d); vertical-align: middle; }
.badge-green { background: #dff3e2; color: #1d6b29; }
.badge-grey { background: #eceff2; color: #56606b; }

/* Étapes des tours */
.steps { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; }
.steps li { padding: .35rem .8rem; border-radius: 999px; background: #eceff2; font-size: .85rem; font-weight: 600; }
.steps li.ouvert { background: #dff3e2; color: #1d6b29; }
.steps li.preparation { background: #fff4d1; color: #6d5200; }

/* Candidats */
.cand-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.cand-list li { display: flex; align-items: center; gap: .7rem; padding: .55rem .3rem; border-bottom: 1px solid var(--line); }
.cand-num { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex: none; }
.cand-name { flex: 1; font-weight: 600; }
.cand-actions { display: flex; gap: .3rem; }
ul.plain { padding-left: 1.2rem; }

/* Bulletin */
.vote-page { max-width: 640px; margin: 0 auto; }
.ballot { display: grid; gap: .7rem; margin: 1rem 0 1.2rem; }
.ballot-item { display: flex; align-items: center; gap: .9rem; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; cursor: pointer; font-size: 1.1rem; font-weight: 600; transition: border-color .15s, background .15s; }
.ballot-item:hover { border-color: #a9c3de; }
.ballot-item input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; }
.ballot-item.selected { border-color: var(--blue); background: #eef5fc; }
.ballot-item.blanc { border-style: dashed; color: var(--muted); }
.confirm-choice { font-size: 1.3rem; font-weight: 800; text-align: center; padding: .8rem; background: #eef5fc; border-radius: 10px; color: var(--blue-d); }

/* Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin: .8rem 0; }
.kpi { background: #f5f8fc; border: 1px solid var(--line); border-radius: 10px; padding: .7rem; text-align: center; display: flex; flex-direction: column; }
.kpi-val { font-size: 1.5rem; font-weight: 800; color: var(--blue-d); }
.kpi-lbl { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.progress { height: 14px; background: #e7edf4; border-radius: 999px; overflow: hidden; margin: .5rem 0 1rem; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .6s; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #f3f6fa; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table th.right, .table td.right { text-align: right; }
.table tr.inactive td { color: #9aa4ae; }
.table td.actions { white-space: nowrap; }
.table td.actions .btn { margin: 1px; }
.table tfoot td { background: #fafbfd; }
.result-table tr.winner td { background: #eaf7ec; font-weight: 700; }
.bar-col { width: 30%; }
.mini-bar { height: 10px; background: #e7edf4; border-radius: 999px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--blue); }

/* Graphique */
.chart-wrap { margin: 1rem 0; }
.chart { width: 100%; height: auto; max-width: 760px; }
.ch-lbl { font-size: 13px; fill: #1b2430; font-weight: 600; }
.ch-val { font-size: 13px; fill: #1b2430; }
.ch-track { fill: #eef2f7; }

/* Décision */
.decision { padding: .8rem 1rem; border-radius: 10px; background: #eef3f9; margin: .8rem 0; }
.decision.elu { background: #e3f5e6; border-left: 5px solid var(--green); }
.decision.second_tour, .decision.egalite, .decision.aucun { background: #fff6dc; border-left: 5px solid var(--yellow); }
.winner-card { display: flex; align-items: center; gap: 1rem; border-left: 6px solid var(--green); }
.winner-name { font-size: 1.7rem; font-weight: 800; color: #1d6b29; }
.result-block + .result-block { margin-top: 1.6rem; padding-top: 1.2rem; border-top: 2px solid var(--line); }

/* Installation */
.checklist { list-style: none; padding: 0; }
.checklist li { padding: .3rem 0; }
.checklist .ok { color: #1d6b29; } .checklist .ko { color: var(--red); font-weight: 700; } .checklist .warn { color: #8a6400; }

/* Cartes d'accès */
.cards-print { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; }
.access-card { background: #fff; border: 1.5px dashed #8897a8; border-radius: 10px; padding: .8rem 1rem; break-inside: avoid; page-break-inside: avoid; }
.ac-head { display: flex; align-items: center; gap: .6rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; margin-bottom: .5rem; }
.ac-head img { height: 32px; width: auto; }
.ac-head div { display: flex; flex-direction: column; line-height: 1.2; }
.ac-head small { color: var(--muted); font-size: .75rem; }
.ac-name { font-weight: 700; margin-bottom: .3rem; }
.ac-name small { font-weight: 400; color: var(--muted); }
.ac-row { display: flex; justify-content: space-between; align-items: center; padding: .15rem 0; }
.ac-row code { font-size: 1.15rem; font-weight: 700; letter-spacing: .08em; }
.ac-site { font-size: .8rem; color: var(--blue-d); margin-top: .3rem; }
.ac-note { font-size: .72rem; color: var(--muted); }

/* Procès-verbal */
.pv { padding: 1.6rem 1.8rem; }
.pv-intro { text-align: justify; }
.pv-proclamation { font-size: 1.05rem; border: 2px solid var(--ink); border-radius: 8px; padding: .8rem 1rem; margin: 1.2rem 0; }
.pv-obs { margin: 1rem 0; }
.signatures { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.sig { border: 1px solid #b8c2cd; border-radius: 8px; padding: .6rem; break-inside: avoid; }
.sig-fn { font-size: .8rem; color: var(--muted); text-transform: uppercase; }
.sig-name { font-weight: 700; margin-bottom: .4rem; }
.sig-box { height: 70px; border-top: 1px dotted #b8c2cd; font-size: .72rem; color: #9aa4ae; padding-top: .2rem; }
.print-head { display: flex; align-items: center; gap: 1rem; border-bottom: 3px solid var(--ink); padding-bottom: .7rem; margin-bottom: 1rem; }
.print-head img { width: 90px; height: auto; }
.ph-etab { font-weight: 700; font-size: 1.05rem; }
.ph-title { font-weight: 800; font-size: 1.25rem; }
.ph-meta { color: var(--muted); }

/* Modale */
.modal { position: fixed; inset: 0; background: rgba(12, 24, 40, .55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 100; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 14px; max-width: 520px; width: 100%; padding: 1.3rem 1.4rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); max-height: 90vh; overflow: auto; animation: pop .15s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; }
.modal-actions [hidden] { display: none; }

/* Notifications */
.toasts { position: fixed; top: 76px; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 90; max-width: min(420px, calc(100vw - 2rem)); }
.toast { display: flex; align-items: flex-start; gap: .6rem; background: #fff; border-radius: 10px; padding: .75rem .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); border-left: 5px solid var(--blue); animation: pop .2s ease-out; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: var(--muted); line-height: 1; }
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-warning { border-left-color: var(--yellow); }

/* Mobile */
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .mainnav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .mainnav.open { display: flex; }
  .grid-2, .form-2 { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .bar-col { display: none; }
  .table td.actions { white-space: normal; }
}

/* Impression / PDF */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11pt; display: block; }
  .no-print, .topbar, .footer, .toasts, .modal { display: none !important; }
  .print-only { display: block; }
  .container { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; margin: 0 0 8mm; }
  .kpis { grid-template-columns: repeat(6, 1fr); gap: 2mm; }
  .kpi { border: 1px solid #999; background: #fff; padding: 2mm 1mm; }
  .kpi-val { font-size: 13pt; }
  .kpi-lbl { font-size: 6.5pt; }
  .table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .result-block, .signatures, .pv-proclamation { break-inside: avoid; }
  .mini-bar span, .progress-bar, .chart rect, .decision, .result-table tr.winner td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cards-print { grid-template-columns: 1fr 1fr; gap: 5mm; }
  .access-card { border-color: #555; }
  a { color: inherit; text-decoration: none; }
}
