/* Drapeaux emoji sous Windows (Twemoji Country Flags, CC-BY 4.0) : ne s'applique qu'aux caractères de drapeau */
@font-face {
  font-family: 'Twemoji Country Flags';
  src: url('../vendor/TwemojiCountryFlags.woff2') format('woff2');
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  font-display: swap;
}

:root {
  --green: #1d6b34;
  --green-dark: #124a22;
  --green-soft: #e7f2ea;
  --red: #b5322e;
  --red-soft: #fbeceb;
  --amber: #b7791f;
  --amber-soft: #fdf3e1;
  --blue: #2b5c8a;
  --blue-soft: #e8f0f8;
  --ink: #1b2420;
  --muted: #5f6b66;
  --line: #e2e7e4;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 24, .06), 0 4px 16px rgba(16, 40, 24, .05);
  --font: 'Twemoji Country Flags', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Montserrat', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--green); }
h1, h2, h3 { font-family: 'Twemoji Country Flags', var(--display); font-weight: 800; letter-spacing: -.01em; margin: 0 0 .6em; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Admin shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--green-dark); color: #dfeee4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: none; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; text-decoration: none; color: inherit; }
.brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; }
.brand strong { display: block; font-family: var(--display); font-style: italic; font-size: 1.15rem; color: #fff; letter-spacing: .02em; }
.brand small { display: block; font-size: .75rem; opacity: .8; }
.sidebar nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #cfe3d6; text-decoration: none; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 var(--red); }
.sidebar .badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 8px; font-weight: 600; }
.nav-sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 12px 4px; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.who { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.who small { display: block; opacity: .7; font-size: .75rem; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; color: #cfe3d6; text-decoration: none; font-size: .88rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 1.3rem; margin: 0; flex: 1; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; background: none; border: 0; padding: 4px; cursor: pointer; color: var(--ink); }
.content { padding: 24px 28px 48px; max-width: 1280px; width: 100%; }

/* ---------- Member shell ---------- */
.member-top { background: var(--green-dark); color: #fff; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 0 24px; gap: 8px; }
.member-top .brand { padding: 12px 0; min-width: 0; }
.member-top .brand > span { min-width: 0; }
.member-top .welcome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; font-size: .82rem; }
.member-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.member-nav a { display: flex; align-items: center; gap: 6px; color: #cfe3d6; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .92rem; }
.member-nav a:hover, .member-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.member-content { max-width: 1000px; margin: 0 auto; padding: 24px 20px 48px; }
.page-title { font-size: 1.5rem; }

/* ---------- Public ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
  background: radial-gradient(ellipse at top, #2a8045 0%, var(--green-dark) 55%, #0b2f15 100%); }
.auth-card { background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 32px; width: 100%; max-width: 420px; }
.auth-card.wide { max-width: 760px; }
.auth-card .logo { display: block; width: 96px; height: 96px; margin: 0 auto 12px; border-radius: 50%; }
.auth-card h1 { text-align: center; font-size: 1.35rem; }
.auth-card .sub { text-align: center; color: var(--muted); margin: -6px 0 22px; }
.auth-links { text-align: center; margin-top: 18px; font-size: .9rem; display: flex; flex-direction: column; gap: 6px; }
.public .flash { width: 100%; max-width: 420px; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: 320px minmax(0, 1fr); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-top: 3px solid var(--green); }
.stat.red { border-top-color: var(--red); }
.stat.amber { border-top-color: var(--amber); }
.stat.blue { border-top-color: var(--blue); }
.stat .label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.stat .value { font-family: var(--display); font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .8rem; color: var(--muted); }
.stat a { text-decoration: none; color: inherit; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: var(--green); color: #fff; padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--green-dark); }
.btn-red { background: var(--red); } .btn-red:hover { background: #8f2522; }
.btn-light { background: var(--surface); color: var(--ink); border-color: var(--line); } .btn-light:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
form.inline { display: inline; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; border: 1px solid; }
.flash-success { background: var(--green-soft); border-color: #b8dbc3; color: var(--green-dark); }
.flash-error { background: var(--red-soft); border-color: #efc3c1; color: #7c1f1c; }
.flash-info { background: var(--blue-soft); border-color: #c6d9ec; color: #1d4268; }
.flash-warning { background: var(--amber-soft); border-color: #f0d9ae; color: #774d0e; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill-actif, .pill-validee, .pill-paye, .pill-active { background: var(--green-soft); color: var(--green-dark); }
.pill-en_attente { background: var(--amber-soft); color: #774d0e; }
.pill-suspendu, .pill-rejetee, .pill-revoquee, .pill-du { background: var(--red-soft); color: #7c1f1c; }
.pill-radie, .pill-expiree { background: #eceeed; color: #555; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafcfb; }
.tbl .person { display: flex; align-items: center; gap: 10px; }
.tbl .person img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--bg); }
.tbl .person a { font-weight: 600; text-decoration: none; color: var(--ink); }
.tbl .person > div { min-width: 0; overflow-wrap: anywhere; }
.tbl .person small { display: block; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-grid .field { margin-bottom: 0; }
label, .label { font-weight: 600; font-size: .85rem; }
.req::after { content: ' *'; color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], input[type=search], input[type=month], select, textarea {
  font: inherit; font-family: var(--font); font-size: .95rem; padding: 9px 11px; border: 1px solid #cfd6d2; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(29,107,52,.25); border-color: var(--green); }
textarea { min-height: 80px; resize: vertical; }
.help { font-size: .8rem; color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 18px; }
legend { font-family: var(--display); font-weight: 800; padding: 0 6px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.radio-cards label { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: block; font-weight: 500; }
.radio-cards input { margin-right: 6px; }
.radio-cards label:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.radio-cards strong { display: block; }

.pagination { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination a { padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); background: #fff; }
.pagination a.active { background: var(--green); color: #fff; border-color: var(--green); }
.pagination .dots { padding: 5px 4px; }

/* Profile */
.profile-head { display: flex; gap: 18px; align-items: center; }
.profile-head img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--green-soft); background: var(--bg); }
.profile-head h2 { margin: 0 0 4px; font-size: 1.3rem; }
dl.info { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; font-size: .92rem; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Month grid */
.months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.month { border-radius: 8px; padding: 8px 4px; text-align: center; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.month span { display: block; font-size: .68rem; font-weight: 500; margin-top: 2px; }
.month.paye { background: var(--green); color: #fff; border-color: var(--green); }
.month.en_attente { background: var(--amber-soft); color: #774d0e; border-color: #f0d9ae; }
.month.du { background: var(--red-soft); color: #7c1f1c; border-color: #efc3c1; }
.month.a_venir { background: #fff; color: var(--ink); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Bars (dashboard) */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar div { width: 100%; max-width: 38px; background: var(--green); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar small { font-size: .7rem; color: var(--muted); }
.bar b { font-size: .68rem; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

.callout { border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.callout.ok { background: var(--green-soft); border: 1px solid #b8dbc3; }
.callout.warn { background: var(--amber-soft); border: 1px solid #f0d9ae; }
.callout.bad { background: var(--red-soft); border: 1px solid #efc3c1; }
.callout h3 { margin: 0 0 2px; }
.callout p { margin: 0; }

/* Découpage territorial */
.geo-stack { display: flex; flex-direction: column; gap: 10px; }
.geo-stack h2 { margin-bottom: 2px; }
.geo-stack .btn { align-self: flex-start; }
.card.geo-row { padding: 14px 16px; margin-bottom: 10px; }
.geo-row-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.geo-row-head input { max-width: 320px; font-weight: 600; }
.geo-row-selects { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.geo-row-selects select { width: auto; flex: 1 1 160px; min-width: 0; }
.geo-row-selects select[name=pays] { flex-basis: 210px; }
.filters select[data-geo-pays], .filters select[name=pays] { min-width: 190px; }

/* Carte électorale (admin) */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 0 0 18px; }
.tabs a { padding: 9px 18px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--green-dark); border-bottom-color: var(--green); }
.tabs a.tabs-lien { margin-left: auto; color: var(--green); font-weight: 500; }
.card .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card .stat { box-shadow: none; padding: 10px 12px; }
.card .stat .value { font-size: 1.3rem; white-space: nowrap; }
.filters-inline { margin-bottom: 14px; }
/* Nombre d'électeurs du bureau (fiche adhérent) : valeur de la carte électorale, non modifiable */
.valeur-carte { padding: 9px 11px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--line); font-weight: 700; font-variant-numeric: tabular-nums; user-select: none; }
.filters-inline select { width: auto; flex: 1 1 170px; min-width: 0; }
details > summary { cursor: pointer; }

/* Utilisateurs */
.affectation { border-top: 1px solid var(--line); padding: 12px 0; }
.affectation .geo-stack { margin-top: 10px; }
.affectation .person { display: flex; gap: 10px; align-items: center; }
.affectation .person img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--bg); flex: none; }
.affectation .person > div { min-width: 0; overflow-wrap: anywhere; }
.affectation .person small { display: block; }

/* Commissions : choix des adhérents à ajouter */
.choix-membre { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-weight: 400; cursor: pointer; }
.choix-membre img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--bg); flex: none; }
.choix-membre span { min-width: 0; overflow-wrap: anywhere; }
.choix-membre small { display: block; }

/* Attribution des fonctions (BEN) */
.attribution { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 10px 18px; align-items: center; border-top: 1px solid var(--line); padding: 12px 0; }
.attribution .person { display: flex; gap: 10px; align-items: center; }
.attribution .person img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--bg); flex: none; }
.attribution .person > div { min-width: 0; overflow-wrap: anywhere; }
.attribution .person small { display: block; }
.attribution-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; }
.attribution-form .field { margin: 0; }
@media (max-width: 760px) {
  .attribution, .attribution-form { grid-template-columns: minmax(0, 1fr); }
}

/* Carte des adhérents */
.carte-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.carte-card { padding: 12px; }
.carte, .carte.leaflet-container { height: 560px; border-radius: 8px; background: #d9e9f2; }
.carte-zoom { background: #fff; border: 2px solid rgba(0,0,0,.2); border-radius: 4px; padding: 5px 10px; font: 600 12px var(--font); cursor: pointer; color: var(--ink); }
.carte-zoom:hover { background: var(--green-soft); }
.carte[hidden] { display: none; }
.carte .leaflet-interactive { cursor: pointer; }
.carte-badge { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); border-radius: 99px; font: 700 12px/21px var(--font);
  text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer; }
.carte-badge.sn { background: var(--green); color: #fff; border-color: #fff; }
.leaflet-container { font-family: var(--font); }
.pastille { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; background: #d0d6d3; }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--green-soft); }
.zone-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.zone-head h2 { margin: 0; }
.zone-stats { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 12px; }
#zone-membres { max-height: 640px; overflow-y: auto; }
@media (max-width: 960px) {
  .carte-grid { grid-template-columns: minmax(0, 1fr); }
  .carte { height: 420px; }
  #zone-membres { max-height: none; }
}
.tbl .tbl td { padding: 4px 8px; }

/* Signature (souris, doigt, stylet) */
.signature-pad { position: relative; height: 190px; border: 1.5px dashed #b9c4be; border-radius: 10px; background: #fff; overflow: hidden; }
.signature-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; display: block; }
.signature-pad.has-ink { border-style: solid; border-color: var(--green); }
.signature-hint { position: absolute; left: 0; right: 0; top: 42%; text-align: center; color: #9aa6a0; font-size: .9rem; pointer-events: none; padding: 0 12px; }
.signature-pad.has-ink .signature-hint { display: none; }
.signature-line { position: absolute; left: 8%; right: 8%; bottom: 38px; border-bottom: 1px solid #d7ded9; pointer-events: none; }
.signature-actions { margin-top: 10px; }
.signature-error { color: #7c1f1c; background: var(--red-soft); border-radius: 8px; padding: 8px 12px; margin: 10px 0 0; }
.signature-field.invalid .signature-pad { border-color: var(--red); }
.signature-current { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.signature-current img, .signature-img { max-height: 70px; max-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }

/* Mon compte */
.compte-stats { margin: 18px 0 14px; }
.compte-stats .stat { text-decoration: none; color: inherit; }
.compte-stats .stat:hover { border-color: var(--green); }
.stat .value.small-value { font-size: 1.15rem; line-height: 1.3; margin: 2px 0; overflow-wrap: anywhere; }

/* Fiche adhérent (lecture) */
.fiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 6px 28px; margin-top: 14px; }
.fiche section { padding-top: 12px; border-top: 1px solid var(--line); }
.fiche h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--green); margin-bottom: 8px; }
.fiche dl.info { grid-template-columns: 170px minmax(0, 1fr); }
.geoloc-quick .geoloc { margin-top: 12px; border-top: 0; padding-top: 0; }

/* Annuaire du département (espace adhérent) */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.member-tile { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.member-tile.me { border-color: var(--green); background: var(--green-soft); }
.member-tile img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--bg); }
.member-tile strong { display: block; line-height: 1.25; }
.member-tile .fn { display: block; font-size: .78rem; font-weight: 700; color: var(--red); text-transform: uppercase; }
.member-tile small { display: block; }

/* Relevé de cotisations */
.releve { max-width: 900px; margin: 0 auto; background: #fff; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); }
.releve-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; border-bottom: 3px solid var(--green); padding-bottom: 14px; margin-bottom: 18px; }
.releve-head .logo-pastef { justify-self: start; height: 56px; width: auto; max-width: 100%; object-fit: contain; }
.releve-head .logo-mopadj { justify-self: end; height: 72px; width: 72px; }
.releve-head h2 { margin: 0; text-align: center; font-size: 1.35rem; letter-spacing: .04em; white-space: nowrap; }
.releve-foot { margin-top: 28px; padding-top: 10px; border-top: 2px solid var(--green); text-align: center; font-size: .82rem; color: var(--muted); }
@media screen and (max-width: 560px) {
  /* téléphone : les deux logos sur une ligne, le titre centré en dessous */
  .releve-head { grid-template-columns: 1fr 1fr; grid-template-areas: "pastef mopadj" "titre titre"; row-gap: 10px; }
  .releve-head .logo-pastef { grid-area: pastef; height: 44px; }
  .releve-head .logo-mopadj { grid-area: mopadj; height: 54px; width: 54px; }
  .releve-head h2 { grid-area: titre; font-size: 1.05rem; }
}
.releve .ident { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 4px 24px; margin-bottom: 18px; font-size: .92rem; }
.releve .ident span { color: var(--muted); }
.releve h3 { margin: 22px 0 8px; font-size: .95rem; }
.releve .total td { font-weight: 700; border-top: 2px solid var(--ink); }
@media print {
  .releve { border: 0; padding: 0 0 14mm; max-width: none; }
  .releve .table-wrap { overflow: visible; margin: 0; padding: 0; }
  .releve .card, .releve { overflow: visible; }
  /* pied de page répété au bas de chaque page imprimée */
  .releve-foot { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 2mm 0 0; background: #fff; }
}

/* WhatsApp */
.btn-whatsapp { background: #1fa855; } .btn-whatsapp:hover { background: #168043; }
.whatsapp-box .actions { flex: none; }
.wa-sent { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: .78rem; color: #168043; }
.wa-sent .ico { width: 14px; height: 14px; }

/* Graphiques circulaires du tableau de bord */
.graphes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (min-width: 1240px) { .graphes { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .graphes { grid-template-columns: minmax(0, 1fr); } }
.graphe { display: flex; flex-direction: column; margin: 0; padding: 14px 16px; }
.graphe .card-head { margin-bottom: 8px; }
.graphe .card-head h2 { font-size: 1rem; margin: 0; }
.graphe .card-head h2 a { color: inherit; text-decoration: none; }
.graphe .card-head h2 a:hover { text-decoration: underline; }
.anneau { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; }
.anneau-dessin { position: relative; width: 124px; height: 124px; }
.anneau-dessin svg { width: 100%; height: 100%; display: block; overflow: visible; }
.anneau-part { cursor: pointer; transition: stroke-width .12s, opacity .12s; }
.anneau-part:hover, .anneau-part.actif { stroke-width: 24; }
.anneau.survol .anneau-part:not(.actif) { opacity: .35; }
.anneau-centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.anneau-centre strong { font-size: 1.3rem; font-weight: 700; line-height: 1.1; color: var(--ink); }
.anneau-centre span { font-size: .72rem; color: var(--muted); }
.anneau-bulle { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px; padding: 6px 10px;
  font-size: .8rem; line-height: 1.35; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.18); transform: translate(-50%, calc(-100% - 10px)); }
.anneau-bulle b { display: block; font-weight: 600; }
.anneau-legende { list-style: none; margin: 0; padding: 0; width: 100%; font-size: .8rem; line-height: 1.3; }
.anneau-legende li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 40px; gap: 6px; align-items: center; padding: 2px 4px; border-radius: 5px; }
.anneau-legende li.actif { background: var(--bg); }
.anneau-legende li.vide { color: var(--muted); }
.anneau-legende .nom { overflow-wrap: anywhere; }
.anneau-legende .nom a { color: var(--ink); text-decoration: none; }
.anneau-legende .nom a:hover { text-decoration: underline; }
.anneau-legende .val { font-weight: 600; text-align: right; }
.anneau-legende .pct { color: var(--muted); text-align: right; }
.pastille-graphe { width: 10px; height: 10px; border-radius: 3px; }
.graphe-pied { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.graphe-pied a { display: inline-flex; align-items: center; gap: 5px; }
.graphe-pied .ico { width: 15px; height: 15px; }

/* Relances des retards */
.actions-relance { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.actions-relance .btn .ico { width: 15px; height: 15px; }
.relance-ok { color: #168043; font-weight: 600; }
.relance-apercu { margin: 4px 0 14px; border: 1px solid var(--line, #e3e6ee); border-radius: 10px; padding: 10px 14px; background: #fafbfd; }
.relance-apercu summary { cursor: pointer; font-weight: 600; }
.relance-messages { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.relance-messages h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.relance-messages pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .85rem; background: #fff; border: 1px solid var(--line, #e3e6ee); border-radius: 8px; padding: 10px; }
@media (max-width: 720px) { .actions-relance { justify-content: flex-start; } }
.etapes { margin: 0 0 14px; padding-left: 20px; }
.etapes li { margin-bottom: 4px; }
.message-texte { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .85rem; background: #fafbfd; border: 1px solid var(--line, #e3e6ee); border-radius: 8px; padding: 10px; margin: 6px 0 12px; }
.ligne-retiree td { opacity: .55; }
.ligne-retiree td:last-child { opacity: 1; }
/* Téléphone : chaque adhérent en retard devient une fiche, boutons de relance en bas, sans défilement horizontal */
@media (max-width: 640px) {
  .tbl-retards thead { display: none; }
  .tbl-retards, .tbl-retards tbody { display: block; }
  .tbl-retards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tbl-retards td { display: block; padding: 0; border: 0; }
  .tbl-retards td:nth-child(1) { grid-column: 1; }
  .tbl-retards td:nth-child(2) { grid-column: 2; text-align: right; }
  .tbl-retards td:nth-child(3) { grid-column: 1 / -1; font-size: .85rem; }
  .tbl-retards td:nth-child(4) { grid-column: 1; }
  .tbl-retards td:nth-child(5) { grid-column: 2; align-self: start; }
  .tbl-retards td:nth-child(6) { grid-column: 1 / -1; }
  .tbl-retards[data-relances] td:nth-child(6):not(:empty)::before { content: 'Dernière relance : '; color: var(--muted); }
  .tbl-retards td:nth-child(6) br { display: none; }
  .tbl-retards td:nth-child(7) { grid-column: 1 / -1; margin-top: 6px; display: flex; justify-content: stretch; }
  .tbl-retards td:nth-child(7):empty { display: none; }
  .tbl-retards td:nth-child(7) .btn { flex: 1 1 0; justify-content: center; }
  .tbl-retards td.empty { grid-column: 1 / -1; }
}

/* Capture d'écran du paiement */
.sr-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.justif-picker label.btn { position: relative; cursor: pointer; }
.justif-picker img { display: block; max-height: 220px; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: #fff; }
.justif-picker .actions { margin-bottom: 6px; }
.justif-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .78rem; text-decoration: none; }
.justif-link img { width: 34px; height: 44px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.justif-link.grand img { width: 72px; height: 96px; }
.justif-link:hover img { border-color: var(--green); }

/* Géolocalisation */
.geoloc { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.geoloc-status.ok { color: var(--green-dark); }
.geoloc-status.bad { color: #7c1f1c; }

/* Prise de photo par caméra */
.camera { position: fixed; inset: 0; z-index: 50; background: rgba(8, 24, 14, .82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.camera[hidden] { display: none; }
.camera-box { background: var(--surface); border-radius: 14px; padding: 16px; width: 100%; max-width: 440px; }
.camera-view { position: relative; aspect-ratio: 1; background: #000; border-radius: 10px; overflow: hidden; }
.camera-view video { width: 100%; height: 100%; object-fit: cover; }
.camera-view video.mirror { transform: scaleX(-1); }
.camera-guide { position: absolute; left: 22%; right: 22%; top: 12%; bottom: 18%; border: 2px dashed rgba(255,255,255,.7); border-radius: 50% / 42%; pointer-events: none; }
.camera-error { color: #7c1f1c; background: var(--red-soft); padding: 10px 12px; border-radius: 8px; margin: 12px 0 0; }
.camera-actions { margin-top: 14px; justify-content: center; }

/* ---------- Carte de membre (format ID-1 : 85.6 × 54 mm) ---------- */
.cards-sheet { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; }
.mcard { width: 85.6mm; height: 54mm; border-radius: 3.2mm; position: relative; overflow: hidden; background: #fff; color: #111;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); font-family: var(--font); -webkit-print-color-adjust: exact; print-color-adjust: exact; flex: none; }
.mcard .head { background: var(--green); color: #fff; height: 13mm; display: flex; align-items: center; gap: 2mm; padding: 0 3mm; position: relative; }
.mcard .head::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1.2mm; height: 1.2mm; background: var(--red); }
.mcard .head img { width: 10mm; height: 10mm; border-radius: 50%; background: #fff; flex: none; }
.mcard .head .org { line-height: 1.05; min-width: 0; }
.mcard .head .org strong { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 4.4mm; letter-spacing: .2mm; display: block; margin-bottom: .5mm; }
.mcard .head .org span { display: block; font-size: 1.75mm; opacity: .95; text-transform: uppercase; letter-spacing: .1mm; white-space: nowrap; }
.mcard .head .year { margin-left: auto; text-align: right; font-size: 1.7mm; text-transform: uppercase; letter-spacing: .2mm; line-height: 1.15; flex: none; }
.mcard .head .year b { display: block; font-family: ui-monospace, Consolas, monospace; font-size: 3.3mm; letter-spacing: .15mm; margin-top: .4mm; }
.mcard .body { display: flex; gap: 3mm; padding: 3mm 3mm 0; }
.mcard .idcol { width: 20mm; flex: none; display: flex; flex-direction: column; gap: .8mm; }
.mcard .photo { width: 20mm; height: 22mm; object-fit: cover; border-radius: 1.5mm; border: .5mm solid var(--green); background: #eee; display: block; }
/* signature du titulaire sous la photo */
.mcard .msig { height: 6.2mm; border-bottom: .25mm solid #c9d3cd; display: flex; align-items: flex-end; justify-content: center; }
.mcard .msig img { max-height: 100%; max-width: 100%; }
.mcard .details { flex: 1; min-width: 0; font-size: 2.2mm; line-height: 1.3; }
.mcard .details .name { font-family: var(--display); font-weight: 800; font-size: 3.4mm; line-height: 1.1; margin: .4mm 0 .8mm; text-transform: uppercase; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mcard .details .title { font-size: 2.3mm; font-weight: 800; color: var(--red); text-transform: uppercase; letter-spacing: .1mm; line-height: 1.15; margin-bottom: 1.2mm; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mcard .details .row { display: flex; gap: 1mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard .details .row span { color: #666; }
.mcard .details .row b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.mcard .qr { width: 17mm; flex: none; display: flex; flex-direction: column; align-items: center; gap: .6mm; }
.mcard .qr .qrbox { width: 17mm; height: 17mm; }
.mcard .qr .qrbox img, .mcard .qr .qrbox canvas { width: 100% !important; height: 100% !important; }
.mcard .qr small { font-size: 1.5mm; color: #666; text-align: center; line-height: 1.1; }
.mcard .foot { position: absolute; left: 0; right: 0; bottom: 0; height: 6mm; display: flex; align-items: center; justify-content: space-between; padding: 0 3mm;
  font-size: 1.9mm; background: var(--green-soft); border-top: .3mm solid #cfe3d6; }
.mcard .foot b { font-family: ui-monospace, Consolas, monospace; font-size: 2.3mm; letter-spacing: .2mm; color: var(--green-dark); }
.mcard .wm { position: absolute; right: -8mm; bottom: -10mm; width: 42mm; opacity: .06; pointer-events: none; }
.mcard.invalid::before { content: 'NON VALIDE'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display);
  font-weight: 800; font-size: 9mm; color: rgba(181,50,46,.35); transform: rotate(-18deg); z-index: 3; pointer-events: none; }
.card-preview { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 20px 0; }

/* Verification page */
.verify { text-align: center; }
.verify .status { font-family: var(--display); font-size: 1.4rem; font-weight: 800; padding: 12px; border-radius: 10px; margin: 14px 0; }
.verify .status.ok { background: var(--green-soft); color: var(--green-dark); }
.verify .status.bad { background: var(--red-soft); color: #7c1f1c; }
.verify img.photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--green-soft); flex: none; }
.verify-id { display: flex; gap: 20px; align-items: flex-start; text-align: left; margin: 18px 0; }
.verify-id h2 { margin: 4px 0 2px; font-size: 1.3rem; }
.verify-fonction { margin: 0 0 12px; font-weight: 800; color: var(--red); text-transform: uppercase; font-size: .9rem; }
.verify-mentions { text-align: left; font-size: .88rem; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 12px 12px 12px 30px; margin: 0 0 18px; }
.verify-signatures { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-bottom: 14px; font-size: .85rem; }
.verify-signatures .sigbox { height: 78px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: center; margin-bottom: 6px; }
.verify-signatures .sigbox img { max-height: 100%; max-width: 100%; }
@media (max-width: 520px) {
  .verify-id { flex-direction: column; align-items: center; text-align: center; }
  .verify-id dl.info { text-align: left; }
}

/* Receipt */
.receipt { max-width: 720px; margin: 0 auto; background: #fff; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); }
.receipt header { display: flex; gap: 14px; align-items: center; border-bottom: 3px solid var(--green); padding-bottom: 14px; margin-bottom: 18px; }
.receipt header img { width: 70px; }
.receipt .amount { font-family: var(--display); font-size: 1.6rem; font-weight: 800; color: var(--green-dark); }

@media print {
  @page { margin: 10mm; }
  body { background: #fff; }
  .sidebar, .topbar, .member-top, .no-print, .flash, .page-title { display: none !important; }
  .content, .member-content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .mcard { box-shadow: none; outline: .2mm dashed #bbb; break-inside: avoid; }
  .cards-sheet { gap: 6mm; justify-content: flex-start; }
  .receipt { border: 0; padding: 0; }
}

/* ---------- Tous appareils ---------- */
/* Un fieldset, une liste déroulante ou une grille ne doivent jamais imposer leur largeur à la page */
fieldset { min-width: 0; }
.field, .grid > *, .form-grid > * { min-width: 0; }
select, input, textarea { max-width: 100%; }
img { max-width: 100%; }
/* Écrans tactiles : cibles plus grandes */
@media (pointer: coarse) {
  .btn-sm { padding: 8px 12px; }
  .sidebar nav a { padding: 12px; }
  .pagination a { padding: 8px 13px; }
}

@media (max-width: 960px) {
  .grid-2, .grid-3, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: -260px; z-index: 20; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .menu-btn { display: block; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 40px; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  /* rien ne doit élargir la page : textes coupés, boutons sur plusieurs lignes, tableaux défilant dans leur cadre */
  .btn { white-space: normal; text-align: center; }
  p, dd, .help { overflow-wrap: anywhere; }
  td { overflow-wrap: break-word; }
  .card { overflow-x: auto; }
  input[type=file] { width: 100%; font-size: 14px; }
  /* 16 px minimum : évite le zoom automatique de l'iPhone sur les champs */
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], input[type=search], select, textarea { font-size: 16px; }
  .topbar { flex-wrap: wrap; gap: 8px 10px; }
  .topbar h1 { font-size: 1.1rem; flex: 1 1 0; min-width: 0; }
  .topbar-actions { flex: 1 1 100%; }
  .topbar-actions:empty { display: none; }
  .topbar-actions .btn { flex: 1 1 auto; justify-content: center; }
  .card { padding: 14px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .content { padding: 12px 12px 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat .value { font-size: 1.35rem; }
  .filters .field, .filters .grow { min-width: 0; flex: 1 1 calc(50% - 10px); }
  .filters .grow { flex-basis: 100%; }
  .filters .btn { flex: 1 1 100%; justify-content: center; }
  .hide-sm { display: none; }
  .profile-head { flex-wrap: wrap; }
  .callout .btn { width: 100%; justify-content: center; }
  .geo-row-selects select, .geo-row-selects select[name=pays] { flex: 1 1 100%; }
  .signature-pad { height: 170px; }
  .receipt { padding: 16px; }
  .bars { gap: 3px; }
  .bar b { font-size: .58rem; }
  .bar small { font-size: .6rem; }
  .months { grid-template-columns: repeat(4, 1fr); }
  dl.info { grid-template-columns: 1fr; gap: 0 0; }
  dl.info dd { margin-bottom: 8px; }
  .auth-card { padding: 22px 18px; }
  .member-top { padding: 0 16px; }
  .member-nav a span { display: none; }
  .member-content { padding: 16px; }
}
/* Carte de membre (85,6 mm ≈ 324 px) sur petits téléphones : réduite à l'écran, taille réelle à l'impression */
@media screen and (max-width: 400px) {
  .cards-sheet .mcard, .card-preview .mcard { zoom: .86; }
}
@media screen and (max-width: 340px) {
  .cards-sheet .mcard, .card-preview .mcard { zoom: .76; }
}
/* Filtres repliables sur téléphone (bouton ajouté par app.js) */
.filters-toggle { display: none; }
@media (max-width: 640px) {
  .filters-toggle { display: flex; width: 100%; justify-content: space-between; margin-bottom: 12px; }
  form.filters.collapsed { display: none; }
}
