/* ==========================================================
   ChannelO — console d'administration ALIBORA
   Couleurs et typographie : charte graphique ALIBORA (bleu #003DA5, Exo 2)
   Mise en page : barre latérale bleu profond + contenu sur fond clair.
   Les couleurs sont des variables : un thème sombre suit le réglage de l'ordinateur.
   ========================================================== */

:root {
  --bg: #F2F5FB;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --line: #E5E7EB;
  --line-soft: #EDF0F5;
  --ink: #1F2937;
  --muted: #475164;
  --faint: #7A8496;

  --brand: #003DA5;          /* couleur principale ALIBORA */
  --brand-hover: #00348D;
  --brand-ink: #FFFFFF;
  --brand-soft: #E6EDF8;
  --link: #003DA5;

  --navy: #001F6B;           /* bleu profond : barre latérale */
  --navy-2: #0B2C80;
  --navy-3: #1A3B8F;
  --on-navy: #DCE5F7;
  --on-navy-2: #93A6D6;

  --ok: #22C55E;  --ok-ink: #166534;  --ok-bg: #DCFCE7;
  --warn: #F59E0B; --warn-ink: #92400E; --warn-bg: #FEF3C7;
  --danger: #EF4444; --danger-ink: #DC2626; --danger-bg: #FEE2E2;
  --neutral-bg: #EEF1F5; --neutral-ink: #4B5563;

  --code-bg: #00143F;
  --code-ink: #C9D8F5;
  --chart-bar: #9DB3DC;
  --chart-last: #003DA5;
  --chart-grid: #E5E7EB;

  --shadow: 0 1px 2px rgba(0, 31, 107, .05), 0 6px 18px rgba(0, 31, 107, .05);
  --font: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1430; --surface: #101D3D; --surface-2: #14244A; --line: #22345E; --line-soft: #1B2B52;
    --ink: #EEF2FA; --muted: #BAC5DE; --faint: #8E9DC0;
    --brand: #2F63D0; --brand-hover: #3A70E0; --brand-ink: #FFFFFF; --brand-soft: #1A2F63; --link: #8FB2F5;
    --navy: #061235; --navy-2: #0E1F4D; --navy-3: #1A3270; --on-navy: #DCE5F7; --on-navy-2: #8FA3D2;
    --ok-ink: #4ADE80; --ok-bg: rgba(34, 197, 94, .15);
    --warn-ink: #FBBF24; --warn-bg: rgba(245, 158, 11, .16);
    --danger-ink: #F87171; --danger-bg: rgba(239, 68, 68, .16);
    --neutral-bg: #1B2B52; --neutral-ink: #B6C2DD;
    --code-bg: #050D26; --code-ink: #C9D8F5;
    --chart-bar: #33528F; --chart-last: #8FB2F5; --chart-grid: #22345E;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1430; --surface: #101D3D; --surface-2: #14244A; --line: #22345E; --line-soft: #1B2B52;
  --ink: #EEF2FA; --muted: #BAC5DE; --faint: #8E9DC0;
  --brand: #2F63D0; --brand-hover: #3A70E0; --brand-ink: #FFFFFF; --brand-soft: #1A2F63; --link: #8FB2F5;
  --navy: #061235; --navy-2: #0E1F4D; --navy-3: #1A3270; --on-navy: #DCE5F7; --on-navy-2: #8FA3D2;
  --ok-ink: #4ADE80; --ok-bg: rgba(34, 197, 94, .15);
  --warn-ink: #FBBF24; --warn-bg: rgba(245, 158, 11, .16);
  --danger-ink: #F87171; --danger-bg: rgba(239, 68, 68, .16);
  --neutral-bg: #1B2B52; --neutral-ink: #B6C2DD;
  --code-bg: #050D26; --code-ink: #C9D8F5;
  --chart-bar: #33528F; --chart-last: #8FB2F5; --chart-grid: #22345E;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: var(--mono); font-size: 14px; }
h1, h2, h3 { text-wrap: balance; }

/* ---------- Icônes ---------- */
svg { flex: none; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; font-size: 15.5px; font-weight: 600;
  background: var(--surface); color: var(--ink);
  transition: background .15s, border-color .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { background: var(--brand-hover); }
.btn--ghost { border-color: var(--line); }
.btn--ghost:hover { border-color: var(--faint); }
.btn--danger { border-color: var(--line); color: var(--danger-ink); }
.btn--danger:hover { border-color: var(--danger-ink); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 14.5px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.link {
  border: 0; background: none; padding: 0; color: var(--link);
  font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; gap: 4px;
}
.link:hover { text-decoration: underline; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); display: inline-grid; place-items: center; color: var(--ink);
}
.icon-btn:hover { border-color: var(--faint); }

/* ---------- Pastilles d'état ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.pill__dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.pill--ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill--warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill--danger { background: var(--danger-bg); color: var(--danger-ink); }
.pill--muted { background: var(--neutral-bg); color: var(--neutral-ink); }
.pill--brand { background: var(--brand-soft); color: var(--link); }
.tag-decide { background: var(--warn-bg); color: var(--warn-ink); padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ---------- Avatars d'institution ---------- */
.seal {
  --s: 38px;
  width: var(--s); height: var(--s); border-radius: 10px; flex: none;
  display: inline-grid; place-items: center;
  background: var(--brand-soft); color: var(--link);
  font-weight: 700; font-size: calc(var(--s) * var(--k, .3)); letter-spacing: .02em;
  overflow: hidden; white-space: nowrap; padding: 0 2px;
}
.seal--lg { --s: 64px; border-radius: 16px; }
.seal--sm { --s: 30px; border-radius: 8px; }

/* ==========================================================
   CONNEXION
   ========================================================== */
.login {
  min-height: 100%;
  display: grid; place-items: center;
  padding-block: 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.06) 0 8px, transparent 9px),
    radial-gradient(circle at 82% 14%, rgba(255,255,255,.05) 0 14px, transparent 15px),
    radial-gradient(circle at 70% 82%, rgba(255,255,255,.05) 0 10px, transparent 11px),
    linear-gradient(160deg, #003DA5 0%, #001F6B 72%);
}
.login__card {
  width: 100%; max-width: 420px;
  background: var(--surface); border-radius: 20px; padding: 32px 28px 26px;
  box-shadow: 0 30px 80px rgba(0, 10, 40, .35);
  display: flex; flex-direction: column; gap: 22px;
}
.login__brand { display: flex; align-items: center; gap: 12px; }
.login__mark { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); color: #FFFFFF; display: grid; place-items: center; }
.login__name { margin: 0; font-size: 24.5px; font-weight: 800; letter-spacing: -.01em; }
.login__tag { margin: 0; font-size: 14.5px; color: var(--muted); }
.login__title { margin: 0; font-size: 22.5px; font-weight: 700; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login__theme { margin-left: auto; }
.login__forgot { align-self: flex-end; margin-top: -4px; }
.login__back { align-self: center; }
.login__foot { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }

/* ---------- Champs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; font-weight: 600; }
.field__hint { font-weight: 400; color: var(--muted); font-size: 14px; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 15.5px; font-weight: 400;
}
.textarea { padding: 10px 12px; min-height: 80px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.info { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok-ink); font-size: 14.5px; font-weight: 500; }
.select--sm { width: auto; min-height: 36px; padding: 0 8px; font-size: 14.5px; }
.error { margin: 0; color: var(--danger-ink); font-size: 14.5px; font-weight: 500; }

.switch {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer;
  transition: background .2s;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 999px; background: #FFFFFF; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* ==========================================================
   STRUCTURE : barre latérale + contenu
   ========================================================== */
.shell { min-height: 100%; display: flex; }
.side {
  flex: 0 0 268px;
  background: var(--navy); color: var(--on-navy);
  display: flex; flex-direction: column; gap: 22px;
  padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.side__mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #FFFFFF; display: grid; place-items: center; }
.side__name { margin: 0; font-size: 18px; font-weight: 800; color: #FFFFFF; }
.side__tag { margin: 0; font-size: 13px; color: var(--on-navy-2); }
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 0 12px; border-radius: 10px; border: 0;
  background: transparent; color: var(--on-navy); font-size: 15.5px; font-weight: 500; text-align: left;
  transition: background .15s;
}
.nav-btn:hover { background: rgba(255, 255, 255, .07); }
.nav-btn.is-on { background: var(--navy-3); color: #FFFFFF; font-weight: 600; box-shadow: inset 3px 0 0 #FFFFFF; }
.nav-btn__label { flex: 1; }
.nav-btn__badge { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: var(--on-navy-2); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
/* Problème en cours : une simple pastille rouge à la place du nombre */
.nav-btn__badge.is-alert, .nav-btn__dot { min-width: 0; width: 10px; height: 10px; padding: 0; background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .25); }
.nav-btn__dot { border-radius: 999px; flex: none; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.env {
  margin: 0 8px; padding: 8px 10px; border-radius: 10px; background: var(--navy-2);
  font-size: 13.5px; color: var(--on-navy); display: flex; gap: 8px; align-items: center;
}
.env__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--warn); }
.me { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.me__link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 6px 6px; border: 0; border-radius: 10px; background: transparent; color: inherit;
  transition: background .15s;
}
.me__link:hover { background: rgba(255, 255, 255, .07); }
.me__link.is-on { background: var(--navy-3); }
.me__av { width: 36px; height: 36px; border-radius: 999px; background: #FFFFFF; color: #001F6B; font-weight: 700; font-size: 14.5px; display: grid; place-items: center; flex: none; }
.me__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.me__name { font-size: 15px; font-weight: 600; color: #FFFFFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__role { font-size: 13px; color: var(--on-navy-2); }
.me .icon-btn { background: transparent; border-color: var(--navy-3); color: var(--on-navy); }

.main {
  flex: 1; min-width: 0;
  padding-block: 28px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px), 3vw);
  padding-right: max(16px, env(safe-area-inset-right, 0px), 3vw);
}
.view { display: none; flex-direction: column; gap: 18px; max-width: 1280px; margin: 0 auto; }
.view.is-on { display: flex; animation: view-in .25s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); font-size: 15.5px; max-width: 68ch; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
  box-shadow: var(--shadow);
}
.card--flush { padding: 0; gap: 0; }
.card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card__head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.card__head .muted { font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- Indicateurs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi__label { font-size: 14.5px; font-weight: 600; color: var(--muted); }
.kpi__value { font-size: 33.5px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi__note { font-size: 14px; font-weight: 500; color: var(--muted); }
.kpi--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.kpi--danger .kpi__value, .kpi--danger .kpi__note { color: var(--danger-ink); }
.kpi--ok .kpi__note { color: var(--ok-ink); }
.kpi--warn .kpi__note { color: var(--warn-ink); }

/* ---------- Bandeau d'alerte ---------- */
.alert {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--danger-bg); color: var(--danger-ink);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}
.alert__text { flex: 1 1 320px; margin: 0; font-size: 15.5px; color: var(--ink); }
.alert__text strong { color: var(--danger-ink); }
.alert--info { background: var(--brand-soft); color: var(--link); border-color: transparent; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  text-align: left; font-size: 13.5px; font-weight: 600; color: var(--muted);
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table--click tbody tr { cursor: pointer; transition: background .12s; }
.table--click tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.card .table th:first-child, .card .table td:first-child { padding-left: 20px; }
.card .table th:last-child, .card .table td:last-child { padding-right: 20px; }
.inst-cell { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.inst-cell__text { display: flex; flex-direction: column; min-width: 0; }
.inst-cell__name { font-weight: 600; color: var(--ink); background: none; border: 0; padding: 0; text-align: left; font-size: 15.5px; }
.inst-cell__cat { font-size: 14px; color: var(--muted); }
.dir { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dir svg { color: var(--faint); }
.row-new { animation: row-in 1.2s ease; }
@keyframes row-in { from { background: var(--brand-soft); } to { background: transparent; } }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }

/* ---------- Outils de filtre ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search {
  flex: 1 1 260px; max-width: 420px;
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); }
.search:focus-within { border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.chip__count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.chip.is-on { background: var(--navy); border-color: var(--navy); color: #FFFFFF; font-weight: 600; }
.chip.is-on .chip__count { color: var(--on-navy-2); }
.toolbar .select { width: auto; min-height: 42px; }

/* ---------- Graphique ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--chart-grid); }
.chart .tick { fill: var(--muted); font-size: 12.5px; font-family: var(--font); }
.chart .bar { fill: var(--chart-bar); }
.chart .bar--last { fill: var(--chart-last); }
.chart .bar-label { fill: var(--ink); font-size: 13px; font-weight: 700; font-family: var(--font); }
.chart .bar:hover { fill: var(--chart-last); }

/* ---------- Santé des webhooks ---------- */
.health { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.health li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.health li:last-child { border-bottom: 0; }
.health__name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: none; border: 0; padding: 0; text-align: left; }
.health__name:hover { color: var(--link); }
.health__lat { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }

.pending { display: flex; flex-direction: column; gap: 10px; }
.pending__item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }
.pending__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pending__text strong { font-weight: 600; }

/* ---------- Fiche institution ---------- */
.back { align-self: flex-start; }
.inst-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.inst-head__text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.inst-head h1 { margin: 0; font-size: 27px; font-weight: 700; }
.inst-head__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 14.5px; }
.secret { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.secret code {
  flex: 1 1 260px; min-width: 0; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 14.5px; overflow-x: auto; white-space: nowrap;
}
.log {
  margin: 0; padding: 14px 16px; border-radius: 10px;
  background: var(--code-bg); color: var(--code-ink);
  font-family: var(--mono); font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-x: auto;
}
.log .l-ok { color: #4ADE80; }
.log .l-err { color: #F87171; }
.log .l-warn { color: #FBBF24; }
.log .l-dim { color: #7F8FB3; }
.endpoint { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.endpoint:first-of-type { border-top: 0; padding-top: 0; }
.endpoint__dir { font-size: 13.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.endpoint code { font-family: var(--mono); font-size: 14px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; overflow-x: auto; white-space: nowrap; }
.endpoint__verb { color: var(--link); font-weight: 700; margin-right: 6px; }
.mini-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini { padding: 12px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.mini__label { font-size: 13.5px; color: var(--muted); }
.mini__value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.setting:first-of-type { border-top: 0; padding-top: 0; }
.setting__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setting__text strong { font-weight: 600; }
.setting__text span { font-size: 14px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; font-size: 14.5px; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .who { color: var(--muted); font-size: 13.5px; }

/* ---------- Relais ---------- */
.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--ink); font-size: 14.5px;
}
.note svg { color: var(--link); margin-top: 1px; }
.queue { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); }
.queue__text { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.queue__big { font-size: 24.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 500; }
.live__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--ok); animation: pulse 1.6s infinite; }
.live.is-paused .live__dot { background: var(--faint); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Paramètres ---------- */
.segmented { display: inline-flex; padding: 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.segmented button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; font-size: 14.5px; font-weight: 500; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 31, 107, .14); }
.admin { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.admin:first-of-type { border-top: 0; padding-top: 0; }
.admin__av { width: 36px; height: 36px; border-radius: 999px; background: var(--brand-soft); color: var(--link); font-weight: 700; font-size: 14px; display: grid; place-items: center; flex: none; }
.admin__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin__text strong { font-weight: 600; }
.admin__text span { font-size: 14px; color: var(--muted); }
.invite { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.invite .input { flex: 1 1 200px; }
.invite .select { flex: 0 1 200px; }
.decisions { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: d; }
.decisions li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.decisions li::before { counter-increment: d; content: counter(d); width: 24px; height: 24px; border-radius: 999px; background: var(--brand-soft); color: var(--link); font-size: 13.5px; font-weight: 700; display: grid; place-items: center; }
.decisions strong { font-weight: 600; display: block; }
.decisions span { font-size: 14px; color: var(--muted); }

/* ---------- Utilisateurs ---------- */
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.role {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
}
.role__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 17px; }
.invite .input[type="text"] { flex: 1 1 180px; }

/* ---------- États des services ---------- */
.status-banner {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid transparent;
}
.status-banner div { display: flex; flex-direction: column; gap: 2px; }
.status-banner strong { font-size: 17px; }
.status-banner span { color: var(--ink); }
.status-banner--ok { background: var(--ok-bg); color: var(--ok-ink); }
.status-banner--warn { background: var(--warn-bg); color: var(--warn-ink); }
.status-banner--danger { background: var(--danger-bg); color: var(--danger-ink); }
.svc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.svc {
  display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(160px, 1fr) 110px 120px 140px;
  align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.svc:last-child { border-bottom: 0; }
.svc__text { display: flex; flex-direction: column; min-width: 0; }
.svc__text strong { font-weight: 600; }
.svc__bars { display: flex; gap: 2px; align-items: center; min-width: 0; }
.svc__num { display: flex; flex-direction: column; font-weight: 700; font-variant-numeric: tabular-nums; }
.svc__num .small { font-weight: 400; }
.svc__pill { justify-self: end; }
.svc-day { display: inline-block; flex: 1 1 0; max-width: 8px; min-width: 3px; height: 26px; border-radius: 2px; background: var(--ok); }
.svc-day--degraded { background: var(--warn); }
.svc-day--down { background: var(--danger); }
.svc-day--maintenance { background: var(--link); }
.svc-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.svc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.svc-legend .svc-day { width: 8px; height: 12px; flex: none; }

/* ---------- Profil ---------- */
.profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile__av { width: 68px; height: 68px; border-radius: 999px; background: var(--brand); color: #FFFFFF; font-size: 24px; font-weight: 700; display: grid; place-items: center; flex: none; }
.profile__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.profile__text h2 { margin: 0; font-size: 22px; }
.segmented button { display: inline-flex; align-items: center; gap: 6px; }

/* ==========================================================
   FENÊTRES : assistant d'inscription et confirmation
   ========================================================== */
.modal {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.modal__backdrop { position: absolute; inset: 0; border: 0; background: rgba(0, 20, 63, .5); animation: fade .2s; }
.modal__panel {
  position: relative; width: 100%; max-width: 640px; max-height: 100%;
  overflow-y: auto; background: var(--surface); border-radius: 18px;
  display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 10, 40, .35);
  animation: rise .25s ease;
}
.modal__panel--sm { max-width: 460px; }
.modal__head { padding: 20px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal__head h2 { margin: 0; font-size: 21.5px; font-weight: 700; }
.modal__body { padding: 18px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal__foot { padding: 16px 24px 22px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.modal__foot .spacer { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.steps { list-style: none; margin: 0; padding: 0 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.steps li { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.steps li::before { content: ""; height: 4px; border-radius: 999px; background: var(--line); }
.steps li.is-done::before, .steps li.is-on::before { background: var(--brand); }
.steps li.is-on { color: var(--ink); }
.choice-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px;
  border: 1px solid var(--line); cursor: pointer; font-size: 14.5px;
}
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { margin-top: 3px; accent-color: var(--brand); }
.choice strong { display: block; font-size: 15.5px; font-weight: 600; margin-bottom: 2px; }
.choice span { color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15.5px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.check span span { display: block; font-size: 14px; color: var(--muted); }
.summary { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 60; max-width: min(520px, calc(100% - 32px));
  background: #1F2937; color: #FFFFFF; padding: 12px 18px; border-radius: 12px;
  font-size: 15.5px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  display: flex; gap: 10px; align-items: center;
  animation: toast-in .25s ease;
}
.toast svg { color: #4ADE80; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ==========================================================
   ÉCRANS PLUS ÉTROITS
   ========================================================== */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roles { grid-template-columns: minmax(0, 1fr); }
  .svc { grid-template-columns: minmax(0, 1fr) auto; }
  .svc__bars { grid-column: 1 / -1; order: 5; }
  .svc__num { display: none; }
  .grid-2, .grid-2--even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto; flex: none;
    flex-direction: row; align-items: center; gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  }
  .side__brand .side__tag, .side__foot .env, .me__text { display: none; }
  .side__nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .side__nav::-webkit-scrollbar { display: none; }
  .nav-btn { flex: none; min-height: 38px; font-size: 14.5px; }
  .nav-btn.is-on { box-shadow: none; }
  .nav-btn svg { display: none; }
  .side__foot { margin: 0; flex-direction: row; }
  .me { padding: 0; }
  .main { padding-block: 20px 40px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .side__brand .side__name { display: none; }
  .choice-group, .mini-kpis { grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .summary dd { margin-bottom: 8px; }
  .steps li { font-size: 0; }
  .page-head h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Intégration Laravel : pages en aperçu ---------- */
.note--demo { background: var(--warn-bg); color: var(--warn-ink); }
.note--demo svg { color: var(--warn-ink); }

/* ---------- Connexion : afficher / masquer le mot de passe ---------- */
.password { position: relative; display: block; }
.password .input { padding-right: 46px; }
.password__toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.password__toggle:hover { background: var(--surface-2); color: var(--ink); }
.password__toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
#forgot-form { display: flex; flex-direction: column; gap: 14px; }
#forgot-form[hidden] { display: none; }

/* ---------- Pagination des listes ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 20px; border-top: 1px solid var(--line); }
.pager:empty { display: none; }
.pager__info { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.pager__nav { display: flex; align-items: center; gap: 10px; }
.pager__count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Boutons d'action d'une ligne : passent à la ligne plutôt que d'élargir le tableau */
.row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }

/* Filtres du flux des relais (à l'intérieur de la carte) */
.relay-filters { padding: 0 20px 12px; }
.relay-filters .search { flex: 1 1 260px; }

/* ---------- Pages Blade : la navigation et les actions sont des liens <a> ---------- */
a.nav-btn, a.btn, a.link, .me__link, .card a { text-decoration: none; }
a.nav-btn, .me__link { color: var(--on-navy); }
.card p a:not(.btn) { color: var(--link); font-weight: 600; }
.card p a:not(.btn):hover { text-decoration: underline; }
.inline-form { display: inline; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; }
.card__foot { padding: 12px 20px; border-top: 1px solid var(--line); }

/* ==========================================================
   HABILLAGE DE LA CONSOLE (pages Blade, body.console)
   Profondeur douce, barre latérale en dégradé, cartes et
   indicateurs raffinés. Couleurs : charte ALIBORA ci-dessus.
   ========================================================== */
:root {
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px -12px rgba(0, 31, 107, .14);
  --shadow-lift: 0 2px 6px rgba(16, 24, 40, .06), 0 22px 40px -18px rgba(0, 31, 107, .28);
  --ring: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent);
  --page-glow: rgba(0, 61, 165, .09);
  --page-glow-2: rgba(47, 99, 208, .06);
  --side-bg: linear-gradient(180deg, #002B85 0%, #001D63 48%, #001246 100%);
  --hairline: color-mix(in srgb, var(--line) 80%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070F26; --surface: #0D1A3A; --surface-2: #112145; --line: #1F3160; --line-soft: #172A55;
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 30px -14px rgba(0, 0, 0, .7);
    --shadow-lift: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 24px 44px -18px rgba(0, 0, 0, .8);
    --page-glow: rgba(47, 99, 208, .20);
    --page-glow-2: rgba(143, 178, 245, .07);
    --side-bg: linear-gradient(180deg, #071645 0%, #050F33 55%, #030A24 100%);
  }
}
:root[data-theme="dark"] {
  --bg: #070F26; --surface: #0D1A3A; --surface-2: #112145; --line: #1F3160; --line-soft: #172A55;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 30px -14px rgba(0, 0, 0, .7);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 24px 44px -18px rgba(0, 0, 0, .8);
  --page-glow: rgba(47, 99, 208, .20);
  --page-glow-2: rgba(143, 178, 245, .07);
  --side-bg: linear-gradient(180deg, #071645 0%, #050F33 55%, #030A24 100%);
}

/* ----- Fond de page : halo discret en haut à droite ----- */
body.console {
  background:
    radial-gradient(1100px 520px at 100% -8%, var(--page-glow), transparent 62%),
    radial-gradient(800px 460px at 20% -12%, var(--page-glow-2), transparent 58%),
    var(--bg);
  background-attachment: fixed;
}

/* ----- Barre latérale ----- */
.console .side {
  background: var(--side-bg);
  border-right: 1px solid rgba(255, 255, 255, .06);
  gap: 18px; overflow: hidden;
}
.console .side::before {
  content: ""; position: absolute; inset: -120px -80px auto auto; width: 320px; height: 320px;
  background: radial-gradient(closest-side, rgba(96, 148, 255, .35), transparent);
  pointer-events: none;
}
.console .side > * { position: relative; }
.console .side__mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #4C86FF 0%, #003DA5 100%);
  box-shadow: 0 6px 18px -6px rgba(76, 134, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.console .side__name { font-size: 19px; letter-spacing: -.01em; }
.console .side__tag { font-size: 12.5px; letter-spacing: .02em; }
.console .side__nav { gap: 2px; overflow-y: auto; scrollbar-width: none; }
.console .side__nav::-webkit-scrollbar { display: none; }
.side__section {
  margin: 14px 12px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: color-mix(in srgb, var(--on-navy-2) 85%, transparent);
}
.side__section:first-child { margin-top: 4px; }
.console .nav-btn {
  position: relative; min-height: 40px; font-size: 15px; color: color-mix(in srgb, var(--on-navy) 88%, transparent);
  transition: background .18s, color .18s, transform .18s;
}
.console .nav-btn svg { opacity: .8; transition: opacity .18s; }
.console .nav-btn:hover { background: rgba(255, 255, 255, .07); color: #FFFFFF; }
.console .nav-btn:hover svg { opacity: 1; }
.console .nav-btn.is-on {
  background: linear-gradient(90deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05));
  color: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10);
}
.console .nav-btn.is-on svg { opacity: 1; color: #9CC0FF; }
.console .nav-btn.is-on::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #8DB6FF, #4C86FF); box-shadow: 0 0 12px rgba(76, 134, 255, .9);
}
.console .side__foot { padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.console .me__av {
  background: linear-gradient(135deg, #FFFFFF, #DCE7FF); box-shadow: 0 0 0 2px rgba(255, 255, 255, .18);
}
.console .side .icon-btn {
  background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: var(--on-navy);
  transition: background .15s, border-color .15s;
}
.console .side .icon-btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); }

/* ----- Contenu : largeur confortable, apparition douce ----- */
.console .main { padding-block: 18px 56px; }
.console .main > .topbar, .console .main > .view { max-width: 1280px; margin-inline: auto; }
.console .view.is-on { gap: 22px; animation: console-in .4s cubic-bezier(.2, .7, .2, 1); }
@keyframes console-in { from { opacity: 0; transform: translateY(10px); } }

/* ----- Barre supérieure ----- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 22px; padding: 8px 8px 8px 16px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid var(--hairline); border-radius: 14px;
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  box-shadow: var(--shadow);
  position: sticky; top: 12px; z-index: 10;
}
.crumbs { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); min-width: 0; }
.crumbs svg { opacity: .6; }
.crumbs strong { color: var(--ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__end { display: flex; align-items: center; gap: 8px; }
.chip-time {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--hairline);
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.chip-time__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.console .topbar .icon-btn { border-color: var(--hairline); background: var(--surface); transition: border-color .15s, transform .15s; }
.console .topbar .icon-btn:hover { border-color: var(--brand); transform: rotate(-12deg); }

/* ----- En-tête de page ----- */
.console .page-head { align-items: center; }
.console .page-head h1 {
  font-size: 32px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15;
  background: linear-gradient(180deg, var(--ink) 30%, color-mix(in srgb, var(--ink) 70%, var(--brand)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.console .page-head .sub { font-size: 15px; margin-top: 6px; }

/* ----- Boutons ----- */
.console .btn { border-radius: 11px; transition: background .18s, border-color .18s, box-shadow .18s, transform .18s; }
.console .btn--primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 82%, #FFFFFF) 0%, var(--brand) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 20px -8px color-mix(in srgb, var(--brand) 75%, transparent);
}
.console .btn--primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 14px 26px -10px color-mix(in srgb, var(--brand) 85%, transparent); }
.console .btn--ghost, .console .btn--danger { background: var(--surface); border-color: var(--line); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.console .btn--ghost:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); color: var(--link); }
.console .btn--danger:hover { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }

/* ----- Cartes ----- */
.console .card {
  border-color: var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, transparent), var(--surface));
}
.console .card__head h2 { font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.console .card--flush > .card__head { border-bottom: 1px solid var(--line-soft); }

/* ----- Indicateurs ----- */
.console .kpis { gap: 16px; }
.console .kpi {
  --tone: var(--brand);
  border-color: var(--hairline); border-radius: var(--radius); padding: 18px 20px 18px;
  gap: 4px; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.console .kpi::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 25%, transparent));
}
.console .kpi::after {
  content: ""; position: absolute; right: -40px; bottom: -60px; width: 160px; height: 160px; border-radius: 999px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tone) 7%, transparent), transparent);
  pointer-events: none;
}
.console .kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--tone) 35%, var(--line)); }
.console .kpi--ok { --tone: var(--ok); }
.console .kpi--warn { --tone: var(--warn); }
.console .kpi--danger { --tone: var(--danger); }
.kpi__icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 8px;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 22%, transparent);
}
.console .kpi__label { font-size: 13.5px; font-weight: 650; letter-spacing: .01em; }
.console .kpi__value { font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0; }

/* ----- Tableaux ----- */
.console .table { font-size: 14.5px; }
.console .table th {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  padding-block: 12px; position: sticky; top: 0; z-index: 1;
}
.console .table td { padding-block: 13px; border-bottom-color: var(--line-soft); }
.console .table tbody tr { transition: background .12s; }
.console .table tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.console .table .mono { color: var(--muted); font-size: 13.5px; }

/* ----- Pastilles ----- */
.console .pill {
  padding: 3px 10px 3px 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .01em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent);
}
.console .pill__dot { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent); }

/* ----- Formulaires et notes ----- */
.console .input, .console .select, .console .textarea { border-radius: 11px; border-color: var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.console .input:hover, .console .select:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.console .input:focus, .console .select:focus, .console .textarea:focus { box-shadow: var(--ring); }
.console .note {
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
  background: linear-gradient(90deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 40%, transparent));
}

/* ----- Responsive : barre supérieure compacte ----- */
@media (max-width: 900px) {
  .console .side::before, .side__section, .console .nav-btn.is-on::before { display: none; }
  .console .side { border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .console .side__foot { padding-top: 0; border-top: 0; }
  .topbar { position: static; }
  .chip-time { display: none; }
}
@media (max-width: 560px) {
  .console .page-head h1 { font-size: 26px; }
  .console .kpi__value { font-size: 30px; }
}

/* ---------- Graphique « Messages relayés » (tableau de bord) ---------- */
/* Couleurs vérifiées (validateur dataviz) : #3B6FD4 sur fond clair, #5B8CF0 sur fond sombre */
:root { --bar: #3B6FD4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bar: #5B8CF0; } }
:root[data-theme="dark"] { --bar: #5B8CF0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.chart-card .card__head { align-items: flex-start; }
.chart-sum { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.chart-sum__item { display: inline-flex; align-items: baseline; gap: 8px; }
.chart-sum__value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }

.bars { position: relative; height: 262px; margin: 4px 0 4px; padding: 22px 0 26px 44px; }
.bars__grid { position: absolute; inset: 22px 0 26px 44px; }
.bars__tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); }
.bars__tick:first-child { border-top-color: var(--line); }
.bars__tick span { position: absolute; right: calc(100% + 10px); top: -9px; font-size: 12px; color: var(--faint); white-space: nowrap; }
.bars__cols { position: relative; height: 100%; display: flex; align-items: stretch; }
.bars__col {
  position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center;
  border-radius: 8px; outline: none; cursor: default;
}
.bars__col:hover, .bars__col:focus-visible { background: color-mix(in srgb, var(--bar) 7%, transparent); }
.bars__col:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bar) 55%, transparent); }
/* Barre : 24 px max, extrémité arrondie de 4 px, base carrée ; jours passés atténués, aujourd'hui en plein */
.bars__bar {
  position: relative; width: min(24px, 62%); min-height: 2px; border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--bar) 42%, var(--surface));
  transition: background .15s, height .6s cubic-bezier(.2, .7, .2, 1);
}
.bars__col:hover .bars__bar, .bars__col:focus-visible .bars__bar { background: color-mix(in srgb, var(--bar) 70%, var(--surface)); }
.bars__col.is-today .bars__bar { background: var(--bar); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--bar) 80%, transparent); }
.bars__val { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.bars__x { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--faint); white-space: nowrap; }
.bars__col.is-today .bars__x { color: var(--ink); font-weight: 700; }
/* Info-bulle au survol ou au focus clavier */
.bars__tip {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translate(-50%, 4px); z-index: 3;
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; white-space: nowrap;
  background: var(--ink); color: var(--surface); font-size: 13px; box-shadow: var(--shadow-lift);
  opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s;
}
.bars__tip strong { font-size: 16px; }
.bars__tip span { opacity: .75; text-transform: capitalize; }
.bars__col:hover .bars__tip, .bars__col:focus-visible .bars__tip { opacity: 1; transform: translate(-50%, 0); }
.bars__col:first-child .bars__tip { left: 0; transform: translate(0, 4px); }
.bars__col:first-child:hover .bars__tip, .bars__col:first-child:focus-visible .bars__tip { transform: translate(0, 0); }
.bars__col:last-child .bars__tip { left: auto; right: 0; transform: translate(0, 4px); }
.bars__col:last-child:hover .bars__tip, .bars__col:last-child:focus-visible .bars__tip { transform: translate(0, 0); }

.empty-state { display: flex; align-items: center; gap: 14px; padding: 22px 4px; }
.empty-state p { margin: 0; }
.empty-state__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }

/* ---------- Filtres du flux des relais ---------- */
.filters { display: flex; flex-direction: column; gap: 12px; padding: 4px 20px 16px; border-bottom: 1px solid var(--line-soft); }
.filters .search { flex: 1 1 260px; }
.filters .toolbar--split { justify-content: space-between; }
.console .chip { transition: background .15s, border-color .15s, color .15s; }
.console .chip:hover:not(.is-on) { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.console .chip.is-on { background: var(--brand); border-color: var(--brand); box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--brand) 80%, transparent); }
.console .chip.is-on .chip__count { color: color-mix(in srgb, #FFFFFF 78%, transparent); }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat-strip__item {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
}
.stat-strip__label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.stat-strip__value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.stat-strip__item.is-warn { background: var(--warn-bg); border-color: transparent; }
.stat-strip__item.is-warn .stat-strip__value { color: var(--warn-ink); }
.stat-strip__item.is-danger { background: var(--danger-bg); border-color: transparent; }
.stat-strip__item.is-danger .stat-strip__value { color: var(--danger-ink); }

@media (max-width: 900px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bars { height: 222px; padding-left: 36px; }
  .bars__grid { left: 36px; }
  .bars__x { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .bars__bar { transition: none; } }

/* ---------- Petits plus de la console : états vides, tri, direct, notifications, synthèse ---------- */
.console .table td.empty { padding: 34px 20px; font-size: 15px; }
.empty__icon {
  width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-soft);
}
.console .table td.empty .link { display: inline; margin-left: 4px; }

/* Tri par colonne : en-tête cliquable, flèche selon aria-sort */
.th-sort {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; border-radius: 6px;
}
.th-sort::after { content: "↕"; font-size: 11px; opacity: .45; letter-spacing: 0; }
.th-sort:hover { color: var(--ink); }
.th-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--link); }
th[aria-sort="ascending"] .th-sort::after { content: "↑"; opacity: 1; }
th[aria-sort="descending"] .th-sort::after { content: "↓"; opacity: 1; }
th.num .th-sort { flex-direction: row-reverse; }

/* Interrupteur « En direct » */
.live-toggle {
  display: inline-flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.live-toggle:has(.switch:checked) { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.live-toggle .switch:checked { background: var(--ok); }
.live-toggle [data-autorefresh-label]:empty { display: none; }

/* Notifications */
.console .toast { border-radius: 14px; padding: 12px 18px 12px 14px; background: color-mix(in srgb, #0B1430 92%, var(--brand)); box-shadow: var(--shadow-lift); }
.toast--alert svg { color: #FBBF24; }

/* Bandeau de synthèse (États des services) */
.console .status-banner { border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-color: color-mix(in srgb, currentColor 22%, transparent); }
.status-banner__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, currentColor 14%, transparent); flex: none; }
.console .status-banner span:not(.status-banner__icon) { color: var(--ink); opacity: .85; }

/* Avatar sigle dans l'annuaire */
.console #inst-table .seal { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent); font-weight: 800; }
.console #inst-table .inst-cell__cat { font-size: 13.5px; color: var(--muted); }
.console .input-row .icon-btn { width: 42px; height: 42px; border-radius: 11px; flex: none; }
.console .input-row .icon-btn:hover { border-color: var(--brand); color: var(--link); }
/* Webhook éditable dans l'annuaire : champ souple, boutons compacts */
.webhook-row { min-width: 300px; }
.webhook-row .input { min-width: 150px; }
.console #inst-table td { padding-inline: 12px; }
.console #inst-table .inst-cell { min-width: 220px; }

/* Profil administrateur : identité + changement de mot de passe */
.profile-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; margin: 0 0 18px; }
.profile-facts dt { color: var(--muted); font-size: 13px; }
.profile-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.profile-password { display: grid; gap: 14px; max-width: 460px; }
.profile-password .btn { justify-self: start; }
.profile-password .error { margin: -6px 0 0; }
