/* =========================================================================
   Phenix — interface d'administration
   Thème sombre par défaut, thème clair via [data-theme="light"].
   ========================================================================= */
:root {
  --bg: #0b1020; --side: #0d1326; --surface: #121a2f; --surface-2: #18213a; --surface-3: #202a47;
  --border: #222c48; --border-2: #2c3859;
  --text: #e7eaf3; --muted: #8a94b2; --faint: #5d6889;
  --accent: #6366f1; --accent-2: #8b5cf6; --accent-ink: #ffffff;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --ok: #22c55e; --ok-bg: rgba(34,197,94,.13); --warn: #f59e0b; --warn-bg: rgba(245,158,11,.14);
  --err: #f43f5e; --err-bg: rgba(244,63,94,.14); --info: #38bdf8; --info-bg: rgba(56,189,248,.13);
  --violet: #a78bfa; --violet-bg: rgba(139,92,246,.16); --blue: #60a5fa; --blue-bg: rgba(96,165,250,.14);
  --cyan: #22d3ee; --cyan-bg: rgba(34,211,238,.13);
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 12px 32px -18px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.02) inset;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5fb; --side: #0f172a; --surface: #ffffff; --surface-2: #f4f6fb; --surface-3: #e9edf7;
  --border: #e3e7f1; --border-2: #d5dbea;
  --text: #121729; --muted: #5f6881; --faint: #98a0b8;
  --ok: #16a34a; --ok-bg: #e6f7ec; --warn: #b45309; --warn-bg: #fff3dc;
  --err: #e11d48; --err-bg: #ffe8ed; --info: #0284c7; --info-bg: #e3f3fd;
  --violet: #7c3aed; --violet-bg: #f1eaff; --blue: #2563eb; --blue-bg: #e7efff; --cyan: #0891b2; --cyan-bg: #e0f7fb;
  --shadow: 0 10px 30px -18px rgba(15,23,42,.25);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14.5px/1.55 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1 { font-size: 1.55rem; margin: 0; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 1rem; margin: 0 0 14px; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .85rem; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
::selection { background: rgba(99,102,241,.35); }

/* ------------------------------------------------------------------ Cadre */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side); color: #c3cae0; position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,.05);
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 20px 18px 14px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 1.12rem; color: #fff; text-decoration: none; letter-spacing: -.01em; }
.brand.big { color: var(--text); font-size: 1.6rem; justify-content: center; }
.logo { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); display: inline-block; flex: none;
  box-shadow: 0 6px 18px -6px rgba(99,102,241,.8); position: relative; }
.logo::after { content: ""; position: absolute; inset: 9px 9px 9px 11px; background: #fff; clip-path: polygon(0 0, 100% 50%, 0 100%); border-radius: 2px; }
.brand-img { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; background: #fff; flex: none; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #5f6a8c; font-weight: 700; padding: 16px 12px 6px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 9px 12px; border-radius: 10px;
  color: #aeb6cf; font-weight: 550; position: relative; transition: background .15s, color .15s;
}
.side-nav a .ic { width: 19px; height: 19px; opacity: .85; }
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a[aria-current="page"] { background: linear-gradient(90deg, rgba(99,102,241,.28), rgba(139,92,246,.10)); color: #fff; }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.side-nav a[aria-current="page"] .ic { opacity: 1; color: #c7c9ff; }
.nav-badge { margin-left: auto; background: var(--ok); color: #04210f; font-size: .7rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.side-credits { margin: 0 14px 18px; padding: 14px 16px; border-radius: 12px; background: linear-gradient(135deg, rgba(99,102,241,.22), rgba(139,92,246,.12));
  border: 1px solid rgba(139,92,246,.25); display: flex; align-items: baseline; gap: 8px; }
.side-credits strong { font-size: 1.5rem; color: #fff; }
.icon-btn.menu-close, .icon-btn.menu-btn, .backdrop { display: none; }

.page { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
.crumb .sep { color: var(--faint); }
.top-search { margin-left: auto; position: relative; width: min(320px, 32vw); }
.top-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search input { padding-left: 38px; background: var(--surface); border-radius: 999px; height: 38px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 999px; text-decoration: none;
  background: var(--ok-bg); color: var(--ok); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-pill .muted { color: inherit; opacity: .75; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.icon-btn:hover { border-color: var(--border-2); background: var(--surface-2); }
.user { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.user form { margin: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--grad); flex: none; }
.user-name { font-weight: 650; line-height: 1.2; white-space: nowrap; }
.user-name .sub { font-size: .75rem; }

.main { padding: 28px 28px 70px; min-width: 0; max-width: 1500px; width: 100%; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ Cartes, grilles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 22px; }
.card > .head { margin-bottom: 14px; }
.card > .head h2 { margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; margin-bottom: 22px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.narrow { max-width: 820px; }

/* ------------------------------------------------------------------ Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ic v" "ic l"; column-gap: 14px; align-items: center;
  position: relative; overflow: hidden; text-decoration: none; color: inherit; transition: transform .15s, border-color .15s;
}
a.kpi:hover { transform: translateY(-2px); border-color: var(--border-2); }
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: currentColor; opacity: .05; pointer-events: none; }
.kpi-ic { grid-area: ic; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.kpi-ic .ic { width: 22px; height: 22px; }
.kpi-v { grid-area: v; font-size: 1.65rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.15; }
.kpi-v small { font-size: .95rem; font-weight: 600; }
.kpi-l { grid-area: l; color: var(--muted); font-size: .84rem; }
.kpi.violet { color: var(--violet); } .kpi.violet .kpi-ic { background: var(--violet-bg); color: var(--violet); }
.kpi.blue { color: var(--blue); } .kpi.blue .kpi-ic { background: var(--blue-bg); color: var(--blue); }
.kpi.cyan { color: var(--cyan); } .kpi.cyan .kpi-ic { background: var(--cyan-bg); color: var(--cyan); }
.kpi.green { color: var(--ok); } .kpi.green .kpi-ic { background: var(--ok-bg); color: var(--ok); }
.kpi.amber { color: var(--warn); } .kpi.amber .kpi-ic { background: var(--warn-bg); color: var(--warn); }
.kpi.red { color: var(--err); } .kpi.red .kpi-ic { background: var(--err-bg); color: var(--err); }
.kpi .kpi-v, .kpi .kpi-l { color: var(--text); } .kpi .kpi-l { color: var(--muted); }
.kpis.compact .kpi { padding: 14px 16px; } .kpis.compact .kpi-ic { width: 40px; height: 40px; } .kpis.compact .kpi-v { font-size: 1.35rem; }

/* Graphiques */
.chart { position: relative; height: 230px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--faint); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.alt { stroke: var(--cyan); stroke-width: 1.6; stroke-dasharray: 4 4; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .l-a { background: var(--accent); } .chart-legend .l-b { background: var(--cyan); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 170px; height: 170px; flex: none; }
.donut circle { fill: none; stroke-width: 4.2; }
.donut .track { stroke: var(--surface-3); }
.donut .seg.ok { stroke: var(--ok); } .donut .seg.warn { stroke: var(--warn); } .donut .seg.err { stroke: var(--err); } .donut .seg.muted { stroke: var(--faint); }
.donut text { fill: var(--text); font-weight: 800; font-size: 7px; text-anchor: middle; }
.donut text.lbl { fill: var(--muted); font-weight: 600; font-size: 3px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 160px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend li strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend i.ok { background: var(--ok); } .legend i.warn { background: var(--warn); } .legend i.err { background: var(--err); } .legend i.muted { background: var(--faint); }

/* ------------------------------------------------------------------ Formulaires */
.form { display: flex; flex-direction: column; gap: 18px; }
label { display: block; font-weight: 600; font-size: .9rem; }
label > input, label > select, label > textarea, label > .quick { display: block; margin-top: 7px; }
label > .quick { display: flex; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; width: 100%; font-weight: normal; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover, select:hover { border-color: var(--border-2); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.22); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.short { max-width: 200px; }
.check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 600; }
.check input { margin-top: 4px; display: inline-block; }
.check .sub { font-weight: normal; }
.checks { display: flex; flex-direction: column; gap: 10px; }
details.adv { border: 1px dashed var(--border-2); border-radius: var(--radius-sm); padding: 12px 16px; }
details.adv[open] { display: flex; flex-direction: column; gap: 14px; }
details.adv summary { cursor: pointer; font-weight: 650; color: var(--muted); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: .82rem; line-height: 1.55; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-weight: 550; }
.chip:hover { border-color: var(--accent); }
.search { display: flex; gap: 10px; margin-bottom: 18px; max-width: 560px; align-items: flex-end; }
.search > .inline-form { flex: 1; }
.conn-search { max-width: 820px; flex-wrap: wrap; }
.conn-search input[name=q] { flex: 1 1 260px; min-width: 0; }
.conn-search select { flex: 0 1 220px; min-width: 0; }
.seen-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.seen-list .badge { white-space: normal; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0 10px; }
.geo-form h3, #geo h3 { margin: 18px 0 8px; font-size: 1rem; }
.geo-countries { max-height: 280px; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.conn-end { min-width: 160px; max-width: 280px; }
.geo { display: block; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field .label { font-weight: 600; font-size: .9rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; max-height: 360px; overflow: auto; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.checkgrid .check { font-weight: 500; }
fieldset.manual { border: 1px dashed var(--border-2); border-radius: var(--radius-sm); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; margin: 0; }
fieldset.manual legend { padding: 0 6px; font-weight: 650; color: var(--muted); font-size: .88rem; }
fieldset.manual[hidden] { display: none; }
.inline-form { display: flex; gap: 8px; flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
form.inline-form > input { flex: 1 1 160px; width: auto; min-width: 0; }
td > form.inline-form { flex-wrap: nowrap; align-items: center; }
td > form.inline-form > input { padding: 7px 10px; }
.inline-form label { flex: 1 1 200px; }
.inline-form label.short { flex: 0 0 110px; }
.howto { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 4px; background: var(--surface-2); }
.howto summary { cursor: pointer; font-weight: 650; }
.howto ul, .howto ol { margin: 10px 0 0; padding-left: 20px; }
.howto li { margin-bottom: 6px; }

/* ------------------------------------------------------------------ Boutons */
.btn {
  font: inherit; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm);
  padding: 9px 16px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -10px rgba(99,102,241,.9); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 10px 24px -10px rgba(99,102,241,1); }
.btn.danger { color: var(--err); background: var(--err-bg); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--err) 22%, transparent); }
.btn.small { padding: 5px 11px; font-size: .82rem; border-radius: 8px; }
.btn.wide { width: 100%; padding: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 8px; text-align: left; }
.inline { display: inline; }
.danger-zone { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ Tableaux */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.tbl th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700;
  padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl th:first-child { border-top-left-radius: 10px; } .tbl th:last-child { border-top-right-radius: 10px; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions .btn + .btn, .tbl .actions .inline { margin-left: 4px; }
.tbl tr.dim td { opacity: .5; }
.tbl a { text-decoration: none; } .tbl a:hover strong { color: var(--accent); }
.name { display: flex; align-items: center; gap: 10px; }
.ch-logo { width: 30px; height: 30px; object-fit: contain; border-radius: 8px; background: var(--surface-2); }
.vod-cover { width: 34px; height: 50px; object-fit: cover; border-radius: 6px; background: var(--surface-2); flex: none; }
.pager { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.pager .muted { margin-right: auto; }
.catgroup { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.catgroup summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.catgroup .checkgrid { margin-top: 8px; }
.err-text { color: var(--err); font-size: .85rem; display: block; min-width: 180px; max-width: 320px; }
.tbl td.nowrap, .tbl td.nowrap .sub { white-space: nowrap; }
.tbl td.ch { min-width: 150px; }
.tbl td.content { min-width: 200px; max-width: 360px; }
.more td { text-align: center; color: var(--muted); }
.sub { display: block; color: var(--muted); font-size: .8rem; font-weight: normal; }
.tbl td.neg { color: var(--err); font-weight: 700; }
.tbl td.pos { color: var(--ok); font-weight: 700; }

/* ------------------------------------------------------------------ Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); white-space: nowrap; text-transform: none;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.off { background: var(--surface-3); }
.badge[data-state="direct"], .badge[data-user="actif"], .badge[data-code="utilisé"], .badge[data-role="diffusée"] { background: var(--ok-bg); color: var(--ok); }
.badge[data-state="connexion"], .badge[data-state="reconnexion"], .badge[data-user="expiré"], .badge[data-role="test de retour"], .badge[data-role="recherche"] { background: var(--warn-bg); color: var(--warn); }
.badge[data-user="désactivé"], .badge[data-code="révoqué"], .badge[data-role="écartée"], .badge[data-state="en panne"] { background: var(--err-bg); color: var(--err); }
.badge[data-code="disponible"], .badge[data-role="secours chaud"] { background: var(--info-bg); color: var(--info); }
.badge[data-state="direct"]::before { animation: pulse 1.6s infinite; }
.badge.q.ok { background: var(--ok-bg); color: var(--ok); }
.badge.q.warn { background: var(--warn-bg); color: var(--warn); }
.badge.q.err { background: var(--err-bg); color: var(--err); }
.badge.q.err::before { animation: pulse 1s infinite; }
.qsum { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .badge::before, .dot { animation: none !important; } }

/* ------------------------------------------------------------------ Messages */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin: 0 0 20px; font-weight: 600; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.err { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.empty { text-align: center; padding: 40px 12px; }
.empty p { margin: 0 0 10px; }
.ok-text { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 700; }

/* ------------------------------------------------------------------ Onglets */
.tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; margin: 0 0 16px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tabs a { text-decoration: none; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 650; font-size: .88rem; }
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a[aria-current="page"] { background: var(--grad); color: #fff; }
.tabs .count { font-weight: 700; margin-left: 6px; font-variant-numeric: tabular-nums; padding: 0 7px; border-radius: 999px; background: rgba(255,255,255,.12); }

/* ------------------------------------------------------------------ Analyse de source, détails */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 22px; align-items: start; }
.split > .card { margin-bottom: 0; }
.probe-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: -6px; }
.probe h2 { margin-bottom: 12px; }
.probe .verdict { font-weight: 750; margin: 0 0 12px; }
.probe .verdict.ok { color: var(--ok); } .probe .verdict.bad { color: var(--err); }
.probe ul { margin: 8px 0 0; padding-left: 18px; } .probe li { margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.creds h2 { margin-top: 6px; }
.copy { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; min-width: 0; }
.kv .copy { margin: 0; }
.copy code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; font-size: .86rem; }
.tbl tr.detail > td { background: var(--surface-2); padding: 14px 16px 18px; }
.sub-tbl { font-size: .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.sub-tbl th, .sub-tbl td { padding: 8px 10px; }
.sub-tbl tr.on td { background: var(--ok-bg); }
.detail h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 6px; }
.history { margin: 0; padding-left: 18px; font-size: .85rem; } .history li { margin-bottom: 3px; }
.big-number { font-size: 2.2rem; font-weight: 800; margin: 0; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.codes-box pre { margin: 0 0 14px; max-height: 320px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; font-size: 1.05rem; letter-spacing: .06em; line-height: 1.7; }
code.code { font-size: .95rem; letter-spacing: .05em; }
.form-actions.top { margin-top: 14px; }
.spaced { margin-top: 22px; }
.credits-pill { padding: 5px 11px; border-radius: 999px; background: var(--violet-bg); color: var(--violet); font-weight: 800; font-size: .85rem; }

/* ------------------------------------------------------------------ Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(900px 500px at 15% 10%, rgba(99,102,241,.25), transparent 60%), radial-gradient(800px 500px at 90% 90%, rgba(139,92,246,.18), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; padding: 32px 30px; }
.login-card p { margin: -6px 0 4px; text-align: center; }

/* ------------------------------------------------------------------ Actions en masse, ordre */
.check-col { width: 2.6rem; text-align: center; }
.check-col input { width: 1.05rem; height: 1.05rem; cursor: pointer; }
.bulk { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 10px 14px; margin-bottom: 16px;
  background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: 12px; transition: background .15s, border-color .15s; }
.bulk.active { background: linear-gradient(90deg, rgba(99,102,241,.16), rgba(139,92,246,.08)); border: 1px solid rgba(99,102,241,.45); }
.bulk-count { font-weight: 700; min-width: 11em; }
.bulk .inline-form { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; }
.bulk .inline-form select, .bulk .inline-form input { margin: 0; width: auto; min-width: 170px; padding: 7px 10px; }
.bulk [hidden] { display: none !important; }
.order-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.order-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: grab; }
.order-list li:hover { border-color: var(--border-2); }
.order-list li.dragging { opacity: .4; border-style: dashed; }
.order-list li.dim { opacity: .55; }
.order-list .grip { color: var(--faint); letter-spacing: -2px; }
.order-list .pos { width: 2.2em; height: 2.2em; display: grid; place-items: center; border-radius: 8px; background: var(--surface-3); color: var(--muted); font-weight: 700; font-size: .82rem; font-variant-numeric: tabular-nums; }
.order-list .oname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ Tablette et téléphone */
@media (max-width: 1100px) {
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
  .user-name, .crumb { display: none; }  /* le titre est déjà dans la page */
  .top-search { margin-left: auto; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; visibility: hidden; }
  .side.open { transform: none; visibility: visible; box-shadow: 20px 0 40px rgba(0,0,0,.4); }
  .icon-btn.menu-close { display: inline-grid; background: rgba(255,255,255,.06); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 8px; }
  .icon-btn.menu-btn { display: inline-grid; }
  .backdrop { position: fixed; inset: 0; background: rgba(4,7,15,.55); z-index: 35; }
  .side.open + .backdrop { display: block; }
  .topbar { padding: 0 14px; gap: 10px; }
  .top-search { display: none; }
  .live-pill .muted { display: none; }
  .main { padding: 18px 14px 60px; }
  h1 { font-size: 1.3rem; }
  .row2, .row3, .split { grid-template-columns: 1fr; }
  .row2 > *, .row3 > *, .split > * { min-width: 0; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .card > .tbl, .card > form > .tbl, .card .tbl:not(.table-wrap .tbl) { display: block; overflow-x: auto; }
  .tbl th, .tbl td { white-space: nowrap; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px; column-gap: 10px; } .kpi-ic { width: 38px; height: 38px; } .kpi-v { font-size: 1.25rem; }
  .inline-form label, .inline-form label.short { flex: 1 1 100%; }
  .inline-form .btn { width: 100%; }
  .search { flex-direction: column; }
  .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; }
  .tabs a { white-space: nowrap; }
  .copy { flex-wrap: wrap; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .chart { height: 190px; }
  .donut { width: 140px; height: 140px; }
}

/* Support : fil des messages d'un ticket */
.msg { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 10px 0; max-width: 760px; }
.msg-admin { background: var(--surface-2); margin-left: auto; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; }

/* Tableau de bord : état du serveur */
.srv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.meter { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.meter-top span { color: var(--muted); font-size: .85rem; }
.meter-top strong { font-variant-numeric: tabular-nums; }
.meter-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--ok); transition: width .6s; }
.meter-bar i.warn { background: var(--warn); }
.meter-bar i.err { background: var(--err); }

/* Actions en masse : liste de bouquets dépliable */
.bulk-pick { position: relative; font-size: .86rem; }
.bulk-pick summary { cursor: pointer; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.bulk-pick .checkgrid { margin-top: 8px; max-height: 240px; overflow: auto; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); min-width: min(520px, 80vw); }
/* Journal d'installation d'un LB (page Serveurs) */
pre.log { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: .82rem; line-height: 1.45; max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 10px; }

/* ------------------------------------------------------------------ Serveurs (principal et LB) */
.srv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.srv-tile { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: inherit; text-decoration: none; min-width: 0; transition: border-color .2s; }
.srv-tile:hover { border-color: var(--accent); }
.srv-tile header, .srv-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.srv-tile header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-label { margin-left: auto; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.srv-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--faint); }
[data-state="online"] .srv-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
[data-state="offline"] .srv-dot { background: var(--err); box-shadow: 0 0 0 4px var(--err-bg); }
[data-state="never"] .srv-dot, [data-state="disabled"] .srv-dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.srv-role { font-size: .72rem; padding: 2px 8px; }
.srv-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.srv-cards { display: grid; gap: 20px; margin-top: 16px; }
.srv-card { display: flex; flex-direction: column; gap: 18px; scroll-margin-top: 80px; }
.srv-card[data-state="offline"] { border-color: var(--err); }
.srv-head .srv-dot { width: 12px; height: 12px; }
.srv-title { display: flex; flex-direction: column; min-width: 0; }
.srv-title h2 { margin: 0; font-size: 1.15rem; }
.srv-badge { margin-left: auto; }
[data-state="online"] .srv-badge { background: var(--ok-bg); color: var(--ok); }
[data-state="offline"] .srv-badge { background: var(--err-bg); color: var(--err); }
[data-state="never"] .srv-badge, [data-state="disabled"] .srv-badge { background: var(--warn-bg); color: var(--warn); }
.srv-gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.srv-sparks { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.spark { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.spark-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.spark-top span { color: var(--muted); font-size: .85rem; }
.spark-top strong { font-variant-numeric: tabular-nums; }
.spark svg { width: 100%; height: 46px; display: block; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-area { fill: var(--accent); opacity: .14; }
.spark.alt .spark-line { stroke: var(--violet); } .spark.alt .spark-area { fill: var(--violet); }
.spark.blue .spark-line { stroke: var(--blue); } .spark.blue .spark-area { fill: var(--blue); }
.spark.green .spark-line { stroke: var(--ok); } .spark.green .spark-area { fill: var(--ok); }
.spark-empty { height: 46px; display: grid; place-items: center; color: var(--faint); font-size: .82rem; }
.srv-kv { grid-template-columns: max-content minmax(0, 1fr); font-size: .88rem; padding-top: 14px; border-top: 1px solid var(--border); }
.srv-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
@media (min-width: 1100px) { .srv-kv { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); } }
@media (max-width: 600px) { .srv-tiles { grid-template-columns: 1fr; } .srv-head { flex-wrap: wrap; } .srv-badge { margin-left: 0; } }

/* ------------------------------------------------------------------ Choix des serveurs et bouquets d'une chaîne */
fieldset.pick { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
fieldset.pick legend { padding: 0 6px; font-weight: 600; }
fieldset.pick p { flex-basis: 100%; margin: 0; }
fieldset.pick label.check { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; margin: 0; }
fieldset.pick label.check input { width: auto; margin: 0; }
fieldset.pick { min-width: 0; }
fieldset.pick label.check { white-space: normal; flex-wrap: wrap; }

.share-places { list-style: none; margin: 0; padding: 0; }
.share-places li + li { margin-top: 4px; }

/* QR code de la commande d'ajout d'un LB */
.qr { display: block; width: 220px; max-width: 100%; height: auto; image-rendering: pixelated; background: #fff; border-radius: 8px; margin: .5rem 0; }

/* ------------------------------------------------------------------ Retouches 3.48 */
.grid-2 > * { min-width: 0; }                         /* plus de débordement des cartes côte à côte */
.card h2 + p, .card .card-head + p, .card summary + p { margin-top: -4px; }  /* titre collé à sa description */
.chart:has(.chart-empty) { height: 130px; }           /* graphique encore vide : moins de place */
.head.narrow { max-width: 820px; }                    /* « Retour » au bord du formulaire */
.users-tbl .owner, .users-tbl .bouquets, .nowrap { white-space: nowrap; }
.badges { display: inline-flex; gap: 5px; flex-wrap: wrap; align-items: center; }
/* Thème clair : boutons secondaires francs, barre d'actions en masse légère. */
:root[data-theme="light"] .btn:not(.primary):not(.danger) { background: var(--surface); border-color: var(--border-2); box-shadow: 0 1px 2px rgba(15,23,42,.06); }
:root[data-theme="light"] .btn:not(.primary):not(.danger):hover { background: var(--surface-2); border-color: var(--faint); }
:root[data-theme="light"] .chip { background: var(--surface); }
:root[data-theme="light"] .bulk { background: transparent; border-color: var(--border-2); }
/* Menu « ⋯ Plus » des cartes de serveur. */
.more { position: relative; display: inline-block; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; display: flex; flex-direction: column; gap: 4px;
  padding: 6px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: var(--shadow); }
.more-menu form { margin: 0; }
.more-menu .btn { width: 100%; justify-content: flex-start; border-color: transparent; background: transparent; box-shadow: none; }
.more-menu .btn:hover { background: var(--surface-2); }
/* Sommaire des réglages. */
.toc { position: sticky; top: 64px; z-index: 10; display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; margin: -10px 0 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.toc a { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; font-size: .85rem; font-weight: 600; color: var(--muted); }
.toc a:hover { color: var(--text); border-color: var(--accent); }
[id] { scroll-margin-top: 130px; }
/* Ajout d'un serveur : onglets de méthode. */
.method-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.method-tabs a { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border-2); text-decoration: none; font-weight: 600; font-size: .88rem; color: var(--muted); }
.method-tabs a[aria-current] { background: var(--grad); color: #fff; border-color: transparent; }
@media (max-width: 900px) {
  .crumb { display: none; }
  .live-pill { margin-left: auto; }
  .search { flex-direction: row; flex-wrap: wrap; }
  .search > * { flex: 1 1 100%; order: 2; }
  .search > input[name="q"] { flex: 1 1 0; min-width: 0; order: 0; }
  .search > button[type="submit"] { flex: none; order: 1; width: auto; }

}
.card h3 { font-size: .95rem; margin: 0 0 12px; }
.srv-sparks + .srv-gauges { margin-top: 16px; }

/* =========================================================================
   Finition « premium » (3.49) : profondeur, lumière, typographie, rythme.
   Couche posée par-dessus le reste : on peut la retirer d'un bloc.
   ========================================================================= */
:root {
  --bg: #080c18; --side: #0a0f1f; --surface: #10172b; --surface-2: #151d35; --surface-3: #1d2744;
  --border: rgba(148,163,214,.10); --border-2: rgba(148,163,214,.18);
  --text: #eef0f8; --muted: #8f98b8; --faint: #5b6585;
  --radius: 16px; --radius-sm: 11px;
  --hl: inset 0 1px 0 rgba(255,255,255,.045);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 18px 40px -24px rgba(0,0,0,.8);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.35), 0 28px 60px -28px rgba(0,0,0,.9);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --glow: 0 10px 30px -12px rgba(124,92,255,.75);
}
:root[data-theme="light"] {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #f6f7fb; --surface-3: #eceff7;
  --border: rgba(15,23,42,.08); --border-2: rgba(15,23,42,.14);
  --text: #0f1424; --muted: #5d6680; --faint: #9aa2b8;
  --hl: inset 0 1px 0 rgba(255,255,255,.9);
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 12px 32px -20px rgba(15,23,42,.22);
  --shadow-lg: 0 2px 4px rgba(15,23,42,.06), 0 24px 50px -24px rgba(15,23,42,.3);
  --glow: 0 10px 26px -12px rgba(99,102,241,.6);
}
body {
  font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; text-rendering: optimizeLegibility; letter-spacing: -.003em;
  background:
    radial-gradient(1200px 520px at 78% -8%, rgba(124,92,255,.13), transparent 60%),
    radial-gradient(900px 480px at -10% 30%, rgba(56,189,248,.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-theme="light"] body {
  background: radial-gradient(1100px 480px at 80% -10%, rgba(124,92,255,.08), transparent 60%), var(--bg); background-attachment: fixed;
}
h1 { font-size: 1.7rem; font-weight: 760; letter-spacing: -.028em; }
h2 { font-size: 1.02rem; font-weight: 680; letter-spacing: -.014em; }
.head { margin-bottom: 26px; }
.head p.muted { font-size: .88rem; }

/* Barres de défilement discrètes. */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }

/* Menu latéral : verre sombre, élément actif lumineux. */
.side {
  background: linear-gradient(180deg, #0c1224 0%, #090d1b 100%);
  border-right: 1px solid rgba(148,163,214,.08); box-shadow: inset -1px 0 0 rgba(255,255,255,.02);
}
.side-top { padding: 22px 20px 16px; }
.logo { box-shadow: 0 8px 22px -6px rgba(124,92,255,.9), inset 0 1px 0 rgba(255,255,255,.35); }
.nav-group { color: #4f5a7c; font-size: .66rem; letter-spacing: .14em; padding: 18px 12px 7px; }
.side-nav a { padding: 9px 12px; color: #a3abc6; font-weight: 560; font-size: .92rem; }
.side-nav a .ic { opacity: .7; transition: opacity .15s, color .15s; }
.side-nav a:hover { background: rgba(148,163,214,.07); }
.side-nav a:hover .ic { opacity: 1; }
.side-nav a[aria-current="page"] {
  background: linear-gradient(90deg, rgba(124,92,255,.24), rgba(124,92,255,.06));
  box-shadow: inset 0 0 0 1px rgba(139,120,255,.22), 0 6px 18px -10px rgba(124,92,255,.7);
}
.side-nav a[aria-current="page"]::before { left: -12px; top: 9px; bottom: 9px; box-shadow: 0 0 12px rgba(139,92,246,.9); }
.side-nav a[aria-current="page"] .ic { color: #b9b4ff; }
.side-credits { box-shadow: var(--hl), 0 10px 30px -18px rgba(124,92,255,.8); }

/* Barre du haut : verre. */
.topbar {
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.top-search input { background: var(--surface-2); border-color: var(--border); box-shadow: var(--hl); }
.icon-btn { background: var(--surface-2); border-color: var(--border); box-shadow: var(--hl); transition: background .15s, border-color .15s; }
.icon-btn:hover { border-color: var(--border-2); background: var(--surface-3); }
.avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px rgba(139,92,246,.55); }
.live-pill { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 28%, transparent); }

/* Cartes : reflet, bord fin, ombre en couches. */
.card, .kpi {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 97%, white) 0%, var(--surface) 60%);
  border: 1px solid var(--border); box-shadow: var(--hl), var(--shadow);
}
:root[data-theme="light"] .card, :root[data-theme="light"] .kpi { background: var(--surface); }
.card { padding: 24px; }
.card-head { margin-bottom: 16px; }

/* Indicateurs : 4 par rangée sur grand écran, 2 sinon ; halo de couleur. */
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1250px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 18px 18px 17px; transition: transform .18s, border-color .18s, box-shadow .18s; }
a.kpi:hover { transform: translateY(-2px); border-color: color-mix(in srgb, currentColor 35%, var(--border)); box-shadow: var(--hl), var(--shadow-lg); }
.kpi::after { right: -50px; top: -60px; width: 160px; height: 160px; opacity: .1; filter: blur(30px); }
.kpi-ic { border-radius: 13px; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
.kpi-v { font-size: 1.75rem; font-weight: 780; letter-spacing: -.035em; }
.kpi-l { font-size: .82rem; line-height: 1.35; }
.kpis.compact .kpi-v { font-size: 1.4rem; }

/* Boutons : hauteur commune, reflet, primaire lumineux. */
.btn {
  min-height: 38px; padding: 8px 16px; border-radius: 11px; font-weight: 640; letter-spacing: -.005em;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2)); border: 1px solid var(--border-2); box-shadow: var(--hl), 0 1px 2px rgba(0,0,0,.25);
}
.btn:hover { background: var(--surface-3); border-color: color-mix(in srgb, var(--accent) 35%, var(--border-2)); }
.btn.primary {
  background: linear-gradient(135deg, #6d6cf6 0%, #8b5cf6 55%, #a35cf0 100%); border-color: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), var(--glow);
}
.btn.primary:hover { filter: brightness(1.07) saturate(1.05); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 14px 32px -12px rgba(124,92,255,.9); }
.btn.danger { background: var(--err-bg); box-shadow: none; }
.btn.small { min-height: 30px; padding: 4px 11px; border-radius: 9px; }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible { outline: none; box-shadow: var(--ring); }
:root[data-theme="light"] .btn:not(.primary):not(.danger) { background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.07); }

/* Champs : creusés, anneau au focus. */
input, textarea, select {
  background-color: color-mix(in srgb, var(--bg) 55%, var(--surface-2)); border-color: var(--border-2);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.25); border-radius: 11px;
}
:root[data-theme="light"] input, :root[data-theme="light"] textarea, :root[data-theme="light"] select { background-color: #fff; box-shadow: inset 0 1px 2px rgba(15,23,42,.05); }
input:focus, textarea:focus, select:focus { border-color: color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: var(--ring); }
select:not([multiple]) { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f98b8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type="checkbox"], input[type="radio"] { box-shadow: none; }
label { font-weight: 620; font-size: .88rem; }

/* Tableaux : en-tête léger, lignes aérées, survol doux. */
.tbl th { background: transparent; color: var(--faint); font-size: .68rem; letter-spacing: .1em; padding: 11px 12px; border-bottom: 1px solid var(--border-2); }
.tbl td { padding: 13px 12px; border-bottom: 1px solid var(--border); }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tbl tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }

/* Badges : liseré de la même teinte. */
.badge { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }

/* Onglets et messages. */
.tabs { background: var(--surface-2); box-shadow: var(--hl); border-color: var(--border); }
.tabs a[aria-current="page"], .method-tabs a[aria-current] { box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 6px 16px -8px rgba(124,92,255,.8); }
.flash { border-radius: 12px; }

/* Cartes de serveur et tuiles. */
.srv-tile { background: var(--surface-2); box-shadow: var(--hl); transition: border-color .15s, transform .15s; }
.srv-tile:hover { border-color: var(--border-2); transform: translateY(-1px); }
.srv-card[data-state="online"] { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--ok) 70%, transparent), var(--hl), var(--shadow); }
.srv-card[data-state="offline"] { border-color: color-mix(in srgb, var(--err) 45%, var(--border)); }

/* Connexion. */
.login-card { box-shadow: var(--hl), var(--shadow-lg); }

@media (max-width: 900px) { .card { padding: 16px; } h1 { font-size: 1.35rem; } }
@media (max-width: 900px) { .card-head { flex-wrap: wrap; } .card-head > .muted { order: 3; flex-basis: 100%; } }

/* Tableau de bord : 5 indicateurs de tout le réseau ; le débit coupé en deux (sortie / entrée). */
.kpis.five { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.7fr); }
.kpis.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-l .sub { display: block; font-size: .74rem; }
.kpi-split { grid-template-columns: auto 1fr 1fr; grid-template-areas: "ic a b"; }
.kpi-split > div { display: flex; flex-direction: column; min-width: 0; }
.kpi-split > div + div { border-left: 1px solid var(--border); padding-left: 12px; }
.kpi-split .kpi-v { font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1250px) { .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis.five .kpi-split { grid-column: 1 / -1; } }
@media (max-width: 600px) { .kpis.five, .kpis.compact { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ Menu latéral premium (3.64) */
.side {
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(124,92,255,.20), transparent 60%),
    radial-gradient(90% 50% at 100% 100%, rgba(34,211,238,.10), transparent 65%),
    linear-gradient(180deg, #0b1022 0%, #070a17 100%);
  border-right: 1px solid rgba(148,163,214,.09);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.03), 12px 0 40px -30px rgba(124,92,255,.6);
}
.side::before { /* liseré lumineux qui respire */
  content: ""; position: absolute; top: 0; right: -1px; width: 1px; height: 100%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(139,120,255,.7) 30%, rgba(34,211,238,.5) 70%, transparent);
  opacity: .45; animation: side-breathe 6s ease-in-out infinite;
}
@keyframes side-breathe { 50% { opacity: .9; } }
.side-top { position: relative; }
.side-top::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 4px; height: 1px; background: linear-gradient(90deg, transparent, rgba(148,163,214,.18), transparent); }
.brand .logo { animation: logo-glow 4s ease-in-out infinite; }
@keyframes logo-glow { 50% { box-shadow: 0 8px 28px -4px rgba(124,92,255,1), inset 0 1px 0 rgba(255,255,255,.4); } }
.side-nav > * { flex-shrink: 0; }
.side-nav { scrollbar-width: thin; scrollbar-color: rgba(148,163,214,.15) transparent; padding-bottom: 22px; }
.nav-group { display: flex; align-items: center; gap: 10px; color: #56628a; }
.nav-group::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(148,163,214,.16), transparent); }

.side-nav a, .nav-sub > summary {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; position: relative; overflow: hidden;
  color: #a3abc6; font-weight: 560; font-size: .92rem; text-decoration: none; cursor: pointer; isolation: isolate;
  transition: color .2s, background .25s, transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.side-nav a .ic, .nav-sub > summary .ic { transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .2s, color .2s; }
/* reflet qui traverse l'élément au survol */
.side-nav a::after, .nav-sub > summary::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.07) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .6s ease;
}
.side-nav a:hover, .nav-sub > summary:hover { color: #fff; background: rgba(148,163,214,.08); transform: translateX(3px); }
.side-nav a:hover::after, .nav-sub > summary:hover::after { transform: translateX(120%); }
.side-nav a:hover .ic, .nav-sub > summary:hover .ic { opacity: 1; transform: scale(1.14) rotate(-4deg); color: #d4d0ff; }
.side-nav a:active { transform: translateX(3px) scale(.98); }
.side-nav a:focus-visible, .nav-sub > summary:focus-visible { outline: 2px solid rgba(139,120,255,.8); outline-offset: 1px; }

.side-nav a[aria-current="page"] {
  color: #fff; transform: none;
  background: linear-gradient(90deg, rgba(124,92,255,.32), rgba(99,102,241,.10) 70%, transparent);
  box-shadow: inset 0 0 0 1px rgba(139,120,255,.28), 0 8px 24px -12px rgba(124,92,255,.9);
}
.side-nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #a78bfa, #22d3ee); box-shadow: 0 0 14px rgba(139,92,246,1);
  animation: nav-bar-in .45s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes nav-bar-in { from { transform: scaleY(0); opacity: 0; } }
.side-nav a[aria-current="page"] .ic { opacity: 1; color: #c4b5fd; filter: drop-shadow(0 0 6px rgba(167,139,250,.7)); }

/* Sous-menu Users */
.nav-sub > summary { list-style: none; }
.nav-sub > summary::-webkit-details-marker { display: none; }
.nav-sub > summary .ic:last-child { margin-left: auto; width: 15px; height: 15px; opacity: .55; transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .2s; }
.nav-sub[open] > summary .ic:last-child { transform: rotate(90deg); opacity: 1; }
.nav-sub > summary.has-current { color: #fff; }
.nav-sub > summary.has-current .ic:first-child { color: #c4b5fd; opacity: 1; }
.nav-sub-list { position: relative; display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 21px; padding-left: 12px; }
.nav-sub-list::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px; background: linear-gradient(180deg, rgba(139,120,255,.5), rgba(148,163,214,.08)); }
.nav-sub[open] .nav-sub-list > a { animation: nav-sub-in .35s cubic-bezier(.2,.8,.2,1) both; }
.nav-sub[open] .nav-sub-list > a:nth-child(2) { animation-delay: .04s; }
.nav-sub[open] .nav-sub-list > a:nth-child(3) { animation-delay: .08s; }
.nav-sub[open] .nav-sub-list > a:nth-child(4) { animation-delay: .12s; }
.nav-sub[open] .nav-sub-list > a:nth-child(5) { animation-delay: .16s; }
@keyframes nav-sub-in { from { opacity: 0; transform: translateX(-8px); } }
.nav-sub-list a { padding: 7px 10px; font-size: .87rem; }
.nav-sub-list a .ic { width: 16px; height: 16px; }
.nav-sub-list a[aria-current="page"]::before { left: -13px; }
/* Épisodes : rattaché aux séries */
.side-nav a.nav-child { margin-left: 21px; padding-left: 12px; font-size: .87rem; }
.side-nav a.nav-child::before { content: ""; position: absolute; left: 0; top: -2px; height: 50%; width: 8px; border-left: 1px solid rgba(148,163,214,.25); border-bottom: 1px solid rgba(148,163,214,.25); border-bottom-left-radius: 6px; background: none; box-shadow: none; animation: none; }
.side-nav a.nav-child[aria-current="page"]::before { border-color: #a78bfa; }

.nav-badge { box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: badge-pulse 2.4s ease-out infinite; }
@keyframes badge-pulse { 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* Arrivée du menu (une fois par session) */
.side.intro .side-nav > * { animation: nav-in .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes nav-in { from { opacity: 0; transform: translateX(-14px); } }

@media (prefers-reduced-motion: reduce) {
  .side::before, .brand .logo, .nav-badge, .side.intro .side-nav > *, .nav-sub[open] .nav-sub-list > a, .side-nav a[aria-current="page"]::before { animation: none; }
  .side-nav a, .nav-sub > summary, .side-nav a::after { transition: none; }
}
.nav-badge.down { background: var(--err); color: #fff; animation-name: badge-pulse-red; }
@keyframes badge-pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.6); } 70% { box-shadow: 0 0 0 7px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
