/* GPlus Control Plane — styles de la console.
   Valeurs reprises de la maquette Figma (design/tokens.json) : couleurs Light/Dark,
   typographie Atkinson Hyperlegible, espacements, rayons, composants CP/*. */

@font-face { font-family: "Atkinson Hyperlegible Next"; font-weight: 400; font-display: swap; src: url("../polices/atkinson-next-400.e8da57bc0c3d.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-weight: 500; font-display: swap; src: url("../polices/atkinson-next-500.042e3fd7cb27.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-weight: 600; font-display: swap; src: url("../polices/atkinson-next-600.9204a77cef78.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-weight: 700; font-display: swap; src: url("../polices/atkinson-next-700.617b4197a93a.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-weight: 500; font-display: swap; src: url("../polices/atkinson-mono-500.5c3c3f3ccea5.woff2") format("woff2"); }

:root {
  --bg-app: #F5F7FA;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F9FAFC;
  --bg-overlay: #0D263B80;
  --border-default: #E1E6EC;
  --border-strong: #B8C2CE;
  --text-primary: #0D263B;
  --text-secondary: #566779;
  --text-on-accent: #FFFFFF;
  --accent-default: #C8441A;
  --accent-hover: #B53D10;
  --accent-weak: #FFEEE6;
  --accent-text: #B53D10;
  --success-bg: #E7FCEF;  --success-fg: #08603E;
  --warning-bg: #FFF2E4;  --warning-fg: #AA5A07;
  --danger-bg: #FFEFEB;   --danger-fg: #891E18;  --danger-on: #FFFFFF;
  --degraded-bg: #F4F3FF; --degraded-fg: #4E32A5;
  --info-bg: #E5F9FF;     --info-fg: #0175A9;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-12: 48px;
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-full: 9999px;
  --elevation-pop: 0 16px 40px -8px #1D2B3333, 0 2px 4px 0 #1D2B331A;

  --font: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-app: #0B1B2B; --bg-surface: #12263A; --bg-surface-2: #183049; --bg-overlay: #00000099;
    --border-default: #22405C; --border-strong: #335473;
    --text-primary: #EAF0F6; --text-secondary: #9DB0C3; --text-on-accent: #0B1B2B;
    --accent-default: #FF7A45; --accent-hover: #FF9A70; --accent-weak: #3A2418; --accent-text: #FF9A70;
    --success-bg: #1F3D2A; --success-fg: #36F08E;
    --warning-bg: #413414; --warning-fg: #DCAF3D;
    --danger-bg: #4C2A2C; --danger-fg: #D4878B; --danger-on: #0B1B2B;
    --degraded-bg: #37304D; --degraded-fg: #A68DEE;
    --info-bg: #0D3D42; --info-fg: #7BDCE9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg-app: #0B1B2B; --bg-surface: #12263A; --bg-surface-2: #183049; --bg-overlay: #00000099;
  --border-default: #22405C; --border-strong: #335473;
  --text-primary: #EAF0F6; --text-secondary: #9DB0C3; --text-on-accent: #0B1B2B;
  --accent-default: #FF7A45; --accent-hover: #FF9A70; --accent-weak: #3A2418; --accent-text: #FF9A70;
  --success-bg: #1F3D2A; --success-fg: #36F08E;
  --warning-bg: #413414; --warning-fg: #DCAF3D;
  --danger-bg: #4C2A2C; --danger-fg: #D4878B; --danger-on: #0B1B2B;
  --degraded-bg: #37304D; --degraded-fg: #A68DEE;
  --info-bg: #0D3D42; --info-fg: #7BDCE9;
  color-scheme: dark;
}

/* --- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg-app); color: var(--text-primary);
  font: 400 14px/21px var(--font);
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-default); outline-offset: 2px; }
.ico { width: 20px; height: 20px; flex: none; display: block; }
.ico-16 { width: 16px; height: 16px; }
.ico-12 { width: 12px; height: 12px; }
.mono { font: 500 13px/20px var(--font-mono); color: var(--text-secondary); }
.secondaire { color: var(--text-secondary); }
.petit { font-size: 12px; line-height: 17px; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.t-display { font-weight: 700; font-size: 32px; line-height: 38px; letter-spacing: -0.3px; }
.t-h1 { font-weight: 700; font-size: 26px; line-height: 32px; letter-spacing: -0.3px; }
.t-h2 { font-weight: 600; font-size: 19px; line-height: 26px; letter-spacing: -0.1px; }
.t-h3 { font-weight: 600; font-size: 16px; line-height: 22px; }
.t-libelle { font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: 0.1px; color: var(--text-secondary); }

/* --- Gabarit : CP/Sidebar + CP/Topbar -------------------------------------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 20px 16px;
  background: var(--bg-surface); border-right: 1px solid var(--border-default);
}
.sidebar__logo {
  display: flex; align-items: center; gap: 12px; padding: 4px 0 20px 8px;
  border-bottom: 1px solid var(--border-default); color: inherit;
}
.sidebar__logo:hover { text-decoration: none; }
.sidebar__logo img { width: 48px; height: 48px; border-radius: 9px; }
.sidebar__nom { font-weight: 700; font-size: 22px; line-height: 26px; letter-spacing: -0.1px; }
.sidebar__sous-nom { font-size: 12px; line-height: 17px; color: var(--text-secondary); }
.sidebar__section { padding: 14px 0 6px 12px; }
.sidebar__espace { flex: 1 0 12px; }

.nav-item {
  display: flex; align-items: center; gap: 12px; height: 36px; padding: 8px 12px;
  border-radius: var(--radius-md); color: var(--text-primary); font-weight: 500;
}
.nav-item .ico { color: var(--text-secondary); }
.nav-item span:not(.compteur) { flex: 1; min-width: 0; }
.nav-item:hover { background: var(--bg-surface-2); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--accent-weak); color: var(--accent-text); }
.nav-item[aria-current="page"] .ico { color: var(--accent-text); }
.compteur {
  padding: 1px 7px; border-radius: var(--radius-full); background: var(--danger-bg);
  color: var(--danger-fg); font-weight: 500; font-size: 12px; line-height: 17px;
}
.nav-item[aria-current="page"] .compteur { background: var(--bg-surface); }

.sidebar__utilisateur { position: relative; border-top: 1px solid var(--border-default); }
.sidebar__utilisateur summary {
  display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer; list-style: none;
}
.sidebar__utilisateur summary::-webkit-details-marker { display: none; }
.sidebar__utilisateur summary > div { flex: 1; min-width: 0; }
.sidebar__utilisateur summary .ico { color: var(--text-secondary); }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: var(--radius-full); background: var(--accent-weak);
  color: var(--accent-text); font-weight: 500; font-size: 12px; line-height: 17px;
}
.menu {
  position: absolute; bottom: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  padding: 6px; background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--elevation-pop);
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0;
  background: none; border-radius: var(--radius-md); color: var(--text-primary); cursor: pointer; text-align: left;
}
.menu button:hover, .menu a:hover { background: var(--bg-surface-2); text-decoration: none; }

.principal { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 28px; background: var(--bg-surface); border-bottom: 1px solid var(--border-default);
}
.recherche {
  display: flex; align-items: center; gap: 10px; width: 420px; max-width: 100%; height: 38px;
  padding: 8px 8px 8px 12px; background: var(--bg-surface-2);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
}
.recherche .ico { color: var(--text-secondary); }
.recherche input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 0; }
.recherche input::placeholder { color: var(--text-secondary); }
.recherche:focus-within { border-color: var(--accent-default); }
kbd {
  padding: 2px 6px; border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-secondary); font: 500 12px/17px var(--font);
}
.topbar__espace { flex: 1; }
.pastille-env {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-full);
  background: var(--success-bg); color: var(--success-fg); font-weight: 500; font-size: 12px; line-height: 17px;
}
/* Libellé de synchronisation cliquable : met la page à jour (actualisation.js) ; l'icône tourne pendant la collecte. */
.synchro-form { display: contents; }
.synchro {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: var(--radius-full);
  background: none; font: inherit; font-size: 12px; line-height: 17px; color: var(--text-secondary);
  text-decoration: none; cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.synchro:hover, .synchro:focus-visible { background: var(--success-bg); color: var(--success-fg); }
.synchro__ico { width: 14px; height: 14px; color: var(--success-fg); transition: transform 0.3s; }
.synchro:hover .synchro__ico { transform: rotate(90deg); }
.synchro--en-cours { pointer-events: none; }
.synchro--en-cours .synchro__ico { animation: synchro-tourne 0.8s linear infinite; }
@keyframes synchro-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .synchro--en-cours .synchro__ico { animation: none; } }
/* Actualisation en arrière-plan en échec (actualisation.js) : le motif est dans l'infobulle du libellé. */
.synchro--erreur, .synchro--erreur .synchro__ico { color: var(--warning-fg); }
.synchro--erreur:hover, .synchro--erreur:focus-visible { background: var(--warning-bg); color: var(--warning-fg); }
.bouton-rond {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0;
  border: 1px solid var(--border-default); border-radius: var(--radius-full); background: none;
  color: var(--text-secondary); cursor: pointer;
}
.bouton-rond:hover { background: var(--bg-surface-2); text-decoration: none; }
.bouton-rond .ico { width: 18px; height: 18px; }
.bouton-rond__compteur {
  position: absolute; top: -3px; right: -3px; display: grid; place-items: center;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--radius-full);
  background: var(--danger-fg); color: var(--danger-on); font: 500 11px/1 var(--font);
  border: 2px solid var(--bg-surface);
}
.bouton-menu { display: none; }

/* Panneau de notifications du bouton cloche */
.notifications { position: relative; }
.notifications summary { list-style: none; }
.notifications summary::-webkit-details-marker { display: none; }
.notifications[open] summary { background: var(--bg-surface-2); }
.notifications__panneau {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: 340px; max-width: calc(100vw - 32px);
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--elevation-pop); overflow: hidden;
}
.notifications__entete {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border-default);
}
.notifications__groupe + .notifications__groupe { border-top: 1px solid var(--border-default); }
.notifications__titre { margin: 0; padding: 10px 12px 4px; }
.notifications__liste { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.notifications__liste a {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--border-default); color: var(--text-primary);
}
.notifications__liste li:last-child a { border-bottom: 0; }
.notifications__liste a:hover { background: var(--bg-surface-2); text-decoration: none; }
.notifications__liste a > div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.notifications__liste .ico { color: var(--text-secondary); flex: none; margin-top: 2px; }
.notifications__liste .tag { flex: none; }
.notifications__vide { margin: 0; padding: 16px 12px; color: var(--text-secondary); font-size: 12px; line-height: 17px; }
.notifications__pied {
  display: block; padding: 10px 12px; border-top: 1px solid var(--border-default);
  text-align: center; font-size: 12px; line-height: 17px; font-weight: 500;
}

.contenu { padding: 28px; display: flex; flex-direction: column; gap: 24px; width: 100%; }

/* --- En-tête de page -------------------------------------------------------- */
.entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.entete__texte { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.entete__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fil { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 17px; color: var(--text-secondary); }
.fil a { color: var(--text-secondary); }
.fil .ico { width: 14px; height: 14px; }

/* --- Cartes ---------------------------------------------------------------- */
.carte { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.carte__corps { padding: 20px; }
.carte__entete {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border-default);
}
.carte__entete > div { display: flex; align-items: center; gap: 10px; }
.grille { display: grid; gap: 16px; }
.grille-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grille-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grille-principale { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.pile { display: flex; flex-direction: column; gap: 16px; }
.pastille-ico {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: var(--radius-md); background: var(--accent-weak); color: var(--accent-text);
}
.pastille-ico .ico { width: 16px; height: 16px; }

/* --- CP/KPI ---------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 2px 8px 2px 16px; border-left: 2px solid var(--border-strong); }
.kpi__valeur { font-weight: 700; font-size: 28px; line-height: 34px; letter-spacing: -0.4px; }
.kpi__detail { font-size: 12px; line-height: 17px; color: var(--text-secondary); }
.kpi--alerte { border-left-color: var(--danger-fg); }

/* --- CP/Button ------------------------------------------------------------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px;
  border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; white-space: nowrap;
  font-weight: 500; font-size: 14px; line-height: 21px; text-decoration: none;
}
.bouton:hover { text-decoration: none; }
.bouton .ico { width: 16px; height: 16px; }
.bouton--primaire { background: var(--accent-default); color: var(--text-on-accent); }
.bouton--primaire:hover { background: var(--accent-hover); }
.bouton--secondaire { background: var(--bg-surface); border-color: var(--border-default); color: var(--text-primary); }
.bouton--secondaire:hover { background: var(--bg-surface-2); }
.bouton--danger { background: var(--danger-fg); color: var(--danger-on); }
.bouton--danger:hover { filter: brightness(0.92); }
.bouton--fantome { background: none; color: var(--accent-text); padding-inline: 8px; }
.bouton--fantome:hover { background: var(--accent-weak); }
.bouton[disabled], .bouton[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.bouton--petit { padding: 5px 10px; font-size: 12px; line-height: 17px; }

/* --- CP/Statut et CP/Tag --------------------------------------------------- */
.statut, .tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; white-space: nowrap;
  border: 1px solid; border-radius: var(--radius-sm); font-weight: 500; font-size: 12px; line-height: 17px;
}
.statut .ico { width: 12px; height: 12px; }
.statut--actif { background: var(--success-bg); border-color: var(--success-fg); color: var(--success-fg); }
.statut--lecture_seule { background: var(--warning-bg); border-color: var(--warning-fg); color: var(--warning-fg); }
.statut--arrete { background: var(--danger-fg); border-color: var(--danger-fg); color: var(--danger-on); }
.statut--en_attente { background: var(--bg-surface-2); border-color: var(--text-primary); color: var(--text-primary); }
.statut--degrade { background: var(--degraded-bg); border-color: var(--degraded-fg); color: var(--degraded-fg); }
.statut--hors_ligne, .statut--refuse { background: var(--bg-surface-2); border-color: var(--border-strong); color: var(--text-secondary); }

.tag--neutre { background: var(--bg-surface-2); border-color: var(--border-strong); color: var(--text-secondary); }
.tag--accent { background: var(--accent-weak); border-color: var(--accent-default); color: var(--accent-text); }
.tag--succes { background: var(--success-bg); border-color: var(--success-fg); color: var(--success-fg); }
.tag--alerte { background: var(--warning-bg); border-color: var(--warning-fg); color: var(--warning-fg); }
.tag--danger { background: var(--danger-bg); border-color: var(--danger-fg); color: var(--danger-fg); }
.tag--info { background: var(--info-bg); border-color: var(--info-fg); color: var(--info-fg); }

/* --- CP/Jauge -------------------------------------------------------------- */
.jauge { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 12px; line-height: 17px; }
.jauge__piste { position: relative; width: 72px; height: 6px; overflow: hidden; border-radius: var(--radius-full); background: var(--border-default); }
.jauge__niveau { position: absolute; inset: 0 auto 0 0; border-radius: var(--radius-full); background: var(--text-primary); }
.jauge--bas .jauge__niveau { background: var(--success-fg); }
.jauge--eleve .jauge__niveau { background: var(--warning-fg); }
.jauge--critique .jauge__niveau { background: var(--danger-fg); }
.jauge--critique { color: var(--danger-fg); }
.jauge--large .jauge__piste { width: 100%; flex: 1; }
.jauge--large { display: flex; }

/* --- Tableaux -----------------------------------------------------------------
   Système partagé par tous les écrans : en-tête différencié, bordure horizontale
   fine, ligne compacte (≈ 40 px), survol discret, état sélectionné, alignement
   numérique, troncature contrôlée et en-têtes triables. */
.table-defile { position: relative; overflow-x: auto; }
.tableau { width: 100%; border-collapse: separate; border-spacing: 0; }
.tableau th {
  padding: 9px 14px; text-align: left; white-space: nowrap; background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-strong);
  font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: 0.2px; color: var(--text-secondary);
}
.tableau th a { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.tableau th a:hover { color: var(--text-primary); text-decoration: none; }
.tableau th[aria-sort="ascending"], .tableau th[aria-sort="descending"] { color: var(--text-primary); }
.tri__fleche { font-size: 10px; line-height: 1; opacity: .35; }
/* Tri dans le navigateur (vue tableau des graphiques) : même aspect que les en-têtes triés par le serveur. */
.tableau th .tri {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer;
}
.tableau th.numerique .tri { flex-direction: row; }
.tableau th .tri:hover { color: var(--text-primary); }
.tableau th .tri:focus-visible { outline: 2px solid var(--accent-default); outline-offset: 2px; border-radius: 2px; }
.tableau th[aria-sort="ascending"] .tri__fleche, .tableau th[aria-sort="descending"] .tri__fleche { opacity: 1; }
.tableau td { padding: 9px 14px; border-bottom: 1px solid var(--border-default); vertical-align: middle; }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tbody tr:hover td { background: var(--bg-surface-2); }
.tableau tbody tr:focus-within td { background: var(--bg-surface-2); }
.tableau tbody tr[aria-selected="true"] td { background: var(--accent-weak); }
.tableau tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 2px 0 0 var(--accent-default); }
.tableau .principal-cellule { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tableau .principal-cellule a { color: var(--text-primary); font-weight: 500; }
.tableau .actions { text-align: right; width: 1%; white-space: nowrap; }
.tableau .actions a, .tableau .actions button { color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; }
.tableau .actions a:hover, .tableau .actions button:hover { color: var(--accent-text); }
.tableau .actions > span, .tableau .actions form { display: inline-flex; align-items: center; gap: 6px; }
/* Valeurs numériques : alignées à droite, chiffres de largeur fixe pour comparer. */
.tableau .numerique { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau th.numerique { text-align: right; }
/* Troncature contrôlée : la valeur complète reste dans l'attribut title. */
.tableau .tronque { display: block; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tableau .tronque--court { max-width: 14ch; }
.tableau .tronque--long { max-width: 48ch; }
/* Colonnes de texte : le retour à la ligne évite d'élargir inutilement le tableau. */
.tableau .cellule-texte { white-space: normal; min-width: 18ch; max-width: 52ch; }
/* Largeurs des colonnes récurrentes (le contenu reste tronqué au-delà). */
.tableau .col-nom { width: 268px; }
.tableau .col-instance { width: 150px; }
.tableau .col-statut { width: 130px; }
.tableau .col-licence { width: 170px; }
.tableau .col-contact { width: 130px; }
.tableau .col-disque { width: 140px; }
.tableau .col-empreinte { width: 80px; }
.ligne-lien { color: var(--text-primary); font-weight: 500; }
.carte > .tableau th:first-child, .carte .table-defile:first-child .tableau th:first-child { border-top-left-radius: var(--radius-lg); }
/* En-tête collé sous la barre supérieure : copie de l'en-tête produite par console.js, car l'overflow horizontal
   de .table-defile empêche position: sticky de suivre le défilement de la page. */
.tableau-colle {
  position: fixed; z-index: 9; display: none; overflow: hidden;
  background: var(--bg-surface-2); border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 8px 12px -10px rgba(15, 23, 42, .35);
}
@media print { .tableau-colle { display: none !important; } }
.texte-danger { color: var(--danger-fg); }
.empreinte-ok { color: var(--success-fg); }
.empreinte-ko { color: var(--degraded-fg); }

/* --- Filtres --------------------------------------------------------------- */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filtre {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-full);
  border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-primary);
  font-weight: 500; font-size: 12px; line-height: 17px;
}
.filtre:hover { text-decoration: none; background: var(--bg-surface-2); }
.filtre[aria-current="true"] { background: var(--accent-weak); border-color: var(--accent-default); color: var(--accent-text); }
.filtre b { font-weight: 600; }

/* --- CP/Champ -------------------------------------------------------------- */
.formulaire { display: flex; flex-direction: column; gap: 16px; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ > label { font-weight: 500; }
.champ input, .champ select, .champ textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: var(--radius-md); line-height: 21px;
}
.champ textarea { min-height: 88px; resize: vertical; }
.champ input:focus, .champ select:focus, .champ textarea:focus {
  outline: none; border-color: var(--accent-default); box-shadow: inset 0 0 0 1px var(--accent-default);
}
.champ--erreur input, .champ--erreur select, .champ--erreur textarea { border-color: var(--danger-fg); box-shadow: inset 0 0 0 1px var(--danger-fg); }
.champ__aide { font-size: 12px; line-height: 17px; color: var(--text-secondary); }
.champ--erreur .champ__aide, .champ__erreur { font-size: 12px; line-height: 17px; color: var(--danger-fg); }
.champ--code input { font: 500 22px/28px var(--font-mono); letter-spacing: 6px; text-align: center; }
.rangee { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* --- CP/Switch ------------------------------------------------------------- */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: var(--border-strong); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent-default); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-default); outline-offset: 2px; }

/* --- CP/Étape -------------------------------------------------------------- */
.etapes { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.etape { display: flex; gap: 12px; min-height: 40px; }
.etape__pastille {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 14px;
}
.etape__pastille .ico { width: 14px; height: 14px; }
.etape--fait .etape__pastille { background: var(--success-bg); color: var(--success-fg); }
.etape--en_cours .etape__pastille { background: var(--warning-bg); color: var(--warning-fg); }
.etape--a_venir .etape__pastille { background: var(--bg-surface-2); border: 1px solid var(--border-strong); }
.etape--echec .etape__pastille { background: var(--danger-bg); color: var(--danger-fg); }
.etape__titre { font-weight: 500; }
.etape--a_venir .etape__titre { color: var(--text-secondary); }
.etape__detail { font-size: 12px; line-height: 17px; color: var(--text-secondary); }

/* --- Listes de propriétés -------------------------------------------------- */
.proprietes { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 10px 24px; margin: 0; }
.proprietes dt { color: var(--text-secondary); }
.proprietes dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* --- Bandeaux, encarts, vides --------------------------------------------- */
.bandeau {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px;
  border: 1px solid; border-radius: var(--radius-lg);
}
.bandeau .ico { margin-top: 1px; }
.bandeau > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.bandeau b { font-weight: 600; }
.bandeau--info { background: var(--info-bg); border-color: var(--info-fg); color: var(--info-fg); }
.bandeau--alerte { background: var(--warning-bg); border-color: var(--warning-fg); color: var(--warning-fg); }
.bandeau--danger { background: var(--danger-bg); border-color: var(--danger-fg); color: var(--danger-fg); }
.bandeau--degrade { background: var(--degraded-bg); border-color: var(--degraded-fg); color: var(--degraded-fg); }
.bandeau--succes { background: var(--success-bg); border-color: var(--success-fg); color: var(--success-fg); }
.bandeau p { color: var(--text-primary); }

.vide { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 20px; text-align: center; }
.vide .pastille-ico { width: 40px; height: 40px; background: var(--bg-surface-2); color: var(--text-secondary); }
.vide .pastille-ico .ico { width: 20px; height: 20px; }
.vide p { max-width: 46ch; color: var(--text-secondary); }

.liste-simple { margin: 0; padding: 0; list-style: none; }
.liste-simple > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-bottom: 1px solid var(--border-default); }
.liste-simple > li:last-child { border-bottom: 0; }
.liste-simple > li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.liste-simple .ico { color: var(--text-secondary); margin-top: 1px; }

/* --- Graphiques monitoring ------------------------------------------------- */
.courbe { width: 100%; height: 140px; display: block; }
.courbe .grille-ligne { stroke: var(--border-default); stroke-width: 1; }
.courbe .trace { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.courbe .trace--cpu { stroke: var(--text-primary); }
.courbe .trace--ram { stroke: var(--info-fg); }
.courbe .trace--disque { stroke: var(--accent-default); }
.courbe .seuil { stroke: var(--danger-fg); stroke-dasharray: 4 4; }
.courbe text { fill: var(--text-secondary); font-size: 11px; }

/* --- Résumés --------------------------------------------------------------- */
.texte-resume { white-space: pre-line; line-height: 23px; max-width: 75ch; }
.bloc-code {
  margin: 0; padding: 12px; overflow-x: auto; background: var(--bg-surface-2);
  border: 1px solid var(--border-default); border-radius: var(--radius-md); font: 500 12px/18px var(--font-mono);
}

/* --- Modales (dialog) ------------------------------------------------------ */
dialog.modale {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--elevation-pop);
}
dialog.modale::backdrop { background: var(--bg-overlay); }
.modale__entete { display: flex; gap: 12px; align-items: flex-start; padding: 20px 20px 0; }
.modale__entete > div { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.modale__corps { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.modale__pied { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border-default); }
.pastille-ico--danger { background: var(--danger-bg); color: var(--danger-fg); }
.pastille-ico--alerte { background: var(--warning-bg); color: var(--warning-fg); }
.pastille-ico--succes { background: var(--success-bg); color: var(--success-fg); }
.pastille-ico--degrade { background: var(--degraded-bg); color: var(--degraded-fg); }

/* --- Toasts (messages Django) ---------------------------------------------- */
.toasts { position: fixed; top: 76px; right: 24px; z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--bg-surface);
  border: 1px solid var(--border-default); border-left: 3px solid var(--success-fg);
  border-radius: var(--radius-lg); box-shadow: var(--elevation-pop);
}
.toast > span { flex: 1; }
.toast--error { border-left-color: var(--danger-fg); }
.toast--warning { border-left-color: var(--warning-fg); }
.toast--info { border-left-color: var(--info-fg); }
.toast .ico { color: var(--success-fg); }
.toast--error .ico { color: var(--danger-fg); }
.toast--warning .ico { color: var(--warning-fg); }
.toast--info .ico { color: var(--info-fg); }
.toast button { border: 0; background: none; padding: 0; color: var(--text-secondary); cursor: pointer; }

/* --- Pages d'accès (A1–A3) et d'erreur ------------------------------------- */
.page-acces { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.acces { width: min(400px, 100%); display: flex; flex-direction: column; gap: 24px; }
.acces__marque { display: flex; align-items: center; gap: 12px; }
.acces__marque img { width: 48px; height: 48px; border-radius: 9px; }
.acces .carte__corps { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.acces__pied { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 17px; color: var(--text-secondary); }
.acces__pied .ico { width: 14px; height: 14px; }

/* --- Pagination partagée ------------------------------------------------------ */
.pagination {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 8px 12px; padding: 10px 14px; border-top: 1px solid var(--border-default);
  font-size: 12px; line-height: 17px; color: var(--text-secondary);
}
.pagination__choix { display: inline-flex; align-items: center; gap: 6px; }
.pagination__tailles { display: inline-flex; gap: 2px; }
.pagination__tailles a { padding: 2px 7px; border-radius: var(--radius-sm); color: var(--text-secondary); font-weight: 500; }
.pagination__tailles a:hover { background: var(--bg-surface-2); text-decoration: none; }
.pagination__tailles a[aria-current="true"] { background: var(--accent-weak); color: var(--accent-text); }
.pagination__navigation { display: inline-flex; gap: 8px; }

/* --- Barre d'outils de tableau (recherche, compte, réinitialisation) ---------- */
.barre-table {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border-default);
}
.barre-table__recherche {
  display: flex; align-items: center; gap: 8px; flex: 1 1 220px; min-width: 0; max-width: 340px;
  padding: 5px 10px; background: var(--bg-surface-2); border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.barre-table__recherche .ico { color: var(--text-secondary); }
.barre-table__recherche input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; outline: none; }
.barre-table__recherche input::placeholder { color: var(--text-secondary); }
.barre-table__recherche:focus-within { border-color: var(--accent-default); }
.barre-table__compte { font-size: 12px; line-height: 17px; color: var(--text-secondary); }
.barre-table__actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
/* Sélection multiple : colonne de cases et barre d'actions, visible dès qu'une case est cochée. */
.col-selection { width: 36px; }
.col-selection input { width: 16px; height: 16px; accent-color: var(--accent-default); cursor: pointer; }
.col-selection input:disabled { cursor: not-allowed; opacity: .4; }
.barre-selection {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 14px;
  background: var(--danger-bg); border-bottom: 1px solid var(--border-default); font-size: 13px;
}
.barre-selection[hidden] { display: none; }
.barre-selection__actions { display: inline-flex; gap: 8px; margin-left: auto; }

.chaine { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grille-principale, .grille-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: 260px; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--elevation-pop);
  }
  .app[data-menu-ouvert] .sidebar { transform: none; }
  .bouton-menu { display: grid; }
  .topbar { padding: 0 16px; gap: 8px; }
  .recherche { width: auto; flex: 1; }
  .recherche kbd, .synchro, .pastille-env { display: none; }
  .topbar__espace { display: none; }
  .contenu { padding: 20px 16px; }
  .grille-2, .rangee { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .proprietes { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .proprietes dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.vide .t-h3 { color: var(--text-primary); }
.champ input[type="checkbox"] { width: auto; align-self: flex-start; }

/* Cellules sur une ligne par défaut : le tableau défile horizontalement dans sa carte
   plutôt que de se tasser ; .cellule-texte rend la main aux colonnes de texte. */
.tableau th, .tableau td { white-space: nowrap; }
@media (max-width: 760px) {
  .tableau th, .tableau td { padding: 8px 10px; }
  .tableau .tronque { max-width: 20ch; }
}
.jauge { white-space: nowrap; }
@media (min-width: 961px) {
  /* Le fond de la barre latérale suit toute la hauteur de la page. */
  .app { background: linear-gradient(to right, var(--bg-surface) 239px, var(--border-default) 239px 240px, transparent 240px); }
}
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .kpis.kpis-3 { grid-template-columns: minmax(0, 1fr); } }

/* --- Supervision : palette des séries (validée daltonisme, clair et sombre) ---
   Palette catégorielle de référence, ordre fixe ; une série garde sa couleur d'un graphique à l'autre. */
:root {
  --serie-1: #2a78d6; --serie-2: #eb6834; --serie-3: #1baf7a; --serie-4: #eda100;
  --serie-5: #e87ba4; --serie-6: #008300; --serie-7: #6250d6; --serie-8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70; --serie-4: #c98500;
    --serie-5: #d55181; --serie-6: #008300; --serie-7: #9085e9; --serie-8: #e66767;
  }
}
:root[data-theme="dark"] {
  --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70; --serie-4: #c98500;
  --serie-5: #d55181; --serie-6: #008300; --serie-7: #9085e9; --serie-8: #e66767;
}

/* --- Graphiques (graphiques.js) --------------------------------------------- */
.graphique { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.graphique__zone { position: relative; min-height: 120px; border-radius: var(--radius-md); }
.graphique__zone svg { display: block; overflow: visible; }
.graphique__grille { stroke: var(--border-default); stroke-width: 1; stroke-dasharray: 3 4; }
.graphique__aire { stroke: none; pointer-events: none; }
.graphique__fin { stroke: var(--bg-surface); stroke-width: 2; }
.graphique__vue { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.graphique__vue[hidden] { display: none; }
/* Bascule Graphique / Tableau : dans l'en-tête de la carte, à droite du titre. */
.carte__titre-graphique { flex-wrap: wrap; align-items: center; }
/* La note passe sous le titre : la bascule reste alignée sur le titre. */
.carte__titre-graphique > .petit { order: 3; flex-basis: 100%; margin-top: -6px; }
.graphique__outils { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.graphique > .graphique__outils { align-self: flex-end; }
.graphique__bascule button { padding: 5px 8px; }
.graphique__bascule button .ico, .graphique__exporter .ico { width: 16px; height: 16px; }
.graphique__exporter {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface);
  color: var(--text-secondary); cursor: pointer;
}
.graphique__exporter:hover { background: var(--bg-surface-2); color: var(--accent-text); }
.segments button {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-secondary); font: inherit; font-weight: 500; font-size: 12px; line-height: 17px;
  cursor: pointer;
}
.segments button .ico { width: 14px; height: 14px; }
.segments button:hover { background: var(--bg-surface-2); }
.segments button[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent-text); }
/* Vue tableau : synthèse par série, puis toutes les valeurs. */
.graphique__synthese, .graphique__valeurs-tableau { border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.graphique__valeurs-tableau { max-height: 280px; overflow-y: auto; }
/* Vue tableau à la hauteur de la vue graphique (fixée par graphiques.js) : la liste des valeurs occupe la place
   restante et défile ; si la synthèse elle-même dépasse, c'est la vue entière qui défile. */
/* Un seul défilement : celui de la vue. Les tableaux s'affichent en entier à l'intérieur ; l'en-tête de la liste
   des valeurs reste collé en haut de la vue pendant le défilement. */
.graphique__vue--tableau { overflow: auto; }
.graphique__vue--tableau > * { flex: none; }
.graphique__vue--tableau .graphique__valeurs-tableau { max-height: none; overflow: visible; }
.graphique__vue--tableau .graphique__valeurs-tableau thead th { top: -1px; }
.graphique__valeurs-tableau thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-surface-2); }
.graphique__cle { display: inline-flex; align-items: center; gap: 6px; }
.graphique__cle i { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.graphique__fort { font-weight: 600; color: var(--text-primary); }
.graphique__barre-valeurs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.graphique__axe { fill: var(--text-secondary); font-size: 11px; font-family: var(--font); }
.graphique__trace { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphique__seuil { stroke: var(--danger-fg); stroke-width: 1; stroke-dasharray: 4 4; }
/* Repères : plafond (capacité) en trait plein discret, seuil d'alerte et seuil critique en tirets. */
.graphique__repere { stroke-width: 1; }
.graphique__repere--plafond { stroke: var(--text-secondary); }
.graphique__repere--seuil { stroke: var(--warning-fg); stroke-dasharray: 4 4; }
.graphique__repere--critique { stroke: var(--danger-fg); stroke-dasharray: 4 4; }
/* Légende des repères, sous le graphique : le trait reprend exactement le style de la ligne. */
.graphique__reperes { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; line-height: 17px; color: var(--text-secondary); }
.graphique__repere-cle { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.graphique__repere-cle i { flex: none; width: 20px; height: 0; border-top: 2px solid var(--text-secondary); }
.graphique__repere-cle--seuil i { border-top: 2px dashed var(--warning-fg); }
.graphique__repere-cle--critique i { border-top: 2px dashed var(--danger-fg); }
.graphique__repere-cle b { font-weight: 600; color: var(--text-primary); }
.graphique__repere-cle--seuil b { color: var(--warning-fg); }
.graphique__repere-cle--critique b { color: var(--danger-fg); }
.graphique__reticule { stroke: var(--border-strong); stroke-width: 1; }
.graphique__point { stroke: var(--bg-surface); stroke-width: 2; }
.graphique__vide { padding: 32px 0; text-align: center; color: var(--text-secondary); }
.graphique__bulle {
  position: absolute; z-index: 5; pointer-events: none; min-width: 140px; padding: 8px 10px;
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  box-shadow: var(--elevation-pop); font-size: 12px; line-height: 17px;
}
.graphique__bulle-date { color: var(--text-secondary); margin-bottom: 4px; }
.graphique__bulle-ligne { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.graphique__bulle-ligne i { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.graphique__bulle-ligne b { font-weight: 600; color: var(--text-primary); }
.graphique__bulle-ligne span { color: var(--text-secondary); }
.graphique__valeurs summary { cursor: pointer; font-size: 12px; line-height: 17px; color: var(--text-secondary); width: max-content; }
.graphique__valeurs .table-defile { max-height: 240px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.tableau--compact th, .tableau--compact td { padding: 6px 12px; font-size: 12px; line-height: 17px; }

.grille-graphiques { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grille-graphiques > .carte { min-width: 0; }
.carte__titre-graphique { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.carte__titre-graphique + .carte__corps { padding-top: 12px; }
@media (max-width: 1180px) { .grille-graphiques { grid-template-columns: minmax(0, 1fr); } }

/* --- Barre d'outils de période et onglets de section ------------------------ */
.barre-outils { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.segments { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); }
.segments a { padding: 4px 10px; border-radius: var(--radius-sm); color: var(--text-secondary); font-weight: 500; font-size: 12px; line-height: 17px; }
.segments a:hover { background: var(--bg-surface-2); text-decoration: none; }
.segments a[aria-current="true"] { background: var(--accent-weak); color: var(--accent-text); }
/* Intervalle « du / au » : replié derrière un bouton à côté des périodes, ouvert en panneau flottant. */
.periodes { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.intervalle { position: relative; }
.intervalle summary { list-style: none; }
.intervalle summary::-webkit-details-marker { display: none; }
.intervalle__bouton {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; cursor: pointer;
  border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface);
  color: var(--text-secondary); font-weight: 500; font-size: 12px; line-height: 17px; white-space: nowrap;
}
.intervalle__bouton:hover, .intervalle[open] .intervalle__bouton { background: var(--bg-surface-2); }
.intervalle[data-actif] .intervalle__bouton { background: var(--accent-weak); color: var(--accent-text); border-color: transparent; }
.intervalle__panneau {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: 320px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--elevation-pop);
}
.intervalle__panneau fieldset { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 110px; gap: 6px; }
.intervalle__panneau legend { padding: 0; margin-bottom: 4px; }
.intervalle__panneau input {
  padding: 6px 8px; border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--bg-surface); color: var(--text-primary); font: inherit; min-width: 0;
}
.intervalle__panneau p { margin: 0; }
.intervalle__actions { display: flex; justify-content: flex-end; gap: 8px; }
.onglets { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border-default); }
.onglets a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; white-space: nowrap;
  color: var(--text-secondary); font-weight: 500; border-bottom: 2px solid transparent;
}
.onglets a .ico { width: 16px; height: 16px; }
.onglets a:hover { color: var(--text-primary); text-decoration: none; }
.onglets a[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent-default); }

/* --- Panneaux en barres (trafic, façon GoAccess) ----------------------------- */
.barres { margin: 0; padding: 12px 20px 16px; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.barres li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; }
.barres .barres__libelle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barres .barres__valeur { font-weight: 600; font-size: 12px; line-height: 17px; text-align: right; white-space: nowrap; }
.barres .barres__valeur span { font-weight: 400; color: var(--text-secondary); margin-left: 6px; }
.barres .barres__piste { grid-column: 1 / -1; height: 6px; border-radius: var(--radius-full); background: var(--bg-surface-2); overflow: hidden; }
.barres .barres__niveau { display: block; height: 100%; border-radius: var(--radius-full); background: var(--serie-1); min-width: 2px; }
.heures { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; align-items: end; height: 120px; padding: 16px 20px 4px; }
/* Panneau sans liste à faire défiler : le graphique occupe la hauteur du bloc au lieu de flotter en haut. */
.carte__defile--graphique { display: flex; flex-direction: column; }
.carte__defile--graphique .heures { flex: 1; height: auto; min-height: 120px; }
/* Filtre compact dans l'en-tête d'un panneau (application des pages). */
.filtre-panneau { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* Filtre d'application de l'onglet Trafic : il commande les chiffres clés, les graphiques et les pages. */
.filtre-trafic { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.filtre-panneau select,
.filtre-trafic select {
  padding: 4px 8px; border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--bg-surface); color: var(--text-primary); font-size: 12px; line-height: 17px; max-width: 26ch;
}
.heures div { position: relative; background: var(--serie-1); border-radius: 4px 4px 0 0; min-height: 2px; }
.heures div:hover { filter: brightness(1.15); }
.heures-axe { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; padding: 0 20px 16px; font-size: 10px; color: var(--text-secondary); text-align: center; }

/* Panneau de hauteur fixe : le contenu défile à l'intérieur, la grille garde des blocs alignés quelle que soit
   la quantité de données. Les en-têtes de tableau restent collés en haut du panneau. */
.carte--panneau { display: flex; flex-direction: column; height: 340px; }
.carte--panneau-haut { height: 460px; }
.carte--panneau > .carte__entete { flex: none; }
.carte__defile { flex: 1; min-height: 0; overflow: auto; }
.carte__defile > .tableau thead th { position: sticky; top: 0; z-index: 1; }
.carte__defile > .tableau th:first-child { border-top-left-radius: 0; }
.panneau__note { margin: 0; padding: 12px 20px 0; }
/* Dans un panneau, les textes longs (hôtes, chemins) cèdent la place aux colonnes de chiffres. */
.carte__defile .tableau .cellule-texte { min-width: 0; max-width: none; }
.carte__defile .tableau .tronque { max-width: 24ch; }
.carte--panneau-haut .tableau .tronque { max-width: 70ch; }
.cellule-ligne { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cellule-ligne > .tronque { min-width: 0; }
.cellule-ligne .ico { flex: none; }
.cellule-pile { display: flex; flex-direction: column; min-width: 0; }

/* Mini-barre dans une cellule de tableau : la valeur, précédée de sa part relative. */
.cellule-barre { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.mini-barre { display: inline-block; width: 44px; height: 6px; overflow: hidden; border-radius: var(--radius-full); background: var(--bg-surface-2); }
.mini-barre > span { display: block; height: 100%; min-width: 2px; border-radius: var(--radius-full); background: var(--serie-1); }

/* Barre humaines / robots sous le chiffre des requêtes. */
.repartition-ligne { display: block; height: 6px; margin: 4px 0 2px; overflow: hidden; border-radius: var(--radius-full); background: var(--serie-4); }
.repartition-ligne > span { display: block; height: 100%; background: var(--serie-1); }

/* Anneau de répartition (conic-gradient) et légende. */
.repartition { display: flex; align-items: center; gap: 20px; margin: 0; padding: 16px 20px; }
.repartition__anneau { position: relative; flex: none; display: grid; place-items: center; width: 116px; height: 116px; border-radius: 50%; }
.repartition__anneau::before { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: var(--bg-surface); }
.repartition__anneau > span { position: relative; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700; font-size: 17px; line-height: 1; letter-spacing: -0.3px; }
.repartition__legende { flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.repartition__legende li { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; }
.repartition__pastille { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.repartition__libelle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repartition__valeur { font-weight: 600; font-variant-numeric: tabular-nums; }
.repartition--mini { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px; }
.repartition--mini .repartition__anneau { width: 76px; height: 76px; align-self: center; }
.repartition--mini .repartition__anneau::before { inset: 13px; }
.repartition--mini .repartition__anneau > span { max-width: 48px; font-size: 10px; font-weight: 600; color: var(--text-secondary); }
.repartition--mini .repartition__legende li { gap: 6px; font-size: 11px; line-height: 16px; }
.repartition--mini .repartition__pastille { width: 8px; height: 8px; }
.repartitions-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.repartitions-mini .repartition--mini { padding: 12px 8px; }
@media (max-width: 1280px) { .grille-3:has(> .carte--panneau) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- Divers supervision ------------------------------------------------------- */
.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1180px) { .kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.journal-extrait { margin: 0; padding: 10px 12px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--bg-surface-2); border: 1px solid var(--border-default); border-radius: var(--radius-md); font: 500 12px/18px var(--font-mono); }
/* --- Résumé « Système » : anneaux, pastilles de l'hôte, histogramme des fils ------------------------------- */
.anneaux { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1280px) { .anneaux { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .anneaux { grid-template-columns: minmax(0, 1fr); } }
.anneau {
  --c: var(--text-secondary);
  display: flex; align-items: center; gap: 16px; min-width: 0; padding: 14px 16px;
  border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--bg-surface);
}
/* Anneau cliquable : lien vers les graphiques de la mesure, sans style de lien. */
a.anneau { color: inherit; text-decoration: none; transition: box-shadow .15s; }
a.anneau:hover { box-shadow: inset 0 0 0 1px var(--border-strong); text-decoration: none; }
a.anneau:hover .anneau__texte { text-decoration: underline; }
/* Le bloc visé par un anneau se décale sous la barre supérieure collante. */
.grille-graphiques > .carte { scroll-margin-top: 80px; }
.grille-graphiques > .carte:target { border-color: var(--accent-default); box-shadow: inset 0 0 0 1px var(--accent-default); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.anneau--ok { --c: var(--success-fg); }
.anneau--alerte { --c: var(--warning-fg); border-color: var(--warning-fg); background: var(--warning-bg); }
.anneau--critique { --c: var(--danger-fg); border-color: var(--danger-fg); background: var(--danger-bg); }
.anneau__cercle {
  --p: 0;
  position: relative; flex: none; display: grid; place-items: center; width: 104px; height: 104px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--border-default) 0);
}
/* Le trou de l'anneau prend la couleur du fond de la carte (y compris en alerte). */
.anneau__cercle::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--bg-surface); }
.anneau--alerte .anneau__cercle::before { background: var(--warning-bg); }
.anneau--critique .anneau__cercle::before { background: var(--danger-bg); }
.anneau__valeur { position: relative; font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -0.4px; color: var(--text-primary); }
.anneau__valeur small { margin-left: 2px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
/* Repère du seuil d'alerte : un trait en travers de l'anneau, tourné autour du centre (rayon 52 px + 3 px). */
.anneau__repere {
  position: absolute; z-index: 1; top: -3px; left: 50%; width: 3px; height: 18px; margin-left: -1.5px;
  border-radius: 2px; background: var(--text-primary);
  transform-origin: 50% 55px; transform: rotate(calc(var(--s) * 3.6deg));
}
.anneau__texte { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.anneau__libelle { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; line-height: 20px; color: var(--text-primary); }
.anneau__libelle .ico { color: var(--c); }
.anneau__detail { font-size: 13px; line-height: 18px; color: var(--text-secondary); }

.pastilles-hote { display: flex; flex-wrap: wrap; gap: 8px; }
.pastille-hote {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 12px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  border: 1px solid var(--border-default); border-radius: var(--radius-full); background: var(--bg-surface-2);
  font-size: 13px; line-height: 18px; color: var(--text-primary);
}
.pastille-hote .ico { flex: none; color: var(--accent-default); }
.pastille-hote b { font-weight: 600; color: var(--text-secondary); }

.histo-coeurs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; }
.histo-coeurs__col { --c: var(--success-fg); display: flex; flex-direction: column; align-items: center; gap: 4px; width: 28px; }
.histo-coeurs__col--alerte { --c: var(--warning-fg); }
.histo-coeurs__col--critique { --c: var(--danger-fg); }
.histo-coeurs__piste { position: relative; width: 100%; height: 56px; overflow: hidden; border-radius: 6px; background: var(--border-default); }
.histo-coeurs__barre { position: absolute; right: 0; bottom: 0; left: 0; min-height: 3px; background: var(--c); }
.histo-coeurs__valeur { font-size: 11px; line-height: 14px; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.histo-coeurs__legende { align-self: center; margin-left: 8px; font-size: 12px; color: var(--text-secondary); }

.coeurs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.coeurs > div { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 17px; color: var(--text-secondary); }
.cases { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.cases label { display: inline-flex; align-items: center; gap: 6px; }
.point-etat { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none; }
.point-etat--ok { background: var(--success-fg); }
.point-etat--ko { background: var(--danger-fg); }
.point-etat--alerte { background: var(--warning-fg); }

/* --- Supervision : page dense -------------------------------------------------
   Règles portées par les pages denses (.contenu--dense, .page-dense) : supervision et fiche d'instance.
   elles resserrent les espacements sans toucher au reste de la console. */
.contenu--dense { padding: 18px 20px; }
.page-dense { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.page-dense .entete { gap: 12px; }
.page-dense .carte__entete { padding: 10px 14px; }
.page-dense .carte__entete > div { gap: 8px; }
.page-dense .carte__corps { padding: 14px; }
.page-dense .carte__titre-graphique { padding: 12px 14px 0; }
.page-dense .carte__titre-graphique + .carte__corps { padding-top: 8px; }
.page-dense .pile { gap: 12px; }
.page-dense .vide { padding: 24px 14px; }
.page-dense .tableau th, .page-dense .tableau td { padding: 8px 12px; }
.page-dense .onglets { gap: 2px; overflow-y: hidden; scrollbar-width: thin; }
.page-dense .onglets a { padding: 8px 12px; gap: 6px; line-height: 20px; }
.page-dense .onglets a[aria-current="page"] {
  background: var(--accent-weak); border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-bottom-color: var(--accent-default);
}
.page-dense .grille-graphiques { gap: 12px; }

/* Bandeaux compacts : icône, titre et résumé sur une ligne, action à droite. */
.bandeau--compact { align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
.bandeau--compact .ico { width: 16px; height: 16px; margin-top: 0; }
.bandeau--compact > div {
  flex: 1 1 240px; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0;
}
.bandeau--compact .bandeau__resume {
  display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; line-height: 17px; color: var(--text-primary);
}
.bandeau--compact .bandeau__resume span + span::before { content: "·"; margin-right: 10px; color: var(--text-secondary); }
.bandeau--compact .bouton { margin-left: auto; }

/* Fiche d'un conteneur : trois groupes logiques, trois colonnes sur grand écran. */
.fiche { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 24px; }
.fiche__groupe { min-width: 0; }
.fiche__groupe > .t-libelle {
  display: block; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 1px solid var(--border-default);
}
.fiche__liste {
  display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 4px 12px; margin: 0; align-items: baseline;
}
.fiche__liste dt { color: var(--text-secondary); font-size: 12px; line-height: 18px; }
.fiche__liste dd { margin: 0; min-width: 0; line-height: 18px; overflow-wrap: anywhere; }
.fiche__valeur { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fiche__tronque { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bouton-copie {
  display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-secondary); cursor: pointer;
}
.bouton-copie:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.bouton-copie .ico { width: 14px; height: 14px; }

/* En-tête de carte : sur petit écran, le titre garde sa ligne et l'action passe dessous. */
@media (max-width: 560px) {
  .page-dense .carte__entete { flex-wrap: wrap; }
  .page-dense .carte__entete > div { flex: 1 1 100%; }
  .page-dense .carte__entete > .bouton { margin-left: auto; }
}

/* Très grand écran : la fiche d'instance passe à trois colonnes de cartes (réglable :
   data-colonnes="2" sur la page conserve la disposition à deux colonnes).
   La pile principale occupe deux colonnes et se répartit elle-même en deux. */
@media (min-width: 1800px) {
  .page-dense:not([data-colonnes="2"]) .grille-principale { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-dense:not([data-colonnes="2"]) .grille-principale > .pile:first-child {
    grid-column: span 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start; gap: 16px;
  }
  .page-dense:not([data-colonnes="2"]) .grille-principale > .pile:first-child > .carte:first-child {
    grid-column: span 2;
  }
}

@media (max-width: 1280px) { .fiche { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .fiche { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 960px) {
  .contenu--dense { padding: 14px 12px; }
  .page-dense { gap: 12px; }
}

/* --- Assistant IA : page, bulle flottante, messages ------------------------------------------------ */
.assistant-page { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 16px; align-items: start; }
.assistant-page__liste { position: sticky; top: 16px; max-height: calc(100vh - 140px); overflow: auto; }
.liste-simple--compacte > li { padding: 10px 16px; }
.liste-simple > li[aria-current="true"] { background: var(--accent-weak); }
/* Comptes (Paramètres) : formulaire sur deux colonnes, clé 2FA. */
.grille-formulaire { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.grille-formulaire > .case { align-self: center; }
.cle-2fa__corps { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.cle-2fa__qr { background: #fff; padding: 12px; border-radius: 8px; line-height: 0; }
.cle-2fa__secret { font-size: 1.25rem; letter-spacing: .08em; padding: 10px 14px; background: var(--bg-surface-2); border-radius: 6px; word-break: break-all; }
/* Suppression d'une conversation (SuperAdmin) : discrète, visible au survol ou au clavier. */
.bouton-rond--petit { width: 28px; height: 28px; flex: none; }
.assistant-page__supprimer { opacity: 0; color: var(--danger-fg); }
.liste-simple > li:hover .assistant-page__supprimer, .assistant-page__supprimer:focus-visible { opacity: 1; }
@media (hover: none) { .assistant-page__supprimer { opacity: 1; } }
.assistant { display: flex; flex-direction: column; min-height: 0; }
.assistant-page .assistant { height: calc(100vh - 210px); min-height: 460px; }
.assistant__contexte { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-default); }
.assistant__choix { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.assistant__choix select { padding: 6px 8px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); font: inherit; max-width: 100%; }
.assistant__supprimer { margin-left: auto; }
.assistant__fil { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px; scroll-behavior: smooth; }
.assistant__suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.assistant__suggestions .filtre { cursor: pointer; font: inherit; }
.assistant__saisie { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--border-default); }
.assistant__saisie textarea { flex: 1; min-width: 0; resize: none; max-height: 160px; padding: 8px 10px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); font: inherit; line-height: 20px; }
.assistant__saisie textarea:focus { outline: 2px solid var(--accent-default); outline-offset: -1px; border-color: transparent; }
.assistant__note { padding: 0 16px 12px; margin: 0; }

.bulle-msg { max-width: min(78ch, 88%); display: flex; flex-direction: column; gap: 4px; }
.bulle-msg p { margin: 0; }
.bulle-msg--moi { align-self: flex-end; align-items: flex-end; }
.bulle-msg--moi > p { padding: 8px 12px; border-radius: 12px 12px 2px 12px; background: var(--accent-weak); color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }
.bulle-msg--ia { align-self: flex-start; }
.bulle-msg__texte { padding: 10px 14px; border: 1px solid var(--border-default); border-radius: 12px 12px 12px 2px; background: var(--bg-surface-2); line-height: 22px; overflow-wrap: anywhere; }
.bulle-msg__texte > * + * { margin-top: 8px; }
.bulle-msg__texte ul, .bulle-msg__texte ol { margin-block: 0; padding-left: 20px; }
.bulle-msg__texte code { font-family: var(--font-mono); font-size: 12px; padding: 1px 4px; border-radius: var(--radius-sm); background: var(--bg-surface); }
.bulle-msg--erreur .bulle-msg__texte { border-color: var(--danger-fg); background: var(--danger-bg); color: var(--danger-fg); }
.bulle-msg__mesure, .bulle-msg__contexte { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; line-height: 15px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bulle-msg__mesure:empty { display: none; }
.bulle-msg__outil { font-size: 11px; line-height: 15px; color: var(--text-secondary); }
.bulle-msg__outil::before { content: "↳ "; }
.bulle-msg__points { display: inline-block; letter-spacing: 2px; animation: points-ia 1s ease-in-out infinite; }
@keyframes points-ia { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .bulle-msg__points { animation: none; } .assistant__fil { scroll-behavior: auto; } }

.bulle-ia { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.bulle-ia__bouton { width: 52px; height: 52px; border-radius: var(--radius-full); border: 0; display: grid; place-items: center; background: var(--accent-default); color: var(--text-on-accent); box-shadow: var(--elevation-pop); cursor: pointer; }
.bulle-ia__bouton:hover { background: var(--accent-hover); }
.bulle-ia__bouton .ico { width: 22px; height: 22px; }
.bulle-ia--ouverte .bulle-ia__bouton { display: none; }
/* `.assistant` est en display:flex, ce qui l'emporterait sur l'attribut hidden : le panneau fermé resterait affiché. */
.bulle-ia__panneau[hidden] { display: none; }
.assistant__contexte--bulle .assistant__choix { flex-direction: row; align-items: center; gap: 8px; }
.bulle-ia__panneau { order: -1; width: min(500px, calc(100vw - 32px)); height: min(600px, calc(100vh - 100px)); background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--elevation-pop); overflow: hidden; }
.bulle-ia__entete { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border-default); }
.bulle-ia__titre { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bulle-ia__titre span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulle-ia__entete .bouton-rond { width: 32px; height: 32px; }
.assistant__contexte--bulle { padding: 8px 12px; }
.bulle-ia .assistant__fil { padding: 12px; }
.bulle-ia .bulle-msg { max-width: 92%; }
.bulle-ia .assistant__saisie { padding: 10px 12px; }
.bulle-ia__recentes { max-height: 240px; overflow-y: auto; border-bottom: 1px solid var(--border-default); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.bulle-ia__recentes[hidden] { display: none; }
.bulle-ia__recente { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-md); background: none; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.bulle-ia__recente:hover, .bulle-ia__recente:focus-visible { background: var(--bg-surface-2); }
.assistant-recherche { display: flex; align-items: center; gap: 6px; margin: 0 12px 8px; padding: 6px 10px; border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.assistant-recherche input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text-primary); font: inherit; outline: none; }
.assistant-recherche:focus-within { outline: 2px solid var(--accent-default); outline-offset: -1px; }
.action-ia .ico { color: var(--accent-text); }
.actions-ia { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

@media (max-width: 960px) {
  .assistant-page { grid-template-columns: minmax(0, 1fr); }
  .assistant-page__liste { position: static; max-height: 220px; }
}
@media (max-width: 560px) {
  .bulle-ia { right: 12px; bottom: 12px; }
  .bulle-ia__panneau { width: calc(100vw - 24px); height: calc(100vh - 80px); }
}

/* Mesures de consommation */
.tableau td.nombre, .tableau th.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mesures-comparaison { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

/* Historique de l'infrastructure : filtres et chronologie */
.historique-filtres { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.historique-filtres input[type="datetime-local"] { padding: 6px 8px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); font: inherit; }
.historique-genres { display: flex; flex-wrap: wrap; gap: 4px 12px; border: 0; padding: 0; margin: 0; }
.historique-genres legend { padding: 0; margin-bottom: 4px; }
.historique-genres label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.chronologie { list-style: none; margin: 0; padding: 8px 20px 16px; }
.chronologie__fait { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 8px 0 8px 14px; border-left: 2px solid var(--border-default); position: relative; }
.chronologie__fait::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.chronologie__fait--alerte::before { background: var(--warning-fg); }
.chronologie__fait--critique::before { background: var(--danger-fg); }
.chronologie__fait time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-secondary); padding-top: 2px; }
.chronologie__fait > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chronologie__titre { overflow-wrap: anywhere; }
@media (max-width: 560px) { .chronologie__fait { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.liste-definitions { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.liste-definitions dt { color: var(--text-secondary); font-size: 12px; line-height: 20px; }
.liste-definitions dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .liste-definitions { grid-template-columns: minmax(0, 1fr); gap: 2px; } .liste-definitions dd { margin-bottom: 8px; } }
.proposition-ia { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 10px 12px; border: 1px dashed var(--accent-default); border-radius: var(--radius-md); background: var(--bg-surface); }
.proposition-ia p { margin: 0; }
.proposition-ia__titre { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.proposition-ia__commande { display: block; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--bg-surface-2); font-family: var(--font-mono); font-size: 12px; overflow-x: auto; white-space: pre; }
/* Réponses de l'assistant : tableaux, titres, code, citations, graphiques, liens. */
.bulle-msg__texte .tableau-ia { margin-inline: -2px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); }
.bulle-msg__texte .tableau-ia .tableau { font-size: 12.5px; }
.bulle-msg__texte .tableau-ia th, .bulle-msg__texte .tableau-ia td { padding: 6px 10px; line-height: 18px; vertical-align: top; }
.bulle-msg__texte .tableau-ia tbody tr:nth-child(even) td { background: var(--bg-surface-2); }
.bulle-msg__texte .titre-ia { margin: 6px 0 0; font-size: 14px; line-height: 20px; font-weight: 700; color: var(--text-primary); }
.bulle-msg__texte h3.titre-ia { font-size: 15px; }
.bulle-msg__texte .code-ia { margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg-surface); border: 1px solid var(--border-default); font: 12px/18px var(--font-mono); overflow-x: auto; white-space: pre; }
.bulle-msg__texte .code-ia code { padding: 0; background: none; }
.bulle-msg__texte blockquote { margin: 0; padding: 4px 10px; border-left: 3px solid var(--accent-default); color: var(--text-secondary); }
.bulle-msg__texte hr { border: 0; border-top: 1px solid var(--border-default); margin: 6px 0; }
.bulle-msg__texte ul ul, .bulle-msg__texte ol ul, .bulle-msg__texte ul ol { margin-top: 2px; }
.bulle-msg__texte .lien-ia { color: var(--accent-text); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.graphique-ia { padding: 8px 4px 4px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); }
.graphique-ia__titre { margin: 0 8px 4px; font-weight: 600; font-size: 13px; }
.graphique-ia .barres { padding: 4px 8px 8px; }
.graphique-ia__attente { font-style: italic; }
.texte-rapport { border: 0; background: none; padding: 0; max-width: 80ch; }
.case { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }

/* --- Documents rédigés : résumés d'activité et rapports d'infrastructure ------------------------------------ */
.kpis-document { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpis-document .kpi__valeur small { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.texte-document { max-width: 78ch; font-size: 14.5px; line-height: 24px; color: var(--text-primary); overflow-wrap: anywhere; }
.texte-document > :first-child { margin-top: 0; }
.texte-document > * + * { margin-top: 10px; }
.texte-document > p:first-child { font-size: 15.5px; line-height: 26px; }
.texte-document .titre-ia {
  margin: 26px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--border-default);
  font-size: 15px; line-height: 22px; font-weight: 700; color: var(--text-primary);
}
.texte-document h5.titre-ia, .texte-document h6.titre-ia { border-bottom: 0; font-size: 14px; margin-top: 16px; }
.texte-document ul, .texte-document ol { margin: 8px 0 0; padding-left: 22px; }
.texte-document li + li { margin-top: 6px; }
.texte-document li::marker { color: var(--text-secondary); }
.texte-document strong { font-weight: 650; }
.texte-document code { font-family: var(--font-mono); font-size: 12.5px; padding: 1px 5px; border-radius: var(--radius-sm); background: var(--bg-surface-2); }
.texte-document blockquote { margin: 10px 0 0; padding: 8px 14px; border-left: 3px solid var(--border-strong); background: var(--bg-surface-2); color: var(--text-secondary); }
.texte-document hr { border: 0; border-top: 1px solid var(--border-default); margin: 20px 0; }
.texte-document .tableau-ia { border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.objectif-document { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-md); background: var(--bg-surface-2); }
.objectif-document .t-libelle { margin-right: 8px; }
.faits-document { display: grid; gap: 0; margin: 0; }
.faits-document > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-top: 1px solid var(--border-default); }
.faits-document > div:first-child { border-top: 0; padding-top: 0; }
.faits-document dt { color: var(--text-secondary); font-weight: 500; }
.faits-document dd { margin: 0; line-height: 22px; }
.details-document > summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 20px; cursor: pointer; list-style: none; }
.details-document > summary::-webkit-details-marker { display: none; }
.details-document > summary::after { content: "▸"; margin-left: auto; color: var(--text-secondary); transition: transform .15s; }
.details-document[open] > summary::after { transform: rotate(90deg); }
.details-document[open] > summary { border-bottom: 1px solid var(--border-default); }
@media (max-width: 720px) { .faits-document > div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.titre-domaine { margin: 12px 0 -8px; padding-top: 8px; border-top: 1px solid var(--border-default); }
.kpis-mini { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.barre-cellule { display: inline-block; width: calc(100% - 60px); max-width: 220px; height: 6px; margin-right: 8px; vertical-align: middle; border-radius: 3px; background: var(--bg-surface-2); overflow: hidden; }
.barre-cellule > span { display: block; height: 100%; border-radius: 3px; background: var(--serie-1); }
