/* freeQoS - interface d'administration.

   Langage visuel inspire des applications Apple : police systeme, grands
   titres, cartes arrondies sans cadre, barre laterale translucide, controles
   en pilule. Theme clair ET sombre, qui suit le systeme sauf choix contraire
   (bouton en bas de la barre laterale).

   Aucune dependance externe : pas de police ni d'icone a telecharger, le
   controleur doit rester utilisable sur une VM de management sans internet. */

/* ================================================================ jetons */
:root {
  color-scheme: light;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e9e9ee;
  --fill: rgba(118, 118, 128, .12);
  --fill-strong: rgba(118, 118, 128, .2);
  --border: rgba(60, 60, 67, .12);
  --border-strong: rgba(60, 60, 67, .22);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #8e8e93;

  /* Bleu = descendant (le routeur emet vers l'abonne, tx).
     Orange = montant (le routeur recoit de l'abonne, rx). */
  --down: #0a84ff;
  --down-dim: rgba(10, 132, 255, .12);
  --up: #ff9500;
  --up-dim: rgba(255, 149, 0, .14);

  --ok: #28a745;
  --warn: #d98e04;
  --crit: #e5342a;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-dim: rgba(0, 113, 227, .1);
  --purple: #8e44d6;
  --seg-active: #ffffff;

  --sidebar-bg: rgba(246, 246, 248, .78);
  --topbar-bg: rgba(255, 255, 255, .78);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .06), 0 18px 48px rgba(0, 0, 0, .12);

  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 236px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "Segoe UI", Roboto, Inter, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-3: #3a3a3c;
    --fill: rgba(118, 118, 128, .24);
    --fill-strong: rgba(118, 118, 128, .36);
    --border: rgba(84, 84, 88, .55);
    --border-strong: rgba(120, 120, 128, .6);
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --faint: #8d8d93;
    --down: #409cff;
    --down-dim: rgba(64, 156, 255, .18);
    --up: #ff9f0a;
    --up-dim: rgba(255, 159, 10, .2);
    --ok: #30d158;
    --warn: #ffd60a;
    --crit: #ff453a;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-dim: rgba(10, 132, 255, .18);
    --purple: #bf5af2;
    --seg-active: #636366;
    --sidebar-bg: rgba(28, 28, 30, .72);
    --topbar-bg: rgba(22, 22, 24, .72);
    --shadow: 0 0 0 1px rgba(255, 255, 255, .05);
    --shadow-lift: 0 0 0 1px rgba(255, 255, 255, .08), 0 24px 60px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --fill: rgba(118, 118, 128, .24);
  --fill-strong: rgba(118, 118, 128, .36);
  --border: rgba(84, 84, 88, .55);
  --border-strong: rgba(120, 120, 128, .6);
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --faint: #8d8d93;
  --down: #409cff;
  --down-dim: rgba(64, 156, 255, .18);
  --up: #ff9f0a;
  --up-dim: rgba(255, 159, 10, .2);
  --ok: #30d158;
  --warn: #ffd60a;
  --crit: #ff453a;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-dim: rgba(10, 132, 255, .18);
  --purple: #bf5af2;
  --seg-active: #636366;
  --sidebar-bg: rgba(28, 28, 30, .72);
  --topbar-bg: rgba(22, 22, 24, .72);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .05);
  --shadow-lift: 0 0 0 1px rgba(255, 255, 255, .08), 0 24px 60px rgba(0, 0, 0, .6);
}

/* ================================================================== base */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.47 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, .login { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }

/* ======================================================= barre laterale
   Sur grand ecran, la navigation est une colonne translucide a gauche, comme
   dans Reglages ou Musique ; elle redevient une barre horizontale en dessous
   de 1000 px (voir la fin du fichier). */
header.top {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
  width: var(--sidebar);
  display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.25rem .85rem 1rem;
  background: var(--sidebar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 0 .55rem;
  font-size: 1.2rem; font-weight: 700; letter-spacing: -.025em;
}
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(10, 132, 255, .35);
}
.brand .logo svg { width: 18px; height: 18px; }
.brand .dot {
  width: 8px; height: 8px; border-radius: 50%; margin-left: auto;
  background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}
.brand .dot.stale { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.brand .dot.down  { background: var(--crit); box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 22%, transparent); }

nav.tabs { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
nav.tabs a {
  display: flex; align-items: center; gap: .7rem;
  padding: .5rem .6rem; border-radius: 9px;
  color: var(--text); font-size: .9rem; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
nav.tabs a svg {
  width: 19px; height: 19px; flex: 0 0 auto;
  stroke: var(--accent); fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
nav.tabs a:hover { background: var(--fill); text-decoration: none; }
nav.tabs a.active { background: var(--accent); color: #fff; }
nav.tabs a.active svg { stroke: #fff; }

.sidebar-foot {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6rem .55rem 0; border-top: 1px solid var(--border);
  font-size: .75rem; color: var(--faint);
}
.theme-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--fill); border: 0; color: var(--muted);
  border-radius: 999px; padding: .28rem .7rem; font-size: .75rem;
}
.theme-toggle:hover:not(:disabled) { background: var(--fill-strong); color: var(--text); }

.mode {
  font-size: .74rem; color: var(--muted); font-family: var(--font);
  background: var(--fill); border-radius: 999px; padding: .22rem .7rem;
  white-space: nowrap; font-weight: 500;
}
.mode:empty { display: none; }

/* ============================================================== contenu */
main {
  margin-left: var(--sidebar);
  padding: 2rem 2.5rem 4rem;
  max-width: calc(1680px + var(--sidebar));
}
#app-error[hidden] { display: none; }

.page-head { margin-bottom: .55rem; }
.page-head h1 {
  margin: 0; font-size: 2.1rem; line-height: 1.12; font-weight: 700; letter-spacing: -.03em;
}

/* --------------------------------------------------------- barre de page
   Collee en haut au defilement : nom de la page (quand le grand titre a
   disparu), sommaire des sections, etat du direct. Sa hauteur ne change pas
   quand elle se colle : rien ne saute sous le doigt. */
.page-bar-sentinel { height: 1px; margin-bottom: -1px; }
.page-bar {
  position: sticky; top: var(--topbar-h, 0px); z-index: 25;
  display: flex; align-items: center; gap: .75rem; min-height: 2.6rem;
  margin: 0 -2.5rem 1.2rem; padding: .45rem 2.5rem;
  border-bottom: 1px solid transparent;
  transition: background .2s ease, border-color .2s ease;
}
.page-bar.stuck {
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: var(--border);
}
.pb-title {
  flex: 0 0 auto; font-weight: 700; font-size: 1rem; letter-spacing: -.02em;
  max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap;
  transition: max-width .25s ease, opacity .2s ease;
}
.page-bar.stuck .pb-title { max-width: 14rem; opacity: 1; }
.page-toc {
  flex: 1 1 auto; min-width: 0; display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.page-toc::-webkit-scrollbar { display: none; }
.page-toc:empty { -webkit-mask-image: none; mask-image: none; }
.page-toc a {
  flex: 0 0 auto; padding: .26rem .7rem; border-radius: 999px;
  font-size: .78rem; font-weight: 500; color: var(--muted); white-space: nowrap;
  text-decoration: none; transition: background .15s ease, color .15s ease;
}
.page-toc a:hover { background: var(--fill); color: var(--text); text-decoration: none; }
.page-toc a.active { background: var(--accent-dim); color: var(--accent); }
.pb-tools { flex: 0 0 auto; margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.live {
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
  font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.live.live i { background: var(--ok); animation: pouls 2s ease-in-out infinite; }
.live.pause i, .live.still i { background: var(--faint); }
.live.wait i { background: var(--accent); animation: pouls 1s ease-in-out infinite; }
.live.err { color: var(--crit); }
.live.err i { background: var(--crit); }
@keyframes pouls {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 0%, transparent); opacity: 1; }
  50% { opacity: .45; }
}
.pb-refresh { width: 2rem; height: 2rem; padding: 0; display: grid; place-items: center; }
.pb-refresh svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pb-refresh.is-busy svg { display: none; }
/* Un titre de section vise depuis le sommaire s'arrete SOUS la barre. */
main h2 { scroll-margin-top: calc(var(--topbar-h, 0px) + 4.2rem); }

section { display: none; }
section.active { display: block; animation: apparition .25s ease; }
@keyframes apparition { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h2 {
  font-size: 1.15rem; font-weight: 650; letter-spacing: -.02em;
  color: var(--text); margin: 2.4rem 0 .85rem;
}
h2:first-child { margin-top: 0; }
h3 { letter-spacing: -.015em; }

/* =============================================================== cartes */
.card {
  background: var(--surface); border: 0;
  border-radius: var(--radius); padding: 1.15rem 1.3rem;
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 1rem; }
.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
/* Le tableau des gros consommateurs a six colonnes, les backhauls trois
   jauges : partager la largeur a parts egales cachait l'upload et la latence. */
.dash-split { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
@media (max-width: 1280px) { .dash-split { grid-template-columns: minmax(0, 1fr); } }
/* Un enfant de grille ne s'elargit jamais au-dela de sa colonne : sans cela un
   tableau large poussait toute la page hors de l'ecran sur mobile, au lieu de
   defiler dans son cadre. */
.grid > * { min-width: 0; }

.stat .label {
  font-size: .8rem; color: var(--muted); font-weight: 500; margin-bottom: .35rem;
}
.stat .value {
  font-size: 2rem; font-weight: 650; line-height: 1.08; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stat .value .unit { font-size: .9rem; font-weight: 500; color: var(--muted); margin-left: .25rem; letter-spacing: 0; }
.stat .sub { font-size: .78rem; color: var(--faint); margin-top: .4rem; }
.stat.down .value { color: var(--down); }
.stat.up .value { color: var(--up); }
.stat.warn .value { color: var(--warn); }

/* ======================================================= points de mesure */
.vantage-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 1rem; }
.vantage {
  display: grid; gap: .85rem;
  background: var(--surface); border-radius: var(--radius); padding: 1.15rem 1.3rem;
  box-shadow: var(--shadow); border: 2px solid transparent;
}
.vantage.counting { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.vantage-head { display: flex; align-items: center; gap: .7rem; }
.vantage-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-dim); color: var(--accent);
}
.vantage-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vantage-title { font-weight: 650; font-size: 1rem; }
.vantage-title .hint { margin: .1rem 0 0; font-weight: 400; font-size: .78rem; letter-spacing: 0; }
.vantage-head .badge { margin-left: auto; }
.vantage-figures { display: flex; gap: 1.6rem; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.vantage-figures div { display: grid; gap: .1rem; }
.vantage-figures span { font-size: .75rem; color: var(--muted); }
.vantage-figures b { font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; }
.vantage-figures .d b { color: var(--down); }
.vantage-figures .u b { color: var(--up); }
.vantage-note { font-size: .8rem; color: var(--muted); }

/* ======================================================= controle segmente */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--fill); border-radius: 10px;
}
.segmented button {
  background: transparent; border: 0; color: var(--text);
  border-radius: 8px; padding: .32rem .9rem; font-size: .82rem; font-weight: 500;
}
.segmented button:hover:not(:disabled) { background: var(--fill); }
.segmented button.active {
  background: var(--seg-active); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04);
}

/* =============================================================== graphe */
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: .6rem; flex-wrap: wrap; gap: .5rem;
}
.legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: .35rem; }
.legend .d i { background: var(--down); }
.legend .u i { background: var(--up); }
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--faint); font-size: 10px; font-family: var(--font); }
.chart .zero { stroke: var(--border-strong); stroke-width: 1; }
.chart .hover-line { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--surface); color: var(--text);
  border-radius: 10px; padding: .55rem .75rem; font-size: .78rem;
  box-shadow: var(--shadow-lift); white-space: nowrap;
}
.tooltip .t { color: var(--faint); margin-bottom: .3rem; }
.tooltip .row { display: flex; gap: .9rem; justify-content: space-between; }
.tooltip .row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }

/* =============================================================== tables */
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
/* Pas de position:sticky ici : dans un conteneur a overflow, l'en-tete se
   detachait et recouvrait la premiere ligne. */
thead th {
  text-align: left; font-size: .75rem; font-weight: 600;
  color: var(--muted); padding: .7rem .9rem .55rem;
  border-bottom: 1px solid var(--border); background: var(--surface);
  white-space: nowrap;
}
tbody td { padding: .62rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--fill); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Un identifiant ou un nom de PoP coupe sur deux lignes ("NAS-" / "FRANCOPHONIE")
   ne se lit plus : ces cellules restent sur une ligne, le tableau defile. */
td.login, td.nowrap, .nowrap { white-space: nowrap; }
th.num { text-align: right; }
.table-wrap {
  overflow-x: auto; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.table-wrap + form, .table-wrap + .card, .table-wrap + .toolbar,
.table-wrap + .actions, .table-wrap + .table-wrap { margin-top: 1.1rem; }

/* =============================================================== jauges */
.meter { display: flex; align-items: center; gap: .55rem; min-width: 150px; }
.meter .track {
  flex: 1; height: 6px; border-radius: 999px; background: var(--fill);
  overflow: hidden; min-width: 60px;
}
.meter .fill { height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.meter .fill.down { background: var(--down); }
.meter .fill.up { background: var(--up); }
.meter .fill.ok { background: var(--ok); }
.meter .fill.warn { background: var(--warn); }
.meter .fill.crit { background: var(--crit); }
.meter .pct { font-size: .75rem; color: var(--muted); width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* ========================================================= arbre (liste) */
.node { margin-bottom: 1rem; }
.node-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.node-title { font-weight: 650; display: flex; align-items: center; gap: .5rem; }
.node-title .host { font-family: var(--mono); font-size: .76rem; color: var(--faint); font-weight: 400; }
.node-metrics { display: flex; gap: 1.4rem; font-size: .82rem; font-variant-numeric: tabular-nums; }
.node-metrics .d { color: var(--down); }
.node-metrics .u { color: var(--up); }
.children { margin: .9rem 0 0; padding: .9rem 0 0 1.1rem; border-top: 1px solid var(--border); }
.child {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem 0; flex-wrap: wrap;
}
.child + .child { border-top: 1px solid var(--border); }
.child .name { font-size: .86rem; display: flex; align-items: center; gap: .5rem; }

/* =============================================================== badges */
.badge {
  display: inline-block; padding: .14rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: 0;
  color: var(--muted); background: var(--fill); white-space: nowrap;
}
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.badge.crit { color: var(--crit); background: color-mix(in srgb, var(--crit) 13%, transparent); }
.badge.file { color: var(--accent); background: var(--accent-dim); }

.flag { font-size: 1.05em; line-height: 1; margin-right: .25rem; }
.geo { font-size: .76rem; color: var(--muted); }

/* ========================================================== formulaires */
form.stack { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.field .help { font-size: .75rem; color: var(--faint); }
input, select, textarea {
  background: var(--fill); border: 1px solid transparent; color: var(--text);
  border-radius: var(--radius-sm); padding: .55rem .75rem;
  font: inherit; font-size: .9rem; width: 100%;
  transition: box-shadow .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
input[type=checkbox] { width: auto; accent-color: var(--accent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }

button {
  background: var(--fill); border: 0; color: var(--accent);
  border-radius: 999px; padding: .5rem 1.05rem;
  font: inherit; font-size: .86rem; font-weight: 550; cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease, box-shadow .15s ease;
}
button:hover:not(:disabled) { background: var(--fill-strong); }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.danger { color: var(--crit); background: color-mix(in srgb, var(--crit) 11%, transparent); }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--crit) 18%, transparent); }
button.sm { padding: .3rem .75rem; font-size: .78rem; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
/* Un champ et son unite cote a cote (debit + kbps/Mbps/Gbps). */
.inline { display: flex; gap: .45rem; align-items: center; }
textarea { resize: vertical; font-family: var(--mono); font-size: .84rem; }
select[multiple] { height: auto; padding: .35rem; }

/* Une liste deroulante doit se distinguer d'un champ de saisie. Le chevron est
   ecrit en SVG dans la feuille de style : rien a aller chercher sur internet. */
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center;
  background-size: 10px 6px;
  padding-right: 2.1rem;
  cursor: pointer;
}
select[multiple] { background-image: none; padding-right: .6rem; cursor: auto; }

/* ====================================================== fiche d'une adresse */
.ip-card {
  border-radius: var(--radius); padding: 1.2rem 1.3rem;
  background: var(--surface); margin-top: 1rem; box-shadow: var(--shadow);
}
.ip-card h3 { margin: 0 0 .8rem; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.ip-card h3 .ip-close { margin-left: auto; font-size: 1.1rem; line-height: 1; padding: .2rem .55rem; }
.ip-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem 1.2rem; }
.ip-facts div { font-size: .86rem; }
.ip-facts span { display: block; color: var(--muted); font-size: .74rem; margin-bottom: .1rem; }

/* ============================================================= bandeaux */
.notice {
  border-radius: var(--radius-sm); padding: .75rem .95rem; font-size: .86rem; margin-bottom: 1rem;
  background: var(--fill); color: var(--text); border: 0;
}
.notice.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.notice.err { background: color-mix(in srgb, var(--crit) 11%, transparent); }
.notice.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.notice code { font-size: .82rem; }
/* Une precision qui SUIT une affirmation. */
.hint { color: var(--faint); font-size: .76rem; display: block; margin-top: .25rem; }
.notice .hint { color: var(--muted); margin-top: .35rem; }

.empty { color: var(--faint); font-size: .88rem; padding: 2rem 1.5rem; text-align: center; }
.toolbar { display: flex; gap: .65rem; align-items: center; margin-bottom: .9rem; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }
.toolbar input[type=search] { max-width: 280px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* =============================================================== panneau */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .32); z-index: 40;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.drawer {
  position: fixed; top: .75rem; right: .75rem; bottom: .75rem; width: min(640px, calc(100% - 1.5rem));
  background: var(--bg); border-radius: 18px; z-index: 50;
  overflow-y: auto; padding: 1.5rem; box-shadow: var(--shadow-lift);
  animation: glisse .25s cubic-bezier(.2, .8, .2, 1);
}
@keyframes glisse { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.drawer-head h3 { margin: 0; font-size: 1.3rem; font-weight: 700; }

/* ======================================================== vue executive */
.heat-row { display: flex; align-items: center; gap: .9rem; padding: .32rem 0; }
.heat-row + .heat-row { border-top: 1px solid var(--border); }
.heat-label { flex: 0 0 140px; font-size: .82rem; color: var(--muted); }
.heat-label .u { color: var(--faint); font-size: .74rem; }
.heat-cells { display: flex; gap: 2px; flex: 1; min-width: 0; }
.heat-cell { flex: 1; height: 22px; border-radius: 4px; background: var(--fill); min-width: 4px; }
.heat-cell.ok { background: var(--ok); }
.heat-cell.warn { background: var(--warn); }
.heat-cell.crit { background: var(--crit); }
.heat-cell.none { background: var(--fill); }
.heat-now { flex: 0 0 auto; font-size: .74rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.heat-unavail { flex: 1; font-size: .78rem; color: var(--faint); font-style: italic; }

.lq-panels { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 1rem; margin-bottom: 1.2rem; }
.lq-panel { min-height: 210px; }
.lq-panel h3 { margin: 0 0 .8rem; font-size: 1rem; display: flex; align-items: center; gap: .45rem; }
.lq-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.lq-table th { text-align: right; font-size: .74rem; color: var(--muted); font-weight: 600; padding: .35rem .45rem; }
.lq-table th:first-child { text-align: left; }
.lq-table td { padding: .38rem .45rem; border-top: 1px solid var(--border); }
.lq-table td:first-child { color: var(--muted); }
.lq-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Petit repere colore devant une valeur (severite). */
.sq { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .45rem; vertical-align: middle; background: var(--fill-strong); }
.sq.ok { background: var(--ok); } .sq.warn { background: var(--warn); } .sq.crit { background: var(--crit); }
.sq.none { background: var(--fill-strong); }

.lq-kv { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; font-size: .86rem; }
.lq-kv .k { color: var(--muted); }
.lq-kv .v { text-align: right; font-variant-numeric: tabular-nums; }
.lq-chips { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: .6rem; }
.lq-chips span { background: var(--surface-2); border-radius: 999px; padding: .2rem .6rem; font-size: .78rem; }
.lq-chips i { color: var(--muted); font-style: normal; }
.lq-clients tbody tr { cursor: pointer; }
.lq-clients tbody tr:hover td { background: var(--surface-2); }
.lq-clients td { font-size: .84rem; }
.mini-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--surface-2);
  vertical-align: middle; overflow: hidden; margin-right: .35rem; }
.mini-bar > span { display: block; height: 100%; background: var(--ok); }
.mini-bar.warn > span { background: var(--warn); }
.mini-bar.crit > span { background: var(--crit); }
.lq-rate { display: flex; align-items: center; gap: .45rem; margin-top: .9rem; flex-wrap: wrap; }
.lq-rate input { width: 90px; }
.lq-note { font-size: .76rem; color: var(--faint); margin-top: .7rem; }

@media (max-width: 1100px) { .lq-panels { grid-template-columns: 1fr; } }

.na { color: var(--faint); }
tr.node-row { cursor: pointer; }
tr.node-row:hover td { background: var(--fill); }
tr.sub-row td { background: color-mix(in srgb, var(--accent) 4%, transparent); font-size: .82rem; }
.expand { cursor: pointer; user-select: none; color: var(--muted); width: 1rem; display: inline-block; }

/* Jauge (compteur de vitesse) du tiroir de noeud. */
.gauge-wrap { display: flex; gap: 1rem; align-items: center; justify-content: center; }
.gauge text { fill: var(--text); font-family: var(--font); }
.gauge .track { stroke: var(--fill); }
.gauge .lbl { fill: var(--faint); font-size: 9px; }

/* Sankey : bandes de flux dessinees main. */
.sankey svg { width: 100%; display: block; }
.sankey .node rect { rx: 3; }
.sankey .flow { fill-opacity: .32; }
.sankey .flow:hover { fill-opacity: .55; }
.sankey .nlabel { fill: var(--text); font-size: 10.5px; }

/* ================================================================ boost */
.boost-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .14rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600;
  color: var(--purple); background: color-mix(in srgb, var(--purple) 14%, transparent);
  white-space: nowrap;
}
.boost-choices { display: flex; gap: .45rem; flex-wrap: wrap; }
.boost-choices button.active { background: var(--accent); color: #fff; }

/* ========================================== interrupteur (facon iOS) */
.switch { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; }
.switch input { display: none; }
.switch .rail {
  width: 51px; height: 31px; border-radius: 999px; background: var(--fill-strong);
  position: relative; transition: background .25s ease; flex: 0 0 auto;
}
.switch .rail::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16);
  transition: left .25s cubic-bezier(.2, .8, .2, 1);
}
.switch input:checked + .rail { background: #34c759; }
.switch input:checked + .rail::after { left: 22px; }
.switch .label { font-size: .88rem; }

/* ============================================ editeur d'arbre (topologie) */
.chk {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  font-size: .84rem; color: var(--muted);
}
.chk input { width: auto; }

.topo-editor { display: flex; gap: 1rem; align-items: stretch; }
/* LE CADRE SUIT LE DESSIN, ET LE QUADRILLAGE AVEC LUI : le quadrillage est
   dessine DANS le SVG, et la hauteur du cadre est posee par le rendu d'apres
   l'etendue des cases. Ce minimum ne sert qu'avant tout dessin. */
.topo-canvas {
  flex: 1; min-width: 0;
  min-height: 360px;
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}
.topo-canvas svg { display: block; touch-action: none; }
.topo-canvas .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

.topo-panel {
  flex: 0 0 270px; background: var(--surface);
  border-radius: var(--radius); padding: 1.05rem; font-size: .86rem;
  box-shadow: var(--shadow);
  align-self: flex-start;
  /* Sous la barre de page collee en haut, pas derriere elle. */
  position: sticky; top: 4rem;
  max-height: calc(100vh - 5rem); overflow: auto;
}
.topo-panel .muted { color: var(--faint); }
.topo-panel h4 { margin: 0 0 .6rem; font-size: 1rem; word-break: break-all; }
.topo-panel .kv { display: flex; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.topo-panel .kv span:last-child { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.topo-panel .stack { margin-top: .8rem; }

.topo-edge { fill: none; stroke: var(--border-strong); stroke-width: 1.6; }
.topo-edge.ok   { stroke: var(--ok); }
.topo-edge.warn { stroke: var(--warn); }
.topo-edge.crit { stroke: var(--crit); }
.topo-edge.faint { stroke: var(--border); stroke-width: 1.2; stroke-dasharray: 4 4; }
.topo-edge.forced { stroke: var(--accent); stroke-width: 1.8; stroke-dasharray: 6 3; }
.topo-edge.uncertain { stroke-dasharray: 3 4; opacity: .65; }
.export-pre {
  margin-top: .6rem; max-height: 460px; overflow: auto; padding: .8rem .9rem;
  background: var(--fill); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .76rem; line-height: 1.5; white-space: pre; color: var(--muted);
}
.topo-edge-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.topo-node.linksrc .box { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 5 3; }
.topo-edge-label { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.topo-edge-label .d { fill: var(--down); }
.topo-edge-label .u { fill: var(--up); }

.topo-node { cursor: grab; }
.topo-node.dragging { cursor: grabbing; }
.topo-node .box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; rx: 10; }
.topo-node.selected .box { stroke: var(--accent); stroke-width: 2.2; }
.topo-node.drop-target .box { stroke: var(--ok); stroke-width: 2.5; }
.topo-node.stale .box { stroke-dasharray: 5 4; opacity: .8; }
.topo-node .accent { rx: 3; }
.topo-node .title { fill: var(--text); font-size: 12px; font-weight: 650; }
.topo-node .role  { font-size: 9px; font-weight: 700; letter-spacing: .03em; }
.topo-node .meta  { fill: var(--faint); font-size: 9.5px; }

/* Les actions restent atteignables sans defiler horizontalement. */
.sticky-actions {
  position: sticky; right: 0; z-index: 1;
  background: var(--surface);
  box-shadow: -10px 0 10px -10px rgba(0, 0, 0, .25);
}

/* ================================================== blocs depliables */
details {
  margin: 1rem 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: .8rem 1.1rem;
}
details > summary {
  cursor: pointer;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex; align-items: center; gap: .55rem;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; width: 7px; height: 7px; flex: 0 0 auto;
  border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
  transform: rotate(-45deg); transition: transform .2s ease; margin-right: .1rem;
}
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover { color: var(--accent); }
details[open] > summary {
  margin-bottom: .9rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

/* Qui parle a qui : un bloc par client. La ligne de tete porte sa
   consommation ; les adresses sont dessous, depliees a la demande. */
details.flow-client { margin: .55rem 0; padding: .75rem 1.1rem; }
details.flow-client > summary {
  flex-wrap: wrap; gap: .7rem;
  font-size: .92rem; font-weight: 500;
}
.flow-client-sum {
  display: flex; gap: 1.2rem; flex-wrap: wrap;
  font-variant-numeric: tabular-nums; font-size: .84rem;
}
details.flow-client .table-wrap { margin: 0; box-shadow: none; }

/* ============================================= l'arbre, en detail */
.topo-toggle { cursor: pointer; }
.topo-toggle rect { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.topo-toggle text { fill: var(--muted); font-size: 10px; font-weight: 700; }
.topo-toggle:hover rect { stroke: var(--accent); }
.topo-toggle:hover text { fill: var(--text); }
.topo-toggle.replie rect { fill: var(--accent-dim); stroke: var(--accent); }
.topo-toggle.replie text { fill: var(--accent); }

/* Le quadrillage est peint dans le SVG : il ne capte aucun clic. */
.topo-fond { pointer-events: none; }

.topo-node .box { transition: stroke .12s ease; }
.topo-node:hover .box { stroke: var(--faint); }

.topo-legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.topo-legend .chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .74rem; color: var(--muted);
  background: var(--fill); border-radius: 999px; padding: .18rem .6rem;
}
.topo-legend .chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.toolbar .zoom { display: inline-flex; align-items: center; gap: .3rem; }
.toolbar .zoom .mode { min-width: 56px; text-align: center; }

/* ============================================================ finitions */
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* Suivre une ligne sur dix colonnes demande un repere visuel. */
tbody tr:hover td { background: color-mix(in srgb, var(--fill) 55%, transparent); }
/* Fond OPAQUE au survol, et plus specifique que ``tr.clickable:hover td`` :
   un fond translucide laissait voir la colonne qui defile dessous (le badge
   Bufferbloat superpose aux boutons Rate / Boost). */
tbody tr:hover td.sticky-actions,
tbody tr.clickable:hover td.sticky-actions { background: var(--surface-2); }

* { scrollbar-width: thin; scrollbar-color: var(--fill-strong) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--fill-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }

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

/* Saisie d'un client a IP fixe : une largeur d'oeil, des colonnes egales. */
#sc-form { max-width: 1120px; }
#sc-form .row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ======================================================= petits ecrans
   En dessous de 1000 px, la barre laterale redevient une barre du haut, et
   ses onglets defilent horizontalement plutot que de casser en deux lignes. */
@media (max-width: 1000px) {
  header.top {
    position: sticky; bottom: auto; width: auto;
    flex-direction: row; align-items: center; gap: .8rem;
    padding: .6rem 1rem;
    background: var(--topbar-bg);
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0; font-size: 1.05rem; }
  .brand .logo { width: 24px; height: 24px; border-radius: 7px; }
  .brand .dot { margin-left: .2rem; }
  nav.tabs {
    flex-direction: row; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs a { padding: .38rem .7rem; font-size: .84rem; flex: 0 0 auto; }
  nav.tabs a svg { display: none; }
  .sidebar-foot { border-top: 0; padding: 0; }
  .sidebar-foot .version { display: none; }
  main { margin-left: 0; padding: 1.3rem 1rem 3rem; }
  .page-head h1 { font-size: 1.7rem; }
  .page-bar { margin: 0 -1rem 1rem; padding: .4rem 1rem; gap: .5rem; }
  .page-bar.stuck .pb-title { display: none; }
  .topo-editor { flex-direction: column; }
  .topo-panel { flex: 1 1 auto; width: 100%; position: static; max-height: none; }
}
@media (max-width: 760px) {
  .row-2, .row-3, #sc-form .row-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .card { padding: 1rem; }
  .stat .value { font-size: 1.6rem; }
  .sidebar-foot { display: none; }
}

/* ======================================================= graphe de debit */
.chart-summary { display: flex; flex-wrap: wrap; gap: .6rem 2rem; margin: .1rem 0 .7rem; }
.chart-summary .cs { display: flex; align-items: baseline; gap: 1.1rem; flex-wrap: wrap; }
.chart-summary .cs-name { font-size: .78rem; color: var(--muted); min-width: 0; display: inline-flex; align-items: center; }
.chart-summary .cs-name i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: .4rem; }
.chart-summary .cs.d .cs-name i { background: var(--down); }
.chart-summary .cs.u .cs-name i { background: var(--up); }
.chart-summary .cs div { display: flex; flex-direction: column; }
.chart-summary .cs div span { font-size: .68rem; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.chart-summary .cs div b { font-size: .95rem; font-variant-numeric: tabular-nums; }
.chart-summary .cs.d b { color: var(--down); }
.chart-summary .cs.u b { color: var(--up); }
.chart .grid-line.v { stroke-dasharray: 2 4; }
.chart .axis-side { font-size: 10.5px; font-weight: 600; font-family: var(--font); opacity: .85; }
.chart .peak-label { font-size: 10px; font-weight: 600; font-family: var(--font); }

/* ======================================================= ecran executif */
.verdict {
  display: flex; gap: .8rem; align-items: flex-start;
  border-radius: var(--radius); padding: .95rem 1.2rem; margin-bottom: 1rem;
  background: var(--surface); box-shadow: var(--shadow); font-size: .92rem;
}
.verdict .v-dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; margin-top: .3rem; background: var(--fill-strong); }
.verdict.ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.verdict.ok .v-dot { background: var(--ok); }
.verdict.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.verdict.warn .v-dot { background: var(--warn); }
.verdict.crit { background: color-mix(in srgb, var(--crit) 10%, var(--surface)); }
.verdict.crit .v-dot { background: var(--crit); }
.verdict ul { margin: .35rem 0 0; padding: 0; list-style: none; }
.verdict li { margin: .2rem 0; }
.stat.crit .value { color: var(--crit); }
.stat .meter { margin-top: .55rem; min-width: 0; }
.qbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: .55rem; background: var(--fill); gap: 2px; }
.qbar-seg.ok { background: var(--ok); }
.qbar-seg.warn { background: var(--warn); }
.qbar-seg.crit { background: var(--crit); }
.qbar-seg.none { background: var(--fill-strong); }
.qlegend { display: flex; flex-wrap: wrap; gap: .25rem .8rem; }
.qlegend .sq, .exec-legend .sq { margin-right: .3rem; }

.exec-legend {
  display: flex; flex-wrap: wrap; gap: .35rem 1.4rem; align-items: center;
  font-size: .75rem; color: var(--muted); margin-top: .7rem;
}
.exec-legend .sq + .sq, .exec-legend span .sq:not(:first-child) { margin-left: .5rem; }
.exec-legend .hint { display: inline; margin: 0; }
.pct-hint { color: var(--faint); font-size: .74rem; font-weight: 400; }
.sel-name { color: var(--accent); text-transform: none; }

.loadbars { display: flex; flex-direction: column; gap: .15rem; }
.lb-row {
  display: grid; grid-template-columns: minmax(120px, 1.1fr) 3fr minmax(120px, auto) minmax(90px, auto);
  gap: 1rem; align-items: center; padding: .45rem 0;
}
.lb-row + .lb-row { border-top: 1px solid var(--border); }
.lb-name { font-size: .88rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lb-name a { color: var(--text); text-decoration: none; }
.lb-name a:hover { color: var(--accent); }
.lb-name .hint { font-weight: 400; margin-top: .05rem; }
.lb-track { position: relative; height: 14px; border-radius: 999px; background: var(--fill); overflow: visible; }
.lb-fill { height: 100%; border-radius: 999px; min-width: 3px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.lb-fill.ok { background: var(--ok); }
.lb-fill.warn { background: var(--warn); }
.lb-fill.crit { background: var(--crit); }
.lb-fill.none { background: var(--down); }
.lb-cap { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); opacity: .55; border-radius: 1px; }
.lb-cap-key { display: inline-block; width: 2px; height: 11px; background: var(--text); opacity: .55; margin-right: .4rem; vertical-align: middle; }
.lb-val { text-align: right; font-size: .86rem; font-variant-numeric: tabular-nums; }
.lb-val .hint { margin-top: .05rem; }
.lb-up { text-align: right; font-size: .78rem; font-variant-numeric: tabular-nums; }

.heat-axis { padding-top: .1rem; }
.heat-axis + .heat-row { border-top: 0; }
.heat-row.heat-axis { border-top: 0; }
.heat-ticks { display: flex; justify-content: space-between; flex: 1; min-width: 0; font-size: .7rem; color: var(--faint); }

@media (max-width: 760px) {
  .lb-row { grid-template-columns: 1fr auto; }
  .lb-track { grid-column: 1 / -1; order: 3; }
  .lb-up { display: none; }
}

/* ======================================================= carte et IP */
.lookup-form { display: flex; gap: .6rem; flex-wrap: wrap; }
.lookup-form input { flex: 1 1 280px; max-width: 520px; font-family: var(--mono); }
#svc-lookup-result:not(:empty) { margin-top: .9rem; }
#svc-lookup-result .ip-card { box-shadow: none; padding: 0; background: transparent; }

.map-card { padding: .8rem; }
.map-wrap { position: relative; border-radius: var(--radius-sm); overflow: hidden; }
.worldmap { width: 100%; height: auto; display: block; cursor: grab; user-select: none; }
.worldmap.dragging { cursor: grabbing; }
.worldmap .sea { fill: var(--surface-2); }
.worldmap .land { fill: var(--surface-3); stroke: var(--border-strong); stroke-width: var(--sw, 1.2); stroke-linejoin: round; }
.worldmap .grat { stroke: var(--border); stroke-width: var(--sw, 1.2); }
.worldmap .grat.eq { stroke: var(--border-strong); }
.worldmap .pt {
  fill: var(--down); fill-opacity: .55; stroke: var(--surface); stroke-width: var(--sw, 1.2);
  cursor: pointer; transition: fill-opacity .15s;
}
.worldmap .pt:hover, .worldmap .pt.on { fill-opacity: .9; stroke: var(--text); }
.worldmap .pt-label {
  fill: var(--text); font-family: var(--font); font-weight: 600; pointer-events: none;
  paint-order: stroke; stroke: var(--surface-2); stroke-width: calc(var(--sw, 1.2) * 3); stroke-linejoin: round;
}
.worldmap .pin { fill: var(--crit); stroke: var(--surface); stroke-width: 2; }
.worldmap .pin-halo { fill: var(--crit); fill-opacity: .18; }
.worldmap.mini { cursor: default; border-radius: var(--radius-sm); }
.minimap { max-width: 520px; margin: 0 0 .9rem; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 600 / 250; background: var(--surface-2); }
.map-zoom { position: absolute; right: .6rem; top: .6rem; display: flex; flex-direction: column; gap: .3rem; }
.map-zoom button { width: 30px; padding: .2rem 0; box-shadow: var(--shadow); }
.map-foot { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; font-size: .78rem; color: var(--muted); margin-top: .6rem; padding: 0 .3rem; }
.map-place { margin-top: .8rem; padding: .9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.mp-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; font-size: .95rem; }
.mp-head .spacer { flex: 1; }
.mp-addr { margin-top: .7rem; font-size: .84rem; display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: center; }
tr.muted-row td { color: var(--muted); }
.meter .fill.muted { background: var(--faint); }
.ip-facts span.flag, .ip-facts span.geo { display: inline; font-size: 1em; color: inherit; margin-bottom: 0; }
.heat-now { flex: 0 0 64px; text-align: right; }

/* ================================================ saturation et latence */
.hot-group + .hot-group { margin-top: 1.1rem; }
.hot-title { font-weight: 600; font-size: .92rem; margin-bottom: .35rem; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.hot-row {
  display: grid; grid-template-columns: minmax(150px, 1.2fr) 2.4fr repeat(3, minmax(88px, auto));
  gap: .9rem; align-items: center; padding: .45rem 0;
}
.hot-row + .hot-row { border-top: 1px solid var(--border); }
.hot-name { min-width: 0; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; }
.hot-name .hint { margin-top: .05rem; }
.hot-bar .lb-track { overflow: visible; }
.hot-peak { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--text); border-radius: 2px; opacity: .7; }
.hot-peak-key { display: inline-block; width: 3px; height: 11px; background: var(--text); opacity: .7; margin-right: .4rem; vertical-align: middle; border-radius: 2px; }
.hot-val { text-align: right; font-size: .86rem; font-variant-numeric: tabular-nums; }
.hot-val .hint { margin-top: .05rem; }
.hot-unknown { margin-top: .9rem; font-size: .84rem; }
.hot-unknown summary { cursor: pointer; color: var(--muted); }
.hot-mini { display: flex; flex-wrap: wrap; gap: .3rem .8rem; padding: .3rem 0; border-top: 1px solid var(--border); }
.hot-mini span:last-child { margin-left: auto; font-variant-numeric: tabular-nums; }
.sev-crit { color: var(--crit); }
.sev-warn { color: var(--warn); }
.sev-ok { color: var(--ok); }
.lat-method { font-size: .76rem; color: var(--muted); padding: .75rem 1rem .25rem; }
.lat-sub { display: block; font-size: .7rem; color: var(--faint); }
#exec-latency td .hint { margin-top: .05rem; }
@media (max-width: 760px) {
  .hot-row { grid-template-columns: 1fr auto auto; }
  .hot-bar { grid-column: 1 / -1; order: 5; }
  .hot-row .hot-val:last-child { display: none; }
}

/* ============================================================ connexion */
.auth-gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 16px;
  background: var(--bg);
}
.auth-gate[hidden] { display: none; }
body.gated header.top, body.gated main { visibility: hidden; }
.auth-card {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: .8rem;
  background: var(--surface); border-radius: var(--radius); padding: 2rem 1.8rem 1.6rem;
  box-shadow: var(--shadow-lift);
}
.auth-logo {
  width: 44px; height: 44px; border-radius: 12px; margin: 0 auto .2rem;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  display: grid; place-items: center;
}
.auth-logo svg { width: 26px; height: 26px; }
.auth-card h1 { font-size: 1.4rem; margin: 0; text-align: center; letter-spacing: -.02em; }
.auth-sub { margin: -.3rem 0 .4rem; text-align: center; color: var(--muted); font-size: .85rem; }
.auth-card label { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; color: var(--muted); }
.auth-card label[hidden] { display: none; }
.auth-card button { margin-top: .3rem; padding: .6rem; font-size: .92rem; }
#auth-error .notice { margin: 0; }

/* Le compte connecte : une carte (initiales, email, grade) qui mene a "mon
   compte", et un bouton de deconnexion a cote. */
.user-chip {
  display: flex; align-items: center; gap: .4rem;
  padding: .65rem .2rem 0; border-top: 1px solid var(--border); font-size: .76rem;
}
.user-chip[hidden] { display: none; }
.user-card {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .55rem;
  padding: .35rem .4rem; border-radius: 10px; color: var(--text); text-decoration: none;
}
.user-card:hover { background: var(--fill); text-decoration: none; }
.avatar {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #5e5ce6, #0a84ff); color: #fff;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.user-id { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; }
.user-email { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.user-id .badge { font-size: .64rem; padding: .05rem .45rem; }
.user-logout { flex: 0 0 auto; width: 2rem; height: 2rem; padding: 0; display: grid; place-items: center; color: var(--muted); }
.user-logout:hover { color: var(--crit); }
.user-logout svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.readonly-banner {
  margin: -.4rem 0 1rem; padding: .55rem .9rem; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warn) 14%, transparent); font-size: .84rem;
}
.readonly-banner[hidden] { display: none; }

.acc-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-top: 1rem; font-size: .86rem; }
.acc-form > b, .acc-form > .hint { flex: 0 0 100%; }
.acc-form > input { flex: 1 1 200px; max-width: 280px; }
.acc-form > .pwd-field { flex: 1 1 220px; max-width: 300px; }
.acc-form > .pwd-meter { flex: 0 0 100%; order: 10; }
.acc-form select { width: auto; }
.acc-me { margin-bottom: .4rem; }
#settings-accounts td select { width: auto; }
.acc-actions button + button { margin-left: .35rem; }
/* Les comptes sont une seule carte en quatre blocs : comptes, mon mot de
   passe, mes sessions, journal. Un filet les separe, un titre les nomme. */
.acc-block + .acc-block { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.acc-block > h3 { margin: 0 0 .7rem; font-size: 1rem; }
.acc-block .acc-form:first-of-type { margin-top: 0; }
.acc-hint { margin: .5rem 0 0; font-size: .78rem; }
.acc-pwd-row td { background: var(--surface-2); }
.acc-inline { margin: .2rem 0; }
.acc-sessions-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .7rem; }
.acc-sessions-foot .hint { font-size: .78rem; }
.acc-journal-bar { margin-bottom: .6rem; }
.acc-journal { max-height: 420px; overflow: auto; }
.acc-journal td { font-size: .8rem; }
.acc-detail { color: var(--muted); }
/* Les boutons d'un formulaire de compte ont la hauteur des champs voisins. */
.acc-form > button { height: 2.55rem; padding: 0 1.05rem; }

/* ---------------------------------------------------- mots de passe */
.pwd-field { position: relative; display: block; }
.pwd-field input { width: 100%; padding-right: 2.4rem; }
.pwd-eye {
  position: absolute; right: .25rem; top: 50%; transform: translateY(-50%);
  width: 2rem; height: 1.8rem; padding: 0; margin: 0 !important;
  display: grid; place-items: center;
  background: transparent; border: 0; box-shadow: none; color: var(--faint); cursor: pointer;
}
.pwd-eye:hover { color: var(--text); background: var(--fill); }
.pwd-eye.on { color: var(--accent); }
.pwd-eye svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pwd-meter { display: flex; align-items: center; gap: .55rem; font-size: .74rem; color: var(--muted); min-height: 1.1rem; }
.pwd-meter[hidden] { display: none; }
.pwd-bars { display: inline-grid; grid-template-columns: repeat(4, 22px); gap: 3px; flex: 0 0 auto; }
.pwd-bars i { height: 4px; border-radius: 2px; background: var(--fill-strong); transition: background .2s; }
.pwd-meter.s1 .pwd-bars i:nth-child(-n+1) { background: var(--warn); }
.pwd-meter.s2 .pwd-bars i:nth-child(-n+2) { background: color-mix(in srgb, var(--warn) 50%, var(--ok)); }
.pwd-meter.s3 .pwd-bars i:nth-child(-n+3),
.pwd-meter.s4 .pwd-bars i { background: var(--ok); }
.pwd-meter.bad .pwd-label { color: var(--crit); }
.caps-warn { font-size: .75rem; color: var(--warn); margin-top: -.4rem; }
.caps-warn[hidden] { display: none; }
.auth-foot { margin: .2rem 0 0; text-align: center; font-size: .7rem; color: var(--faint); line-height: 1.4; }

/* -------------------------------------------------------- messages */
#toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 120;
  display: flex; flex-direction: column; gap: .5rem; max-width: min(440px, calc(100vw - 32px));
}
.toast {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .75rem .85rem .75rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-lift); font-size: .84rem; line-height: 1.45;
  animation: toast-in .25s ease-out;
}
.toast a { white-space: nowrap; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
.toast-x {
  margin: -.2rem -.2rem 0 auto; padding: 0 .35rem; flex: 0 0 auto;
  background: transparent; border: 0; box-shadow: none; color: var(--faint); font-size: 1.15rem; line-height: 1;
}
.toast-x:hover { color: var(--text); background: var(--fill); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =================================================== ports en direct */
.chart-source { font-size: .75rem; color: var(--muted); margin-top: .5rem; }
.cycles { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .78rem; color: var(--muted); margin-bottom: .7rem; }
.cycle .sq { margin-right: .35rem; }
.ports-foot { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .78rem; color: var(--muted); margin-top: .6rem; }
.stale-row td { opacity: .6; }

/* Une tuile ne deborde jamais : une adresse IP ou un nom de PoP long passent a
   la ligne dans leur case au lieu de mordre sur la voisine. */
.stat { min-width: 0; overflow: hidden; }
.stat .value { overflow-wrap: anywhere; word-break: break-word; }
.drawer .grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.drawer .stat .value { font-size: 1.2rem; letter-spacing: -.01em; }
.drawer .stat .sub { overflow-wrap: anywhere; }

/* ================================================ recherche instantanee */
.global-search { position: relative; padding: 0 .1rem; }
.global-search input { width: 100%; font-size: .84rem; padding: .45rem .7rem; }
.gs-results {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 80;
  width: min(440px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lift);
  padding: .35rem;
}
.gs-results[hidden] { display: none; }
.gs-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: .5rem .5rem .2rem; }
.gs-item {
  display: flex; gap: .6rem; align-items: center; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 8px; padding: .4rem .5rem; color: var(--text);
}
.gs-item:hover, .gs-item:focus { background: var(--fill); }
.gs-kind { flex: 0 0 38px; font-size: .62rem; font-weight: 700; color: var(--accent); text-align: center; background: var(--accent-dim); border-radius: 6px; padding: .15rem 0; }
.gs-main { display: flex; flex-direction: column; min-width: 0; }
.gs-main b { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-main .hint { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-empty { padding: .7rem; color: var(--muted); font-size: .84rem; }
.stat.crit .value { color: var(--crit); }

/* =========================================================== sante radio */
.radio-card + .radio-card { margin-top: .8rem; }
.radio-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem .8rem; margin-bottom: .7rem; }
.radio-head .spacer { flex: 1; }
.radio-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem 1rem; font-size: .86rem; margin-bottom: .6rem; }
.radio-facts span { display: block; color: var(--muted); font-size: .72rem; }
.radio-card details { margin-top: .5rem; font-size: .86rem; }
.radio-card summary { cursor: pointer; color: var(--muted); margin-bottom: .4rem; }

/* ================================================ corrections d'affichage */
/* Blocs de code : ils defilent dans leur cadre, jamais la page. */
pre { max-width: 100%; overflow-x: auto; }

@media (max-width: 1000px) {
  /* Barre du haut sur deux lignes : marque, recherche et compte en haut, les
     onglets dessous sur toute la largeur. La recherche n'est plus ecrasee a
     trois lettres, le compte ne sort plus de l'ecran. */
  header.top { flex-wrap: wrap; row-gap: .5rem; }
  .global-search { flex: 1 1 160px; min-width: 0; order: 1; }
  .brand { order: 0; }
  .user-chip { order: 2; flex-wrap: nowrap; padding: 0; border-top: 0; min-width: 0; }
  .user-chip .user-email { flex: 0 1 auto; max-width: 16ch; }
  .user-card { padding: .15rem .3rem; }
  .user-id .badge { display: none; }
  .sidebar-foot { order: 3; }
  nav.tabs { order: 4; flex: 1 1 100%; }
}
@media (max-width: 760px) {
  /* Les pastilles d'explication passent a la ligne plutot que de deborder. */
  .mode { white-space: normal; border-radius: 10px; max-width: 100%; }
  .user-chip .user-email { display: none; }
  /* Marque, recherche et compte tiennent sur UNE ligne : l'avatar suffit. */
  .user-id { display: none; }
  .user-chip { gap: .15rem; }
  .user-card { gap: 0; padding: .1rem; }
  .global-search { flex-basis: 110px; }
  /* Le point suffit (son texte reste en infobulle) : la place va au sommaire. */
  .live span { display: none; }
}

/* Boutons d'une ligne de tableau : cote a cote, jamais empiles (chaque ligne
   d'abonne triplait de hauteur). */
.sticky-actions .actions { flex-wrap: nowrap; }
.sticky-actions { white-space: nowrap; }

/* Clients detectes, non declares */
.cand-banner .cand-list { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .45rem; }
.cand-banner .cand { display: inline-flex; align-items: center; gap: .35rem; }

/* Mise en service automatique d'un equipement */
.prov-steps { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .84rem; }
.prov-steps li { display: flex; align-items: baseline; gap: .45rem; padding: .12rem 0; flex-wrap: wrap; }
.prov-steps .hint { display: inline; }
.prov-result { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin-top: .55rem; font-size: .84rem; }
.sq.none { background: var(--fill-strong); }

/* ============================== listes deployantes a cases (cibles de regle) */
details.pick-dd {
  position: relative; margin: 0; padding: 0;
  background: none; box-shadow: none; border-radius: 0;
}
details.pick-dd > summary,
details.pick-dd[open] > summary {
  display: block; margin: 0;
  padding: .6rem 2rem .6rem .85rem; border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--fill); color: var(--text);
  font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  position: relative;
}
details.pick-dd > summary:hover { color: var(--text); border-color: var(--accent); }
details.pick-dd > summary::before { content: none; }
details.pick-dd > summary::after {
  content: "\25BE"; position: absolute; right: .8rem; top: 50%;
  transform: translateY(-50%); color: var(--faint);
}
details.pick-dd[open] > summary::after { content: "\25B4"; }
.pick-panel {
  position: absolute; z-index: 20; left: 0; right: 0; margin-top: .3rem;
  background: var(--surface); border: 1px solid var(--border, var(--fill-strong));
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  padding: .5rem;
}
.pick-filter { width: 100%; margin-bottom: .4rem; }
.pick-list { max-height: 260px; overflow-y: auto; }
.pick-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .4rem; border-radius: 8px; cursor: pointer;
}
.pick-item:hover { background: var(--fill); }
.pick-item .hint { margin-left: auto; font-size: .75rem; }
.pick-item[hidden] { display: none; }

/* ================================================ ports des routeurs */
.pl-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.pl-top #ports-toggle { margin-left: auto; }
.pl-health { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.pl-health.crit { color: var(--crit, #d70015); }
.pl-health.warn { color: var(--warn, #c93400); }
.pl-router { border-top: 1px solid var(--border); padding: .9rem 0 .4rem; }
.pl-router:first-of-type { border-top: 0; padding-top: 0; }
.pl-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .7rem; }
.pl-head b { font-size: 1rem; }
.pl-alerts { margin-left: auto; display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.pl-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.pl-kpi { background: var(--fill); border-radius: 12px; padding: .65rem .8rem; display: flex; flex-direction: column; gap: .3rem; }
.pl-kpi > span:first-child { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.pl-kpi .nowrap { font-weight: 600; margin-right: .6rem; }
.pl-ports td .hint { display: block; font-size: .72rem; }
.pl-hot td { background: color-mix(in srgb, var(--crit, #d70015) 8%, transparent); }
.pl-more { margin: .3rem 0 0; font-size: .78rem; }

/* ================================================ ronds de chargement */
@keyframes fq-spin { to { transform: rotate(360deg); } }
button.is-busy { position: relative; color: transparent !important; cursor: progress; }
button.is-busy > * { visibility: hidden; }
button.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-top-color: var(--accent);
  animation: fq-spin .7s linear infinite;
}
button.primary.is-busy::after { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
button.danger.is-busy::after { border-top-color: var(--crit); }
.page-loading::after {
  content: ""; display: inline-block; vertical-align: middle;
  width: .7em; height: .7em; margin-left: .6em; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--text) 18%, transparent);
  border-top-color: var(--accent);
  animation: fq-spin .7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  button.is-busy::after, .page-loading::after { animation-duration: 2s; }
}

/* ============================================================ info-bulles */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; margin-left: .38em; vertical-align: .08em;
  border-radius: 50%; border: 1.2px solid currentColor;
  font: italic 700 9px/1 Georgia, serif; text-transform: none; letter-spacing: 0;
  color: var(--faint); cursor: help; opacity: .85; user-select: none;
  transition: color .15s ease, background .15s ease;
}
.info:hover, .info:focus-visible { color: var(--accent); background: var(--accent-dim); opacity: 1; outline: none; }
/* La bulle est une petite fiche : titre, ce que c'est, comment c'est mesure,
   l'echelle en couleurs, comment le lire, quoi faire. Survol = apercu ; clic
   sur le (i) = epinglee (texte selectionnable, utilisable au doigt). */
.info-bulle {
  position: fixed; z-index: 1000; display: none; width: max-content; max-width: min(400px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow: auto;
  padding: .8rem .9rem .85rem; border-radius: 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  font-size: .79rem; font-weight: 400; line-height: 1.5; text-align: left; white-space: normal;
  text-transform: none; letter-spacing: 0;
  box-shadow: var(--shadow-lift); pointer-events: none;
}
.info-bulle.pinned { pointer-events: auto; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.ib-title { font-weight: 650; font-size: .88rem; margin-bottom: .25rem; letter-spacing: -.01em; }
.ib-what { margin: 0; }
.ib-sec { margin-top: .55rem; color: var(--muted); }
.ib-k {
  display: block; margin-bottom: .1rem; color: var(--faint);
  font-size: .63rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
}
.ib-scale {
  list-style: none; margin: .6rem 0 0; padding: .5rem .6rem; display: grid; gap: .28rem;
  border-radius: 9px; background: var(--surface-2);
}
.ib-scale li { display: flex; align-items: baseline; gap: .1rem; }
.ib-scale .sq { flex: 0 0 auto; transform: translateY(-1px); }

/* ===================================================== filaire / radio
   Chaque lien dit d'ou vient sa capacite : fixe (filaire), lue en direct sur
   son antenne (radio), ou la plus petite connue (auto). */
.badge.medium-wired { color: var(--muted); background: var(--fill); }
.badge.medium-radio { font-weight: 600; }
.medium-edit { font-size: .72rem; margin-left: .35rem; white-space: nowrap; }
.medium-dialog {
  width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lift);
}
.medium-dialog::backdrop { background: rgba(0, 0, 0, .35); }
.medium-form { display: flex; flex-direction: column; gap: .7rem; padding: 1.2rem 1.3rem 1.1rem; }
.medium-form h3 { margin: 0; font-size: 1.05rem; }
.medium-form > .hint { margin: -.3rem 0 .1rem; }
.medium-opt {
  display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.medium-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.medium-opt input[type=radio] { width: auto; margin-top: .25rem; accent-color: var(--accent); }
.medium-opt > span { display: flex; flex-direction: column; gap: .2rem; font-size: .86rem; }
.medium-sub { display: flex; align-items: center; gap: .45rem; margin-top: .35rem; font-size: .82rem; color: var(--muted); }
.medium-sub input { width: 8rem; }
.medium-sub select { width: auto; max-width: 100%; }
.medium-opt:not(:has(input:checked)) .medium-sub { display: none; }
.medium-form .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .2rem; }

/* Point de vue d'un exporteur, modifiable sur place. */
select.exp-mode { width: auto; min-width: 12rem; padding: .3rem .55rem; font-size: .82rem; }
select.exp-mode.warn { color: var(--warn); }
