/* Interface d'administration. Refonte du 2026-10-09 : docs/design/01-refonte-interface.md.
   Charte Fraum (plan Franchise OS §4) : toutes les couleurs, rayons et la police viennent de tokens.css (--fr-*),
   chargé avant ce fichier ; le thème sombre est entièrement porté par les jetons. Le vert boréal (--fr-accent) n'est
   jamais un texte ni un contour : c'est l'aplat de la cellule « reçu ». Graisses 400 / 500 / 600.
   Tailles 12 / 14 / 16 / 20 / 24 / 30. Variables propres à ce fichier : préfixe --app-. */

/* Police : Figtree (auto-hébergée, fonts.css), comme la maquette ; tokens.css reste identique à celui de Fraum. */
:root {
  --fr-font: "Figtree", system-ui, -apple-system, sans-serif;
  /* Couleurs de la maquette (docs/design/maquettes/mcdo.html), valeurs exactes. Pas de jeton Fraum équivalent : variables propres. */
  --app-top: #264F36; --app-on-top: #FFFFFF; --app-primary: #1F6B3A; --app-on-primary: #FFFFFF;
  --app-accent: #FFC72C; --app-on-accent: #27251F; --app-bg: #F4F6F0; --app-surface: #FFFFFF;
  --app-ink: #1E2A22; --app-muted: #4F5A52; --app-line: #DCE3D6; --app-soft: #FFF1C9; --app-soft-ink: #5A4300;
  --app-ok-bg: #DDF1E6; --app-ok-ink: #12543A; --app-ok-dot: #1F8F5F;
  --app-warn-bg: #FCEBC2; --app-warn-ink: #654000; --app-warn-dot: #C98A00;
  --app-bad-bg: #F9DADD; --app-bad-ink: #7C1620; --app-bad-dot: #B3202F;
  --app-on-dot: #FFFFFF;
  --app-band: var(--app-top); --app-band-ink: var(--app-on-top); --app-band-muted: #cfe0d4; --app-band-line: #3c7455;
  --app-amber: var(--app-accent); --app-amber-ink: var(--app-on-accent);
  --app-line-strong: color-mix(in srgb, var(--fr-line), var(--fr-ink) 22%);
  --app-primary-hover: color-mix(in srgb, var(--fr-primary) 86%, var(--fr-ink));
  --app-link-hover: color-mix(in srgb, var(--fr-brand) 80%, var(--fr-ink));
  --app-scrim: rgb(13 20 18 / 0.45);
  /* Bandeau de marque de l'écran de connexion (comme Fraum Studio) : le bleu Fraum, texte blanc. */
  --app-auth-rail: var(--fr-brand); --app-auth-rail-ink: #FFFFFF; --app-auth-rail-muted: rgb(255 255 255 / 0.78);
  /* Séries des graphiques (Analyses), dans cet ordre fixe : vert de l'enseigne, bleu, ambre, violet. Ordre et teintes
     validés (outil dataviz : clarté, saturation, écart pour les daltoniens entre voisins, contraste >= 3:1 sur le fond). */
  --app-chart-1: #1F6B3A; --app-chart-2: #2A78D6; --app-chart-3: #B07D00; --app-chart-4: #6250D6;
}
/* Même application aux couleurs de Burger King (maquette bk.html) quand le client est une enseigne Burger King. */
:root[data-brand="burgerking"] {
  --app-top: #502314; --app-on-top: #F5EBDC; --app-primary: #502314; --app-accent: #FF8732; --app-on-accent: #502314;
  --app-bg: #F5EBDC; --app-surface: #FFFBF4; --app-ink: #3A1A0E; --app-muted: #6B4A3A; --app-line: #E3D2BC;
  --app-soft: #FFE0C7; --app-soft-ink: #7A2E00;
  --app-chart-1: #D9561C; --app-chart-2: #2A78D6; --app-chart-3: #198737; --app-chart-4: #6250D6;
}
/* Couleurs de Pitaya (site de l'enseigne : noir, crème, orange) quand le client est une enseigne Pitaya. */
:root[data-brand="pitaya"] {
  --app-top: #221E1B; --app-on-top: #F4F0E6; --app-primary: #221E1B; --app-accent: #F26322; --app-on-accent: #221E1B;
  --app-bg: #F4F0E6; --app-surface: #FFFDF8; --app-ink: #221E1B; --app-muted: #5E574F; --app-line: #E2DCCD;
  --app-soft: #FDE3D3; --app-soft-ink: #8A2E00; --app-band-muted: #CFC8BB; --app-band-line: #4A443D;
  --app-chart-1: #D9561C; --app-chart-2: #2A78D6; --app-chart-3: #198737; --app-chart-4: #6250D6;
}
/* Couleurs de Quick (rouge de l'enseigne adouci, blanc) quand le client est une enseigne Quick. */
:root[data-brand="quick"] {
  --app-top: #8E2A2E; --app-on-top: #FFF8F6; --app-primary: #8E2A2E; --app-accent: #F3D9D6; --app-on-accent: #6E1F23;
  --app-bg: #FAF6F4; --app-surface: #FFFFFF; --app-ink: #2B1D1D; --app-muted: #6B5A59; --app-line: #E8DCD9;
  --app-soft: #F6E4E1; --app-soft-ink: #7A2428; --app-band-muted: #E6C9C7; --app-band-line: #A9494D;
  --app-chart-1: #B03A3F; --app-chart-2: #2A78D6; --app-chart-3: #198737; --app-chart-4: #6250D6;
}
/* Couleurs d'O'Tacos : orange de l'enseigne (#FF7200) assombri en #C25E28 (demandes d'Amine : moins pétant, puis plus sombre ; blanc dessus 4,3:1) ; dans le bandeau, texte, icônes et logo Fraum en blanc
   (demande d'Amine du 13/11), puces actives noires. */
:root[data-brand="otacos"] {
  --app-top: #C25E28; --app-on-top: #FFFFFF; --app-primary: #1B1A19; --app-accent: #1B1A19; --app-on-accent: #FFFFFF;
  --app-bg: #F7F3EE; --app-surface: #FFFDFA; --app-ink: #1B1A19; --app-muted: #5E5751; --app-line: #E5DDD3;
  --app-soft: #FFE5CF; --app-soft-ink: #8A3A00; --app-band-muted: #5C2E00; --app-band-line: #A44F21;
  --app-amber: #C25E28; --app-amber-ink: #1B1A19;
  --app-chart-1: #A44F21; --app-chart-2: #2A78D6; --app-chart-3: #198737; --app-chart-4: #6250D6;
}
/* Couleurs de KFC : rouge de l'enseigne (#F5002B) calmé en #B8162F pour une app (demandes d'Amine du 14/11 : « meilleur
   rouge pour une app », puis « trop pétant » ; même teinte, blanc dessus 6,6:1) ; dans le bandeau, texte, icônes et logo
   Fraum en blanc, logo KFC officiel (seau du Colonel) sans tuile ; noir de l'enseigne pour les puces actives. */
:root[data-brand="kfc"] {
  --app-top: #B8162F; --app-on-top: #FFFFFF; --app-primary: #B8162F; --app-accent: #1B1A19; --app-on-accent: #FFFFFF;
  --app-bg: #F8F6F5; --app-surface: #FFFFFF; --app-ink: #1B1A19; --app-muted: #5F5856; --app-line: #E8E0DE;
  --app-soft: #FBE3E6; --app-soft-ink: #8E1024; --app-band-muted: #F5CDD3; --app-band-line: #CF3A51;
  --app-chart-1: #B8162F; --app-chart-2: #2A78D6; --app-chart-3: #198737; --app-chart-4: #6250D6;
}
/* Sans enseigne (démo commune de la landing) : couleurs Fraum (tokens.css, fiche PDF), ni vert ni jaune d'une enseigne. */
:root[data-brand="generique"] {
  --app-top: #224656; --app-on-top: #FFFFFF; --app-primary: #1A5C32; --app-accent: #7EFF78; --app-on-accent: #101814;
  --app-bg: #F2F5F2; --app-surface: #FFFFFF; --app-ink: #101814; --app-muted: #5A6B60; --app-line: #D0DBD3;
  --app-soft: #E3ECF0; --app-soft-ink: #224656; --app-band-muted: #C4D3DA; --app-band-line: #3D6070;
  --app-chart-1: #1A5C32;
}
/* Thème sombre : l'écran d'accueil reprend les jetons Fraum (la maquette n'existe qu'en clair). */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --app-top: var(--fr-surface-2); --app-on-top: var(--fr-ink); --app-primary: var(--fr-primary); --app-on-primary: var(--fr-on-primary);
    --app-bg: var(--fr-canvas); --app-surface: var(--fr-surface); --app-ink: var(--fr-ink); --app-muted: var(--fr-muted); --app-line: var(--fr-line);
    --app-soft: var(--fr-warn-soft); --app-soft-ink: var(--fr-warn);
    --app-ok-bg: var(--fr-ok-soft); --app-ok-ink: var(--fr-ok); --app-ok-dot: var(--fr-ok);
    --app-warn-bg: var(--fr-warn-soft); --app-warn-ink: var(--fr-warn); --app-warn-dot: var(--fr-warn);
    --app-bad-bg: var(--fr-danger-soft); --app-bad-ink: var(--fr-danger); --app-bad-dot: var(--fr-danger);
    --app-on-dot: var(--fr-on-primary); --app-band-muted: var(--fr-muted); --app-band-line: var(--fr-line);
    --app-auth-rail: var(--fr-surface-2); --app-auth-rail-ink: var(--fr-ink); --app-auth-rail-muted: var(--fr-muted);
    --app-chart-1: #3A9D5D; --app-chart-2: #3987E5; --app-chart-3: #C98500; --app-chart-4: #9085E9;
  }
}
:root[data-theme="dark"] {
  --app-top: var(--fr-surface-2); --app-on-top: var(--fr-ink); --app-primary: var(--fr-primary); --app-on-primary: var(--fr-on-primary);
  --app-bg: var(--fr-canvas); --app-surface: var(--fr-surface); --app-ink: var(--fr-ink); --app-muted: var(--fr-muted); --app-line: var(--fr-line);
  --app-soft: var(--fr-warn-soft); --app-soft-ink: var(--fr-warn);
  --app-ok-bg: var(--fr-ok-soft); --app-ok-ink: var(--fr-ok); --app-ok-dot: var(--fr-ok);
  --app-warn-bg: var(--fr-warn-soft); --app-warn-ink: var(--fr-warn); --app-warn-dot: var(--fr-warn);
  --app-bad-bg: var(--fr-danger-soft); --app-bad-ink: var(--fr-danger); --app-bad-dot: var(--fr-danger);
  --app-on-dot: var(--fr-on-primary); --app-band-muted: var(--fr-muted); --app-band-line: var(--fr-line);
  --app-auth-rail: var(--fr-surface-2); --app-auth-rail-ink: var(--fr-ink); --app-auth-rail-muted: var(--fr-muted);
  --app-chart-1: #3A9D5D; --app-chart-2: #3987E5; --app-chart-3: #C98500; --app-chart-4: #9085E9;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--app-bg);
  color: var(--app-ink);
  font: 400 16px/1.4 var(--fr-font);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 20px; line-height: 1.3; font-weight: 600; }
h3 { font-size: 16px; line-height: 1.4; font-weight: 600; }
h1:focus { outline: none; }
a { color: var(--fr-brand); text-underline-offset: 3px; }
a:hover { color: var(--app-link-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
.small { font-size: 14px; }
.muted { color: var(--fr-muted); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--fr-primary); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 8px; top: -64px; z-index: 100; padding: 8px 16px;
  background: var(--fr-primary); color: var(--fr-on-primary); border-radius: var(--fr-r-control); text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ---------- Coque : en-tête, menu, bannière et barre du bas dans shell.css (prototype v73) ---------- */
/* Logotype Fraum en masque : il prend la couleur du texte (en-tête, écran de connexion). */
.fraum-logo { display: inline-block; width: 52px; height: 12px; background-color: currentColor; opacity: 0.8;
  -webkit-mask: url("../assets/fraum-logo.svg") center / contain no-repeat; mask: url("../assets/fraum-logo.svg") center / contain no-repeat; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 24px; padding: 16px 20px 0; max-width: 1180px; margin-inline: auto; box-sizing: border-box; }
.filters__field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filters__field label, .filters__label { font-size: 14px; color: var(--fr-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: var(--fr-r-pill); border: 1px solid var(--app-line-strong); background: var(--fr-surface); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--fr-primary); color: var(--fr-on-primary); border-color: var(--fr-primary); font-weight: 600; }
.kicker { font-size: 14px; color: var(--fr-muted); }

/* ---------- Cartes, listes, étiquettes (communes ; l'Accueil a ses règles dans css/screens/accueil.css) ---------- */
.card { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--fr-r-card); padding: 24px; box-shadow: var(--fr-shadow-1); }
.card > h2 { margin-bottom: 12px; }
.items { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface); }
.item__text { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.item__text .strong { font-size: 15px; font-weight: 600; }
.item__text .small { margin-top: 2px; font-size: 13px; color: var(--app-muted); }
.items__empty { padding: 20px; border-radius: 12px; background: var(--app-ok-bg); color: var(--app-ok-ink); font-size: 15px; font-weight: 600; }
.tag, .badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.tag--bad { background: var(--app-bad-bg); color: var(--app-bad-ink); }
.badge--ecart { background: var(--app-bad-bg); color: var(--app-bad-ink); }
.badge--ecart::before { background: var(--app-bad-dot); }
.tag--warn { background: var(--app-warn-bg); color: var(--app-warn-ink); }
.badge--verifier { background: var(--app-warn-bg); color: var(--app-warn-ink); }
.badge--verifier::before { background: var(--app-warn-dot); }
.badge--ajour { background: var(--app-ok-bg); color: var(--app-ok-ink); }
.badge--ajour::before { background: var(--app-ok-dot); }
/* Pastille neutre (ligne « déjà vue », rien à traiter) : grise, ni verte ni orange ; distincte de tag--muted (passages) */
.badge--neutre, .badge--incomplet { background: var(--app-line); color: var(--app-ink); }
.badge--neutre::before, .badge--incomplet::before { background: var(--app-muted); }
.scope-note { width: calc(100% - 40px); max-width: 1140px; margin: 24px auto 0; box-sizing: border-box; }
.scope-note[hidden] { display: none; }
.scope-note:not([hidden]) ~ main .page { padding-top: 20px; }

.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 56px; }
.page--narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head__text { min-width: 0; max-width: 64ch; flex: 1 1 360px; }
.page-head > .row { flex: none; }
.page-head .lede { margin-top: 8px; color: var(--fr-muted); }
.backlink { display: inline-block; font-size: 14px; margin-bottom: 8px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.people { list-style: none; margin: 0; padding: 0; border: 1px solid var(--app-line); border-radius: var(--fr-r-card); background: var(--fr-surface); }
.people__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.people__row + .people__row { border-top: 1px solid var(--app-line); }
.people__row p { margin: 0; }
.people__who { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
/* Boutons alignés à droite, dans le même ordre sur chaque ligne ; « Retirer » toujours en dernier (passe UX, SE4) */
.people__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-left: auto; }
.people__row--attn { background: var(--app-warn-bg); }
.row--end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack--l { gap: 32px; }
.stack--s { gap: 4px; }
.block + .block { margin-top: 32px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--fr-r-control); border: 1px solid transparent;
  background: transparent; color: var(--fr-brand); font-size: 14px; font-weight: 500; line-height: 1.2;
  cursor: pointer; text-decoration: none; text-align: center; white-space: normal;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--fr-primary); color: var(--fr-on-primary); }
.btn--primary:hover:not(:disabled) { background: var(--app-primary-hover); color: var(--fr-on-primary); }
.btn--secondary { border-color: var(--app-line-strong); background: var(--fr-surface); color: var(--fr-ink); }
.btn--secondary:hover:not(:disabled) { background: var(--fr-surface-2); color: var(--fr-ink); }
.btn[aria-pressed="true"] { border-color: var(--fr-primary); box-shadow: 0 0 0 1px var(--fr-primary); font-weight: 600; }
.btn--ghost { padding: 0 8px; }
.btn--ghost:hover:not(:disabled) { background: var(--fr-surface-2); }
.btn--danger { background: var(--fr-danger); color: var(--fr-on-primary); }
.btn--danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn--danger-text { color: var(--fr-danger); padding: 0 8px; }
.btn--danger-text:hover:not(:disabled) { background: var(--fr-danger-soft); }
.btn--sm { min-height: 32px; padding: 0 12px; }
.btn--sm.btn--ghost, .btn--sm.btn--danger-text { padding: 0 8px; }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 40px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--fr-brand); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field__label { font-size: 14px; font-weight: 500; }
.field__hint { font-size: 14px; color: var(--fr-muted); }
.field__error { font-size: 14px; color: var(--fr-danger); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; background: var(--fr-surface); color: var(--fr-ink);
  border: 1px solid var(--app-line-strong); border-radius: var(--fr-r-control); font-size: 16px;
}
.textarea { min-height: 80px; resize: vertical; }
.input::placeholder { color: var(--fr-muted); opacity: 0.8; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--fr-primary); outline-offset: 0; border-color: var(--fr-primary); }
.input[aria-invalid="true"] { border-color: var(--fr-danger); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 96px; }
.input-wrap__btn { position: absolute; right: 4px; top: 4px; min-height: 32px; }
/* Contrôles natifs : un seul gabarit (hauteur 40/44 px, rayon, filet, focus), même rendu dans tous les navigateurs. */
.input, .select, .textarea { appearance: none; -webkit-appearance: none; line-height: 1.4; transition: border-color .12s, box-shadow .12s; }
.input:hover:not(:disabled), .select:hover:not(:disabled), .textarea:hover:not(:disabled) { border-color: var(--fr-muted); }
.select { padding-right: 36px; cursor: pointer; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--fr-muted) 50%), linear-gradient(135deg, var(--fr-muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.select:focus-visible { background-image: linear-gradient(45deg, transparent 50%, var(--fr-primary) 50%), linear-gradient(135deg, var(--fr-primary) 50%, transparent 50%); }
.select option { color: var(--fr-ink); background: var(--fr-surface); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--fr-primary) 18%, transparent); }
.input:disabled, .select:disabled, .textarea:disabled { background-color: var(--fr-surface-2); color: var(--fr-muted); cursor: not-allowed; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--fr-danger); box-shadow: 0 0 0 1px var(--fr-danger); }
input[type="date"].input { min-width: 0; }
input[type="date"].input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .65; }
input[type="file"] { max-width: 100%; font-size: 14px; color: var(--fr-muted); }
input[type="file"]::file-selector-button { min-height: 32px; margin-right: 12px; padding: 0 12px; border: 1px solid var(--app-line-strong); border-radius: var(--fr-r-control);
  background: var(--fr-surface); color: var(--fr-ink); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--fr-surface-2); }
input[type="checkbox"], input[type="radio"] { appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; width: 18px; height: 18px; margin: 0;
  border: 1.5px solid var(--app-line-strong); background: var(--fr-surface); cursor: pointer; vertical-align: middle; flex: none; }
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked, input[type="radio"]:checked { border-color: var(--fr-primary); background: var(--fr-primary); }
input[type="checkbox"]:checked::after { content: ""; width: 9px; height: 5px; border: solid var(--fr-on-primary); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
input[type="radio"]:checked::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fr-on-primary); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--fr-primary); outline-offset: 2px; }
.option input, .check input { width: 18px; height: 18px; margin-top: 2px; }
.btn:focus-visible { outline: 2px solid var(--fr-primary); outline-offset: 2px; border-radius: var(--fr-r-control); }
.btn--primary:focus-visible, .btn--danger:focus-visible { box-shadow: 0 0 0 2px var(--fr-surface); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.options { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; min-width: 0; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border: 1px solid var(--app-line-strong); border-radius: var(--fr-r-card); background: var(--fr-surface); cursor: pointer; }
.option:has(input:checked) { border-color: var(--fr-primary); box-shadow: 0 0 0 1px var(--fr-primary); }
.option__title { display: block; font-weight: 500; }
.option__text { display: block; font-size: 14px; color: var(--fr-muted); }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 4px 0; }
.search { position: relative; flex: 1 1 220px; max-width: 320px; }
.search .input { padding-left: 36px; }
.search svg { position: absolute; left: 12px; top: 12px; color: var(--fr-muted); pointer-events: none; }

/* ---------- Cadres, tableaux ---------- */
.frame { background: var(--fr-surface); border: 1px solid var(--fr-line); border-radius: var(--fr-r-card); overflow: hidden; }
.frame__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 16px; border-bottom: 1px solid var(--fr-line); }
.frame__bar .grow { flex: 1 1 auto; }
.frame__foot { padding: 12px 16px; border-top: 1px solid var(--fr-line); font-size: 14px; color: var(--fr-muted); }
.scroll { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 8px 16px; text-align: left; vertical-align: middle; }
.table thead th { font-weight: 500; color: var(--fr-muted); border-bottom: 1px solid var(--fr-line); background: var(--fr-surface); white-space: nowrap; }
.table tbody tr { border-top: 1px solid var(--fr-line); }
.table tbody tr:first-child { border-top: 0; }
.table tbody th { font-weight: 500; }
.table td.num, .table th.num { text-align: right; }
.table .row-h { height: 56px; }
.table .row-h > th, .table .row-h > td { padding-top: 6px; padding-bottom: 6px; }
.table td { white-space: nowrap; }
.table td.wrap { white-space: normal; }
.table tbody tr:hover { background: color-mix(in srgb, var(--fr-surface-2) 55%, transparent); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * + * { margin-left: 4px; }
.state-attn { color: var(--fr-warn); font-weight: 500; }
.state-bad { color: var(--fr-danger); font-weight: 500; }
.state-ok { color: var(--fr-ink); }

.rename { display: block; width: 100%; text-align: left; min-height: 40px; padding: 0 8px; margin-left: -8px; border: 1px solid transparent; border-radius: var(--fr-r-control); background: none; cursor: text; font-weight: 500; color: var(--fr-ink); font-size: 14px; }
.rename:hover { border-color: var(--app-line-strong); background: var(--fr-surface); }
.rename-input { width: calc(100% + 16px); margin-left: -8px; min-height: 40px; padding: 0 8px; font-size: 14px; font-weight: 500; }

/* ---------- Grille de suivi ---------- */
.grid-table { border-collapse: separate; border-spacing: 0; }
.grid-table th, .grid-table td { padding: 0; }
.grid-table thead th { text-align: center; padding: 10px 0 8px; min-width: 52px; font-size: 14px; border-bottom: 1px solid var(--fr-line); }
.grid-table thead th.rname { text-align: left; padding-left: 16px; min-width: 190px; }
.grid-table thead th.current { color: var(--fr-ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--fr-primary); }
.grid-table tbody th.rname { text-align: left; padding: 0 16px; height: 44px; font-weight: 500; border-top: 1px solid var(--fr-line); position: sticky; left: 0; background: var(--fr-surface); z-index: 1; white-space: nowrap; }
.grid-table tbody td { text-align: center; height: 44px; border-top: 1px solid var(--fr-line); }
.grid-table td.current, .grid-table tbody tr:hover th.rname { background: var(--fr-surface-2); }
.grid-table tbody tr:hover td { background: color-mix(in srgb, var(--fr-surface-2) 55%, transparent); }
.grid-table tbody tr:hover td.current { background: var(--fr-surface-2); }
.grid-table tbody tr:first-child th, .grid-table tbody tr:first-child td { border-top: 0; }
.cell { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; font-size: 14px; font-weight: 600; line-height: 1; }
.cell--ok { background: var(--fr-accent); color: var(--fr-accent-ink); }
.cell--valide { background: var(--fr-brand); color: var(--fr-on-primary); }
.cell--attente { background: var(--fr-warn-soft); color: var(--fr-warn); box-shadow: inset 0 0 0 1px var(--fr-warn); }
.cell--manquant { background: var(--fr-danger-soft); color: var(--fr-danger); box-shadow: inset 0 0 0 1px var(--fr-danger); }
.cell--echec { background: var(--fr-danger); color: var(--fr-on-primary); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--fr-muted); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend .cell { width: 20px; height: 20px; font-size: 12px; border-radius: 4px; }

/* À faire */
.todo { margin: 0 0 24px; }
.todo h2 { margin-bottom: 8px; }
.todo__list { border-top: 1px solid var(--fr-line); }
.todo__item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--fr-line); }
.todo__text { flex: 1 1 320px; min-width: 0; }
.todo__title { font-weight: 500; }
.todo__sub { font-size: 14px; color: var(--fr-muted); }
.todo__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.todo__reject { flex: 1 1 100%; display: flex; flex-direction: column; gap: 8px; max-width: 520px; padding-bottom: 4px; }

/* ---------- Notices, vide, toast ---------- */
.notice { padding: 12px 16px; border-radius: var(--fr-r-card); background: var(--fr-surface-2); font-size: 14px; }
.notice--attention { background: var(--fr-warn-soft); color: var(--fr-warn); }
.notice--danger { background: var(--fr-danger-soft); color: var(--fr-danger); }
.notice__title { font-weight: 600; }
.notice a { color: inherit; }
.notice a.btn--primary { color: var(--fr-on-primary); }
.notice > * + * { margin-top: 4px; }
.empty { padding: 24px; text-align: center; max-width: 52ch; margin: 0 auto; color: var(--app-muted); font-size: 15px; }
.empty--center { margin: 0 auto; }
.empty h2 { font-size: 17px; margin-bottom: 4px; }
.empty p { color: var(--app-muted); margin-bottom: 12px; }
.loader { display: flex; align-items: center; gap: 8px; color: var(--fr-muted); padding: 24px 0; font-size: 14px; }
.wait { display: flex; gap: 12px; align-items: center; }
/* Notifications au centre, en bas (prototype v73) ; au téléphone, au-dessus de la barre du bas (shell.css). */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column;
  align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--fr-ink); color: var(--fr-canvas); padding: 12px 18px; border-radius: 12px; font-size: 15px; font-weight: 600;
  box-shadow: 0 10px 28px rgba(0,0,0,.25); max-width: 560px; }
.toast--error { background: var(--fr-danger); color: var(--fr-on-primary); }

/* ---------- Boîtes de dialogue ---------- */
dialog { border: 0; padding: 0; color: var(--fr-ink); background: var(--fr-surface); }
dialog::backdrop { background: var(--app-scrim); }
.modal { width: min(460px, calc(100vw - 32px)); border-radius: var(--fr-r-dialog); box-shadow: var(--fr-shadow-2); border: 1px solid var(--fr-line); margin: auto; }
.modal__inner { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.modal__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.slideover {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(440px, 100vw); max-width: 100vw; height: 100%; max-height: 100%;
  border-left: 1px solid var(--fr-line); border-radius: 0; box-shadow: var(--fr-shadow-2);
}
.slideover[open] { animation: slide-in 0.18s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.slideover__inner { height: 100%; display: flex; flex-direction: column; }
.slideover__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--fr-line); }
.slideover__body { padding: 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.slideover__foot { padding: 16px 24px; border-top: 1px solid var(--fr-line); display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Sections, faits, onglets, listes ---------- */
.section { padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--fr-line); }
.page-head + .section { padding-top: 0; margin-top: 0; border-top: 0; }
.section > h2 { margin-bottom: 4px; }
.section > .section__sub { color: var(--fr-muted); margin-bottom: 16px; font-size: 14px; max-width: 64ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px 24px; }
.facts dt { font-size: 14px; color: var(--fr-muted); }
.facts dd { font-weight: 500; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--fr-line); margin-bottom: 16px; }
.tab { background: none; border: 0; padding: 8px 16px; min-height: 40px; cursor: pointer; color: var(--fr-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; font-weight: 500; }
.tab[aria-selected="true"] { color: var(--fr-ink); border-bottom-color: var(--fr-primary); }
.copybox { display: flex; align-items: center; gap: 8px; border: 1px solid var(--app-line-strong); border-radius: var(--fr-r-control); padding: 4px 4px 4px 12px; background: var(--fr-surface-2); min-width: 0; }
.copybox__text { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.steps-list { list-style: decimal; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; max-width: 64ch; }
.steps-list li::marker { color: var(--fr-muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.list { border-top: 1px solid var(--fr-line); }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--fr-line); min-height: 56px; }
.list__main { min-width: 0; flex: 1 1 240px; }
.list__title { font-weight: 500; }
.list__meta { font-size: 14px; color: var(--fr-muted); }
/* Une ligne de liste qui demande un geste garde sa couleur (sinon le gris ci-dessus la cache, écran du cabinet) */
.list__meta.state-attn { color: var(--fr-warn); }
.list__meta.state-bad { color: var(--fr-danger); }

/* ---------- Journal ---------- */
.feed__day { font-size: 16px; font-weight: 600; margin: 32px 0 8px; }
.feed__day:first-child { margin-top: 0; }
.feed { border-top: 1px solid var(--fr-line); }
.feed li { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--fr-line); font-size: 14px; }
.feed time { color: var(--fr-muted); }

/* ---------- Connexion (#/connexion, #/mot-de-passe) : deux parties comme Fraum Studio ----------
   À gauche le bandeau de marque (logo, « Espace client », une phrase, arc décoratif), à droite le formulaire.
   Sous 768 px : une colonne, le bandeau devient un en-tête. Le vert boréal n'y est qu'un aplat (arc, filet). */
.page.page--auth, .demo-note:not([hidden]) ~ main .page.page--auth { max-width: none; margin: 0; padding: 0; }
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(280px, 420px) 1fr; background: var(--fr-canvas); }
.auth-rail { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 48px 40px 48px 48px; background: var(--app-auth-rail); color: var(--app-auth-rail-ink); }
.auth-rail__line { position: absolute; left: 0; top: 96px; bottom: 96px; width: 4px; background: linear-gradient(180deg, transparent, var(--fr-accent) 18%, var(--fr-accent) 82%, transparent); opacity: 0.85; pointer-events: none; }
.auth-rail__content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.auth-rail .fraum-logo { width: 112px; height: 26px; opacity: 1; margin-bottom: 12px; }
.auth-rail__label { font-size: 14px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.auth-rail__tagline { font-size: 16px; line-height: 1.55; color: var(--app-auth-rail-muted); max-width: 30ch; }
.auth-zone { display: flex; align-items: center; justify-content: center; padding: 48px 32px; min-width: 0; }
.auth-panel { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.auth-panel h1 { color: var(--fr-brand); }
.auth-panel__lead { color: var(--fr-muted); margin-top: 4px; }
/* Lien par e-mail au même niveau que le mot de passe (fos-novice-21) : « ou », puis un bouton pleine largeur */
.auth-or { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--fr-muted); font-size: 14px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--fr-line); }
@media (max-width: 767px) {
  .auth-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-rail { padding: 16px 20px; }
  .auth-rail__content { flex-direction: row; align-items: center; gap: 12px; }
  .auth-rail .fraum-logo { width: 80px; height: 18px; margin: 0; }
  .auth-rail__tagline, .auth-rail__line { display: none; }
  .auth-zone { align-items: flex-start; padding: 28px 20px 40px; }
  .auth-panel h1 { font-size: 24px; }
}

/* ---------- Passages lancés à la main (J18) ---------- */
.tag--ok { background: var(--app-ok-bg); color: var(--app-ok-ink); }
.tag--info { background: var(--app-soft); color: var(--app-soft-ink); }
.tag--muted { background: var(--app-line); color: var(--app-ink); }
.card--run, .rundetail > .card, .rundetail > .page-head { max-width: 860px; }
.runform { display: flex; flex-direction: column; gap: 18px; }
.runform .options { gap: 10px; }
.options--wrap { flex-direction: row; flex-wrap: wrap; gap: 8px 24px; }
.runform .options--wrap { gap: 8px 24px; }
.check { align-items: center; gap: 10px; }
.check input { margin-top: 0; }
.options--wrap { flex-direction: row; flex-wrap: wrap; gap: 6px 20px; }
.items__empty--calm { background: var(--app-bg); color: var(--app-muted); font-weight: 400; }
.item--run { align-items: flex-start; }
.item--run .item__text { flex: 1 1 260px; }
.item--run .item__text .strong a { color: var(--app-ink); text-decoration: none; }
.item--run .item__text .strong a:hover { text-decoration: underline; }
.prog { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.prog--compact { gap: 6px; }
.prog__pct { margin: 0; font-size: 14px; }
.prog__pct strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.prog__why { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--app-warn-ink); }
.prog__actions { margin-top: 16px; }
.pbar { height: 12px; border-radius: 999px; background: var(--app-line); overflow: hidden; }
.pbar__fill { display: block; height: 100%; border-radius: 999px; background: var(--app-primary); transition: width 0.4s ease; }
.pstep { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 4px; }
.pstep__i { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--app-line); border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--app-muted); }
.pstep__mark { flex: none; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; background: var(--app-line); color: var(--app-muted); }
.pstep__i--done { color: var(--app-ink); }
.pstep__i--done .pstep__mark { background: var(--app-primary); color: var(--app-on-primary); }
.pstep__i--current { border-color: var(--app-primary); color: var(--app-ink); }
.pstep__i--current .pstep__mark { background: var(--app-surface); color: var(--app-primary); border: 2px solid var(--app-primary); }
.pstep__i--bad { border-color: var(--app-bad-dot); color: var(--app-bad-ink); }
.pstep__i--bad .pstep__mark { background: var(--app-bad-bg); color: var(--app-bad-ink); }
.pieces { display: flex; flex-direction: column; gap: 6px; }
.pieces__i { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 12px; border: 1px solid var(--app-line); border-radius: 10px; font-size: 14px; overflow-wrap: anywhere; }
.pieces__k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 2px 8px; border-radius: 999px; background: var(--app-ok-bg); color: var(--app-ok-ink); }
.card--runs { margin: 0; }
@media (prefers-reduced-motion: reduce) { .pbar__fill { transition: none; } }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .input, .select { min-height: 44px; }
  .filters { padding: 12px 20px 0; }
  .card { padding: 16px; }
  .page-head > .row { flex: 1 1 100%; }
  .page-head .btn { flex: 1 1 auto; }
  h1 { font-size: 24px; }
  .btn { min-height: 44px; }
  .btn--sm { min-height: 40px; }
  .btn--icon { width: 44px; }
  .grid-table thead th.rname { min-width: 120px; }
  .grid-table tbody th.rname { max-width: 128px; overflow: hidden; text-overflow: ellipsis; padding: 0 8px 0 16px; }
  .grid-table thead th { min-width: 42px; }
  .wk-old { display: none; }
  .feed li { grid-template-columns: 48px 1fr; gap: 12px; }

  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td, .table--stack th { display: block; width: 100%; }
  .table--stack tbody tr { padding: 12px 16px; }
  .table--stack th, .table--stack td { padding: 2px 0; white-space: normal; }
  .table--stack td[data-label]:not(.actions)::before { content: attr(data-label) " : "; color: var(--fr-muted); }
  .table--stack td.actions { text-align: left; margin-top: 8px; }
  .table--stack .row-h { height: auto; }
  .table--stack td.num { text-align: left; }
  .rename { margin-left: 0; padding-left: 0; }
  .rename-input { margin-left: 0; width: 100%; }
}
@media (pointer: coarse) {
  .btn--sm { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-right-color: currentColor; opacity: 0.5; }
  .slideover[open] { animation: none; }
}

/* ---------- Résultats : Livraison, Titres-restaurant (J16b) ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.toolbar p { margin: 0; }
.res-note { margin: 8px 0 0; max-width: 760px; }
/* Livraison (V2) : le nom du restaurant ouvre le détail de la ligne ; source des frais et alertes sous le nom. */
.linkbtn { display: inline; min-height: 24px; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--app-ink); text-align: left; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { text-decoration-thickness: 2px; }
.linkbtn:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; border-radius: 4px; }
.table--res .sub--warn { color: var(--app-warn-ink); font-weight: 600; }
.lad-notes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.lad-notes p { margin: 0; }
.lad-detail { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; margin: 0; }
.lad-detail dt { color: var(--app-muted); }
.lad-detail dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .lad-table .table--res th, .lad-table .table--res td { padding: 12px 8px; }
  .lad-table .badge { white-space: normal; }
  .cx-table .table--res th, .cx-table .table--res td { padding: 12px 6px; }
  .cx-table .badge, .cx-table .btn { white-space: normal; }
}
.tablewrap { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 16px; overflow-x: auto; margin-top: 12px; }
.table--res tfoot th, .table--res tfoot td { border-top: 2px solid var(--fr-line); font-weight: 700; }
.table--res td.num, .table--res th.num { font-variant-numeric: tabular-nums; }
.table--res .sub { font-size: 13px; color: var(--app-muted); font-weight: 400; }
.show-sm { display: none; }
.tcards { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tcard { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 16px; padding: 16px; min-width: 0; }
.tcard p { margin: 4px 0; }
.tcard__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tcard__head h2 { margin: 0; font-size: 18px; }
.tcard__net { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* ---------- P&L, RH, dépôt de classeur (J16c) ---------- */
.res-section { margin-top: 20px; }
.res-section h2 { margin: 0 0 4px; font-size: 18px; }
.res-alert { margin: 12px 0; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--fr-danger, #b3261e); background: var(--app-surface); }
.res-alert ul { margin: 6px 0 0; padding-left: 20px; }
.depots { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.depot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 12px; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 12px; min-width: 0; }
.depot__name { font-weight: 600; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .table--res th, .table--res td { padding: 8px 10px; }
  .table--res td { white-space: normal; }
}
.toolbar:has(#depot-file:focus-visible) label[for="depot-file"] { outline: 3px solid var(--fr-primary); outline-offset: 2px; }

/* J16d : Validations (Valider / Signaler côte à côte) et Connexions */
.vlist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.vcard { display: grid; gap: 8px; align-content: start; padding: 14px 16px; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 12px; min-width: 0; }
.vcard h2 { margin: 0; font-size: 17px; }
.vcard--focus { border-color: var(--app-primary); box-shadow: 0 0 0 2px var(--app-primary); }
.vcard p { margin: 0; }
.vcard__actions { display: flex; gap: 8px; }
.vcard__actions .btn { flex: 1 1 0; }
.table--res .sub--block { display: block; }

/* ---------- Passe 2 : fidélité maquette (filtres, puces, tableaux de résultats) ---------- */
.filters { margin-top: 16px; padding: 16px 20px; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 16px; width: calc(100% - 40px); max-width: 1140px; gap: 12px 28px; }
.filters:not([hidden]) + * { margin-top: 0; }
.filters__field label, .filters__label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--app-muted); }
.chip { min-height: 44px; padding: 0 18px; font-size: 15px; font-weight: 700; border-color: var(--app-line); background: var(--app-surface); color: var(--app-ink); transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--app-line-strong); background: var(--fr-surface-2); }
.chip[aria-pressed="true"] { background: var(--app-primary); border-color: var(--app-primary); color: var(--app-on-primary); }
.chip:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.toolbar #excel { min-height: 48px; padding: 0 22px; border: 0; border-radius: 12px; background: var(--app-primary); color: var(--app-on-primary); font-size: 16px; font-weight: 700; }
.toolbar #excel:hover { filter: brightness(1.12); background: var(--app-primary); color: var(--app-on-primary); }
/* Les téléchargements de l'écran (lot D2) : Excel en premier, puis le PDF de l'écran et le rapport du mois, de la même hauteur. */
.res-exports { align-items: center; }
.toolbar .res-exports .btn { min-height: 48px; padding: 0 18px; border-radius: 12px; }
.table--res { border-collapse: separate; border-spacing: 0; }
.table--res th, .table--res td { padding: 16px 16px; }
.table--res thead th { padding-top: 18px; padding-bottom: 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--app-muted); background: var(--app-surface); border-bottom: 1px solid var(--app-line); }
.table--res tbody tr { border-top: 0; }
.table--res tbody th, .table--res tbody td { border-top: 1px solid var(--app-line); }
.table--res tbody tr:first-child th, .table--res tbody tr:first-child td { border-top: 0; }
.table--res tbody th { font-weight: 700; }
.table--res tbody tr:hover { background: color-mix(in srgb, var(--app-bg) 70%, transparent); }
.table--res tfoot th, .table--res tfoot td { border-top: 2px solid var(--app-ink); font-weight: 700; padding-top: 16px; }
.table--res .state-bad { font-weight: 700; color: var(--app-bad-ink); }
.table--res tbody td.num { font-weight: 500; }
@media (max-width: 640px) { .filters { width: calc(100% - 32px); padding: 14px 16px; } .toolbar #excel { width: 100%; } .res-exports { width: 100%; } .res-exports .btn:not(#excel) { flex: 1 1 auto; } }
/* Téléphone et tablette, après le style de base des tableaux ci-dessus (qui écrasait la règle plus haut) : marges de
   cellule réduites et pastille d'état sur deux lignes au besoin, la colonne État ne sort plus du tableau (Titres, 375 px) */
@media (max-width: 860px) {
  .table--res th, .table--res td { padding-left: 10px; padding-right: 10px; }
  .table--res .badge { white-space: normal; }
}
.table--res tbody td.num:nth-last-child(2) { font-weight: 700; }
.tcard { padding: 20px; border-radius: 16px; }
.tcard__label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--app-muted); margin-top: 14px; }
.tcard__net { font-size: 28px; font-weight: 800; line-height: 1.2; margin: 2px 0 6px; }
.tcard__head h2 { font-size: 18px; font-weight: 700; }
.tcard__products { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--app-line); display: grid; gap: 4px; }
.tcard__products li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; min-width: 0; }
.tcard__amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.res-products__item + .res-products__item::before { content: " · "; }
@media (max-width: 860px) {
  .res-products__item { display: block; }
  .res-products__item + .res-products__item::before { content: none; }
}
.page-head h1 { font-size: 26px; font-weight: 700; line-height: 1.25; }
.page-head .lede { font-size: 16px; color: var(--app-muted); }
.btn { font-weight: 700; border-radius: 12px; }
.btn--secondary { border-color: var(--app-line); background: var(--app-surface); }
.btn--primary { background: var(--app-primary); color: var(--app-on-primary); }
.vcard { border-radius: 16px; }
.vcard h2 { font-size: 18px; font-weight: 700; }
textarea, input[type="text"], input[type="email"], input[type="search"] { border-radius: 12px; border-color: var(--app-line-strong); }


/* Passe 3 : bloc de marge (P&L), résumé du jour (RH), encart « Envoi au comptable » (Validations). */
.margin__hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 8px; }
.margin__hero h2 { margin: 0; flex: 1 1 100%; }
.margin__headline { margin: 0; font-size: 22px; font-weight: 800; color: var(--app-ink); }
.margin .bar { display: block; height: 6px; margin-top: 4px; border-radius: 3px; background: var(--app-line); }
.margin .bar__fill { display: block; height: 100%; border-radius: 3px; background: var(--app-primary); }
.vlayout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .vlayout { grid-template-columns: minmax(0, 1fr) 320px; } .dispatch { position: sticky; top: 16px; } }
.dispatch__who { margin: 4px 0; font-size: 18px; font-weight: 700; }
.dispatch__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.dispatch__stats dt { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--app-muted, #5c5c5c); }
.dispatch__stats dd { margin: 0; font-size: 24px; font-weight: 800; }
@media (max-width: 899px) { .dispatch { order: -1; } }

/* ---------- Passe UX, vague 1 (2026-10-20, docs/audit/2026-10-20-passe-ux.md) ---------- */
/* T11 : zone de toucher d'au moins 40 px au doigt, sans changer la mise en page ; téléphone et tablette, jusqu'à
   1 199 px (audit EC-13 : un lien de tableau de 17 px de haut à 1 024 px). */
@media (max-width: 1199px), (pointer: coarse) {
  .btn--sm { min-height: 40px; }
  .linkbtn { display: inline-block; padding: 8px 0; margin: -8px 0; }
  .table a:not(.btn), .table--res a:not(.btn) { display: inline-block; padding: 12px 0; margin: -12px 0; }
  .backlink { display: inline-flex; align-items: center; min-height: 40px; }
  .check, .option { min-height: 40px; }
  .check input, .option input { width: 22px; height: 22px; }
}

/* X3 : le bandeau « accès en attente » ne se confond plus avec le bandeau « Démonstration » (aplat jaune pâle). */
.scope-note.notice--attention {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; background: var(--app-surface); color: var(--app-ink);
  border: 1px solid var(--app-warn-dot); border-left-width: 6px; font-size: 15px; font-weight: 600;
}
.scope-note.notice--attention::before {
  content: "!" / ""; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--app-warn-dot); color: #fff;
  font-weight: 800; font-size: 14px; line-height: 22px; text-align: center;
}
.scope-note > * + * { margin-top: 0; }
/* X1 : la page unique de l'accès en attente. */
.waiting { padding: 28px 24px; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 16px; }
.waiting h1 { font-size: 24px; margin-bottom: 12px; }
.waiting p + p { margin-top: 10px; }
.waiting a { font-weight: 600; overflow-wrap: anywhere; }

/* M1, M2 : actions d'une ligne de « Mes restaurants » : une action visible et « Plus d'actions » ; les boutons passent
   à la ligne (avant, « nowrap » les faisait sortir de la carte sur téléphone). */
.actions__row { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 6px; white-space: normal; }
.actions__row > .btn { flex: none; }
.actions__more:not([hidden]) { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 6px; flex: 1 1 100%; }
@media (max-width: 860px) {
  .table--stack td.actions .actions__row, .table--stack td.actions .actions__more { justify-content: flex-start; }
}

/* Explorateur de fichiers d'un drive (V3, drive-picker.js) : chemin parcouru, liste du dossier. */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 12px; font-size: 14px; overflow-wrap: anywhere; }
.crumbs [aria-current] { font-weight: 600; }
.drive-picker .list__title { overflow-wrap: anywhere; }

/* Vues par période (V4, lot D1) : le choix de la vue (Jour, Semaine, Mois, Année) devant la liste des périodes ; sur
   téléphone, sur sa propre ligne. Sous-totaux de chaque semaine, mois ou jour : un tableau sous les lignes. */
.res-vues { flex: 0 0 auto; gap: 6px; }
.res-vues .chip { min-height: 40px; padding: 0 14px; }
.res-regle a { font-weight: 600; }
.res-semaines { margin: 0; }
.res-decoupe h2 { margin-bottom: 8px; }
@media (max-width: 640px) { .res-vues { flex: 1 1 100%; } .res-vues .chip { padding: 0 12px; } }

/* ---------- Passe UX des écrans de données (2026-10-20) ---------- */
/* L3 : sur téléphone, un seul bouton « Télécharger » ouvre la liste des téléchargements (sous le tableau en Livraison). */
.res-exports__toggle { display: none; }
.res-exports__vide { flex: 1 1 100%; margin: 0; }
@media (max-width: 640px) {
  .res-downloads { width: 100%; margin-top: 12px; }
  .res-exports__toggle { display: flex; width: 100%; min-height: 48px; border-radius: 12px; }
  .res-downloads:not(.is-open) .res-exports { display: none; }
  .res-downloads.is-open .res-exports { margin-top: 8px; }
  .res-downloads .res-exports .btn { width: 100%; min-height: 48px; border-radius: 12px; }
}
/* L1 : la ligne « Dont Uber Eats » sous le Total, plus discrète que lui. */
.table--res tfoot tr + tr th, .table--res tfoot tr + tr td { border-top: 1px solid var(--app-line); font-weight: 600; padding-top: 12px; }
/* L2 : les points du calcul ouvrent le détail de la ligne. */
.table--res .linkbtn.sub { font-size: 13px; font-weight: 600; text-align: left; }
/* P1, P3 : le détail pour le cabinet, replié. */
.res-more { margin-top: 6px; }
.res-more summary { cursor: pointer; font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.res-more p { margin: 4px 0 0; }
.vcard__motif { display: grid; gap: 6px; }
/* Lignes dépliables (Livraison, Titres-restaurant, P&L, RH) : toute la ligne déplie son détail juste dessous ; la
   flèche au bout de la ligne fait de même au clavier. Le détail ne fait pas grandir le tableau : il prend sa largeur. */
.table--res tr.row-x { cursor: pointer; }
.table--res tr.row-x.is-open > th, .table--res tr.row-x.is-open > td { background: color-mix(in srgb, var(--app-bg) 70%, transparent); }
.table--res th.res-toggle-cell, .table--res td.res-toggle-cell { width: 44px; padding-left: 0; padding-right: 10px; text-align: right; }
.table--res thead th.res-toggle-cell { position: relative; }   /* son titre caché reste dans le cadre du tableau (téléphone) */
.res-toggle { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--app-line); border-radius: 999px; background: var(--app-surface); color: var(--app-ink); cursor: pointer; }
.res-toggle:hover { border-color: var(--app-line-strong); }
.res-toggle:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.res-toggle__icon { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
.res-toggle[aria-expanded="true"] .res-toggle__icon { transform: translateY(2px) rotate(-135deg); }
@media (prefers-reduced-motion: reduce) { .res-toggle__icon { transition: none; } }
.table--res tr.res-detail > td { padding: 4px 16px 20px; border-top: 0; font-weight: 400; white-space: normal; background: color-mix(in srgb, var(--app-bg) 70%, transparent); }
.tablewrap:has(> .table--res.has-detail) { container-type: inline-size; }
/* Le détail prend la largeur visible du cadre et y reste quand le tableau défile de côté (téléphone, P&L et RH). */
.res-detail__body { display: grid; gap: 8px; position: sticky; left: 16px; width: 0; min-width: min(100%, calc(100cqw - 32px)); }
.res-detail__body > p { margin: 0; }
.res-detail__body .tablewrap { margin-top: 4px; }
.table--res.has-detail > tbody > tr > td.num:nth-last-child(2):not(.key) { font-weight: 500; }
.table--res > tbody > tr > td.key { font-weight: 700; }
.lad-detail { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 0 32px; }
.lad-detail__item { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--app-line); }
@media (max-width: 640px) {             /* la colonne de la flèche tient dans la largeur du téléphone */
  .table--res thead th { white-space: normal; }       /* « CA HT moins charges » sur deux lignes : P&L et RH à 375 px */
  .table--res .res-state { margin-top: 6px; }
  .table--res.has-detail > * > tr > th, .table--res.has-detail > * > tr > td { padding-left: 6px; padding-right: 6px; }
  .table--res.has-detail th.res-toggle-cell, .table--res.has-detail td.res-toggle-cell { width: 24px; padding-left: 0; padding-right: 4px; }
  .res-toggle { width: 24px; height: 24px; border: 0; background: none; }
  .table--res.has-detail tr.res-detail > td { padding: 4px 10px 16px; }
  .res-detail__body { left: 10px; min-width: min(100%, calc(100cqw - 20px)); }
}

/* ---------- Passe UX vague 2 : Passages, console, envoi ---------- */
/* PA1 : la suite d'un passage en erreur, et son bouton « Relancer ». */
.item--run .run-next { margin: 4px 0 0; }
.run-next__act { margin: 8px 0 0; }
/* E4 : Envoi au comptable, une carte par réglage, son bouton dedans. */
.envoi-card { margin-top: 24px; }
.page-head + .envoi-card { margin-top: 0; }
.envoi-card__sub { color: var(--fr-muted); margin: -4px 0 16px; font-size: 14px; max-width: 64ch; }
.envoi-card > .options + .small, .envoi-card > .options + .notice { margin-top: 12px; }
.envoi-recipients { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--fr-line); }
.envoi-recipients > h3 { margin: 0 0 4px; }
.envoi-card__save { margin-top: 20px; }
.envoi-membre { align-items: flex-start; }
.envoi-membre > .btn { margin-top: 30px; }
/* CF1 : console, le parc tient dans 1280 px : actions sous le nom du client, cellules qui passent à la ligne. */
.table--parc thead th { white-space: normal; vertical-align: bottom; }
.table--parc tbody th, .table--parc td { vertical-align: top; padding-left: 12px; padding-right: 12px; }
.table--parc tbody th { min-width: 150px; }
.table--parc .parc-client__name { display: block; font-weight: 600; }
.parc-client__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.parc-mode { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.table--parc .btn { white-space: nowrap; }
@media (max-width: 640px) {
  .envoi-membre > .btn { margin-top: 0; }
  .table--parc tbody th { min-width: 0; }
}

/* ---------- Analyses (docs/specs/analytique.md) : graphiques SVG dessinés par js/charts.js ----------
   Couleurs : seulement par ces classes (jamais d'attribut ni de style en ligne) ; une série pose `color`, ses traits et
   aplats prennent currentColor. Traits fins : barres de 24 px au plus, courbes de 2 px, grille d'un pixel. */
.chart { margin: 16px 0 0; padding: 16px 16px 12px; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 16px; min-width: 0; }
.chart__title { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--app-ink); }
.chart__legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 8px; font-size: 13px; color: var(--app-muted); }
.chart__legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-key { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 3px; background: currentColor; }
.chart-key--line { width: 16px; height: 3px; border-radius: 2px; }
.chart-key--dash { width: 18px; height: 0; border-radius: 0; background: none; border-top: 2px dashed currentColor; }
.chart__plot { min-width: 0; }
.chart__svg { display: block; width: 100%; height: auto; font-family: var(--fr-font); font-size: 12px; font-variant-numeric: tabular-nums; touch-action: pan-y; }
.chart__svg:focus { outline: none; }
.chart__svg:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 4px; border-radius: 6px; }
.chart-s1 { color: var(--app-chart-1); }
.chart-s2 { color: var(--app-chart-2); }
.chart-s3 { color: var(--app-chart-3); }
.chart-s4 { color: var(--app-chart-4); }
.chart-prev { color: var(--app-muted); }
.chart-avgkey { color: var(--app-ink); }
.chart-grid { stroke: var(--app-line); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { stroke: var(--app-line-strong); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick { fill: var(--app-muted); font-size: 12px; }
.chart-tick--sub { font-size: 11px; }
.chart-label { fill: var(--app-ink); font-size: 12px; font-weight: 600; paint-order: stroke; stroke: var(--app-surface); stroke-width: 4px; stroke-linejoin: round; }
.chart-name { fill: var(--app-ink); font-size: 13px; font-weight: 600; }
.chart-label-bg { fill: var(--app-surface); }
.chart-bar { fill: currentColor; }
.chart-bar--partial { fill-opacity: 0.5; }
.chart-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line--dash { stroke-dasharray: 5 4; stroke-linecap: butt; }
.chart-dot { fill: currentColor; stroke: var(--app-surface); stroke-width: 2; }
.chart-band { fill: var(--app-ink); fill-opacity: 0.06; }
.chart-cross { stroke: var(--app-muted); stroke-width: 1; shape-rendering: crispEdges; }
.chart-avg { stroke: var(--app-ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart-active, .chart-layer text { pointer-events: none; }
.chart-tip__bg { fill: var(--app-surface); stroke: var(--app-line-strong); stroke-width: 1; }
.chart-tip__head { fill: var(--app-muted); font-size: 12px; }
.chart-tip__value { fill: var(--app-ink); font-size: 13px; font-weight: 700; }
.chart-tip__label { fill: var(--app-muted); font-size: 12px; }
.chart-tip__key { stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.chart-tip__key--dash { stroke-width: 2; stroke-dasharray: 3 2; stroke-linecap: butt; }
@media (forced-colors: active) {
  .chart-bar { fill: CanvasText; }
  .chart-line { stroke: CanvasText; }
  .chart-dot { fill: CanvasText; }
}

/* L'écran Analyses : un bloc par question, la phrase chiffrée d'abord, le détail dessous. */
.an-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; }
.an-alertes__count { margin-left: 8px; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--app-accent); color: var(--app-on-accent); font-size: 12px; font-weight: 700; text-align: center; }
.an-block { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--app-line); }
.an-block > h2 { font-size: 22px; font-weight: 700; line-height: 1.3; }
.an-key { margin-top: 8px; font-size: 20px; line-height: 1.4; font-weight: 500; color: var(--app-ink); font-variant-numeric: normal; max-width: 60ch; }
.an-key strong { font-weight: 800; }
.an-lead { margin-top: 6px; font-size: 16px; color: var(--app-ink); max-width: 72ch; }
.an-sub { margin-top: 6px; max-width: 72ch; color: var(--app-muted); }
.an-h3 { margin: 28px 0 0; font-size: 17px; font-weight: 700; }
.an-h3 + .an-sub { margin-top: 4px; }
.an-sub + .chart__legend { margin-top: 10px; }
.an-facts { margin: 12px 0 0; display: grid; gap: 6px; font-size: 15px; }
.an-facts li { display: flex; align-items: baseline; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.an-facts .chart-key { transform: translateY(-3px); }
.an-grid { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.an-grid > * { min-width: 0; }
.an-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 14px; }
.an-field label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--app-muted); }
.an-field .select { width: auto; min-width: 0; max-width: 100%; flex: 0 1 320px; }
.an-chartbox { min-width: 0; }
.an-numbers { margin-top: 8px; }
.an-numbers > summary { display: inline-flex; align-items: center; min-height: 40px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--fr-brand); text-decoration: underline; text-underline-offset: 3px; }
.an-numbers > summary:hover { text-decoration-thickness: 2px; }
.an-numbers > .tablewrap { margin-top: 4px; }
/* Seule la colonne clé est en gras : la règle des onglets à détail (avant-dernière colonne en gras) ne vaut pas ici. */
.an-block .table--res tbody td.num:nth-last-child(2):not(.key) { font-weight: 500; }
.an-subtable + .an-subtable { margin-top: 16px; }
.an-subtable > p { margin-top: 8px; }
.an-empty { margin-top: 12px; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 16px; max-width: none; }
.an-empty h3 { font-size: 17px; margin-bottom: 4px; color: var(--app-ink); }
.an-empty p { margin: 0 auto 12px; max-width: 52ch; }
/* Alertes des Analyses (lot B) : pastille « Alerte » (Accueil et onglet), liste, alertes proposées, formulaire. Teinte
   de la 4e série des graphiques : distincte des écarts (rouge) et des pièces (orange), suit la marque et le mode sombre. */
.tag--alerte { background: color-mix(in srgb, var(--app-chart-4) 14%, var(--app-surface)); color: color-mix(in srgb, var(--app-chart-4) 72%, var(--app-ink)); }
.an-alertes__list { margin-top: 14px; }
.an-alerte--declenchee { border-color: color-mix(in srgb, var(--app-chart-4) 50%, var(--app-line)); }
.an-alerte__constat { margin-top: 4px; font-size: 14px; color: var(--app-ink); }
.an-alerte__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.an-alertes__add { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 16px; }
.an-alertes__sugg { display: flex; flex-wrap: wrap; gap: 8px; }
.an-alerte-form { margin-top: 16px; padding: 16px; max-width: 820px; box-sizing: border-box; border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface); }
.an-alerte-form .an-h3 { margin-top: 0; }
.an-alerte-form__grid { display: grid; gap: 14px 16px; margin-top: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: start; }
.an-alerte__seuilbox { display: flex; align-items: center; gap: 8px; }
.an-alerte__seuilbox .input { flex: 1 1 auto; min-width: 0; }
.an-alerte__unit { font-weight: 600; color: var(--app-muted); }
.an-alerte-form__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
/* Téléphone : l'état au-dessus, le texte en entier, puis les boutons (sinon « Vue » tient à côté du texte et
   « Déclenchée » passe au-dessus : deux mises en page dans la même liste). */
@media (max-width: 640px) { .an-alerte .item__text { flex-basis: 100%; } }
@media (max-width: 640px) {
  .chart { padding: 12px 12px 8px; }
  .an-actions { width: 100%; justify-content: flex-start; }
  .an-key { font-size: 18px; }
  .an-block > h2 { font-size: 20px; }
  .an-field .select { flex: 1 1 100%; }
}

/* ---------- Analyses : la zone écrite par l'IA (le reste de ses règles est dans css/screens/analyses.css) ---------- */
.an-ia { display: flex; flex-direction: column; gap: 28px; margin-top: 20px; }
.an-ia:empty { display: none; }
.an-ia h2 { font-size: 22px; font-weight: 700; line-height: 1.3; }
@media (max-width: 640px) {
  .an-ia h2 { font-size: 20px; }
}

/* Interrupteur (Réglages, « Analyses écrites par l'IA ») : une case à cocher dessinée en interrupteur. */
input[type="checkbox"].switch { position: relative; display: inline-block; width: 44px; height: 24px; margin: 0; border: 0; border-radius: 999px; background: var(--fr-muted); transition: background-color .15s; }
input[type="checkbox"].switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--fr-surface); transform: none; transition: transform .15s; }
input[type="checkbox"].switch:checked { background: var(--fr-primary); }
input[type="checkbox"].switch:checked::after { width: 18px; height: 18px; border: 0; transform: translateX(20px); }
input[type="checkbox"].switch:disabled { opacity: .5; }
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row__state { font-weight: 600; }
.envoi-ia__effet { margin-top: 8px; max-width: 64ch; }
@media (prefers-reduced-motion: reduce) {
  input[type="checkbox"].switch, input[type="checkbox"].switch::after { transition: none; }
}

/* Connexions : une carte dépliable par émetteur (logo, nom, état), une ligne par connexion, le détail se déplie (demande d'Amine, 23/10). */
.cx-groups { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.cx-group { border: 1px solid var(--app-line); border-radius: 16px; background: var(--app-surface); overflow: hidden; }
.cx-group__head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; list-style: none; }
.cx-group__head::-webkit-details-marker { display: none; }
.cx-group__head .switch { margin-left: 4px; }
.cx-group__head::after { content: ""; flex: none; width: 9px; height: 9px; margin-left: 2px; border-right: 2px solid var(--app-muted); border-bottom: 2px solid var(--app-muted); transform: rotate(45deg); transition: transform .15s; }
.cx-group[open] > .cx-group__head::after { transform: rotate(-135deg); }
.cx-group__head:focus-visible, .cx-conn__more > summary:focus-visible { outline: 2px solid var(--app-primary); outline-offset: -2px; }
.cx-logo { flex: none; width: 96px; height: 44px; box-sizing: border-box; padding: 6px 10px; border: 1px solid var(--app-line); border-radius: 10px; background: #ffffff; object-fit: contain; display: block; }
.cx-group__name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cx-group__name .strong { font-size: 17px; font-weight: 700; }
.cx-conns { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--app-line); }
.cx-conn { padding: 12px 16px 12px 126px; border-top: 1px solid var(--app-line); }
.cx-conn:first-child { border-top: 0; }
.cx-conn__main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.cx-conn__id { flex: 1 1 240px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; overflow-wrap: anywhere; }
.cx-conn__acts { flex: none; }
.cx-conn__more { margin-top: 6px; }
.cx-conn__more > summary { cursor: pointer; width: fit-content; font-size: 14px; color: var(--app-muted); list-style: none; padding: 2px 0; }
.cx-conn__more > summary::-webkit-details-marker { display: none; }
.cx-conn__more > summary::before { content: "▸ "; }
.cx-conn__more[open] > summary::before { content: "▾ "; }
.cx-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 8px 0 2px; font-size: 14px; }
.cx-dl dt { color: var(--app-muted); }
.cx-dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .cx-group__head { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto auto; grid-template-areas: "logo name sw chev" ". badge badge badge"; gap: 8px 10px; align-items: center; padding: 12px; }
  .cx-group__head > .switch { grid-area: sw; margin-left: 0; }
  .cx-logo { grid-area: logo; width: 72px; height: 36px; padding: 4px 6px; }
  .cx-group__name { grid-area: name; }
  .cx-group__name .sub { font-size: 13px; }
  .cx-group__head > .badge { grid-area: badge; justify-self: start; }
  .cx-group__head::after { grid-area: chev; }
  .cx-conn { padding: 12px; }
  .cx-dl { grid-template-columns: 1fr; gap: 0; }
  .cx-dl dd { margin-bottom: 8px; }
}

/* Connexions v2 : interrupteur (pause / reprise), instructions, restaurants détectés (demande d'Amine, 23/10). */
.switch { flex: none; position: relative; width: 46px; height: 26px; padding: 0; border: 0; border-radius: 999px; background: #b9c2bb; cursor: pointer; transition: background .15s; }
.switch[aria-checked="true"] { background: var(--app-primary); }
.switch:disabled { opacity: .45; cursor: default; }
.switch__knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgb(0 0 0 / .3); transition: transform .15s; }
.switch[aria-checked="true"] .switch__knob { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.cx-conn__main { gap: 10px 14px; }
.cx-conn--pause .cx-conn__id .strong { color: var(--app-muted); }
.cx-more-acct { padding: 8px 16px 8px 126px; list-style: none; border-top: 1px solid var(--app-line); }
.cx-how { border-top: 1px solid var(--app-line); padding: 10px 16px 12px 126px; }
.cx-how > summary { cursor: pointer; width: fit-content; font-size: 14px; font-weight: 600; color: var(--app-primary); list-style: none; }
.cx-how > summary::-webkit-details-marker { display: none; }
.cx-how > summary::before { content: "▸ "; }
.cx-how[open] > summary::before { content: "▾ "; }
.cx-how ol { margin: 8px 0 0; padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.cx-names { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cx-names li { padding: 2px 10px; border: 1px solid var(--app-line); border-radius: 999px; font-size: 13px; background: var(--app-bg); }
@media (max-width: 640px) { .cx-more-acct, .cx-how { padding-left: 12px; } }

/* Téléphone : « En savoir plus » (P&L) et « Voir les chiffres en tableau » (Analyses) à 44 px au doigt (fos-slow-9) ;
   après leurs règles de base, qu'elles remplacent. */
@media (max-width: 767px) {
  .res-more summary, .an-numbers > summary { min-height: 44px; }
}
/* Tablette (768 à 1 199 px, le doigt ; audit EC-13) : cibles de 40 px au moins, même dessin ; au-delà, la souris et
   les tailles du prototype. Un interrupteur garde son dessin de 46 × 26 : la zone touchée fait 52 × 44. */
@media (min-width: 768px) and (max-width: 1199px) {
  .res-more summary { min-height: 40px; }
  .switch::before { content: ""; position: absolute; inset: -9px -3px; }
}
