/* =========================================================================
   EB-APP : design system
   Bleu nuit et bleu action, jaune et rouge du drapeau de la RDC en accents
   (couleurs relevées sur les maquettes de la page de connexion).
   ========================================================================= */

/* ---------- Polices (locales) ---------- */
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("../fonts/manrope-regular.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url("../fonts/manrope-medium.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("../fonts/manrope-semibold.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("../fonts/manrope-bold.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 800; font-display: swap; src: url("../fonts/manrope-extrabold.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-weight: 600; font-display: swap; src: url("../fonts/atkinson-hyperlegible-mono-latin-600-normal.woff2") format("woff2"); }

/* ---------- Jetons : thème clair (couleurs relevées sur les maquettes EB-APP) ---------- */
:root {
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  /* Codes de ménage et chiffres : police à chasse fixe sans ambiguïté (0/O, 1/l/I). */
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, Consolas, monospace;

  /* Couleurs de marque */
  --navy: #0A1633;
  --navy-2: #10204A;
  --navy-3: #12224A;
  --navy-line: #22356A;
  --navy-text: #B3C2E0;
  --etoile: #F2C80F;
  --rouge: #C8102E;

  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;
  --sunken: #EEF2F8;
  --border: #E1E7F0;
  --border-strong: #D5DCE8;
  --text: #0B1733;
  --text-2: #1E293B;
  --muted: #5B6B85;
  --placeholder: #7D8AA3;

  --primary: #1D66DE;
  --primary-hover: #1857C4;
  --primary-soft: #EAF1FC;
  --primary-line: #D3E0F5;
  --primary-ink: #1868DB;
  --on-primary: #FFFFFF;
  --primary-glow: 0 10px 24px -8px rgba(29, 102, 222, .55);

  --accent: #F2C80F;
  --accent-soft: #FDF6D3;
  --accent-ink: #5E4C00;

  --info-bg: #EAF1FC;
  --info-line: #D3E0F5;
  --info-text: #3E4C66;
  --info-icon: #1D66DE;

  --danger: #C8102E;
  --danger-hover: #A50D26;
  --danger-soft: #FCEBEE;
  --success: #12804A;
  --success-soft: #E6F5EC;
  --warning: #A85407;
  --warning-soft: #FDF1E2;

  --sidebar-bg: var(--navy);
  --sidebar-text: #C3CFE6;
  --sidebar-muted: #7F90B3;
  --sidebar-hover: rgba(255, 255, 255, .06);
  --sidebar-active: rgba(255, 255, 255, .1);

  --focus-ring: 0 0 0 3px rgba(29, 102, 222, .28);
  --shadow-1: 0 1px 2px rgba(11, 23, 51, .06), 0 1px 1px rgba(11, 23, 51, .03);
  --shadow-2: 0 10px 30px -12px rgba(11, 23, 51, .22), 0 2px 6px -2px rgba(11, 23, 51, .08);
  --shadow-3: 0 24px 60px -16px rgba(10, 22, 51, .38);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 20px;

  --sidebar-w: 272px;
  --topbar-h: 64px;
  --ease-out: cubic-bezier(.22, .8, .32, 1);

  --z-sticky: 20;
  --z-sidebar: 40;
  --z-dropdown: 60;
  --z-modal: 100;
  --z-toast: 120;
  --z-preloader: 200;

  color-scheme: light;
}

/* ---------- Jetons : thème sombre ---------- */
:root[data-theme="dark"] {
  --bg: #0B1222;
  --surface: #111B30;
  --surface-2: #131F37;
  --sunken: #0F1A2E;
  --border: #1C2944;
  --border-strong: #24314D;
  --text: #FFFFFF;
  --text-2: #DCE4F2;
  --muted: #94A3BE;
  --placeholder: #6B7A96;

  --primary: #1D66DE;
  --primary-hover: #2F76EE;
  --primary-soft: rgba(59, 130, 246, .14);
  --primary-line: #16305F;
  --primary-ink: #7AABF7;
  --on-primary: #FFFFFF;
  --primary-glow: 0 10px 28px -8px rgba(29, 102, 222, .7);

  --accent-soft: rgba(242, 200, 15, .14);
  --accent-ink: #F2C80F;

  --info-bg: #0F1A2E;
  --info-line: #1C2944;
  --info-text: #A3B1CA;
  --info-icon: #F2C80F;

  --danger: #FF5C70;
  --danger-hover: #FF7A8B;
  --danger-soft: rgba(255, 92, 112, .14);
  --success: #3DD68C;
  --success-soft: rgba(61, 214, 140, .13);
  --warning: #F5A54A;
  --warning-soft: rgba(245, 165, 74, .14);

  --sidebar-bg: #0A1633;
  --sidebar-text: #C3CFE6;
  --sidebar-muted: #7F90B3;

  --focus-ring: 0 0 0 3px rgba(59, 130, 246, .35);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .6);
  --shadow-3: 0 24px 60px -16px rgba(0, 0, 0, .7);

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.625rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0; }
/* Liens sans soulignement, même au survol : seule la teinte change (le clavier garde l'anneau de focus).
   :where() garde une spécificité minimale pour que boutons, menus et cartes gardent leurs propres couleurs. */
a { color: var(--primary-ink); text-decoration: none; transition: color .15s; }
:where(a):hover { color: var(--primary-hover); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
::selection { background: rgba(11, 95, 216, .2); }
.mono, code { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 300; padding: 10px 14px; background: var(--primary); color: var(--on-primary); border-radius: var(--r-md); }
.skip-link:focus { top: 12px; }

/* ---------- Préchargement de l'application ---------- */
.app-preloader {
  position: fixed; inset: 0; z-index: var(--z-preloader);
  display: grid; place-items: center; background: var(--bg);
  transition: opacity .25s ease, visibility .25s;
}
.app-preloader.is-hidden { opacity: 0; visibility: hidden; }
.app-preloader__inner { display: grid; justify-items: center; gap: 18px; }
.app-preloader__mark { width: 72px; height: 72px; animation: mark-breathe 1.4s ease-in-out infinite; }
.app-preloader__mark .roof { stroke-dasharray: 60; animation: roof-draw 1.4s var(--ease-out) infinite; }
.app-preloader__label { font-size: .875rem; color: var(--muted); }
@keyframes mark-breathe { 50% { transform: scale(.94); } }
@keyframes roof-draw { 0% { stroke-dashoffset: 60; } 55%, 100% { stroke-dashoffset: 0; } }

/* Barre de progression de navigation (contenu) */
.route-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: calc(var(--z-sticky) + 30);
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.route-progress::before {
  content: ""; display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform-origin: left; transform: scaleX(var(--progress, 0));
  transition: transform .3s var(--ease-out);
}
.route-progress.is-active { opacity: 1; }

/* ---------- Coquille de l'application ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
:root[data-sidebar="collapsed"] { --sidebar-w: 76px; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: var(--z-sidebar);
  display: flex; flex-direction: column;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  overflow: hidden;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 18px; flex: none; }
.sidebar__brand img { width: 38px; height: 38px; flex: none; }
.sidebar__brand-text { min-width: 0; line-height: 1.2; }
.sidebar__app { display: block; color: #fff; font-weight: 700; font-size: 1.0625rem; letter-spacing: .02em; }
.sidebar__org { display: block; font-size: .8125rem; color: var(--sidebar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar__nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group__title { padding: 0 12px 6px; font-size: .75rem; font-weight: 600; color: var(--sidebar-muted); white-space: nowrap; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: var(--r-md);
  color: var(--sidebar-text); font-weight: 500; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link[aria-current="page"] { background: var(--sidebar-active); color: #fff; }
.nav-link[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--etoile);
}
.nav-link .icon { opacity: .9; }
.nav-link__badge { margin-left: auto; font-size: .6875rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; }
.nav-link--soon { opacity: .55; cursor: default; }
.nav-link--soon:hover { background: transparent; color: var(--sidebar-text); }

.sidebar__footer { flex: none; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar__collapse { width: 100%; border: 0; background: transparent; }

/* Sidebar réduite (bureau) : icônes seules, libellés en info-bulle */
:root[data-sidebar="collapsed"] .sidebar__brand-text,
:root[data-sidebar="collapsed"] .nav-link__label,
:root[data-sidebar="collapsed"] .nav-link__badge,
:root[data-sidebar="collapsed"] .nav-group__title { display: none; }
:root[data-sidebar="collapsed"] .sidebar__brand { justify-content: center; padding: 0; }
:root[data-sidebar="collapsed"] .nav-link { justify-content: center; padding: 0; }
:root[data-sidebar="collapsed"] .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 24px;
  background: var(--surface);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) { .topbar { background: var(--surface); } }
.topbar .topbar__menu { display: none; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.content { flex: 1; position: relative; }
.content.is-loading > .page { opacity: .35; pointer-events: none; transition: opacity .15s .1s; }
/* Le titre reçoit le focus après une navigation (lecteurs d'écran) : pas de contour visible. */
h1[tabindex="-1"]:focus { outline: none; }
.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 28px 48px; animation: page-in .22s var(--ease-out); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-header__text { min-width: 0; max-width: 70ch; }
.page-header__text p { margin-top: 6px; color: var(--muted); }
.page-header__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.drawer-backdrop { display: none; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-md);
  border: 1px solid transparent; font-weight: 600; font-size: .9375rem; line-height: 1;
  white-space: nowrap; text-decoration: none; touch-action: manipulation;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--sunken); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; position: relative; }
.btn-icon.btn-sm { width: 36px; }
.btn .spinner { display: none; }
.btn.is-busy .spinner { display: inline-block; }
.btn.is-busy .btn__icon { display: none; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field__label { font-weight: 600; font-size: .9375rem; color: var(--text); }
.field__req { color: var(--danger); margin-left: 2px; }
.field__hint { font-size: .8125rem; color: var(--muted); }
.field__error { display: none; align-items: flex-start; gap: 6px; font-size: .8125rem; color: var(--danger); font-weight: 500; }
.field.has-error .field__error { display: flex; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: 1rem; /* 16px : évite le zoom automatique sur iOS */
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.select {
  appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A6A81' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.input-group { position: relative; }
.input-group .input { padding-right: 48px; }
.input-group__btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: var(--r-sm); }
.input-group__btn:hover { color: var(--text); }
.input-color { display: flex; gap: 10px; align-items: center; }
.input-color input[type="color"] { width: 52px; height: 46px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.input-color .input { flex: 1; font-family: var(--font-mono); text-transform: uppercase; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background-color .2s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .2s var(--ease-out); }
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus-ring); }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--border); }

/* Zone d'envoi d'image avec aperçu */
.upload { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2); transition: border-color .15s, background-color .15s; }
.upload.is-dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload__preview { width: 88px; height: 88px; flex: none; display: grid; place-items: center; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); overflow: hidden; color: var(--muted); }
.upload__preview:has(img) { background: #fff; } /* les logos sont imprimés sur fond blanc */
.upload__preview img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.upload--square .upload__preview img { object-fit: cover; padding: 0; }
.upload__body { min-width: 0; display: grid; gap: 6px; }
.upload__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.upload input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ---------- Panneaux ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.panel__header p { color: var(--muted); font-size: .875rem; margin-top: 2px; }
.panel__body { padding: 22px; }

/* ---------- Badges, avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 600; background: var(--sunken); color: var(--text-2); white-space: nowrap; }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge--accent { background: var(--accent-soft); color: var(--accent-ink); }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: .8125rem; background: var(--primary-soft); color: var(--primary-ink); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Menus déroulants ---------- */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-dropdown);
  min-width: 240px; padding: 6px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2);
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98); transform-origin: top right;
  transition: opacity .15s, transform .15s var(--ease-out), visibility .15s;
}
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: none; }
.dropdown__header { padding: 10px 12px; border-bottom: 1px solid var(--border); margin: -6px -6px 6px; }
.dropdown__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); text-align: left; font-weight: 500; }
.dropdown__item:hover { background: var(--sunken); }
.dropdown__item--danger { color: var(--danger); }
.dropdown__sep { height: 1px; margin: 6px 0; background: var(--border); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 0; border-radius: 999px; background: transparent; }
.user-chip:hover { background: var(--sunken); }
.user-chip__name { font-weight: 600; font-size: .9375rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notifications */
.notif-dot { position: absolute; top: 7px; right: 7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--rouge); color: #fff; font-size: .6875rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.notif-dot[hidden] { display: none; }
.notif-panel { width: min(380px, calc(100vw - 24px)); padding: 0; }
.notif-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: min(420px, 60vh); overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); }
.notif__icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary-ink); }
.notif--success .notif__icon { background: var(--success-soft); color: var(--success); }
.notif--warning .notif__icon { background: var(--warning-soft); color: var(--warning); }
.notif--danger .notif__icon { background: var(--danger-soft); color: var(--danger); }
.notif__title { font-weight: 600; font-size: .9375rem; }
.notif__body { font-size: .875rem; color: var(--muted); margin-top: 2px; }
.notif__time { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.notif.is-unread .notif__title::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--primary); vertical-align: middle; }

/* ---------- Fenêtre de confirmation ---------- */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(6, 14, 30, .55); animation: fade-in .15s ease; }
.modal__dialog {
  position: relative; width: min(440px, 100%); padding: 24px; border-radius: var(--r-xl);
  background: var(--surface); box-shadow: var(--shadow-3); border: 1px solid var(--border);
  animation: dialog-in .2s var(--ease-out);
}
.modal__icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 16px; background: var(--primary-soft); color: var(--primary-ink); }
.modal--danger .modal__icon { background: var(--danger-soft); color: var(--danger); }
.modal__title { font-size: 1.1875rem; }
.modal__text { margin-top: 8px; color: var(--text-2); }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: var(--z-toast); right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-2);
  animation: toast-in .25s var(--ease-out);
}
:root[data-theme="dark"] .toast { background: #1C2A44; color: var(--text); border: 1px solid var(--border-strong); }
.toast .icon { margin-top: 1px; }
.toast--success .icon { color: #3DD68C; }
.toast--error .icon { color: #FF7A84; }
.toast--info .icon { color: #8AB8FF; }
.toast__text { flex: 1; font-weight: 500; font-size: .9375rem; }
.toast__close { border: 0; background: transparent; color: inherit; opacity: .7; padding: 2px; border-radius: 6px; }
.toast.is-leaving { animation: toast-out .18s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ---------- États vides, squelettes ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.empty__icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--muted); }
.empty p { color: var(--muted); max-width: 46ch; }
.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--sunken) 25%, var(--surface-2) 50%, var(--sunken) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Liste de mise en route ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist__item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--border); }
.checklist__item:last-child { border-bottom: 0; padding-bottom: 0; }
.checklist__item:first-child { padding-top: 0; }
.checklist__mark { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 2px solid var(--border-strong); color: transparent; }
.checklist__item.is-done .checklist__mark { background: var(--success); border-color: var(--success); color: #fff; }
.checklist__item.is-done .checklist__title { color: var(--muted); text-decoration: line-through; }
.checklist__title { font-weight: 600; }
.checklist__text { font-size: .875rem; color: var(--muted); margin-top: 2px; }
.checklist__body { flex: 1; min-width: 0; }

/* ---------- Paramètres ---------- */
.settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { position: sticky; top: calc(var(--topbar-h) + 20px); display: grid; gap: 4px; }
.subnav__link { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: var(--r-md); color: var(--text-2); font-weight: 500; }
.subnav__link:hover { background: var(--sunken); color: var(--text); }
.subnav__link[aria-current="page"] { background: var(--surface); color: var(--primary-ink); font-weight: 600; box-shadow: var(--shadow-1); border: 1px solid var(--border); }

/* ---------- Carte de bénéficiaire (format CR80 : 85,6 × 54 mm) ---------- */
.card-preview { display: grid; gap: 12px; }
.card-preview__stage { padding: 20px; border-radius: var(--r-lg); background: repeating-linear-gradient(45deg, var(--sunken) 0 10px, var(--surface-2) 10px 20px); }
/* ---------- Pages d'authentification et d'installation ---------- */
  position: relative; overflow: hidden; padding: 48px 48px 140px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--sidebar-bg); color: #fff;
}
.auth__alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); font-weight: 500; font-size: .9375rem; }
.auth__alert[hidden] { display: none; }

.setup { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.setup__aside { background: var(--sidebar-bg); color: var(--sidebar-text); padding: 32px 24px; position: relative; overflow: hidden; }
.setup__aside::after { content: ""; position: absolute; right: -70px; bottom: -40px; width: 90px; height: 300px; transform: rotate(35deg); background: linear-gradient(90deg, var(--etoile) 0 18%, var(--rouge) 18% 82%, var(--etoile) 82%); }
.setup__brand { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 700; font-size: 1.125rem; margin-bottom: 36px; }
.setup__brand img { width: 40px; height: 40px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; position: relative; z-index: 1; }
.stepper__item { display: flex; gap: 14px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); color: var(--sidebar-muted); }
.stepper__item a { color: inherit; display: contents; }
.stepper__num { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .875rem; border: 2px solid rgba(255,255,255,.18); }
.stepper__label { font-weight: 600; line-height: 1.3; padding-top: 4px; }
.stepper__label small { display: block; font-weight: 400; font-size: .8125rem; color: var(--sidebar-muted); margin-top: 2px; }
.stepper__item.is-done { color: var(--sidebar-text); }
.stepper__item.is-done .stepper__num { background: rgba(61, 214, 140, .15); border-color: #3DD68C; color: #3DD68C; }
.stepper__item.is-current { background: rgba(255,255,255,.08); color: #fff; }
.stepper__item.is-current .stepper__num { background: var(--etoile); border-color: var(--etoile); color: #0A1633; }
.setup__main { padding: 48px clamp(20px, 5vw, 64px); min-width: 0; }
.setup__content { max-width: 880px; }
.setup__head { margin-bottom: 28px; }
.setup__head p { margin-top: 6px; color: var(--muted); max-width: 64ch; }
.setup__progress { display: none; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }

/* ---------- Divers ---------- */
.stack { display: grid; gap: 18px; }
.cluster { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--text); font-size: .9375rem; }
.callout .icon { color: var(--primary-ink); margin-top: 2px; }
.callout--warning { background: var(--warning-soft); }
.callout--warning .icon { color: var(--warning); }
/* Pages d'erreur : texte à gauche, illustration « cadre de lecture » à droite, raccourcis en dessous. */
.error-page { --tone: var(--primary); --tone-soft: var(--primary-soft); --tone-ink: var(--primary-ink);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); grid-template-areas: "body art" "links links";
  gap: 40px 56px; align-items: center; padding: 40px 0 24px; }
.error-page--danger { --tone: var(--danger); --tone-soft: var(--danger-soft); --tone-ink: var(--danger); }
.error-page--warning { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-ink: var(--warning); }
.error-page__body { grid-area: body; display: grid; justify-items: start; gap: 14px; max-width: 58ch; min-width: 0; }
.error-page__code { font-family: var(--font-mono); font-size: .9375rem; font-weight: 600; color: var(--tone-ink); padding: 4px 12px; border-radius: 999px; background: var(--tone-soft); }
.error-page h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--text); }
.error-page__lead { font-size: 1.0625rem; color: var(--text-2); }
.error-page__address { display: grid; gap: 2px; max-width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--sunken); font-size: .8125rem; }
.error-page__address code { font-family: var(--font-mono); font-size: .9375rem; color: var(--text); overflow-wrap: anywhere; }
.error-page__actions { margin-top: 6px; }
.error-facts { display: grid; gap: 0; width: 100%; max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.error-facts > div { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; padding: 10px 14px; }
.error-facts > div + div { border-top: 1px solid var(--border); }
.error-facts dt { color: var(--muted); font-size: .875rem; }
.error-facts dd { margin: 0; font-weight: 700; color: var(--text); }

.error-art { grid-area: art; position: relative; display: grid; place-items: center; min-height: 250px; aspect-ratio: 4 / 3; width: 100%; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); overflow: hidden; }
.error-art__digits { display: flex; align-items: center; gap: .09em; font-family: var(--font-mono); font-weight: 700; font-size: clamp(4.5rem, 3rem + 6vw, 7rem); line-height: 1; color: var(--text); margin-bottom: 22px; }
/* Le zéro devient un repère de QR code : l'application lit des cartes. */
.error-art__eye { display: grid; place-items: center; width: .7em; height: .7em; margin: 0 .04em; border: .115em solid var(--tone); border-radius: .14em; }
.error-art__eye::after { content: ""; width: .24em; height: .24em; border-radius: .05em; background: var(--tone); }
.error-art__corner { position: absolute; width: 30px; height: 30px; border: 3px solid var(--border-strong); }
.error-art__corner:nth-child(1) { top: 18px; left: 18px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.error-art__corner:nth-child(2) { top: 18px; right: 18px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.error-art__corner:nth-child(3) { bottom: 18px; left: 18px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.error-art__corner:nth-child(4) { bottom: 18px; right: 18px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.error-art__line { position: absolute; left: 12%; right: 12%; top: 16%; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--tone), transparent); opacity: 0; animation: error-scan 1.5s var(--ease-out) .15s 2 alternate; }
.error-art__verdict { position: absolute; bottom: 26px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink); font-size: .875rem; font-weight: 700; }
.error-art__verdict .icon { width: 16px; height: 16px; }
@keyframes error-scan { 0% { top: 16%; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { top: 72%; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .error-art__line { animation: none; } }

.error-links { grid-area: links; padding-top: 28px; border-top: 1px solid var(--border); }
.error-links h2 { font-size: 1rem; font-weight: 700; color: var(--text-2); margin-bottom: 14px; }
.error-links ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.error-links a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s; }
.error-links a span { flex: 1; min-width: 0; }
.error-links a .icon:first-child { color: var(--primary-ink); }
.error-links a .icon:last-child { color: var(--placeholder); width: 16px; height: 16px; }
.error-links a:hover { border-color: var(--primary); background: var(--primary-soft); }

/* Hors connexion : une seule colonne, dans le panneau de l'écran de connexion. */
.error-page--auth { grid-template-columns: minmax(0, 1fr); grid-template-areas: "art" "body"; gap: 28px; padding: 0; }
.error-page--auth .error-art { min-height: 190px; aspect-ratio: 16 / 9; }
.error-page--auth .error-art__digits { font-size: 4.25rem; }
@media (max-width: 900px) {
  .error-page { grid-template-columns: minmax(0, 1fr); grid-template-areas: "art" "body" "links"; gap: 28px; padding: 16px 0 8px; }
  .error-art { max-width: 460px; min-height: 210px; aspect-ratio: 16 / 10; }
  .error-page__actions .btn { flex: 1 1 auto; }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1180px) {
}

@media (max-width: 1023px) {
  :root, :root[data-sidebar="collapsed"] { --sidebar-w: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw);
    transform: translateX(-100%); transition: transform .25s var(--ease-out);
    box-shadow: var(--shadow-3);
  }
  :root[data-drawer="open"] .sidebar { transform: none; }
  :root[data-sidebar="collapsed"] .sidebar__brand-text,
  :root[data-sidebar="collapsed"] .nav-link__label,
  :root[data-sidebar="collapsed"] .nav-link__badge,
  :root[data-sidebar="collapsed"] .nav-group__title { display: revert; }
  :root[data-sidebar="collapsed"] .sidebar__brand { justify-content: flex-start; padding: 0 18px; }
  :root[data-sidebar="collapsed"] .nav-link { justify-content: flex-start; padding: 0 12px; }
  .sidebar__collapse { display: none; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: calc(var(--z-sidebar) - 1); background: rgba(6, 14, 30, .5); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
  :root[data-drawer="open"] .drawer-backdrop { opacity: 1; visibility: visible; }
  .topbar { padding: 0 16px; }
  .topbar .topbar__menu { display: inline-flex; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .subnav__link { white-space: nowrap; }
  .setup { grid-template-columns: minmax(0, 1fr); }
  .setup__aside { padding: 20px; }
  .setup__brand { margin-bottom: 0; }
  .setup__aside .stepper { display: none; }
  .setup__progress { display: block; margin-top: 14px; color: #C9D6EC; font-size: .875rem; position: relative; z-index: 1; }
  .setup__bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.15); margin-top: 8px; overflow: hidden; }
  .setup__bar span { display: block; height: 100%; background: var(--etoile); border-radius: inherit; }
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .page { padding: 20px 16px 40px; }
  h1 { font-size: 1.375rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .panel__header, .panel__body { padding: 16px; }
  .user-chip__name, .user-chip .icon { display: none; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; }
  .toasts { left: 16px; right: 16px; bottom: 16px; width: auto; }
  .upload { flex-direction: column; align-items: flex-start; }
  .setup__main { padding: 24px 16px 40px; }
  .card-preview__stage { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .sidebar, .topbar, .toasts, .route-progress, .app-preloader { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}

/* =========================================================================
   Phase 1 : comptes, profil, tableaux de bord
   ========================================================================= */

/* Couleurs des graphiques (palette validée : bleu, orange, aqua) */
:root {
  --series-1: #2A78D6;
  --series-2: #EB6834;
  --series-3: #1BAF7A;
  --chart-grid: #E6EBF2;
  --chart-axis: #C3CEDF;
}
:root[data-theme="dark"] {
  --series-1: #3987E5;
  --series-2: #D95926;
  --series-3: #199E70;
  --chart-grid: #1E2B42;
  --chart-axis: #2F4262;
}

/* Pied de la barre latérale : fixe, ne défile jamais avec les liens */
.sidebar__footer { display: grid; gap: 2px; padding: 10px 12px 12px; background: var(--sidebar-bg); }
.sidebar__footer form { margin: 0; }
.sidebar__footer .nav-link { width: 100%; border: 0; background: transparent; font: inherit; text-align: left; }
.sidebar-user { min-height: 56px; gap: 10px; margin-bottom: 4px; }
.sidebar-user .avatar { width: 36px; height: 36px; background: rgba(255,255,255,.12); color: #fff; }
.sidebar-user__text { display: grid; min-width: 0; line-height: 1.25; }
.sidebar-user__name { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user__role { font-size: .75rem; color: var(--sidebar-muted); overflow: hidden; text-overflow: ellipsis; }
.nav-link--logout:hover { color: #FF9AA2; }
:root[data-sidebar="collapsed"] .sidebar-user__text { display: none; }

.topbar__avatar { display: inline-flex; padding: 4px; border-radius: 50%; }
.topbar__avatar:hover { background: var(--sunken); }
.notif-panel__foot { display: block; padding: 12px 16px; text-align: center; font-weight: 600; font-size: .9375rem; border-top: 1px solid var(--border); }

/* Avatars */
.avatar--lg { width: 56px; height: 56px; font-size: 1.125rem; }
.avatar--xl { width: 76px; height: 76px; font-size: 1.5rem; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head strong { display: block; font-size: 1.0625rem; }

/* Profil : carte d'identité du compte + onglets */
.profile-card { display: flex; align-items: center; gap: 20px; padding: 20px 22px; }
.profile-card > [data-shell] { flex: none; display: inline-flex; }
.profile-card__main { min-width: 0; display: grid; gap: 10px; }
.profile-card__name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.profile-card__name strong { font-size: 1.25rem; line-height: 1.3; }
.profile-card__meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--text-2); font-size: .875rem; }
.profile-card__meta li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.profile-card__meta .icon { color: var(--muted); flex: none; }
.profile-card { margin-bottom: 16px; }
.profile-tabs { width: fit-content; margin-bottom: 20px; position: relative; border: 1px solid var(--border); }
@media (max-width: 1023px) { .pref-row--desktop { display: none !important; } }
.pref-list { display: grid; gap: 0; padding-top: 4px; padding-bottom: 4px; }
.pref-list .pref-row { padding: 16px 0; border-bottom: 1px solid var(--border); }
.pref-list .pref-row:last-child { border-bottom: 0; }
.pref-row .muted { font-size: .875rem; margin-top: 2px; max-width: 52ch; }
@media (max-width: 639px) {
  .profile-card { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px; }
  .profile-card__meta { flex-direction: column; }
  .profile-tabs { width: auto; }
}

/* Mises en page */
.layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.page--narrow { max-width: 860px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; font-weight: 600; margin-bottom: 8px; }
.field__label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .875rem; }
.field__label-row label { font-weight: 600; font-size: .9375rem; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: var(--danger-soft); color: var(--danger); }
.action-list { display: grid; gap: 10px; }
.action-list .btn { justify-content: flex-start; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 8px; }

/* Barre d'outils, onglets, recherche */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
/* Les filtres occupent la place restante à côté des onglets, ou toute la ligne s'ils passent dessous. */
.toolbar__filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: 1 1 440px; min-width: 0; }
.toolbar__filters .search-field { flex: 1 1 280px; min-width: 260px; }
.toolbar__filters > .select, .toolbar__filters > .combo { flex: 1 0 180px; max-width: 240px; min-width: 0; }
/* Mobile : chaque filtre occupe toute la largeur. */
@media (max-width: 639px) {
  .toolbar__filters { flex-direction: column; align-items: stretch; }
  .toolbar__filters .search-field, .toolbar__filters > .select, .toolbar__filters > .combo { flex: none; width: 100%; max-width: none; min-width: 0; }
}
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--sunken); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs__item { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; font-size: .9375rem; white-space: nowrap; }
.tabs__item:hover { color: var(--text); }
.tabs__item[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.tabs__count { font-size: .75rem; padding: 0 7px; border-radius: 999px; background: var(--border); color: var(--text-2); }
.search-field { position: relative; min-width: 240px; }
.search-field .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field .input { padding-left: 40px; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th { text-align: left; font-weight: 600; font-size: .8125rem; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table--compact th, .table--compact td { padding: 8px 12px; }
.table--compact tbody th { font-weight: 500; color: var(--text); font-size: .875rem; border-bottom: 1px solid var(--border); }
.table--rows tbody tr { position: relative; transition: background-color .12s; }
.table--rows tbody tr:hover { background: var(--surface-2); }
.table--rows tr.is-muted td { color: var(--muted); }
.table__chevron { width: 32px; color: var(--muted); }
.person { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; }
.person strong { display: block; }
.person .muted { display: block; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; }
.person:hover strong { color: var(--primary-ink); }
/* Toute la ligne est cliquable : le lien du nom s'étend à la ligne */
.table--rows .person::after { content: ""; position: absolute; inset: 0; }

/* Cartes de choix (rôle, mode d'accès) */
.choice-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice-cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-card { position: relative; display: grid; gap: 4px; align-content: start; padding: 14px 14px 14px 44px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.choice-card:hover { border-color: var(--muted); }
.choice-card input { position: absolute; left: 14px; top: 16px; width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.choice-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.choice-card:focus-within { box-shadow: var(--focus-ring); }
.choice-card.is-disabled { opacity: .55; cursor: not-allowed; }
.choice-card__title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.choice-card__text { font-size: .8125rem; color: var(--muted); line-height: 1.45; }
fieldset[disabled] .choice-card { cursor: not-allowed; opacity: .7; }


/* Faits, chronologie, puces */
.facts { display: grid; gap: 10px; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; font-size: .9375rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.timeline { list-style: none; margin: 0; padding: 6px 22px 16px; }
.timeline li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .9375rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { white-space: nowrap; font-size: .8125rem; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--sunken); font-size: .875rem; font-weight: 500; }

/* Préférences : choix segmenté */
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-md); background: var(--sunken); }
.segmented__btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); font-weight: 600; font-size: .875rem; }
.segmented__btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* Identifiants affichés une seule fois */
.credentials { display: grid; gap: 8px; margin-top: 16px; padding: 14px; border-radius: var(--r-md); background: var(--sunken); }
.credentials div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; }
.credentials dt { color: var(--muted); font-size: .875rem; }
.credentials dd { margin: 0 0 0 auto; font-family: var(--font-mono); font-weight: 600; font-size: 1rem; white-space: nowrap; }

/* ---------- Tableau de bord ---------- */
.dash__date { color: var(--muted); font-size: .875rem; margin: 0 0 2px !important; }
.kpis { display: grid; grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; display: grid; align-content: space-between; gap: 6px; min-width: 0; }
.kpi__label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: .875rem; }
.kpi__label .icon { width: 18px; height: 18px; }
.kpi__value { font-size: 1.875rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.kpi .kpi__value--hero { font-size: 3.25rem; letter-spacing: -.03em; }
.kpi__foot { font-size: .8125rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.kpi--hero { background: linear-gradient(180deg, var(--primary-soft), var(--surface) 70%); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.delta--up { color: var(--success); }
.delta--down { color: var(--danger); }
.delta--neutral { color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-grid__wide { grid-column: 1; }
.dash-grid > .panel { min-width: 0; }
.dash-mine { margin-bottom: 20px; }
.dash-mine__body { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; padding: 18px 22px; align-items: center; }
.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; }
.mini-stats dt { font-size: .8125rem; color: var(--muted); font-weight: 600; }
.mini-stats dd { margin: 2px 0 0; font-size: 1.5rem; font-weight: 700; }
.mini-stats--column { grid-template-columns: minmax(0, 1fr); align-content: start; }
.team { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: center; }

.chart { margin: 0; }
.chart__canvas { position: relative; }
.chart__skeleton { width: 100%; border-radius: var(--r-md); }
.chart__data { margin-top: 8px; font-size: .875rem; }
.chart__data summary { cursor: pointer; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; list-style: none; }
.chart__data summary::-webkit-details-marker { display: none; }
.chart__data summary::before { content: ""; width: 0; height: 0; border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s; }
.chart__data[open] summary::before { transform: rotate(90deg); }
.chart__data summary:hover { color: var(--text); }
.chart__data .table-wrap { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r-md); max-height: 260px; overflow-y: auto; }

/* Infobulle des graphiques, aux couleurs du thème */
.apexcharts-tooltip.apexcharts-theme-light, .apexcharts-tooltip.apexcharts-theme-dark { border: 1px solid var(--border) !important; background: var(--surface) !important; color: var(--text) !important; box-shadow: var(--shadow-2) !important; border-radius: var(--r-md) !important; }
.eb-tip { padding: 10px 12px; font-family: var(--font); font-size: .8125rem; min-width: 160px; }
.eb-tip__title { font-weight: 700; margin-bottom: 6px; }
.eb-tip__row { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.eb-tip__row + .eb-tip__row { margin-top: 4px; }
.eb-tip__key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.eb-tip__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.eb-tip__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.apexcharts-xaxistooltip { display: none !important; }
.apexcharts-legend-text { color: var(--text-2) !important; font-family: var(--font) !important; }

.recent { list-style: none; margin: 0; padding: 4px 0; }
.recent__item { display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-bottom: 1px solid var(--border); }
.recent__item:last-child { border-bottom: 0; }
.recent__code { font-size: .8125rem; font-weight: 600; color: var(--primary-ink); background: var(--primary-soft); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.recent__main { flex: 1; min-width: 0; display: grid; }
.recent__main strong, .recent__main .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent__main .muted { font-size: .8125rem; }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi--hero { grid-column: span 4; }
}
@media (max-width: 1180px) {
  .layout-aside, .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-mine__body, .team { grid-template-columns: minmax(0, 1fr); }
  .mini-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .choice-cards, .choice-cards--2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi--hero { grid-column: span 2; }
  .kpi .kpi__value--hero { font-size: 2.5rem; }
  .kpi__value { font-size: 1.5rem; }
  .kpi { padding: 14px; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recent__item { padding: 12px 16px; flex-wrap: wrap; }
  /* Tableau en cartes sur mobile */
  .table--rows thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--rows, .table--rows tbody, .table--rows tr, .table--rows td { display: block; width: 100%; }
  .table--rows tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table--rows tbody tr:last-child { border-bottom: 0; }
  .table--rows td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
  .table--rows td[data-label]:not(:first-child)::before { content: attr(data-label); color: var(--muted); font-size: .8125rem; font-weight: 600; }
  .table--rows td:first-child { padding-bottom: 8px; }
  .table__chevron { display: none !important; }
}

/* ---------- Barre du haut : logo, recherche globale ---------- */
.topbar__brand { display: none; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.0625rem; letter-spacing: .02em; flex: none; }
.topbar__brand img { width: 34px; height: 34px; }
/* Ordinateur : pas de logo dans la barre du haut, il est déjà dans la barre latérale (téléphone et tablette : voir plus bas). */

.topbar__search { position: relative; flex: 1; max-width: 520px; }
.topbar__search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topbar__search input { width: 100%; height: 42px; padding: 0 44px 0 40px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); font-size: 1rem; }
.topbar__search input::placeholder { color: var(--muted); }
.topbar__search input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); background: var(--surface); }
.topbar__search input::-webkit-search-cancel-button { display: none; }
.topbar__kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); min-width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 6px; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); background: var(--surface); }
.topbar__search input:focus ~ .topbar__kbd { display: none; }
.topbar__search-close, .topbar__search-open { display: none; }

.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: var(--z-dropdown); max-height: min(440px, 70vh); overflow-y: auto; padding: 6px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2); }
.search-results__group { padding: 8px 10px 4px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.search-results__item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; border-radius: var(--r-sm); color: var(--text); }
.search-results__item:hover, .search-results__item.is-active { background: var(--sunken); }
.search-results__item > .icon { color: var(--muted); }
.search-results__text { display: grid; min-width: 0; }
.search-results__text strong, .search-results__text .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results__text .muted { font-size: .8125rem; }
.search-results__state { display: flex; align-items: center; gap: 10px; padding: 14px 12px; color: var(--muted); font-size: .9375rem; }

@media (max-width: 1023px) {
  .topbar__brand { display: inline-flex; }
  .topbar__search { display: none; }
  .topbar__search-open { display: inline-flex; }
  /* Recherche ouverte sur mobile : le champ couvre la barre du haut. */
  :root[data-search="open"] .topbar__search {
    display: block; position: absolute; inset: 0; max-width: none; padding: 10px 12px; background: var(--surface); z-index: 2;
  }
  :root[data-search="open"] .topbar__search-icon { left: 24px; }
  :root[data-search="open"] .topbar__search input { padding-right: 52px; }
  :root[data-search="open"] .topbar__search-close { display: inline-flex; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 40px; min-height: 40px; }
  :root[data-search="open"] .topbar__kbd { display: none; }
  :root[data-search="open"] .search-results { left: 12px; right: 12px; top: calc(100% - 2px); }
}
@media (max-width: 400px) {
  .topbar { gap: 2px; padding: 0 10px 0 12px; }
}
@media (max-width: 359px) {
  .topbar__brand span { display: none; }
}

/* ---------- Fiche ménage ---------- */
.household-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.household-title .mono { color: var(--primary-ink); }
.household-title span:last-child { font-weight: 600; color: var(--text-2); font-size: .8em; }
.kpis--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-aside--wide { grid-template-columns: minmax(0, 1fr) 400px; }
.assist-grid { display: grid; gap: 10px; }
.assist { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.assist > div { flex: 1; min-width: 0; }
.assist .muted { font-size: .8125rem; }
.assist__icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); flex: none; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.tag { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); white-space: nowrap; }
.avatar--f { background: rgba(235, 104, 52, .14); color: #B8481D; }
:root[data-theme="dark"] .avatar--f { color: #F59A72; }
.table--static tbody tr:hover { background: transparent; }

/* Lignes « derniers ménages » : toute la ligne ouvre la fiche */
.recent__item { position: relative; }
.recent__link { position: absolute; inset: 0; border-radius: inherit; }
.recent__item:hover { background: var(--surface-2); }
.recent__link:focus-visible { box-shadow: inset var(--focus-ring); }

.empty--inline { padding: 24px 16px; border: 1px dashed var(--border-strong); border-radius: var(--r-md); }

@media (max-width: 1180px) {
  .layout-aside--wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .kpis--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tags { justify-content: flex-end; }
  .assist { flex-wrap: wrap; }
}

/* ---------- Listes déroulantes avec recherche ---------- */
.combo { position: relative; min-width: 0; }
.combo__native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.combo__control { display: flex; align-items: center; cursor: pointer; text-align: left; user-select: none; }
.combo__value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo__placeholder { color: var(--muted); }
.combo.is-open .combo__control { border-color: var(--primary); box-shadow: var(--focus-ring); }
.combo--multi .combo__control { min-height: 46px; height: auto; padding-top: 6px; padding-bottom: 6px; }
.combo--multi .combo__value { display: flex; flex-wrap: wrap; gap: 6px; white-space: normal; }
.combo__chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-ink); font-size: .875rem; font-weight: 600; }
.combo__chip-remove { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: inherit; padding: 0; }
.combo__chip-remove:hover { background: rgba(11, 95, 216, .15); }
.combo__chip-remove .icon { width: 14px; height: 14px; }

.combo__popup { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: var(--z-dropdown); min-width: 240px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2); overflow: hidden; animation: dialog-in .14s var(--ease-out); }
.combo--up .combo__popup { top: auto; bottom: calc(100% + 6px); }
.combo__search { position: relative; padding: 8px; border-bottom: 1px solid var(--border); }
.combo__search .icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.combo__search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface-2); font-size: 1rem; }
.combo__search input:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.combo__search input::-webkit-search-cancel-button { display: none; }
.combo__list { list-style: none; margin: 0; padding: 6px; max-height: min(300px, 45vh); overflow-y: auto; overscroll-behavior: contain; }
.combo__option { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; }
.combo__option:hover, .combo__option.is-active { background: var(--sunken); }
.combo__option[aria-selected="true"] { color: var(--primary-ink); font-weight: 600; }
.combo__check { width: 18px; flex: none; display: grid; place-items: center; visibility: hidden; color: var(--primary); }
.combo__check .icon { width: 16px; height: 16px; }
.combo__option[aria-selected="true"] .combo__check { visibility: visible; }
.combo__text { display: grid; min-width: 0; }
.combo__text span, .combo__text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo__text small { color: var(--muted); font-size: .8125rem; font-weight: 400; }
.combo__status { padding: 8px 14px; font-size: .8125rem; color: var(--muted); border-top: 1px solid var(--border); }
.combo__status:empty { display: none; }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 16px; }
.pagination__summary { margin: 0; font-size: .875rem; color: var(--muted); }
.pagination__summary strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pagination__pages { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.pagination__btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 40px; height: 40px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: .875rem; font-variant-numeric: tabular-nums; }
.pagination__btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.pagination__btn.is-current { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pagination__btn.is-disabled { opacity: .45; pointer-events: none; }
.pagination__gap { display: inline-flex; width: 28px; justify-content: center; color: var(--muted); }
.pagination__compact { display: none; }
@media (max-width: 640px) {
  .pagination { justify-content: center; }
  .pagination__summary { width: 100%; text-align: center; }
  .pagination__num { display: none; }
  .pagination__compact { display: block; }
  .pagination__compact .pagination__btn { min-width: 72px; }
}

/* ---------- Verso de la carte ---------- */
.card-faces { display: grid; gap: 14px; }
.card-face__label { display: block; font-size: .8125rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
/* ---------- Sections de formulaire, listes de référence ---------- */
.form-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.form-section__head { margin-bottom: 16px; }
.form-section__head h3 { font-size: 1.0625rem; }
.form-section__head p { margin-top: 4px; color: var(--muted); font-size: .875rem; max-width: 70ch; }

.ref-add__row { display: flex; gap: 10px; }
.ref-add__row .input { flex: 1; min-width: 0; }
.ref-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); }
.ref-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px 16px; align-items: start; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ref-row:last-child { border-bottom: 0; }
.ref-row.is-inactive { background: var(--surface-2); }
.ref-row.is-inactive .ref-row__edit .input { color: var(--muted); }
.ref-row__order { display: flex; flex-direction: column; gap: 2px; }
.ref-row__order form, .ref-row__actions form { margin: 0; }
.ref-row__edit .input { min-height: 40px; }
.ref-row__meta { display: flex; align-items: center; gap: 10px; min-height: 40px; white-space: nowrap; font-size: .875rem; }
.ref-row__actions { display: flex; gap: 4px; min-height: 40px; align-items: center; }
@media (max-width: 900px) {
  .ref-row { grid-template-columns: auto minmax(0, 1fr); }
  .ref-row__meta, .ref-row__actions { grid-column: 2; min-height: 0; }
}
@media (max-width: 560px) {
  .ref-add__row { flex-direction: column; }
}

/* Liste avec recherche sur téléphone et tablette : feuille ancrée en haut de l'écran */
.combo__sheet-head { display: none; }
@media (max-width: 1023px) {
  .combo--sheet .combo__popup {
    position: fixed; top: 0; left: 0; right: 0; bottom: auto; z-index: var(--z-modal);
    max-height: 85vh; max-height: 85dvh; display: flex; flex-direction: column; border-radius: 0 0 var(--r-xl) var(--r-xl);
    border-top: 0; animation: sheet-in .2s var(--ease-out);
  }
  .combo--sheet .combo__sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 0 16px; padding-top: max(8px, env(safe-area-inset-top)); }
  .combo--sheet .combo__sheet-title { font-size: 1rem; }
  .combo--sheet .combo__list { max-height: none; flex: 1; }
  :root.has-sheet body::after { content: ""; position: fixed; inset: 0; z-index: calc(var(--z-modal) - 1); background: rgba(6, 14, 30, .45); }
}
@keyframes sheet-in { from { transform: translateY(-16px); opacity: 0; } }

/* Fiche ménage : deux graphiques côte à côte */
.chart-pair { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1280px) { .chart-pair { grid-template-columns: minmax(0, 1fr); } }

/* =========================================================================
   Page de connexion (et écrans sans session) : maquettes EB-APP
   ========================================================================= */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); background: var(--bg); }

/* Panneau de présentation (bleu nuit dans les deux thèmes) */
.login__hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; padding: 56px 64px 56px;
  background: var(--navy); color: #fff;
}
.login__hero-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 3; }
.login__brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; }
.login__brand img { width: 44px; height: 44px; }

/* Ordre : cercle (0) < bande du drapeau (1) < illustration (2) < textes (3). */
.login__art { position: absolute; top: -10px; right: -40px; width: 520px; height: 520px; pointer-events: none; }
.login__circle { position: absolute; inset: 0; z-index: 0; border-radius: 50%; background: var(--navy-2); }
.login__art picture { position: absolute; inset: 0; display: block; }
.login__art img { position: absolute; display: block; max-width: none; }
.login__art img { z-index: 2; width: 420px; height: auto; left: 10px; top: 80px; }

.login__pitch { position: relative; z-index: 3; margin-top: auto; padding-top: 318px; max-width: 620px; }
.login__badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--navy-3); border: 1px solid var(--navy-line); font-size: .875rem; font-weight: 600; color: #DCE4F2; }
.login__badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--etoile); }
.login__badge-short { display: none; }
.login__headline { margin-top: 22px; font-size: clamp(2.25rem, 3.3vw, 3rem); font-weight: 800; line-height: 1.08; letter-spacing: -.035em; color: #fff; }
.login__headline em { font-style: normal; color: var(--etoile); }
.login__dot { color: var(--etoile); }
.login__lead { margin-top: 18px; max-width: 470px; font-size: 1.0625rem; line-height: 1.65; color: var(--navy-text); }
.login__chips { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.login__chips li { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 999px; background: var(--navy-3); border: 1px solid var(--navy-line); font-size: .9375rem; font-weight: 700; color: #fff; }
.login__chip-icon--qr { color: #6EA8FF; }
.login__chip-icon--food { color: var(--etoile); }
.login__chip-icon--agri { color: #34D399; }
.login__chip-icon--cash { color: #FF6B81; }

.login__partner { display: flex; align-items: center; gap: 14px; }
.login__partner-logo { width: 56px; height: 56px; flex: none; border-radius: 12px; background: #fff; display: grid; place-items: center; overflow: hidden; padding: 6px; }
.login__partner-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.login__partner-initials { font-weight: 800; color: var(--navy); font-size: 1rem; }
.login__partner-label { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8FA0C2; }
.login__partner strong { display: block; margin-top: 2px; font-size: 1rem; font-weight: 700; color: #fff; }
.login__partner--hero { position: relative; z-index: 3; margin-top: 40px; }
.login__partner--main { display: none; }

/* Bande diagonale aux couleurs du drapeau */
.login__stripe {
  position: absolute; z-index: 1; left: 50%; bottom: -112px; width: 92%; height: 118px;
  transform: rotate(-32deg); transform-origin: left bottom;
  background: linear-gradient(180deg, var(--etoile) 0 22%, var(--rouge) 22% 76%, var(--etoile) 76%);
}

/* Partie formulaire */
.login__main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 104px 56px 96px; background: var(--bg); }
.login__theme { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; transition: background-color .15s, border-color .15s; }
.login__theme:hover { border-color: var(--muted); }
.login__theme--main { position: absolute; top: 40px; right: 56px; }
.login__theme--hero { display: none; }
.login__content { width: min(420px, 100%); }

.login__form h1 { font-size: 2.125rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.login__form > p, .login__intro { margin-top: 10px; color: var(--muted); font-size: 1rem; }
.login__form form { margin-top: 30px; display: grid; gap: 20px; }
.login__form .field > label, .login__form .field__label-row label { font-size: .9375rem; font-weight: 700; color: var(--text-2); }
.login__form .input { min-height: 52px; border-radius: var(--r-md); }
.login__forgot { font-size: .9375rem; font-weight: 700; color: var(--primary-ink); }
.login__forgot--row { display: none; }
.login__options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -4px; }
.login__remember-short { display: none; }
.login__notice { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-md); background: var(--info-bg); border: 1px solid var(--info-line); }
.login__notice .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--info-icon); }
.login__notice p { margin: 0; font-size: .8125rem; line-height: 1.55; color: var(--info-text); }
.login__foot { position: absolute; left: 56px; right: 56px; bottom: 40px; display: flex; justify-content: space-between; gap: 16px; font-size: .875rem; color: var(--placeholder); }

/* Champs avec icône à gauche */
.input-icon { position: relative; }
.input-icon__icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--placeholder); pointer-events: none; }
.input-icon .input { padding-left: 46px; }
.input-icon:focus-within .input-icon__icon { color: var(--primary); }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); opacity: 1; }

/* Case à cocher */
.checkbox { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .9375rem; font-weight: 500; color: var(--text-2); }
.checkbox input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.checkbox__box { width: 20px; height: 20px; flex: none; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; color: transparent; transition: background-color .15s, border-color .15s; }
.checkbox__box .icon { width: 14px; height: 14px; stroke-width: 3; }
.checkbox input:checked + .checkbox__box { background: var(--primary); border-color: var(--primary); color: #fff; }
.checkbox input:focus-visible + .checkbox__box { box-shadow: var(--focus-ring); }

/* Boutons : le bouton principal porte un léger halo, comme sur les maquettes */
.btn-primary { box-shadow: var(--primary-glow); }
.btn-primary:hover { box-shadow: var(--primary-glow); }
.btn-lg { min-height: 54px; font-size: 1.0625rem; font-weight: 700; border-radius: var(--r-md); }

/* Téléphone et tablette : bandeau en haut, formulaire dans une feuille arrondie */
@media (max-width: 1023px) {
  .login { grid-template-columns: minmax(0, 1fr); background: var(--navy); }
  .login__hero { padding: 20px 20px 52px; min-height: 0; }
  .login__theme--hero { display: inline-grid; background: var(--navy-3); border-color: var(--navy-line); color: #fff; }
  .login__theme--main { display: none; }
  .login__brand { font-size: 1.125rem; gap: 10px; }
  .login__brand img { width: 36px; height: 36px; }
  .login__art { top: 74px; right: -34px; width: 250px; height: 250px; }
  .login__art img { width: 205px; left: 6px; top: 20px; }
  .login__pitch { margin-top: 0; padding-top: 18px; max-width: 58%; }
  .login__badge { padding: 4px 11px; font-size: .75rem; }
  .login__badge-long { display: none; }
  .login__badge-short { display: inline; }
  .login__headline { margin-top: 12px; font-size: 1.625rem; line-height: 1.15; letter-spacing: -.025em; }
  .login__lead, .login__chips, .login__partner--hero { display: none; }
  .login__stripe { left: 40%; bottom: -34px; width: 78%; height: 40px; }

  .login__main { justify-content: flex-start; align-items: stretch; margin-top: -24px; padding: 28px 20px 24px; border-radius: 24px 24px 0 0; position: relative; z-index: 3; }
  .login__content { width: 100%; max-width: 520px; margin: 0 auto; }
  .login__form h1 { font-size: 1.75rem; }
  .login__form > p, .login__intro { font-size: .9375rem; }
  .login__form form { margin-top: 22px; gap: 18px; }
  .login__forgot--label { display: none; }
  .login__forgot--row { display: inline; }
  .login__notice, .login__foot { display: none; }
  .login__partner--main { display: flex; width: 100%; max-width: 520px; margin: 40px auto 0; padding-top: 22px; border-top: 1px solid var(--border); }
  .login__partner--main .login__partner-logo { width: 46px; height: 46px; border: 1px solid var(--border); }
  .login__partner--main .login__partner-label { color: var(--muted); }
  .login__partner--main strong { color: var(--text); font-size: .9375rem; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .login__remember-long { display: inline; }
  .login__hero { padding: 28px 40px 60px; }
  .login__art { right: 0; width: 300px; height: 300px; top: 70px; }
  .login__art img { width: 250px; }
  .login__headline { font-size: 2rem; }
}
@media (max-width: 639px) {
  .login__remember-long { display: none; }
  .login__remember-short { display: inline; }
}
@media (max-width: 359px) {
  .login__art { display: none; }
  .login__pitch { max-width: none; }
}

/* =========================================================================
   Carte de bénéficiaire (CR80 : 85,6 × 54 mm) : maquettes EB-APP
   Tailles en cqw (1 px de la maquette 856 px = 0,1168 cqw).
   ========================================================================= */
.id-card {
  --card-color: #0B2150;
  --card-ink: #0B1733;
  --card-muted: #64748B;
  --card-line: #DCE3EE;
  container-type: inline-size;
  --u: 1cqw; /* 1 % de la largeur de la carte ; remplacé en pixels par le script si « cqw » n'est pas reconnu */
  position: relative; width: 100%; aspect-ratio: 856 / 540; overflow: hidden;
  border-radius: calc(3.3 * var(--u)); background: #fff; color: var(--card-ink);
  box-shadow: 0 1px 2px rgba(11,23,51,.1), 0 14px 32px -14px rgba(11,23,51,.45);
  font-family: var(--font); line-height: 1.2;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.id-card svg { display: block; }

/* Bande du drapeau sous le bandeau : jaune, rouge, jaune */
.id-card__flag { position: absolute; left: 0; right: 0; height: calc(1.17 * var(--u)); background: linear-gradient(180deg, #F2C80F 0 20%, #C8102E 20% 80%, #F2C80F 80%); }
.id-card--front .id-card__flag { top: calc(10.75 * var(--u)); }
.id-card--back .id-card__flag { top: calc(14.95 * var(--u)); }

/* Fond : motif de cercles très discret et grande étoile en filigrane */
.id-card__body, .id-card-back__body {
  position: absolute; left: 0; right: 0; bottom: calc(3.27 * var(--u));
  background-image: radial-gradient(circle, transparent calc(2.35 * var(--u)), #EEF2F9 calc(2.4 * var(--u)), #EEF2F9 calc(2.55 * var(--u)), transparent calc(2.6 * var(--u)));
  background-size: calc(5.6 * var(--u)) calc(5.6 * var(--u)); background-position: calc(1.4 * var(--u)) 0;
}
.id-card__body { top: calc(11.92 * var(--u)); }
.id-card-back__body { top: calc(16.12 * var(--u)); }
.id-card__star { position: absolute; width: calc(20 * var(--u)); height: auto; left: calc(44.5 * var(--u)); top: calc(20.5 * var(--u)); fill: #F2C80F; opacity: .1; pointer-events: none; }
.id-card--back .id-card__star { left: calc(64 * var(--u)); top: calc(15 * var(--u)); width: calc(16 * var(--u)); }

/* Bandeau du recto : logos (1 à 3) à gauche, titre à droite */
.id-card__band { position: absolute; top: 0; left: 0; right: 0; height: calc(10.75 * var(--u)); padding: 0 calc(3.27 * var(--u)); display: flex; align-items: center; gap: calc(2.5 * var(--u)); background: var(--card-color); }
.id-card__logos { display: flex; gap: calc(1.17 * var(--u)); flex: none; }
.id-card__logo { width: calc(12.15 * var(--u)); height: calc(7 * var(--u)); border-radius: calc(1.17 * var(--u)); background: #fff; display: grid; place-items: center; padding: calc(.7 * var(--u)); overflow: hidden; }
.id-card__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.id-card__logo-empty { font-size: calc(1.2 * var(--u)); font-weight: 600; color: #8A97AE; text-align: center; }
.id-card:not(.id-card--preview) .id-card__logo:has(.id-card__logo-empty) { display: none; }
.id-card__titles { margin-left: auto; min-width: 0; display: grid; justify-items: end; gap: calc(.55 * var(--u)); text-align: right; }
.id-card__title { font-size: calc(2 * var(--u)); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #fff; white-space: nowrap; }
.id-card__subtitle { font-size: calc(1.4 * var(--u)); font-weight: 700; color: #F2C80F; line-height: 1.25; }

/* Photo */
.id-card__photo { position: absolute; left: calc(3.27 * var(--u)); top: calc(2.57 * var(--u)); width: calc(18.69 * var(--u)); height: calc(24.88 * var(--u)); padding: calc(.35 * var(--u)); border: calc(.2 * var(--u)) solid #C9D5E8; border-radius: calc(1.4 * var(--u)); background: #fff; box-shadow: 0 0 0 calc(.12 * var(--u)) #E4EAF4; }
.id-card__photo-inner { width: 100%; height: 100%; border-radius: calc(1.05 * var(--u)); background: #E8EEF8; overflow: hidden; display: grid; place-items: end center; }
.id-card__photo-inner img { width: 100%; height: 100%; object-fit: cover; }
.id-card__photo-inner svg { width: 78%; height: auto; fill: #A9BCD9; }

/* Identité */
.id-card__info { position: absolute; left: calc(24.53 * var(--u)); top: calc(2.8 * var(--u)); width: calc(50.2 * var(--u)); }
.id-card__label, .id-card__fields dt { display: block; font-size: calc(1.29 * var(--u)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--card-muted); }
.id-card__name { margin: calc(.7 * var(--u)) 0 0; padding-bottom: calc(1.6 * var(--u)); border-bottom: calc(.12 * var(--u)) solid #E1E7F0; font-size: calc(2.22 * var(--u)); font-weight: 800; line-height: 1.18; color: var(--card-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.id-card__fields { margin: calc(1.75 * var(--u)) 0 0; display: grid; grid-template-columns: calc(25.7 * var(--u)) minmax(0, 1fr); gap: calc(1.5 * var(--u)) 0; }
.id-card__fields div { min-width: 0; padding-right: calc(1.5 * var(--u)); }
.id-card__fields dd { margin: calc(.45 * var(--u)) 0 0; font-size: calc(1.75 * var(--u)); font-weight: 700; color: var(--card-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-card__fields dd.id-card__wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
.id-card__status { display: inline-block; max-width: 100%; padding: calc(.2 * var(--u)) calc(.9 * var(--u)); border-radius: calc(.7 * var(--u)); background: #FDECEF; border: calc(.12 * var(--u)) solid #F4C7CF; color: #A50D26; font-size: calc(1.52 * var(--u)); font-weight: 700; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

/* QR et numéro du ménage */
.id-card__qr { position: absolute; left: calc(77.1 * var(--u)); top: calc(2.57 * var(--u)); width: calc(19.63 * var(--u)); padding: calc(1.05 * var(--u)) calc(1.05 * var(--u)) calc(1.4 * var(--u)); border: calc(.15 * var(--u)) solid var(--card-line); border-radius: calc(1.4 * var(--u)); background: #fff; display: grid; justify-items: center; align-content: start; }
.id-card__qr-code { width: calc(17.2 * var(--u)); height: calc(17.2 * var(--u)); fill: var(--card-ink); }
.id-card__qr-label { margin-top: calc(1 * var(--u)); padding-top: calc(1 * var(--u)); width: 100%; border-top: calc(.12 * var(--u)) solid #E1E7F0; text-align: center; font-size: calc(1.29 * var(--u)); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--card-muted); }
.id-card__code { margin-top: calc(.5 * var(--u)); font-family: var(--font-mono); font-size: calc(2 * var(--u)); font-weight: 600; letter-spacing: .03em; color: var(--card-ink); white-space: nowrap; }

/* Pied commun au recto et au verso */
.id-card__foot { position: absolute; left: 0; right: 0; bottom: 0; height: calc(3.27 * var(--u)); padding: 0 calc(3.27 * var(--u)); display: flex; align-items: center; justify-content: space-between; gap: calc(2 * var(--u)); background: var(--card-color); overflow: hidden; font-size: calc(1.35 * var(--u)); }
.id-card__foot-org { color: #AFBDD9; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.id-card__foot-date { color: #fff; font-weight: 700; white-space: nowrap; margin-right: calc(8 * var(--u)); }
.id-card__foot-app { color: #fff; font-weight: 700; white-space: nowrap; }
.id-card__corner { position: absolute; right: calc(-3 * var(--u)); bottom: calc(-1.2 * var(--u)); width: calc(14 * var(--u)); height: calc(3.4 * var(--u)); transform: rotate(-27deg); transform-origin: center; background: linear-gradient(180deg, #F2C80F 0 22%, #C8102E 22% 78%, #F2C80F 78%); }

/* ---------- Verso ---------- */
.id-card-back__band { position: absolute; top: 0; left: 0; right: 0; height: calc(14.95 * var(--u)); padding: 0 calc(3.74 * var(--u)); display: flex; align-items: center; gap: calc(2.4 * var(--u)); background: var(--card-color); }
.id-card-back__logo { width: calc(8.88 * var(--u)); height: calc(8.88 * var(--u)); flex: none; border-radius: calc(1.4 * var(--u)); background: #fff; display: grid; place-items: center; padding: calc(.7 * var(--u)); overflow: hidden; }
.id-card-back__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.id-card-back__logo span { font-weight: 800; font-size: calc(1.7 * var(--u)); color: var(--card-color); }
.id-card-back__org { min-width: 0; flex: 1; display: grid; gap: calc(.5 * var(--u)); }
.id-card-back__kicker { font-size: calc(1.52 * var(--u)); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #F2C80F; }
.id-card-back__org strong { font-size: calc(2.57 * var(--u)); font-weight: 800; line-height: 1.15; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: calc(42 * var(--u)); }
.id-card-back__number { flex: none; min-width: calc(20.5 * var(--u)); padding: calc(1.3 * var(--u)) calc(1.6 * var(--u)); border-radius: calc(1.17 * var(--u)); background: rgba(255,255,255,.07); border: calc(.12 * var(--u)) solid rgba(255,255,255,.14); display: grid; justify-items: end; gap: calc(.4 * var(--u)); }
.id-card-back__number span { font-size: calc(1.29 * var(--u)); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #B3C2E0; }
.id-card-back__number strong { font-family: var(--font-mono); font-size: calc(2.57 * var(--u)); font-weight: 600; color: #fff; letter-spacing: .03em; white-space: nowrap; }

.id-card-back__statement { position: absolute; left: calc(3.74 * var(--u)); right: calc(3.74 * var(--u)); top: calc(2.6 * var(--u)); padding: calc(1.6 * var(--u)) calc(3 * var(--u)) calc(1.8 * var(--u)); border-radius: calc(1.4 * var(--u)); background: #F3F6FC; border: calc(.15 * var(--u)) solid #DCE5F4; text-align: center; }
.id-card-back__statement-title { display: inline-flex; align-items: center; gap: calc(.8 * var(--u)); font-size: calc(1.35 * var(--u)); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #1D66DE; }
.id-card-back__statement-title .icon { width: calc(1.75 * var(--u)); height: calc(1.75 * var(--u)); }
.id-card-back__statement p { margin: calc(.9 * var(--u)) 0 0; font-size: calc(2.2 * var(--u)); font-weight: 800; line-height: 1.35; color: var(--card-ink); }

.id-card-back__notices { position: absolute; left: calc(3.74 * var(--u)); top: calc(18.7 * var(--u)); width: calc(54 * var(--u)); margin: 0; padding: 0; list-style: none; display: grid; gap: calc(1.25 * var(--u)); }
.id-card-back__notices li { display: grid; grid-template-columns: calc(1.87 * var(--u)) minmax(0, 1fr); gap: calc(1.2 * var(--u)); align-items: start; font-size: calc(1.58 * var(--u)); line-height: 1.45; color: #5B6B85; }
.id-card-back__notices .icon { width: calc(1.87 * var(--u)); height: calc(1.87 * var(--u)); color: #1D66DE; margin-top: calc(.1 * var(--u)); }
.id-card-back__notices li.is-warning .icon { color: #C8102E; }

.id-card-back__contact { position: absolute; left: calc(3.74 * var(--u)); bottom: calc(2.1 * var(--u)); height: calc(4.9 * var(--u)); padding: 0 calc(2 * var(--u)) 0 calc(.9 * var(--u)); border-radius: 999px; background: var(--card-color); display: inline-flex; align-items: center; gap: calc(1.1 * var(--u)); }
.id-card-back__contact-icon { width: calc(3.04 * var(--u)); height: calc(3.04 * var(--u)); border-radius: 50%; background: #F2C80F; display: grid; place-items: center; color: var(--card-color); }
.id-card-back__contact-icon .icon { width: calc(1.6 * var(--u)); height: calc(1.6 * var(--u)); }
.id-card-back__contact-label { font-size: calc(1.4 * var(--u)); font-weight: 600; color: #B3C2E0; }
.id-card-back__contact strong { font-family: var(--font-mono); font-size: calc(1.87 * var(--u)); font-weight: 600; color: #fff; white-space: nowrap; }

.id-card-back__sign { position: absolute; left: calc(62.4 * var(--u)); right: calc(3.74 * var(--u)); bottom: calc(1.4 * var(--u)); display: grid; justify-items: center; text-align: center; }
.id-card-back__marks { position: relative; width: 100%; height: calc(11.4 * var(--u)); }
.id-card-back__signature { position: absolute; left: 0; bottom: calc(.6 * var(--u)); width: calc(22.4 * var(--u)); height: calc(9 * var(--u)); display: grid; place-items: center; z-index: 2; }
.id-card-back__signature img { max-width: 100%; max-height: 100%; object-fit: contain; }
.id-card-back__stamp { position: absolute; right: 0; top: 0; width: calc(11.4 * var(--u)); height: calc(11.4 * var(--u)); display: grid; place-items: center; z-index: 1; }
.id-card-back__stamp img { width: 100%; height: 100%; object-fit: contain; transform: rotate(-9deg); opacity: .92; mix-blend-mode: multiply; }
.id-card-back__placeholder { display: grid; place-items: center; width: 100%; height: 100%; border: calc(.15 * var(--u)) dashed #9FB3D9; background: rgba(255,255,255,.75); color: #6E86B8; font-size: calc(1.4 * var(--u)); font-weight: 600; border-radius: calc(1.2 * var(--u)); }
.id-card-back__stamp .id-card-back__placeholder { border-radius: 50%; }
.id-card-back__rep { width: 100%; padding-top: calc(.9 * var(--u)); border-top: calc(.2 * var(--u)) solid var(--card-ink); display: grid; gap: calc(.25 * var(--u)); }
.id-card-back__rep strong { font-size: calc(1.87 * var(--u)); font-weight: 800; color: var(--card-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-card-back__rep span { font-size: calc(1.52 * var(--u)); color: var(--card-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Bandeau de repères en bas du recto (site, membres, localisation) */
.id-card__facts { position: absolute; left: calc(3.27 * var(--u)); right: calc(3.27 * var(--u)); top: calc(35.3 * var(--u)); height: calc(9.4 * var(--u)); margin: 0; padding: 0 calc(1.6 * var(--u)); display: grid; grid-template-columns: 1.25fr .85fr 1fr; align-items: center; border-radius: calc(1.4 * var(--u)); background: #F3F6FC; border: calc(.15 * var(--u)) solid #DCE5F4; }
.id-card__facts > div { display: flex; align-items: center; gap: calc(1.2 * var(--u)); min-width: 0; padding: 0 calc(1.4 * var(--u)); }
.id-card__facts > div + div { border-left: calc(.15 * var(--u)) solid #DCE5F4; }
.id-card__facts > div > span:last-child { min-width: 0; }
.id-card__fact-icon { width: calc(4 * var(--u)); height: calc(4 * var(--u)); flex: none; border-radius: 50%; background: var(--card-color); color: #F2C80F; display: grid; place-items: center; }
.id-card__fact-icon .icon { width: calc(2 * var(--u)); height: calc(2 * var(--u)); }
.id-card__facts dt { font-size: calc(1.29 * var(--u)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--card-muted); white-space: nowrap; }
.id-card__facts dd { margin: calc(.35 * var(--u)) 0 0; font-size: calc(1.7 * var(--u)); font-weight: 700; color: var(--card-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Camps et villages ---------- */
.site-tile { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--primary-ink); }
.site-tile--village { background: var(--accent-soft); color: var(--accent-ink); }
.site-tile .icon { width: 20px; height: 20px; }
.cell-lines { display: grid; gap: 2px; }
.cell-lines .muted { font-size: .8125rem; }
.meter { height: 8px; margin: 10px 0 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.meter--high span { background: var(--warning); }
.meter--over span { background: var(--danger); }
.team-list { list-style: none; margin: 0; padding: 4px 22px 12px; }
.team-list li { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.team-list li:last-child { border-bottom: 0; }
.team-list li.is-muted { opacity: .6; }
.team-list .person { min-width: 0; }
.team-list .person .muted { font-size: .8125rem; }
.site-notes { margin: 16px 0 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--sunken); font-size: .9375rem; white-space: normal; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 92px; }
.input-suffix__text { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .9375rem; pointer-events: none; }
.gps { margin-top: 18px; }
.gps__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; align-items: start; }
.gps [data-gps-status].is-error { color: var(--danger); }
.site-form { max-width: 980px; }
.form-footer { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 16px; box-shadow: var(--shadow-2); }
@media (max-width: 639px) {
  .form-footer { bottom: 8px; }
  .form-footer .btn { flex: 1; }
}

/* ---------- Cartes (Leaflet) ---------- */
.page--map { max-width: none; padding-bottom: 20px; }
.page--map .page-header { margin-bottom: 16px; }
.map-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; height: calc(100dvh - 190px); min-height: 480px; }
.map-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.map-panel__toggle { display: none; }
.map-panel__body { display: grid; gap: 16px; align-content: start; padding: 18px; overflow-y: auto; overscroll-behavior: contain; }
.map-toggles { display: grid; gap: 4px; }
.map-toggle { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; font-size: .9375rem; }
.map-toggle:hover { background: var(--sunken); }
.map-toggle input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.map-key { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; }
.map-key .icon { width: 14px; height: 14px; }
.map-key--camp { background: #1D66DE; }
.map-key--village { background: #B7791F; }
.map-key--household { width: 14px; height: 14px; margin: 0 6px; background: var(--primary); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border-strong); }
.map-legend { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-md); background: var(--sunken); font-size: .8125rem; color: var(--text-2); }
.map-legend > span { display: flex; align-items: center; gap: 10px; }
.map-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--surface); flex: none; }
.map-dot--pending { background: var(--warning); }
.map-cluster-key { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: #1D66DE; color: #fff; font-size: .6875rem; font-weight: 800; box-shadow: 0 0 0 3px rgba(29, 102, 222, .3); }
.map-stats { font-size: .875rem; color: var(--text-2); }
.map-stats:empty { display: none; }
.map-missing { font-size: .875rem; }
.map-missing ul { margin: 6px 0 0; padding-left: 18px; }
.map-canvas { position: relative; overflow: hidden; min-height: 0; padding: 0; }
.map-canvas__map { position: absolute; inset: 0; }
.map-canvas__loading { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500; display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-2); font-size: .8125rem; font-weight: 600; }

/* Fond, contrôles et bulles aux couleurs de l'application */
.leaflet-container { font: inherit; font-size: .875rem; background: var(--sunken); border-radius: inherit; }
:root[data-theme="dark"] .leaflet-container:not(.is-satellite) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
.leaflet-bar, .leaflet-control-layers, .map-btn { border: 1px solid var(--border) !important; border-radius: var(--r-sm) !important; box-shadow: var(--shadow-1) !important; }
.leaflet-bar a, .leaflet-control-layers, .map-btn { background: var(--surface) !important; color: var(--text) !important; }
.leaflet-bar a { border-bottom-color: var(--border) !important; width: 36px !important; height: 36px !important; line-height: 36px !important; }
.leaflet-control-layers-expanded { padding: 8px 12px; font-size: .875rem; }
.map-btn { display: grid; place-items: center; width: 38px; height: 38px; cursor: pointer; padding: 0; }
.map-btn .icon { width: 18px; height: 18px; }
.map-btn.is-busy { animation: map-pulse 1s infinite; }
@keyframes map-pulse { 50% { opacity: .45; } }
.leaflet-control-attribution { background: rgba(255, 255, 255, .8) !important; font-size: .6875rem; }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(17, 27, 48, .85) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--primary-ink) !important; }
.leaflet-control-scale-line { background: rgba(255, 255, 255, .75); }
.leaflet-container .leaflet-popup-content-wrapper, .leaflet-container .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); }
.leaflet-container .leaflet-popup-content-wrapper { border-radius: var(--r-md); border: 1px solid var(--border); }
.leaflet-container .leaflet-popup-content { margin: 14px 16px; font-size: .875rem; line-height: 1.45; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.map-pop { display: grid; gap: 3px; justify-items: start; }
.map-pop__title { font-weight: 800; font-size: 1rem; }
.map-pop__meta { color: var(--text-2); }
.map-pop__nums { display: flex; gap: 14px; margin: 6px 0 2px; }
.map-pop__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.map-pop .btn { min-height: 34px; }
.leaflet-container .map-pop a.btn-secondary, .leaflet-container .map-pop a.btn-ghost { color: var(--text); }
.leaflet-container .map-pop a.btn-ghost:hover { color: var(--primary-ink); }
.map-pop .btn .icon { width: 15px; height: 15px; }
.map-pop .badge { margin-top: 4px; }
.map-site { display: grid !important; place-items: center; border-radius: 50%; color: #fff; background: #1D66DE; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(10, 22, 51, .45); }
.map-site--village { background: #B7791F; }
.map-site .icon { width: 16px; height: 16px; }
.map-site.is-closed { background: #6B7790; }
.map-site.is-selected { box-shadow: 0 0 0 4px #F2C80F, 0 2px 10px rgba(10, 22, 51, .5); }
.map-cluster { display: grid !important; place-items: center; border-radius: 50%; background: rgba(29, 102, 222, .9); color: #fff; font-weight: 800; font-size: .75rem; box-shadow: 0 0 0 5px rgba(29, 102, 222, .3); }
.map-cluster--pending { background: rgba(232, 137, 12, .92); box-shadow: 0 0 0 5px rgba(232, 137, 12, .3); }

/* Fiche d'un site et choix d'une position */
.site-map { position: relative; height: 220px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.site-map__map { position: absolute; inset: 0; }
.gps__intro { margin: 0 0 12px; }
.gps__search { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.gps__search .search-field { flex: 1 1 280px; min-width: 0; }
.gps__map { height: 340px; margin: 6px 0 14px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); cursor: crosshair; }
.geo-results { list-style: none; margin: 0 0 10px; padding: 4px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.geo-results button { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; cursor: pointer; font-size: .875rem; }
.geo-results button:hover { background: var(--sunken); }
.geo-results .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--primary-ink); }
.field__hint.is-error { color: var(--danger); }

@media (max-width: 1023px) {
  .page--map { padding-left: 12px; padding-right: 12px; }
  .map-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 170px); gap: 10px; }
  .map-panel__toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 16px; border: 0; background: transparent; font-weight: 700; text-align: left; cursor: pointer; }
  .map-panel__summary { color: var(--muted); font-weight: 600; }
  .map-panel__chevron { margin-left: auto; transition: transform .2s; }
  .map-panel.is-open .map-panel__chevron { transform: rotate(180deg); }
  .map-panel__body { display: none; max-height: 55dvh; border-top: 1px solid var(--border); }
  .map-panel.is-open .map-panel__body { display: grid; }
  .gps__map { height: 280px; }
}

/* Propositions de sites : validation */
.callout--danger { background: var(--danger-soft); }
.callout--danger .icon { color: var(--danger); }
.callout--link { color: var(--text); align-items: center; }
.callout--link:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--warning); }
.callout__end { margin-left: auto; flex: none; }
.chip--removable { color: var(--text); gap: 6px; }
.chip--removable:hover { background: var(--border); color: var(--text); }
.review-panel { margin-bottom: 20px; border-color: var(--warning); }
.similar-list { margin: 6px 0 0; padding-left: 18px; font-size: .9375rem; }
.review-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 24px; align-items: end; }
.review-reject { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.review-reject .field { margin: 0; }
@media (max-width: 760px) {
  .review-actions, .review-reject { grid-template-columns: minmax(0, 1fr); }
  .review-actions .btn { width: 100%; }
}

/* ---------- Ménages : liste ---------- */
.tabs__count--warning { background: var(--warning-soft); color: var(--warning); }
.filter-chips { margin: -4px 0 14px; }
.chip--toggle { color: var(--text-2); border: 1px solid transparent; min-height: 34px; }
.chip--toggle:hover { color: var(--text); background: var(--border); }
.chip--toggle.is-on { background: var(--primary-soft); color: var(--primary-ink); border-color: var(--primary); }
.cluster--tight { gap: 6px; }
.table__check { width: 44px; position: relative; z-index: 2; }
.table__check input, [data-bulk-all] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.bulk-bar { position: sticky; top: calc(var(--topbar-h, 64px) + 8px); z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px; padding: 8px 8px 8px 16px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: .9375rem; }
.dup-list { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 8px; text-align: left; }
.modal__html { text-align: left; }
.modal__html p { margin: 0; }

/* ---------- Ménages : formulaire ---------- */
.hh-form { max-width: 980px; }
.input--upper { text-transform: uppercase; }
.input--upper::placeholder { text-transform: none; }
.segmented__btn input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.segmented__btn { position: relative; cursor: pointer; }
.segmented__btn:has(input:checked) { background: var(--primary); color: #fff; box-shadow: var(--shadow-1); }
.segmented__btn:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.segmented--fill { display: flex; width: 100%; }
.segmented--fill .segmented__btn { flex: 1; justify-content: center; min-height: 44px; }
.segmented--sm .segmented__btn { min-height: 34px; font-size: .8125rem; }
.segmented--wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.segmented--wrap .segmented__btn { min-height: 42px; padding: 0 16px; }
.member-list { display: grid; gap: 16px; }
.member-card { border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.member-card:first-child { border-color: var(--primary); }
.member-card__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; background: var(--sunken); border-bottom: 1px solid var(--border); }
.member-card__num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .8125rem; font-weight: 800; }
.member-card:not(:first-child) .member-card__num { background: var(--text-2); }
.member-card__title { font-size: .9375rem; }
.member-card__remove { margin-left: auto; }
.member-card__body { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; padding: 16px; }
.member-card__fields { margin: 0; }
.member-photo { display: grid; justify-items: center; align-content: start; gap: 6px; cursor: pointer; }
.member-photo input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.member-photo__frame { display: grid; place-items: center; width: 104px; height: 128px; border-radius: var(--r-md); border: 2px dashed var(--border-strong); background: var(--sunken); color: var(--muted); overflow: hidden; }
.member-photo__frame img { width: 100%; height: 100%; object-fit: cover; }
.member-photo__frame .icon { width: 28px; height: 28px; }
.member-photo:hover .member-photo__frame, .member-photo:focus-within .member-photo__frame { border-color: var(--primary); color: var(--primary-ink); }
.member-photo__label { font-size: .8125rem; font-weight: 700; color: var(--primary-ink); }
.birth { display: grid; gap: 8px; }
.needs__list { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; font-size: .875rem; font-weight: 600; color: var(--text-2); }
.check-chip input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.check-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.member-add { justify-self: start; }
@media (max-width: 639px) {
  .member-card__body { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .member-photo { grid-template-columns: auto 1fr; justify-items: start; align-items: center; }
  .member-photo__frame { width: 72px; height: 88px; }
  .member-add { justify-self: stretch; }
}

.avatar--photo { object-fit: cover; padding: 0; }

/* ---------- Import Kobo ---------- */
.section-title { margin: 28px 0 12px; font-size: 1.125rem; }
.steps-list { margin: 0; padding-left: 38px; display: grid; gap: 10px; font-size: .9375rem; color: var(--text-2); }
.steps-list strong { color: var(--text); }
.file-drop { display: grid; justify-items: center; gap: 6px; padding: 32px 20px; border: 2px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--sunken); text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-drop__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); margin-bottom: 4px; }
.file-drop .muted { font-size: .875rem; }
.file-drop:hover, .file-drop.is-over, .file-drop:focus-within { border-color: var(--primary); background: var(--primary-soft); }
.file-drop.has-file { border-style: solid; border-color: var(--primary); }
.stepper { list-style: none; display: flex; gap: 8px; margin: 0 0 20px; padding: 0; overflow-x: auto; scrollbar-width: none; }
.stepper__step { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-size: .875rem; font-weight: 700; white-space: nowrap; }
.stepper__num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--border); color: var(--text-2); font-size: .8125rem; }
.stepper__step.is-current { background: var(--primary-soft); color: var(--primary-ink); }
.stepper__step.is-current .stepper__num { background: var(--primary); color: #fff; }
.stepper__step.is-done { color: var(--text-2); }
.stepper__step.is-done .stepper__num { background: var(--success-soft, var(--primary-soft)); color: var(--success, var(--primary-ink)); }
.import-form { max-width: 1040px; }
.map-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
.map-row { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 6px 14px; align-items: center; margin: 0; }
.map-row > label { margin: 0; font-size: .9375rem; }
.map-row .field__hint { display: block; margin-top: 4px; }
.progress { height: 12px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .4s var(--ease-out, ease-out); }
.import-run__count { margin: 0; font-size: .9375rem; color: var(--text-2); }
.import-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.import-actions__main { margin-left: auto; }
.import-delete { margin-top: 16px; display: flex; justify-content: flex-end; }
.form-footer:has([form="import-delete"]) { justify-content: space-between; }
@media (max-width: 900px) {
  .map-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639px) {
  .map-row { grid-template-columns: minmax(0, 1fr); }
  .import-actions > *, .import-actions .btn { width: 100%; }
  .import-actions__main { margin-left: 0; }
}

/* ---------- Cartes ---------- */
.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.print-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.print-bar__format { margin: 0; padding: 0; border: 0; }
.print-bar__lots { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .875rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions .btn { flex: 1 1 auto; }
.card-replace { border-top: 1px solid var(--border); padding-top: 12px; }
.card-replace summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: .9375rem; color: var(--text-2); list-style: none; }
.card-replace summary::-webkit-details-marker { display: none; }
.card-replace summary:hover { color: var(--text); }
.card-replace[open] summary { margin-bottom: 14px; color: var(--text); }
.panel__header--sub { border-top: 1px solid var(--border); padding-top: 14px; padding-bottom: 4px; }
.panel__header--sub h3 { margin: 0; font-size: .9375rem; }
.id-card__qr-code.is-sample { opacity: .35; }
.verify-form { display: flex; gap: 10px; padding: 16px; margin-bottom: 20px; max-width: 720px; }
.verify-form .search-field { flex: 1; min-width: 0; }
.verdict { display: flex; align-items: center; gap: 16px; padding: 20px 22px; margin-bottom: 20px; max-width: 720px; border-width: 2px; }
.verdict h2 { margin: 0 0 4px; font-size: 1.25rem; }
.verdict p { margin: 0; color: var(--text-2); }
.verdict__icon { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: #fff; }
.verdict__icon .icon { width: 30px; height: 30px; }
.verdict--success { border-color: var(--success); background: var(--success-soft); }
.verdict--success .verdict__icon { background: var(--success); }
.verdict--danger { border-color: var(--danger); background: var(--danger-soft); }
.verdict--danger .verdict__icon { background: var(--danger); }
.verify-household { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 20px; max-width: 720px; }
.verify-household__photo { width: 132px; height: 164px; border-radius: var(--r-md); object-fit: cover; background: var(--sunken); display: grid; place-items: center; color: var(--muted); }
.verify-household__name { font-size: 1.25rem; }
@media (max-width: 760px) {
  .kpis--3 { grid-template-columns: minmax(0, 1fr); }
  .verify-form { flex-direction: column; }
  .verify-household { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .verify-household__photo { width: 96px; height: 120px; }
}

/* ---------- Visionneuse PDF intégrée ---------- */
.has-pdfv, .has-pdfv body { overflow: hidden; }
.pdfv { position: fixed; inset: 0; z-index: calc(var(--z-modal) - 1); display: grid; grid-template-rows: auto minmax(0, 1fr); background: #1B2333; color: #fff; animation: pdfv-in .18s var(--ease-out, ease-out); }
@keyframes pdfv-in { from { opacity: 0; transform: translateY(8px); } }
.pdfv__bar { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); background: #0A1633; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.pdfv__title { flex: 1; min-width: 0; display: grid; line-height: 1.25; padding: 0 4px; }
.pdfv__title strong { font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdfv__title span { font-size: .8125rem; color: #AFBDD9; font-variant-numeric: tabular-nums; }
.pdfv__tools { display: flex; align-items: center; gap: 4px; }
.pdfv__zoom, .pdfv__dock { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.pdfv__btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; transition: background-color .15s; }
.pdfv__btn:hover { background: rgba(255, 255, 255, .14); }
.pdfv__btn:focus-visible, .pdfv__pct:focus-visible { outline: 2px solid #F2C80F; outline-offset: 1px; }
.pdfv__btn .icon { width: 20px; height: 20px; }
.pdfv__pct { min-width: 64px; height: 40px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: #fff; font-weight: 700; font-size: .875rem; font-variant-numeric: tabular-nums; cursor: pointer; }
.pdfv__pct:hover { background: rgba(255, 255, 255, .14); }
.pdfv__body { position: relative; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; outline: none; }
.pdfv__pages { display: grid; justify-items: center; gap: 16px; width: max-content; min-width: 100%; padding: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); will-change: transform; }
.pdfv__page { position: relative; background: #fff; border-radius: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); overflow: hidden; }
.pdfv__page:not(.is-ready)::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, #EEF2F8 30%, #F8FAFD 50%, #EEF2F8 70%); background-size: 200% 100%; animation: pdfv-wait 1.2s linear infinite; }
@keyframes pdfv-wait { to { background-position: -200% 0; } }
.pdfv__page canvas { display: block; width: 100%; height: 100%; }
.pdfv__state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; color: #D5DCEA; font-weight: 600; }
.pdfv__state .spinner { display: inline-block; width: 28px; height: 28px; }
.pdfv__state.is-error .icon { width: 36px; height: 36px; color: #F5A54A; }
.pdfv__dock { display: none; }
.pdfv__print { position: fixed; width: 0; height: 0; border: 0; visibility: hidden; }
@media (max-width: 639px) {
  .pdfv__bar { min-height: 52px; padding-left: 4px; padding-right: 4px; gap: 2px; }
  .pdfv__zoom, .pdfv__tools [data-pdfv="print"] { display: none; }
  .pdfv__pages { padding: 12px 8px 88px; gap: 10px; }
  /* Zoom à portée de pouce, en bas de l'écran */
  .pdfv__dock { display: inline-flex; position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(10, 22, 51, .92); box-shadow: 0 6px 20px rgba(0, 0, 0, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
}
@media (prefers-reduced-motion: reduce) { .pdfv, .pdfv__page::after { animation: none; } }

/* ---------- Distributions ---------- */
.activity-tile--vivres { background: var(--primary-soft); color: var(--primary-ink); }
.activity-tile--agricole { background: var(--success-soft); color: var(--success); }
.activity-tile--cash { background: var(--accent-soft); color: var(--accent-ink); }
.progress-cell { display: grid; gap: 4px; min-width: 150px; font-size: .875rem; }
.progress-cell .meter { margin: 0; height: 6px; }
.text-warning { color: var(--warning); font-weight: 700; }
.facts--left div { justify-content: flex-start; gap: 16px; }
.facts--left dt { flex: 0 0 190px; }
.facts--left dd { text-align: left; font-weight: 600; }
.add-households { margin-bottom: 20px; }
.add-households__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
.add-households__grid form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.add-households__grid .field { margin: 0; }
.table__actions { text-align: right; white-space: nowrap; }
.table--rows .person--plain::after { content: none; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 1rem; }
.btn-success { background: var(--success); color: #fff; border-color: transparent; }
.btn-success:hover { filter: brightness(1.08); color: #fff; }
:root[data-theme="dark"] .btn-success { color: #06140C; }

/* Contrôle par scan */
.session-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.session-card { display: flex; align-items: center; gap: 14px; padding: 18px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.session-card:hover { border-color: var(--primary); color: var(--text); box-shadow: var(--shadow-2); }
.session-card__main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.session-card__main .muted { font-size: .875rem; }
.session-card__main .meter { margin: 6px 0 2px; }
.session-card__count { font-size: .875rem; font-weight: 600; color: var(--text-2); }
.control { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.control__progress { display: grid; gap: 8px; padding: 14px 18px; font-size: .9375rem; }
.control__progress .meter { margin: 0; height: 10px; }
.control__reader { padding: 16px; display: grid; gap: 12px; }
.control__scan { min-height: 52px; padding: 0 22px; }
.control__manual { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.verdict-card { overflow: hidden; border-width: 2px; }
.verdict-card__banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.verdict-card__banner h2 { margin: 0 0 2px; font-size: 1.25rem; }
.verdict-card__banner p { margin: 0; color: var(--text-2); font-size: .9375rem; }
.verdict-card__icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: #fff; }
.verdict-card__icon .icon { width: 26px; height: 26px; }
.verdict-card--info { border-color: var(--primary); }
.verdict-card--info .verdict-card__banner { background: var(--primary-soft); }
.verdict-card--info .verdict-card__icon { background: var(--primary); }
.verdict-card--warning { border-color: var(--warning); }
.verdict-card--warning .verdict-card__banner { background: var(--warning-soft); }
.verdict-card--warning .verdict-card__icon { background: var(--warning); }
.verdict-card--danger { border-color: var(--danger); }
.verdict-card--danger .verdict-card__banner { background: var(--danger-soft); }
.verdict-card--danger .verdict-card__icon { background: var(--danger); }
.verdict-card--success { border-color: var(--success); }
.verdict-card--success .verdict-card__banner { background: var(--success-soft); }
.verdict-card--success .verdict-card__icon { background: var(--success); }
.verdict-card__who { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 18px; padding: 18px; }
.verdict-card__photo { width: 140px; height: 176px; border-radius: var(--r-md); object-fit: cover; background: var(--sunken); display: grid; place-items: center; color: var(--muted); }
.verdict-card__photo--empty .icon { width: 48px; height: 48px; }
.verdict-card__id { display: grid; gap: 8px; align-content: start; min-width: 0; }
.verdict-card__name { font-size: 1.375rem; line-height: 1.2; }
.verdict-card__allowance { display: grid; gap: 2px; margin: 0 18px; padding: 14px 16px; border-radius: var(--r-md); background: var(--sunken); }
.verdict-card__allowance span { font-size: .8125rem; font-weight: 700; color: var(--muted); }
.verdict-card__allowance strong { font-size: 1.5rem; }
.verdict-card__allowance small { color: var(--text-2); font-size: .875rem; }
.verdict-card__confirm { display: grid; gap: 14px; padding: 18px 18px 0; }
.verdict-card__confirm .field { margin: 0; }
.verdict-card__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 18px; }
.verdict-card__confirm .verdict-card__actions { padding: 4px 0 18px; }
button.recent__link { border: 0; background: transparent; cursor: pointer; padding: 0; }
@media (max-width: 1023px) {
  .control { grid-template-columns: minmax(0, 1fr); }
  .add-households__grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639px) {
  .verdict-card__who { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 14px; }
  .verdict-card__photo { width: 96px; height: 122px; }
  .verdict-card__name { font-size: 1.125rem; }
  .verdict-card__actions { flex-direction: column-reverse; }
  .verdict-card__actions .btn { width: 100%; }
  .facts--left div { flex-direction: column; gap: 2px; }
  .facts--left dt { flex: none; }
  .add-households__grid form { grid-template-columns: minmax(0, 1fr); }
}

.control__result { scroll-margin-top: 84px; }
.control__result:empty { display: none; }

.callout--success { background: var(--success-soft); }
.callout--success .icon { color: var(--success); }

/* ---------- Lecteur de QR code ---------- */
.control__inputs { display: grid; gap: 12px; }
.control__camera { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.control__photo { position: relative; min-height: 52px; cursor: pointer; }
.control__photo input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.control__photo.is-busy { opacity: .6; pointer-events: none; }
.scanner { position: relative; border-radius: var(--r-md); overflow: hidden; background: #05080F; aspect-ratio: 4 / 3; max-height: 62dvh; width: 100%; isolation: isolate; }
.scanner__stage { position: absolute; inset: 0; transition: transform .28s ease-out; will-change: transform; }
.scanner__stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner__overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* Cadre de visée : quatre coins discrets, effacés quand le code est lu. */
.scanner__frame { position: absolute; inset: 12% 16%; border-radius: 18px; pointer-events: none; transition: opacity .2s; opacity: .75;
  background:
    linear-gradient(#fff, #fff) left top / 28px 3px no-repeat, linear-gradient(#fff, #fff) left top / 3px 28px no-repeat,
    linear-gradient(#fff, #fff) right top / 28px 3px no-repeat, linear-gradient(#fff, #fff) right top / 3px 28px no-repeat,
    linear-gradient(#fff, #fff) left bottom / 28px 3px no-repeat, linear-gradient(#fff, #fff) left bottom / 3px 28px no-repeat,
    linear-gradient(#fff, #fff) right bottom / 28px 3px no-repeat, linear-gradient(#fff, #fff) right bottom / 3px 28px no-repeat; }
.scanner.is-found .scanner__frame, .scanner.is-tracking .scanner__frame { opacity: 0; }
.scanner__hint { position: absolute; left: 12px; right: 12px; top: 12px; margin: 0; padding: 8px 14px; border-radius: 999px; background: rgba(5, 8, 15, .72); color: #fff; font-size: .875rem; font-weight: 600; text-align: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.scanner__hint.is-warn { background: rgba(168, 84, 7, .92); }
.scanner__hint.is-ok { background: rgba(18, 128, 74, .92); }
.scanner__tools { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scanner__btn { display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: rgba(5, 8, 15, .72); color: #fff; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.scanner__btn:hover { background: rgba(5, 8, 15, .9); }
.scanner__btn:focus-visible { outline: 2px solid #F2C80F; outline-offset: 2px; }
.scanner__btn[aria-pressed="true"] { background: #F2C80F; color: #0A1633; }
.scanner__btn .icon { width: 20px; height: 20px; }
.scanner__zoom { display: inline-flex; align-items: center; gap: 4px; margin: 0 auto; padding: 0 2px; border-radius: 999px; background: rgba(5, 8, 15, .72); color: #fff; font-weight: 700; font-size: .875rem; font-variant-numeric: tabular-nums; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.scanner__zoom .scanner__btn { background: transparent; }
.scanner__zoom span { min-width: 44px; text-align: center; }
.scanner.is-found .scanner__tools { opacity: 0; pointer-events: none; }
@media (max-width: 639px) {
  .scanner { aspect-ratio: 3 / 4; max-height: 68dvh; }
  .control__camera { grid-template-columns: minmax(0, 1fr); }
  .control__scan, .control__photo { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .scanner__stage { transition: none; } }

.pdfv__extra { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; margin-right: 4px; border: 0; border-radius: 999px; background: #1FAF7A; color: #06140C; font-weight: 800; font-size: .875rem; cursor: pointer; }
.pdfv__extra:hover { filter: brightness(1.08); }
.pdfv__extra:focus-visible { outline: 2px solid #F2C80F; outline-offset: 2px; }
.pdfv__extra .icon { width: 18px; height: 18px; }
@media (max-width: 420px) { .pdfv__extra span { display: none; } .pdfv__extra { padding: 0 12px; } }

/* ---------- Indicateur de chargement au clic (boutons et liens) ---------- */
.click-spinner { display: inline-block !important; flex: none; width: 1em; height: 1em; min-width: 14px; min-height: 14px; vertical-align: -.15em; margin-left: .5em; }
.is-clicked { pointer-events: none; }
/* L'indicateur remplace l'icône du bouton ou du lien : la largeur ne bouge pas. */
.is-clicked--swap > .icon, .is-clicked--swap > .btn__icon { display: none !important; }
.is-clicked--swap > .click-spinner { margin-left: 0; width: 18px; height: 18px; }
.btn > .click-spinner, .nav-link > .click-spinner, .tabs__item > .click-spinner { margin-left: 0; }
.nav-link.is-clicked--swap > .click-spinner { width: 20px; height: 20px; margin: 0 1px; }
.person > .click-spinner, .session-card > .click-spinner { margin-left: auto; width: 18px; height: 18px; color: var(--primary-ink); position: relative; z-index: 1; }
.recent__item > .click-spinner { width: 18px; height: 18px; color: var(--primary-ink); }
.pagination__btn > .click-spinner, .pagination a > .click-spinner { margin-left: .35em; width: 12px; height: 12px; min-width: 12px; min-height: 12px; }
/* Bouton en cours d'envoi sans indicateur prévu dans son contenu. */
.btn.is-busy:not(:has(.spinner))::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

/* ---------- Cartes : toujours sous le reste de l'interface ---------- */
/* Les couches internes de Leaflet vont jusqu'à z-index 1000. On les confine dans le plan de la carte :
   la barre du haut, le menu, les listes déroulantes, les fenêtres et les messages passent toujours au-dessus. */
.leaflet-container, .map-canvas, .site-map, .gps__map { isolation: isolate; z-index: 0; }
.map-canvas, .site-map, .gps__map { position: relative; }

/* ================================================================== */
/* Compatibilité : iPhone / iPad (Safari), Mac, Windows, Linux          */
/* ================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, label, summary, [role="button"], input, select, textarea { -webkit-tap-highlight-color: transparent; }
/* Pas de délai ni de zoom au double appui sur les commandes (iOS). */
a, button, label, summary, .btn { touch-action: manipulation; }
/* Apparence identique des champs partout (Safari arrondit et ombre les siens). */
input[type="search"], input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="date"], textarea, select { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="date"] { min-height: 46px; }
input[type="number"] { -moz-appearance: textfield; }
/* Hauteur d'écran : « vh » d'abord pour les navigateurs sans « dvh » (la barre d'adresse mobile est alors comptée). */
@supports not (height: 100dvh) {
  .map-layout { height: calc(100vh - 190px); }
  @media (max-width: 1023px) { .map-layout { height: calc(100vh - 170px); } }
  .scanner { max-height: 62vh; }
  .map-panel__body { max-height: 55vh; }
}
/* Zones sûres de l'iPhone (encoche, barre d'accueil) pour ce qui est collé en bas de l'écran. */
.form-footer { bottom: max(12px, env(safe-area-inset-bottom)); }
.toasts, .toast-stack { padding-bottom: env(safe-area-inset-bottom); }
/* Rapport largeur / hauteur : repli pour Safari avant la version 15. */
@supports not (aspect-ratio: 1) {
  .id-card { height: 0; padding-top: 63.08%; }
  .scanner { height: 60vh; }
}
/* Contour de focus : repli quand « :focus-visible » n'est pas reconnu. */
@supports not selector(:focus-visible) {
  a:focus, button:focus, .btn:focus, input:focus, select:focus, textarea:focus, summary:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
}
/* Sans « :has() » : l'état coché vient de la classe posée par le script. */
.no-has .choice-card.is-checked { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.no-has .segmented__btn.is-checked { background: var(--primary); color: #fff; box-shadow: var(--shadow-1); }
.no-has .check-chip.is-checked { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.no-has .btn.is-busy::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.no-has .btn.is-busy .spinner { display: none; }
/* Défilement fluide dans les zones à défilement interne sur iOS. */
.sidebar__nav, .table-wrap, .tabs, .combo__list, .map-panel__body { -webkit-overflow-scrolling: touch; }

/* Validation groupée des ménages : sélection, valider ou rejeter avec motif. */
.bulk-bar--review { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.bulk-bar--review .bulk-bar__count { font-weight: 600; color: var(--text-2); }
.bulk-bar--review .bulk-bar__actions { display: inline-flex; gap: 8px; margin-left: auto; }
.bulk-bar--review .bulk-bar__reason { display: flex; gap: 8px; flex: 1 1 100%; }
.bulk-bar--review .bulk-bar__reason[hidden] { display: none; }
.bulk-bar--review .bulk-bar__reason .input { flex: 1 1 auto; min-width: 0; min-height: 40px; }
.btn--danger-text { color: var(--danger); }
@media (max-width: 640px) {
  .bulk-bar--review .bulk-bar__actions { margin-left: 0; width: 100%; }
  .bulk-bar--review .bulk-bar__actions .btn { flex: 1 1 0; }
  .bulk-bar--review .bulk-bar__reason { flex-direction: column; }
}

/* Page publique de téléchargement de l'application mobile. */
.app-download__button { margin-top: 24px; min-height: 54px; font-size: 1.0625rem; }
.app-download__meta { margin-top: 10px; font-size: .875rem; text-align: center; }
.app-download__steps { margin-top: 26px; padding-left: 0; }
.app-download__server { display: grid; gap: 2px; margin-top: 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--sunken); font-size: .8125rem; }
.app-download__server code { font-family: var(--font-mono); font-size: 1rem; color: var(--text); overflow-wrap: anywhere; user-select: all; }
.app-download__back { margin-top: 24px; font-size: .9375rem; }
.app-download__back a { display: inline-flex; align-items: center; gap: 6px; }

/* Photo du mandataire : formulaire du ménage, fiche et contrôle par scan. */
.proxy-photo { display: flex; align-items: center; gap: 16px; }
.proxy-photo__text { display: grid; gap: 4px; min-width: 0; }
.proxy-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; vertical-align: middle; margin-right: 10px; border: 1px solid var(--border); }

.app-download__open { margin-top: 18px; min-height: 50px; }
