/* CAPAFIE Vote — feuille de style
   Charte graphique CAPAFIE FINANCE :
   Bleu foncé #0E4099 · Bleu accent #1F7FD1 · Bleu ligne #29A9FF · Fond bleuté #EAF2FC · Rouge #C0392B */
:root {
  --capafie-dark: #0E4099;
  --capafie-accent: #1F7FD1;
  --capafie-line: #29A9FF;
  --capafie-bg: #EAF2FC;
  --capafie-red: #C0392B;

  --bg: var(--capafie-bg);
  --card: #ffffff;
  --ink: #0f1f3d;
  --muted: #55657f;
  --line: #d3e1f3;
  --brand: var(--capafie-dark);
  --brand-hover: var(--capafie-accent);
  --brand-ink: #ffffff;
  --brand-soft: #e1edfb;
  --accent: var(--capafie-accent);
  --pour: #1b7f4b;
  --contre: var(--capafie-red);
  --abst: #8a6d1f;
  --warn-bg: #fff6df;
  --err-bg: #fbe9e7;
  --ok-bg: #e4f4ea;
  --elu-bg: #e1edfb;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1426; --card: #111e36; --ink: #e6eefb; --muted: #9fb2cf; --line: #22355a;
    --brand: #4f9be6; --brand-hover: #29A9FF; --brand-ink: #06122a; --brand-soft: #16294a;
    --accent: #29A9FF;
    --warn-bg: #3a3115; --err-bg: #3d1f1d; --ok-bg: #133024; --elu-bg: #16294a;
    --pour: #4cc285; --contre: #e57368; --abst: #d6b257;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.top { background: linear-gradient(120deg, var(--capafie-dark) 0%, var(--capafie-dark) 55%, var(--capafie-accent) 100%); color: #fff; border-bottom: 4px solid var(--capafie-line); }
.top-in { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 12px; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand strong { letter-spacing: .03em; font-size: 17px; }
.brand small { display: block; opacity: .85; font-size: 13px; }
.logo { background: transparent; border-radius: 8px; width: 48px; height: 48px; display: inline-grid; place-items: center; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.2); overflow: hidden; color: var(--capafie-dark); }
.logo img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.lang { color: #fff; text-decoration: none; border: 1px solid currentColor; border-radius: 99px; padding: 3px 12px; font-size: 13px; font-weight: 600; }
main.wrap { padding-top: 24px; padding-bottom: 24px; }
.foot { color: var(--muted); font-size: 13px; padding-bottom: 32px; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(14,64,153,.06); }
.card.narrow { border-top: 4px solid var(--capafie-accent); }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
h1 { color: var(--brand); font-size: 1.5rem; margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0; }
.eyebrow { color: var(--muted); font-size: 13px; margin: 0 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hint { font-size: 14px; color: var(--muted); margin: 4px 0 10px; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

.form { display: grid; gap: 14px; }
.form.compact { margin-top: 10px; gap: 8px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 680px) { .grid2 { grid-template-columns: 1fr; } }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
input[readonly] { opacity: .65; }
.code-input { font: 600 1.4rem/1.2 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .12em; text-align: center; text-transform: uppercase; padding: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: 11px 18px; font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-hover); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger:hover { filter: brightness(1.08); background: var(--contre); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger { background: var(--contre); color: #fff; }
.btn.big { width: 100%; padding: 15px; font-size: 16px; margin-top: 8px; }
.btn.small { padding: 7px 12px; font-size: 14px; justify-self: start; }
.icon { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 14px; }
.icon.danger:hover { color: var(--contre); border-color: var(--contre); }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions form { margin: 0; }
.wrap-actions { flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.inline-form input { width: auto; }
form.inline { display: inline; }
.mini-actions { display: flex; gap: 4px; }
.mini-actions form { margin: 0; }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 15px; }
.alert.ok { background: var(--ok-bg); }
.alert.err { background: var(--err-bg); }
.alert.warn { background: var(--warn-bg); }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.secret { border-left: 4px solid var(--capafie-line); background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 14px 0; }

/* Bulletin */
.scrutin { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.scrutin legend { font-weight: 700; padding: 0 6px; font-size: 1.05rem; }
.num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--brand-ink); font-size: 13px; font-weight: 700; margin-right: 4px; vertical-align: 2px; }
.options { display: grid; gap: 8px; }
.options.triple { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .options.triple { grid-template-columns: 1fr; } }
.opt { display: flex; gap: 12px; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; font-weight: 400; min-height: 52px; }
.opt input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); margin: 0; }
.opt small { display: block; color: var(--muted); font-size: 13px; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.opt:has(input:disabled) { opacity: .5; }
.opt-pour:has(input:checked) { border-color: var(--pour); }
.opt-contre:has(input:checked) { border-color: var(--contre); background: var(--err-bg); }
.opt-abstention:has(input:checked) { border-color: var(--abst); background: var(--warn-bg); }
.opt-blanc { border-style: dashed; }

.recap dt { font-weight: 700; margin-top: 14px; }
.recap dd { margin: 6px 0 0; }
.tag { display: inline-block; border-radius: 99px; padding: 3px 10px; font-size: 13px; font-weight: 600; background: var(--brand-soft); color: var(--brand); margin: 2px 2px 2px 0; }
.tag-pour { background: var(--ok-bg); color: var(--pour); }
.tag-contre { background: var(--err-bg); color: var(--contre); }
.tag-abstention { background: var(--warn-bg); color: var(--abst); }

.check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--pour); font-size: 34px; display: grid; place-items: center; margin: 0 auto 12px; }
.recu { font: 700 1.7rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; background: var(--brand-soft); border-radius: 10px; padding: 14px; margin: 6px 0 12px; user-select: all; }

/* Admin */
.adm-nav { display: flex; gap: 6px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.adm-nav a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; }
.adm-nav a.on { background: var(--brand); color: var(--brand-ink); }
.adm-nav .sp { flex: 1; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .03em; }
.b-brouillon { background: var(--line); color: var(--ink); }
.b-ouvert { background: var(--ok-bg); color: var(--pour); }
.b-clos { background: var(--warn-bg); color: var(--abst); }
.live { color: var(--pour); font-weight: 700; font-size: 13px; margin-left: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.stats div { background: var(--bg); border-radius: 10px; padding: 12px; }
.stats span { display: block; font-size: 13px; color: var(--muted); }
.stats strong { font-size: 1.5rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 8px 6px; }
.tbl td { border-bottom: 1px solid var(--line); padding: 9px 6px; vertical-align: top; }
.tbl .r { text-align: right; }
.tbl tr.elu td { background: var(--elu-bg); }
.tbl tr.elu td:first-child { box-shadow: inset 4px 0 0 var(--capafie-line); }
.card:has(> .tbl), .card:has(> form + .tbl) { overflow-x: auto; }
.scrutin-adm { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.cands { margin: 10px 0 0; padding-left: 18px; }
.cands li { margin: 4px 0; }
.add-box summary { cursor: pointer; font-weight: 700; color: var(--brand); padding: 8px 0; }
.add-box .form { margin-top: 10px; }
.danger-zone { border-color: var(--err-bg); }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--capafie-dark), var(--capafie-line)); }
.res { margin-top: 22px; }
.reso { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.reso div { border-radius: 10px; padding: 12px; background: var(--bg); display: flex; justify-content: space-between; align-items: baseline; }
.reso div strong { font-size: 1.4rem; }
.reso .opt-pour { background: var(--ok-bg); }
.reso .opt-contre { background: var(--err-bg); }
.reso .opt-abstention { background: var(--warn-bg); }
.pv-head { text-align: center; border-bottom: 3px solid var(--capafie-dark); padding-bottom: 12px; margin-bottom: 12px; }
.pv-head h1 { margin-top: 12px; }
.signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; font-size: 14px; text-align: center; }

/* Coupons de codes */
.coupons { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.coupon { background: #fff; color: #111; border: 1.5px dashed #888; border-radius: 8px; padding: 12px; break-inside: avoid; }
.c-head { font-size: 10px; letter-spacing: .06em; color: #555; font-weight: 700; }
.c-name { font-weight: 700; margin-top: 4px; }
.c-el { font-size: 12px; color: #444; }
.c-code { font: 700 22px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; text-align: center; margin: 10px 0; padding: 8px; border: 1px solid #ccc; border-radius: 6px; }
.c-foot { font-size: 10px; color: #555; }

@media print {
  body { background: #fff; color: #000; }
  .top, .foot, .adm-nav, .no-print, .alert.ok { display: none !important; }
  .card { border: 0; padding: 0; }
  main.wrap { max-width: none; padding: 0; }
  .coupons { grid-template-columns: 1fr 1fr; }
  .tbl tr.elu td { background: #EAF2FC !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* En-tête du procès-verbal avec logo */
.pv-logo { width: auto; height: 96px; object-fit: contain; display: block; margin: 0 auto 6px; }
.pv-head strong { color: var(--capafie-dark); font-size: 18px; letter-spacing: .04em; }
.coupon { border-color: var(--capafie-accent); }
.c-head { color: var(--capafie-dark); }
.c-code { border-color: var(--capafie-line); background: #EAF2FC; color: var(--capafie-dark); }
.c-logo { width: 18px; height: 18px; border-radius: 2px; object-fit: contain; vertical-align: middle; margin-right: 6px; }
@media print {
  .pv-head, .pv-head strong, .c-code { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
svg.pv-logo { width: auto; height: 96px; }
svg.c-logo { width: 18px; height: 18px; border-radius: 2px; }
.tag-elu { background: var(--capafie-dark); color: #fff; }

/* ---- V2 : AG séquentielle ---- */
.votant { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 16px; }
.votant .who { margin: 0; font-weight: 700; }
.attente { padding: 10px 0 4px; }
.sablier { font-size: 40px; margin-bottom: 6px; }
.recap-box { background: var(--brand-soft); border-radius: 10px; padding: 14px; margin: 12px 0; }
.recu-mini { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .06em; color: var(--ink); user-select: all; }
.deroule { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.deroule summary { cursor: pointer; font-weight: 600; color: var(--brand); font-size: 14px; }
.deroule ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.deroule li span:first-child { margin-right: 6px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.p-ok { background: var(--ok-bg); color: var(--pour); }
.p-open { background: var(--capafie-accent); color: #fff; }
.p-off { background: var(--err-bg); color: var(--contre); }
.p-wait { background: var(--line); color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; counter-reset: st; }
.steps li { counter-increment: st; display: flex; gap: 10px; align-items: center; font-size: 14px; flex-wrap: wrap; }
.steps li::before { content: counter(st); width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--line); font-size: 12px; font-weight: 700; flex: none; }
.steps li.done::before { content: "✓"; background: var(--capafie-accent); color: #fff; }
.steps li span { color: var(--muted); }
.live-box { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 16px; padding: 14px; border-radius: 10px; background: var(--brand-soft); border-left: 4px solid var(--capafie-line); }
.live-box > div { flex: 1 1 260px; }
.bar.big { height: 10px; margin: 8px 0 4px; }
.scrutin-adm.is-open { border-color: var(--capafie-accent); box-shadow: 0 0 0 2px var(--capafie-line); }
.compact-grid { margin-top: 10px; align-items: start; }
.compact-grid > div { display: grid; gap: 8px; align-content: start; }
.inline-label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.inline-form.tight { margin: 0; flex-wrap: nowrap; gap: 4px; }
.inline-form.tight select, .inline-form.tight input { padding: 6px 8px; font-size: 14px; max-width: 170px; }
.check-line { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check-line input { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.btn.wa { background: #1fa855; color: #fff; }
.btn.wa:hover { background: #178c46; }
.envoi td.send { white-space: nowrap; }
.envoi tr.sent td { opacity: .55; }
.print-only { display: none; }
.compo ul { margin: 6px 0 14px; padding-left: 20px; }
.compo h3 { color: var(--brand); margin-top: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
@media print { .print-only { display: grid; } .no-print { display: none !important; } }
fieldset.scrutin { border: 0; padding: 0; margin: 4px 0 16px; }
fieldset.scrutin legend.hint { padding: 0; margin-bottom: 10px; font-weight: 600; color: var(--ink); font-size: 15px; }
.serie { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 6px 0 16px; background: var(--brand-soft); }
.serie-head { display: grid; gap: 6px; }
.serie-count { font-size: 1.4rem; color: var(--brand); }
.prochain { background: var(--card); border-radius: 10px; padding: 12px 14px; margin: 12px 0 4px; min-height: 52px; }
.prochain strong { font-size: 1.1rem; }
.btn.big-wa { padding: 14px 22px; font-size: 16px; }
.mode-emploi { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 3px; }
.annuler { margin-top: 10px; }
.annuler summary { cursor: pointer; font-size: 13px; color: var(--contre); }
.b-annule { background: var(--err-bg); color: var(--contre); }
.reset-zone { border-color: var(--capafie-line); background: linear-gradient(0deg, var(--card), var(--card)) padding-box; }

/* Égalité à trancher, état du bureau */
.tie-box{border:1px solid #f0c36d;background:#fff8e6;border-radius:10px;padding:12px 14px;margin:10px 0}
.compact-grid{align-items:end;gap:12px}
.form.compact label{margin-bottom:6px}
.bureau-etat{margin:10px 0 0;padding-left:18px}
.bureau-etat li{margin:4px 0}
.alert.decision{background:#EAF2FC;border-left:4px solid #1F7FD1}
