/* Back office Vigie : système visuel (jetons et composants), limité à body.bo.
   Chargé après app.css ; le site public et Mon espace ne sont pas concernés. */

body.bo {
  /* Fonds et surfaces */
  --bg:              #F6F7F9;   /* fond d'application */
  --surface:         #FFFFFF;   /* cartes, tableaux, barre du haut */
  --surface-subtle:  #F9FAFB;   /* en-têtes de tableau, pieds de carte */
  --surface-hover:   #F3F5F8;   /* survol de ligne, survol de bouton discret */
  --surface-sunken:  #F2F4F7;   /* code en ligne, champ désactivé */

  /* Bordures */
  --border:          #E3E7EE;   /* cartes, filets de tableau (décoratif) */
  --border-strong:   #CDD3DD;   /* séparateurs marqués, bouton secondaire */
  --border-input:    #8B94A6;   /* champs, cases : 3,05:1 sur blanc (RGAA 3.3) */

  /* Texte : 3 niveaux */
  --text-1:          #111B36;   /* marine Vigie : 15,9:1 sur --bg */
  --text-2:          #4A5470;   /* secondaire : 7,0:1 sur --bg */
  --text-3:          #626B80;   /* aides, métadonnées : 5,0:1 sur --bg */
  --text-disabled:   #9AA2B2;
  --text-on-accent:  #FFFFFF;

  /* Accent : bleu Vigie */
  --accent:          #3155F5;   /* 5,6:1 avec blanc */
  --accent-hover:    #2344D0;   /* liens : 7,5:1 */
  --accent-active:   #1C37AE;
  --accent-soft:     #EEF1FE;   /* sélection, onglet actif, info */
  --accent-border:   #C9D3FD;
  --focus-ring:      0 0 0 3px rgba(49, 85, 245, .28);

  /* États : texte / fond / bordure */
  --success:         #0B6B45;  --success-bg: #E9F6EF;  --success-border: #B5DEC8;  --success-dot: #12A16A;
  --warning:         #8A4B00;  --warning-bg: #FFF4DF;  --warning-border: #F3D29A;  --warning-dot: #E09B1C;
  --danger:          #B42318;  --danger-bg:  #FDEEEC;  --danger-border:  #F6C4BF;  --danger-dot:  #D92D20;
  --info:            #2344D0;  --info-bg:    #EEF1FE;  --info-border:    #C9D3FD;  --info-dot:    #3155F5;
  --neutral:         #4A5470;  --neutral-bg: #F2F4F7;  --neutral-border: #E3E7EE;  --neutral-dot: #9AA2B2;
  /* contrastes texte/fond : 5,9 · 6,2 · 5,8 · 6,6 · 6,8 */

  /* Menu latéral (marine) */
  --side-bg:         #111B36;
  --side-bg-hover:   rgba(255,255,255,.06);
  --side-bg-active:  rgba(255,255,255,.10);
  --side-text:       #C5CDE0;   /* 10,7:1 */
  --side-text-dim:   #8C97B3;   /* libellés de rubrique : 5,8:1 */
  --side-indicator:  #9DB0FF;   /* bleu Vigie éclairci pour fond marine : 8,2:1 (le #3155F5 n'y fait que 3,0:1) */
  --side-border:     rgba(255,255,255,.08);

  /* Typographie */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --fs-display: 24px;  --lh-display: 32px;   /* valeur d'une tuile de chiffres */
  --fs-h1:      20px;  --lh-h1:      28px;   /* 600, letter-spacing -0.01em */
  --fs-h2:      16px;  --lh-h2:      24px;   /* 600 */
  --fs-h3:      14px;  --lh-h3:      20px;   /* 600 */
  --fs-body:    14px;  --lh-body:    20px;   /* 400 */
  --fs-small:   13px;  --lh-small:   18px;   /* 400 : aides, métadonnées */
  --fs-label:   12px;  --lh-label:   16px;   /* 500 : en-têtes de tableau, libellés de rubrique, badges */
  --fs-code:    12.5px;
  --fw-regular: 400;  --fw-medium: 500;  --fw-semibold: 600;   /* jamais 700 ni 800 */

  /* Espacements : grille de 4 */
  --sp-0: 2px; --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* Rayons : 4 valeurs seulement */
  --r-xs: 4px;    /* badges, kbd, cases à cocher, code */
  --r-sm: 6px;    /* boutons, champs, éléments de menu */
  --r-md: 8px;    /* cartes, tableaux, panneaux, toasts */
  --r-lg: 12px;   /* dialogues, palette de recherche */
  /* 50 % : avatar et pastilles uniquement */

  /* Ombres : seulement pour ce qui flotte */
  --shadow-xs: 0 1px 2px rgba(17,27,54,.05);                                        /* bouton secondaire */
  --shadow-popover: 0 0 0 1px rgba(17,27,54,.06), 0 4px 12px rgba(17,27,54,.10);    /* menus, panneau du menu replié */
  --shadow-dialog:  0 0 0 1px rgba(17,27,54,.06), 0 16px 40px rgba(17,27,54,.18);   /* dialogues, toasts */

  /* Hauteurs */
  --h-sm: 28px;      /* boutons dans les tableaux et les barres d'outils */
  --h-md: 32px;      /* boutons et champs par défaut */
  --h-lg: 40px;      /* écran de connexion uniquement */
  --h-topbar: 56px;
  --h-row: 44px;     /* ligne de tableau (densité confortable) */
  --h-row-head: 36px;
  --side-w: 240px;  --side-w-collapsed: 56px;

  /* Mouvement */
  --ease: cubic-bezier(.2,0,0,1);  --dur: 120ms;
}

/* Inter est déjà déclarée l. 380-383 : réutiliser ces @font-face. */
body.bo {
  /* … jetons de la section 2 … */
  font: var(--fw-regular) var(--fs-body)/var(--lh-body) var(--font-sans);
  font-variant-numeric: normal;
  font-feature-settings: "cv11";
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.bo :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
body.bo a { color: var(--accent-hover); text-decoration: none }
body.bo :is(p, li, .hint) a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px }
body.bo a:hover { color: var(--accent-active); text-decoration: underline }

body.bo h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 600; letter-spacing: -.01em; margin: 0 }
body.bo h2, body.bo .section-title { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 600; margin: 32px 0 12px }
body.bo h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; margin: 0 0 8px }
body.bo .lead { font-size: var(--fs-body); color: var(--text-2); margin: 4px 0 0; max-width: 72ch }
body.bo .hint, body.bo small { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-3); font-weight: 400 }
body.bo :is(td.r, th.r, .num, .kpi-value, .big, time, .tnum) { font-variant-numeric: tabular-nums }

body.bo .shell { grid-template-columns: var(--side-w-collapsed) 1fr }
body.bo.side-open .shell { grid-template-columns: var(--side-w) 1fr }
body.bo .side { background: var(--side-bg); border-right: 1px solid var(--side-border); padding: 0 8px 8px; color: var(--side-text) }
body.bo .side-top { height: var(--h-topbar); padding: 0 4px; margin: 0 -8px 8px; padding-inline: 12px; border-bottom: 1px solid var(--side-border); justify-content: flex-start }
body.bo .brand { gap: 10px } body.bo .brand-logo { width: 28px; height: 28px; border-radius: 6px }
body.bo .brand b { font-size: 15px; font-weight: 600; letter-spacing: 0 }
body.bo .brand small { font-size: 12px; font-weight: 500; color: var(--side-text-dim) }

body.bo .nav-group { margin: 0 0 8px }
body.bo .nav-head { font-size: var(--fs-label); line-height: var(--lh-label); font-weight: 500; color: var(--side-text-dim); padding: 12px 10px 4px; margin: 0 }
body.bo .nav a { height: 32px; padding: 0 10px; gap: 10px; border-radius: var(--r-sm); font-size: 14px; color: var(--side-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
body.bo .nav a .ico { width: 16px; height: 16px; color: var(--side-text-dim) }
body.bo .nav a:hover { background: var(--side-bg-hover); color: #fff }
body.bo .nav a.active { background: var(--side-bg-active); color: #fff; font-weight: 500; box-shadow: none }
body.bo .nav a.active .ico { color: var(--side-indicator) }

@media (min-width: 921px) {
  body.bo:not(.side-open) .side { padding: 0 8px 8px }
  body.bo:not(.side-open) .side-top { justify-content: center; padding: 0 }
  body.bo:not(.side-open) .nav { gap: 4px; align-items: center }
  body.bo:not(.side-open) .nav-head { width: 40px; height: 40px; border-radius: var(--r-sm); color: var(--side-text); padding: 0 }
  body.bo:not(.side-open) .nav-head .ico { width: 20px; height: 20px }
  body.bo:not(.side-open) :is(.nav-group:hover, .nav-group.open) .nav-head { background: var(--side-bg-hover); color: #fff }
  body.bo:not(.side-open) .nav-group.current .nav-head { background: var(--side-bg-active); color: #fff; box-shadow: none; position: relative }
  body.bo:not(.side-open) .nav-group.current .nav-head::before { content: ""; position: absolute; left: -8px; top: 10px; width: 2px; height: 20px; border-radius: 0 2px 2px 0; background: var(--side-indicator) }
  body.bo:not(.side-open) .nav-items { left: 44px; top: -6px; padding: 6px 6px 6px 14px; min-width: 240px }
  body.bo:not(.side-open) .nav-items::before { inset: 0 0 0 8px; background: #18234A; border: 1px solid var(--side-border); border-radius: var(--r-md); box-shadow: var(--shadow-popover) }
  body.bo:not(.side-open) .nav-fly-title { font-size: var(--fs-label); font-weight: 500; color: var(--side-text-dim); margin: 4px 10px }
  body.bo:not(.side-open) .nav-items a { padding: 0 10px }
}
body.bo .side-toggle { border: 0; background: none; height: 32px; min-height: 0; padding: 0 10px; color: var(--side-text-dim); font-weight: 500; font-size: 13px; border-radius: var(--r-sm) }
body.bo .side-toggle:hover { background: var(--side-bg-hover); color: #fff }

body.bo .topbar { height: var(--h-topbar); padding: 0 32px; gap: 12px; background: var(--surface); backdrop-filter: none; border-bottom: 1px solid var(--border); justify-content: flex-start }
body.bo .topbar .crumb { flex: 1; min-width: 0; font-size: 14px; color: var(--text-3); gap: 6px }
body.bo .topbar .crumb a { color: var(--text-3) } body.bo .topbar .crumb a:hover { color: var(--text-1) }
body.bo .topbar .crumb b { color: var(--text-1); font-weight: 500 }
body.bo .topbar .crumb > span[aria-hidden] { color: var(--text-disabled) }
body.bo .topbar .back { display: none }
body.bo .bo-search { width: 240px; height: 32px; padding: 0 8px 0 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-subtle); color: var(--text-3); font-weight: 400; font-size: 14px; justify-content: flex-start }
body.bo .bo-search:hover { border-color: var(--border-strong); background: var(--surface) }
body.bo .bo-search kbd { margin-left: auto; height: 20px; padding: 0 5px; font: 500 11px/18px var(--font-sans); color: var(--text-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xs) }
body.bo .me { gap: 8px; padding-left: 12px; border-left: 1px solid var(--border) }
body.bo .avatar { width: 28px; height: 28px; background: var(--accent-soft); color: var(--accent-hover); font-size: 12px; font-weight: 600 }
body.bo .me-text b { font-size: 13px; font-weight: 500 } body.bo .me-text small { font-size: 12px; color: var(--text-3) }
body.bo .me button { height: var(--h-sm); min-height: 0; padding: 0 8px; border: 0; background: none; box-shadow: none; color: var(--text-2); font-size: 13px; font-weight: 500 }
body.bo .me button:hover { background: var(--surface-hover); color: var(--text-1) }

body.bo .content { padding: 24px 32px 64px; max-width: none }
body.bo .page-head { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: center; margin: 0 0 20px; padding: 0; border: 0 }
body.bo .page-head .head-actions { gap: 8px }

body.bo .bo-loading { height: 2px; background: var(--accent) }
body.bo.is-loading .content { opacity: .6 }

body.bo button, body.bo .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h-md); min-height: 0; padding: 0 12px; border-radius: var(--r-sm);
  font: 500 14px/1 var(--font-sans); white-space: nowrap; cursor: pointer;
  background: var(--surface); color: var(--text-1); border: 1px solid var(--border-strong); box-shadow: var(--shadow-xs);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
body.bo button:hover { background: var(--surface-hover) }
body.bo button:disabled { background: var(--surface-sunken); color: var(--text-disabled); border-color: var(--border); box-shadow: none; cursor: not-allowed }
body.bo button.primary, body.bo .head-actions button { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); box-shadow: none }
body.bo button.primary:hover, body.bo .head-actions button:hover { background: var(--accent-hover); border-color: var(--accent-hover) }
body.bo button.primary:active { background: var(--accent-active) }
body.bo button.ghost, body.bo button.link, body.bo .add-head .x { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); padding: 0 8px }
body.bo button.ghost:hover, body.bo .add-head .x:hover { background: var(--surface-hover); color: var(--text-1) }
body.bo button.link { color: var(--accent-hover); padding: 0; height: auto } body.bo button.link:hover { background: none; text-decoration: underline }
body.bo button.danger { background: #D92D20; border-color: #D92D20; color: #fff; box-shadow: none }
body.bo button.danger:hover { background: var(--danger); border-color: var(--danger) }
body.bo button.danger-quiet { color: var(--danger) } body.bo button.danger-quiet:hover { background: var(--danger-bg); border-color: var(--danger-border) }
body.bo button.sm, body.bo table td button, body.bo table td .btn { height: var(--h-sm); padding: 0 10px; font-size: 13px; border-radius: var(--r-sm) }
body.bo button.icon { width: var(--h-md); padding: 0 } body.bo button.icon.sm { width: var(--h-sm) }
body.bo .head-actions button::before { content: "+"; font-size: 16px; font-weight: 400; margin-right: 2px }
body.bo .head-actions button.on { background: var(--surface); color: var(--text-1); border-color: var(--border-strong) }

body.bo label { gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-1) }
body.bo :is(input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea) {
  height: var(--h-md); min-height: 0; padding: 0 10px; font: 400 14px/20px var(--font-sans); color: var(--text-1);
  background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--r-sm); width: 100%;
}
body.bo textarea { height: auto; min-height: 80px; padding: 6px 10px; resize: vertical }
body.bo textarea.mono, body.bo .numbers textarea { font-family: var(--font-mono); font-size: 13px }
body.bo :is(input, select, textarea):hover { border-color: var(--text-3) }
body.bo :is(input, select, textarea):focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring) }
body.bo :is(input, select, textarea)[aria-invalid=true] { border-color: #D92D20 }
body.bo :is(input, select, textarea):is(:disabled, [readonly]) { background: var(--surface-sunken); border-color: var(--border) }
body.bo ::placeholder { color: var(--text-3) }
body.bo select { appearance: none; padding-right: 32px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23626B80' stroke-width='1.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center }
body.bo td form select { width: auto; min-width: 0; height: var(--h-sm); font-size: 13px }
body.bo input[type=file] { height: auto; padding: 0; border: 0; font-size: 13px; color: var(--text-3) }
body.bo input[type=file]::file-selector-button { height: var(--h-sm); margin-right: 10px; padding: 0 10px; font: 500 13px var(--font-sans); color: var(--text-1); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); cursor: pointer }
/* Le texte « No file chosen » vient du navigateur : il faut la page en lang="fr", ou bien un libellé personnalisé et un input masqué. */

body.bo :is(input[type=checkbox], input[type=radio]) { appearance: none; width: 16px; height: 16px; min-height: 0; margin: 0; flex: none; border: 1px solid var(--border-input); background: var(--surface); display: inline-grid; place-content: center; cursor: pointer }
body.bo input[type=checkbox] { border-radius: var(--r-xs) }
body.bo input[type=radio] { border-radius: 50% }
body.bo :is(input[type=checkbox], input[type=radio]):checked { background-color: var(--accent); border-color: var(--accent) }
body.bo input[type=checkbox]:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='m4 8 3 3 5-6'/%3E%3C/svg%3E") }
body.bo input[type=radio]:checked { box-shadow: inset 0 0 0 4px var(--accent); background: #fff }
body.bo label.check { gap: 8px; font-size: 14px; font-weight: 400; min-height: 24px }

body.bo .switch { display: flex; flex-direction: row; align-items: center; gap: 10px; cursor: pointer; text-align: left }
body.bo .switch input { appearance: none; width: 32px; height: 18px; border-radius: 999px; border: 0; background: var(--border-strong); position: relative; flex: none; transition: background var(--dur) }
body.bo .switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform var(--dur) var(--ease) }
body.bo .switch input:checked { background: var(--accent) } body.bo .switch input:checked::after { transform: translateX(14px) }
body.bo .switch span { font-weight: 500 }
/* Supprimer les règles l. 730-733 et 742-743 (les quatre !important). */

body.bo .row-form, body.bo .grid-form { gap: 20px 16px }
body.bo .grid-form { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) }
body.bo .grid-form label { font-size: 13px; font-weight: 500 }
body.bo .grid-form label small { font-size: 12.5px; font-weight: 400; color: var(--text-3) }
body.bo .grid-form .form-foot, body.bo .card-foot { display: flex; justify-content: flex-end; gap: 8px; margin: 20px -20px -20px; padding: 12px 20px; background: var(--surface-subtle); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-md) var(--r-md) }
body.bo .card-foot .danger-quiet { margin-right: auto }
body.bo .stacked { gap: 16px } body.bo .stacked > button { align-self: flex-start }
/* Banques partenaires : regrouper « Enregistrer » et « Générer une nouvelle clé » dans un .card-foot (modification du gabarit admin.php). */

body.bo .card, body.bo .add-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px; margin: 0 0 16px; box-shadow: none }
body.bo .add-panel { border-left-width: 1px }
body.bo .card > h2:first-child, body.bo .add-head h2 { font-size: var(--fs-h2); margin: 0 0 16px }
body.bo .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -20px -20px 20px; padding: 14px 20px; border-bottom: 1px solid var(--border) }
body.bo .card-head h2 { margin: 0; font-size: var(--fs-h3) }

/* Composant unique de chiffres : .kpi-row > .kpi (anciens .grid/.stat, .kpis/.kpi, .stats/.stat, .todo-card) */
body.bo :is(.kpi-row, .content > .grid, .kpis, .content .stats) {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin: 0 0 24px;
}
body.bo :is(.kpi, .stat) {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border: 0; border-radius: 0; background: none;
  box-shadow: inset -1px 0 0 var(--border), inset 0 -1px 0 var(--border); color: var(--text-1); text-decoration: none;
}
body.bo .kpi-label, body.bo :is(.kpi, .stat) > span:last-child { order: -1; font-size: 13px; line-height: 18px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
body.bo :is(.kpi-value, .kpi .big, .stat .big, .stats .stat b) { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums }
body.bo a:is(.kpi, .stat):hover { background: var(--surface-hover); text-decoration: none }
body.bo a:is(.kpi, .stat):hover span:last-child { color: var(--text-2); text-decoration: none }
body.bo .stat.alert { box-shadow: inset -1px 0 0 var(--border), inset 0 -1px 0 var(--border) }
body.bo .stat.alert .big { color: var(--text-1) }   /* l'alerte passe par un badge « À traiter » dans le libellé */
body.bo .content .stats .stat { flex-direction: column }   /* annule le column-reverse de la l. 836 */

/* Tableau de bord : « À faire » devient une liste dans une carte, plus des cartes orange */
body.bo .todo-strip { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin: 0 0 24px }
body.bo .todo-card { grid-template-columns: 20px 1fr auto; padding: 12px 16px; border: 0; border-radius: 0; background: none; border-bottom: 1px solid var(--border); color: var(--text-1) }
body.bo .todo-card:last-child { border-bottom: 0 }
body.bo .todo-card .ico { color: var(--warning-dot) } body.bo .todo-card.done .ico { color: var(--success-dot) }
body.bo .todo-card .big { font-size: 14px; font-weight: 600; line-height: 20px }
body.bo .todo-card .go { font-size: 13px; font-weight: 500; color: var(--accent-hover) }
body.bo a.todo-card:hover { background: var(--surface-hover) }
body.bo .todo-card.done { background: none }
body.bo .setup-row { padding: 12px 16px; border-radius: 0; border-bottom: 1px solid var(--border) } body.bo .setup-row .go { color: var(--accent-hover); font-weight: 500 }

/* Alertes (callout) : une seule par page */
body.bo :is(.warn-card, .callout, .error, .flash) { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); font-size: 14px; font-weight: 400; color: var(--text-1); margin: 0 0 16px }
body.bo .warn-card { background: var(--warning-bg); border: 1px solid var(--warning-border) }
body.bo .warn-card b, body.bo .warn-card strong { color: var(--warning); font-weight: 600 }
body.bo .error { background: var(--danger-bg); border: 1px solid var(--danger-border) } body.bo .error b { color: var(--danger) }
body.bo .flash { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success) }
body.bo .state { font-size: 13px; font-weight: 500 }
body.bo .state.ok { color: var(--success) } body.bo .state.todo { color: var(--warning) }

body.bo table { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); font-size: 14px; border-collapse: separate; border-spacing: 0; overflow: hidden }
body.bo th { height: var(--h-row-head); padding: 0 12px; background: var(--surface-subtle); color: var(--text-2); font-size: var(--fs-label); line-height: var(--lh-label); font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap }
body.bo td { height: var(--h-row); padding: 6px 12px; border-bottom: 1px solid var(--border); color: var(--text-1); vertical-align: middle; line-height: 20px }
body.bo tbody tr:last-child td { border-bottom: 0 }
body.bo tbody tr:hover td, body.bo tr.row-link:hover td { background: var(--surface-hover) }
body.bo td a { color: var(--text-1); font-weight: 500; text-decoration: none }
body.bo tr:hover td a, body.bo td a:hover { text-decoration: underline; text-decoration-color: var(--border-strong) }
body.bo :is(td, th).r { text-align: right; font-variant-numeric: tabular-nums }
body.bo td.mono, body.bo td .mono { font: 13px/20px var(--font-mono); color: var(--text-2) }
body.bo tr.off td { color: var(--text-3) }
body.bo td:empty::after { content: "—"; color: var(--text-disabled) }
body.bo td.actions, body.bo td:last-child:has(form, button) { width: 1%; text-align: right; white-space: nowrap }
body.bo table td form { display: inline-flex; gap: 6px; margin: 0 0 0 6px }
body.bo tr[aria-selected=true] td, body.bo tr.is-selected td { background: var(--accent-soft) }
body.bo tr[aria-selected=true] td:first-child, body.bo tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--accent) }
body.bo td.select, body.bo th.select { width: 40px; padding-right: 0 }

/* Barre d'outils du tableau (bo.js crée .table-filter juste avant la table) */
body.bo .table-filter { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--r-md) var(--r-md) 0 0 }
body.bo .table-filter + table { border-top-left-radius: 0; border-top-right-radius: 0 }
body.bo .table-filter input { max-width: 240px; height: var(--h-sm); font-size: 13px }
/* Supprimer les deux définitions l. 739-740 et 779-780. */
body.bo .table-more { height: var(--h-sm); margin: 8px auto 0; font-size: 13px; border: 0; background: none; box-shadow: none; color: var(--accent-hover) }

/* Code */
body.bo code { font: 12.5px/18px var(--font-mono); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 0 5px; color: var(--text-1) }
body.bo code:empty { display: none }
body.bo pre { background: var(--surface-subtle); color: var(--text-1); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 16px; font: 12.5px/1.6 var(--font-mono) }
body.bo pre code { background: none; border: 0; padding: 0; color: inherit; font: inherit }
body.bo table td code { max-width: 360px }

/* Badges : remplace .pill (garder .pill comme alias pour ne pas toucher au PHP tout de suite) */
body.bo :is(.badge, .pill) { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 6px; border-radius: var(--r-xs); font-size: 12px; line-height: 1; font-weight: 500; white-space: nowrap;
  color: var(--neutral); background: var(--neutral-bg); border: 1px solid var(--neutral-border) }
body.bo :is(.badge, .pill)::before { width: 6px; height: 6px; background: var(--neutral-dot) }
body.bo :is(.badge, .pill).ok      { color: var(--success); background: var(--success-bg); border-color: var(--success-border) }
body.bo :is(.badge, .pill).ok::before { background: var(--success-dot) }
body.bo :is(.badge, .pill).warn    { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border) }
body.bo :is(.badge, .pill).warn::before { background: var(--warning-dot) }
body.bo :is(.badge, .pill):is(.mid, .danger) { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border) }
body.bo :is(.badge, .pill):is(.mid, .danger)::before { background: var(--danger-dot) }
body.bo :is(.badge, .pill).info    { color: var(--info); background: var(--info-bg); border-color: var(--info-border) }
body.bo :is(.badge, .pill).info::before { background: var(--info-dot) }
body.bo .badge.plain::before { display: none }

body.bo .tabs-bar { top: var(--h-topbar); gap: 20px; padding: 0; margin: 0 0 20px; background: var(--bg); border-bottom: 1px solid var(--border) }
body.bo .tabs-bar a { height: 40px; display: inline-flex; align-items: center; padding: 0 2px; border: 0; border-radius: 0; background: none; color: var(--text-2); font-size: 14px; font-weight: 500 }
body.bo .tabs-bar a:hover { color: var(--text-1); border: 0 }
body.bo .tabs-bar a[aria-current], body.bo .tabs-bar a.active { color: var(--text-1); box-shadow: inset 0 -2px 0 var(--accent) }
body.bo .content section[id] { scroll-margin-top: calc(var(--h-topbar) + 56px) }

body.bo .toasts { right: 16px; bottom: 16px; gap: 8px; width: min(360px, calc(100vw - 32px)) }
body.bo .toast { padding: 10px 12px; gap: 10px; border-radius: var(--r-md); background: var(--text-1); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-dialog); transform: none; transition: opacity var(--dur) var(--ease) }
body.bo .toast-dot { width: 8px; height: 8px; background: #4ADE80 } body.bo .toast.error .toast-dot { background: #FCA5A5 }
body.bo .toast-x { width: 24px; height: 24px; padding: 0; border: 0; background: none; box-shadow: none; color: #C5CDE0; font-size: 16px }

body.bo :is(.bo-dialog, .bo-palette) { border-radius: var(--r-lg); box-shadow: var(--shadow-dialog) }
body.bo :is(.bo-dialog, .bo-palette)::backdrop { background: rgba(17,27,54,.40) }
body.bo .bo-dialog { max-width: min(440px, calc(100vw - 32px)) }
body.bo .bo-dialog form { padding: 20px }
body.bo .bo-dialog h2 { font-size: var(--fs-h2); margin: 0 0 8px }
body.bo .bo-dialog p { font-size: 14px; color: var(--text-2); margin: 0 0 20px }
body.bo .bo-dialog-acts { gap: 8px }
body.bo .bo-palette { max-width: min(560px, calc(100vw - 32px)); margin-top: 14vh }
body.bo .bo-palette input { height: 48px; border: 0; border-bottom: 1px solid var(--border); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 0 16px; font-size: 15px; box-shadow: none }
body.bo .bo-palette li { height: 36px; padding: 0 12px; align-items: center; border-radius: var(--r-sm); font-size: 14px }
body.bo .bo-palette li[aria-selected="true"], body.bo .bo-palette li:hover { background: var(--accent-soft) }
body.bo .bo-palette li small { font-size: 12px; color: var(--text-3) }

body.bo .empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 40px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md) }
body.bo .empty .ico { width: 40px; height: 40px; padding: 10px; margin-bottom: 8px; border-radius: var(--r-md); background: var(--surface-sunken); color: var(--text-3) }
body.bo .empty b { font-size: 14px; font-weight: 600 } body.bo .empty p { margin: 0; font-size: 13px; color: var(--text-2) }
body.bo .empty button { margin-top: 12px }
/* « Aucun incident en cours. », les tableaux sans ligne et les filtres sans résultat passent par .empty (PHP pour les deux premiers, bo.js pour le dernier). */

/* ---------- Ajustements après première intégration ---------- */
body.bo .menu-toggle { display: none }
body.bo .side-top { display: flex; align-items: center }
body.bo .nav-head, body.bo .nav-head:hover { background: none; border: 0; box-shadow: none; height: auto; min-height: 0; justify-content: flex-start; text-align: left; width: 100%; font: 500 12px/16px var(--font-sans); color: var(--side-text-dim); padding: 12px 10px 4px; cursor: default }
@media (min-width: 921px) {
  body.bo:not(.side-open) .nav-head, body.bo:not(.side-open) .nav-head:hover { justify-content: center; width: 40px; height: 40px; padding: 0; margin: 0 auto; cursor: pointer; color: var(--side-text) }
}
body.bo .side-toggle { box-shadow: none; justify-content: flex-start; width: 100% }
/* Filtres de page : champs à largeur raisonnable, sur une ligne */
body.bo .content > form.row-form:not(.card), body.bo .content > form[method=get] { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 16px }
body.bo .content > form[method=get] label { flex: 0 1 260px }
body.bo .content > form[method=get] select, body.bo .content > form[method=get] input { max-width: 320px }
body.bo td form select { min-width: 150px; padding-right: 28px }
body.bo .card select, body.bo .card input:not([type=checkbox]):not([type=radio]) { max-width: 100% }
.js body.bo .js-hide { display: none }
body.bo .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
body.bo .file-pick { display: flex; align-items: center; gap: 10px }
body.bo .file-pick .file-name { font-size: 13px; color: var(--text-3) }
body.bo .audit-details { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-2) }
body.bo input.menu-toggle { display: none }
body.bo label input[type=checkbox], body.bo td input[type=checkbox], body.bo input[type=checkbox] { width: 16px; height: 16px; min-width: 16px; padding: 0 }
body.bo input[type=checkbox]:checked { background-repeat: no-repeat; background-position: center; background-size: 12px 12px }
body.bo input[type=checkbox]:checked { background-image: none }
body.bo input[type=checkbox]:checked::after { content: ""; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); margin-top: -2px }

/* Consommation de l'API : jauge du forfait */
body.bo progress.usage-bar{display:block;width:100%;height:10px;border:0;border-radius:6px;background:#E8ECF7;overflow:hidden;margin:4px 0 8px;appearance:none;-webkit-appearance:none}
body.bo progress.usage-bar::-webkit-progress-bar{background:#E8ECF7;border-radius:6px}
body.bo progress.usage-bar::-webkit-progress-value{background:#3155F5;border-radius:6px}
body.bo progress.usage-bar::-moz-progress-bar{background:#3155F5;border-radius:6px}
body.bo progress.usage-bar.high::-webkit-progress-value{background:#C27803}
body.bo progress.usage-bar.high::-moz-progress-bar{background:#C27803}
body.bo progress.usage-bar.full::-webkit-progress-value{background:#C2362B}
body.bo progress.usage-bar.full::-moz-progress-bar{background:#C2362B}

/* Fiche d'une organisation : en-tête, onglets, sections de formulaire */
body.bo .entity-head { display: flex; align-items: center; gap: 12px; margin: -8px 0 16px }
body.bo .entity-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); flex: none }
body.bo .entity-meta p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2) }
body.bo .entity-meta p.hint { font-size: 13px; margin-top: 2px }
body.bo .tabs-bar .count { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--surface-sunken); color: var(--text-3); font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums }
body.bo .tabs-bar a[aria-current] .count { background: var(--accent-soft); color: var(--accent) }
body.bo .tabs-bar { overflow-x: auto; scrollbar-width: none }
body.bo .tabs-bar a { white-space: nowrap; flex: none }
body.bo a.strong { font-weight: 600; color: var(--text-1) }
body.bo .kpi-value small { font-size: 14px; font-weight: 500; color: var(--text-3) }
body.bo .form-section { margin-bottom: 16px }
body.bo .form-section-head { margin-bottom: 16px }
body.bo .form-section-head h2 { margin: 0 0 2px; font-size: 16px }
body.bo .form-section-head .hint { margin: 0 }
body.bo .form-section > .grid-form + .grid-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border) }
body.bo .form-section > table, body.bo .form-section > .empty { margin: 0 }
body.bo .form-section .card-foot { justify-content: flex-start; align-items: center }
body.bo .weights { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) }
body.bo .sticky-foot { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%) }
body.bo .state { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 16px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--neutral-bg); color: var(--text-2); font-size: 13px }
body.bo .state.ok { background: var(--success-bg); color: var(--text-1) }
body.bo .state .ico, body.bo .state svg { flex: none; margin-top: 1px }
body.bo .input-affix { display: flex; align-items: stretch; border: 1px solid var(--border-input); border-radius: var(--r-sm); background: var(--surface); overflow: hidden }
body.bo .input-affix:focus-within { box-shadow: var(--focus-ring); border-color: var(--accent) }
body.bo .input-affix > span { display: flex; align-items: center; padding: 0 10px; background: var(--surface-subtle); color: var(--text-3); font-size: 13px; white-space: nowrap }
body.bo .input-affix input { flex: 1; min-width: 120px; border: 0 !important; border-radius: 0; box-shadow: none !important }
body.bo .todo-list { list-style: none; margin: 0 0 24px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface) }
body.bo .todo-list li + li { border-top: 1px solid var(--border) }
body.bo .todo-list a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 12px 40px; color: var(--text-1); position: relative }
body.bo .todo-list a::before { content: ""; position: absolute; left: 16px; top: 15px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--warning-dot) }
body.bo .todo-list a:hover { background: var(--surface-hover); text-decoration: none }
body.bo .todo-list .hint { font-size: 13px }
@media (max-width: 720px) {
  body.bo .input-affix { flex-wrap: wrap } body.bo .input-affix > span:last-child { width: 100%; padding: 4px 10px }
}

/* Téléphone et petite tablette : menu en haut, replié derrière le bouton ; contenu sur toute la largeur */
@media (max-width: 920px) {
  body.bo .shell, body.bo.side-open .shell { display: block }
  body.bo .side { position: sticky; top: 0; z-index: 20; height: auto; padding: 0 12px; border-right: 0; border-bottom: 1px solid var(--side-border) }
  body.bo .side-top, body.bo:not(.side-open) .side-top { height: 56px; margin: 0; padding: 0; border: 0; justify-content: space-between }
  body.bo .brand span, body.bo:not(.side-open) .brand span { display: flex; flex-direction: column; line-height: 1.2 }
  body.bo .menu-btn { display: inline-flex }
  body.bo .nav, body.bo:not(.side-open) .nav { display: none; flex-direction: column; align-items: stretch; gap: 2px; padding: 4px 0 12px; max-height: calc(100vh - 56px); overflow-y: auto }
  body.bo .menu-toggle:checked + .nav { display: flex }
  body.bo .nav-group .nav-head, body.bo:not(.side-open) .nav-head { width: auto; height: auto; justify-content: flex-start; margin: 8px 0 2px; padding: 0 8px; background: none !important; color: var(--side-text-dim); pointer-events: none }
  body.bo .nav-head .ico { display: none }
  body.bo .nav-head span, body.bo:not(.side-open) .nav-head span { display: inline }
  body.bo .nav-items, body.bo:not(.side-open) .nav-items { position: static; display: flex; flex-direction: column; min-width: 0; padding: 0; opacity: 1; visibility: visible; transform: none }
  body.bo .nav-items::before, body.bo .nav-fly-title { display: none }
  body.bo .nav-items a span, body.bo:not(.side-open) .nav-items a span { display: inline }
  body.bo .side-toggle { display: none }
  body.bo .topbar { position: static; padding: 0 16px; gap: 8px }
  body.bo .crumb > :not(.back):not(b), body.bo .crumb > span { display: none }
  body.bo .bo-search span, body.bo .bo-search kbd, body.bo .me-text, body.bo .avatar { display: none }
  body.bo .content { padding: 20px 16px 64px }
  body.bo .page-head { flex-wrap: wrap; gap: 12px }
  body.bo .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  body.bo .grid-form { grid-template-columns: 1fr }
  body.bo .entity-meta p { font-size: 13px }
  body.bo table { display: block; overflow-x: auto; white-space: nowrap }
  body.bo .demo-bar { font-size: 12px; padding: 6px 12px }
}
body.bo .weights label { display: flex; flex-direction: column; justify-content: space-between }
body.bo :is(table, .empty) + .form-section { margin-top: 24px }
