/* =============================================================================
   components.css — les briques génériques, réutilisables par TOUT écran
   -----------------------------------------------------------------------------
   Ce fichier ne connaît aucun métier : ni citerne, ni sonde, ni abonnement.
   Il porte le chrome (barre du haut, navigation, en-tête de page) et le
   vocabulaire visuel commun (cartes, tableaux, puces, onglets, pagination…).

   Un nouvel écran ne devrait avoir à écrire QUE ce qui lui est propre.
   S'il a besoin d'une brique qui n'existe pas encore ET qu'elle est générique,
   c'est ici qu'elle vient — pas dans son fichier à lui.

   Charge APRÈS tokens.css et AVANT le CSS spécifique d'un écran.
   ========================================================================== */

/* --- Barre du haut -------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  height: 62px; padding: 0 22px;
  background: var(--navy); color: #eaf1f7;
}
.brand { display: flex; align-items: center; gap: 9px; width: 210px; flex-shrink: 0; }
.brand-word { font-size: 17px; font-weight: 600; letter-spacing: -.2px; }
.brand-word .pfx { color: var(--blue); font-weight: 500; }
.topbar-filters { display: flex; align-items: center; gap: 10px; flex-grow: 1; }
.pill-ghost {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border: 1px solid rgba(234, 241, 247, .22); border-radius: 8px;
  font-size: 13px; color: #cddae3;
}
.topbar-tools { display: flex; align-items: center; gap: 16px; }
.flag { display: flex; width: 24px; height: 17px; border-radius: 3px; overflow: hidden; border: 1px solid rgba(255,255,255,.28); }
.flag span { flex-grow: 1; }
.bell-wrap { position: relative; display: flex; }
.badge-dot {
  position: absolute; top: -3px; right: -4px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 600; line-height: 15px; text-align: center;
}
.quick-add { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--red); }
.user-menu { display: flex; align-items: center; gap: 9px; padding-left: 14px; border-left: 1px solid rgba(234,241,247,.18); }
.avatar { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(96,161,201,.28); font-size: 12px; font-weight: 600; }
.user-menu span { font-size: 13px; color: #cddae3; }

/* --- Cadre principal ------------------------------------------------------ */
.shell { display: flex; align-items: stretch; min-height: calc(100vh - 62px); }

.sidenav {
  display: flex; flex-direction: column; gap: 4px;
  width: 210px; flex-shrink: 0; padding: 18px 12px;
  background: var(--navy-deep);
}
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px;
  border-radius: 9px; font-size: 13.5px; color: #9fb2c0; cursor: default;
}
.nav-item.is-active {
  background: rgba(255,255,255,.10); color: #fff; font-weight: 500;
  box-shadow: inset 3px 0 0 var(--orange);
}
/* Une entrée de nav n'est cliquable que si elle porte data-href (routeur). */
.nav-item[data-href] { cursor: pointer; }
.nav-item[data-href]:hover { color: #cddae3; }
.sidenav-foot { margin-top: auto; padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.09); font-size: 11px; color: var(--muted); line-height: 1.5; }

.main { flex-grow: 1; padding: 24px 28px 48px; min-width: 0; }

/* --- En-tête de page ------------------------------------------------------ */
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.crumbs .current { color: var(--text); font-weight: 500; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--orange-dark); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 25px; font-weight: 600; color: var(--navy); letter-spacing: -.4px; }
.title-block { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 12px; font-size: 12px; font-weight: 500;
  background: var(--white); border: 1px solid var(--line); color: var(--muted);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip.ok { background: rgba(92,168,110,.14); color: #3f8a55; border-color: transparent; }
.chip.warn { background: rgba(232,161,58,.16); color: #9a6a12; border-color: transparent; }
.chip.bad { background: rgba(217,83,79,.14); color: #a33a36; border-color: transparent; }
.chip-meta { font-size: 12.5px; color: var(--muted); }
a.chip { text-decoration: none; }
a.chip:hover { border-color: #cfd8e0; color: var(--text); }

/* --- Boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 20px; border: 1.6px solid var(--line); background: var(--white);
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer;
}
.btn:hover { border-color: #cfd8e0; }
.head-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* Action principale d'un écran (ex. « Transférer » dans IoT Devices). */
.btn-primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--btn-dark, #1a2027); border-color: #1a2027; color: #fff; }

/* Bouton discret posé DANS un bandeau coloré : il emprunte la couleur du
   bandeau (currentColor), donc il s'adapte au mode fictif / réel / SQL. */
.btn-mini {
  flex-shrink: 0; height: 28px; padding: 0 13px; border-radius: 14px;
  border: 1px solid currentColor; background: transparent; color: inherit;
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn-mini:hover { background: rgba(0,0,0,.05); }

/* --- Onglets -------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 22px; }
.tab {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px;
  margin-bottom: -1.5px; border: 0; background: none; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 500; color: var(--muted);
  border-bottom: 2.5px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--navy); font-weight: 600; border-bottom-color: var(--orange); }

/* Bascule compacte (périodes, sous-vues) — plus légère que des onglets. */
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 9px; background: var(--bg-soft); }
.seg button {
  height: 26px; padding: 0 13px; border: 0; border-radius: 7px; background: none;
  font-family: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.seg button.is-active { background: var(--white); color: var(--navy); font-weight: 600; box-shadow: 0 1px 3px rgba(23,61,86,.14); }

/* --- Grilles et cartes ---------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
/* align-items:start — sans lui, la carte la plus courte s'étire à la hauteur
   de sa voisine et laisse un grand vide (constaté au contrôle visuel). */
.grid-2a { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 18px; align-items: start; }

.card {
  display: flex; flex-direction: column; gap: 14px; padding: 20px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--navy); text-transform: uppercase; letter-spacing: .6px; }

/* Liste clé / valeur : la structure par défaut du contenu d'une carte. */
.kv { display: flex; flex-direction: column; gap: 11px; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.kv-row .k { font-size: 12.5px; color: var(--muted); }
.kv-row .v { font-size: 13px; font-weight: 500; color: var(--navy); text-align: right; }
.kv-row.total { padding-top: 11px; border-top: 1px solid var(--line-soft); }
.kv-row.total .v { font-size: 15px; font-weight: 600; }

/* Tuile de chiffre-clé (KPI). */
.stat { display: flex; flex-direction: column; gap: 4px; padding: 15px 17px; border-radius: 11px; background: #f7fafc; }
.stat .lbl { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat .val { font-size: 23px; font-weight: 600; color: var(--navy); letter-spacing: -.5px; }
.stat .val small { font-size: 13px; font-weight: 400; color: var(--muted); }

/* --- Fil d'évènements ----------------------------------------------------- */
.ev { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.ev .dot { flex-shrink: 0; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; }
.ev .body { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.ev .lbl { font-size: 13px; font-weight: 500; color: var(--navy); }
.ev .sub { font-size: 11.5px; color: var(--muted); }
.ev .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* --- Tableaux ------------------------------------------------------------- */
.tbl-scroll { overflow-x: auto; }
.tbl { font-size: 12.5px; }
.tbl th {
  padding: 0 12px 10px 0; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1.5px solid var(--line);
}
.tbl td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .strong { font-weight: 500; color: var(--navy); }
.tbl tr.invalid td { background: rgba(217,83,79,.05); }
.tbl input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--orange); cursor: pointer; }

/* Variante « liste » : lignes plus aérées, cliquables vers un détail. */
.tbl-list td { padding-top: 13px; padding-bottom: 13px; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #f7fafc; }
.dim { color: #b6c2cc; }

/* Pastille d'état + mini-barre de progression, posées dans une cellule.
   Aucune couleur en dur : elle vient d'un style inline calculé côté JS. */
.lvl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.mini-bar { display: block; width: 54px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 0 0 3px auto; }
.mini-bar i { display: block; height: 100%; border-radius: 3px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pager .pages { display: flex; align-items: center; gap: 5px; }
.pager button {
  min-width: 30px; height: 30px; padding: 0 9px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--white); font-family: inherit; font-size: 12.5px;
  color: var(--text); cursor: pointer;
}
.pager button.is-active { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.pager button:disabled { color: #b6c2cc; cursor: default; }

/* --- Outils de liste (recherche, filtres) --------------------------------- */
.list-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 9px; flex-grow: 1; min-width: 240px;
  height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); }
.search input { flex-grow: 1; border: 0; outline: 0; font-family: inherit; font-size: 13px; color: var(--text); background: none; }
.search input::placeholder { color: #9aa7b3; }

/* --- Formulaires ---------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 13px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.form input {
  height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 14px; color: var(--text); background: var(--white);
}
.form input:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(96,161,201,.15); }
.form .btn { align-self: flex-start; margin-top: 4px; }

/* Interrupteur (aujourd'hui décoratif : l'API v1 n'écrit rien). */
.toggle {
  position: relative; display: inline-flex; align-items: center;
  width: 36px; height: 20px; border-radius: 10px;
  background: #dbe3ea; cursor: pointer; transition: background .18s ease;
}
.toggle.is-on { background: var(--orange); }
.toggle i {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: left .18s ease;
}
.toggle.is-on i { left: 18px; }

/* --- Bandeau d'information ------------------------------------------------ */
.banner {
  display: flex; align-items: center; gap: 13px; padding: 15px 20px;
  border-radius: 12px; background: rgba(96,161,201,.09); border: 1px dashed #a9c6da;
}
.banner .t { font-size: 13.5px; font-weight: 600; color: #2f6685; }
.banner .d { font-size: 12.5px; color: #5b7e95; }

/* Note explicative en pied de carte. */
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.hint code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11px; background: #eef2f5; padding: 1px 5px; border-radius: 4px; }
.hint strong { color: var(--text); }

/* =============================================================================
   CONVENTION 1 — marqueur « non exposé par l'API v1 »
   Le cœur pédagogique du prototype : au lieu d'inventer une donnée absente,
   on la marque visuellement. La page devient une spec de ce qui manque.
   Côté JS : la fonction na(pourquoi).
   ========================================================================== */
.na {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; font-style: normal;
  color: #9a6a12; background: rgba(232,161,58,.14);
  padding: 1px 8px; border-radius: 10px; cursor: help;
}
.na::before { content: '—'; opacity: .55; }
.card.is-na { border-style: dashed; border-color: #e3cfa4; background: #fffdf8; }
.card.is-na .card-title { color: #9a6a12; }

.legend {
  display: flex; align-items: flex-start; gap: 12px; margin-top: 26px; padding: 16px 20px;
  border-radius: 12px; background: #fffdf8; border: 1px dashed #e3cfa4;
  font-size: 12.5px; color: #7a5a12; line-height: 1.65;
}
.legend strong { color: #6b4e0d; }
.legend code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11.5px; background: rgba(232,161,58,.15); padding: 1px 5px; border-radius: 4px; }

/* =============================================================================
   CONVENTION 2 — compteur d'appels
   En tête de chaque écran : le nombre de requêtes réellement nécessaires,
   détaillé par route. Rend le coût « 1 + 3N » visible au lieu de théorique.
   Côté JS : apiMeter(libellé), alimenté par backend().stats.
   ========================================================================== */
.meter {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 12px 18px; border-radius: 12px;
  background: rgba(96, 161, 201, .09); border: 1px solid rgba(96, 161, 201, .25);
}
.meter-head { font-size: 13px; color: #2f6685; }
.meter-head strong { color: #1d4f6d; font-size: 14px; }
.meter-rows { display: flex; flex-wrap: wrap; gap: 6px; }
.meter-row {
  font-size: 11.5px; color: #4b7a94; background: rgba(255, 255, 255, .65);
  padding: 2px 9px; border-radius: 10px; white-space: nowrap;
}
.meter code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11px; }

/* =============================================================================
   CONVENTION 3 — « maquette, données fictives »
   Quand on montre un design qu'AUCUNE donnée ne peut alimenter, on l'affiche
   pour de vrai mais DOUBLEMENT marqué : badge dans le titre (.badge-fake) et
   encart d'avertissement sous le bloc (.warn-box).
   ========================================================================== */
.badge-fake {
  margin-left: 9px; padding: 2px 9px; border-radius: 10px;
  background: rgba(232, 161, 58, .16); color: #9a6a12;
  font-size: 10.5px; font-weight: 600; letter-spacing: .3px; text-transform: none;
  vertical-align: middle; white-space: nowrap;
}
.warn-box {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 14px 16px; border-radius: 11px;
  background: #fffdf8; border: 1px dashed #e3cfa4;
  font-size: 12px; color: #7a5a12; line-height: 1.65;
}
.warn-box strong { color: #6b4e0d; }
.warn-box code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11px; background: rgba(232,161,58,.15); padding: 1px 5px; border-radius: 4px; }

/* --- Barre de mode : d'où viennent les données de l'écran ----------------- */
.mode-bar {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 10px 16px; margin-bottom: 16px; border-radius: 11px;
  font-size: 12.5px; line-height: 1.5;
}
.mode-bar.is-fake { background: #fffdf8; border: 1px dashed #e3cfa4; color: #7a5a12; }
.mode-bar.is-fake strong { color: #6b4e0d; }
.mode-bar.is-real { background: rgba(92,168,110,.10); border: 1px solid rgba(92,168,110,.4); color: #2f6b41; }
.mode-bar.is-real strong { color: #235232; }
/* Mode « base SQL en direct » — navy profond, distinct du vert de l'API. */
.mode-bar.is-sql { background: rgba(23,61,86,.07); border: 1px solid rgba(23,61,86,.35); color: #173d56; }
.mode-bar.is-sql strong { color: #0f2c40; }
.mode-bar span { flex-grow: 1; min-width: 200px; }
.mode-bar code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11px; background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 4px; }
.mode-hint { flex-grow: 0 !important; font-size: 11.5px; opacity: .85; }

/* --- États de chargement / erreur ----------------------------------------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 0; color: var(--muted); font-size: 13px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { padding: 18px 20px; border-radius: 12px; background: rgba(217,83,79,.08); border: 1px solid rgba(217,83,79,.3); color: #a33a36; font-size: 13px; }

/* --- Réactif -------------------------------------------------------------- */
@media (max-width: 1180px) {
  .grid-3, .grid-4, .grid-2a { grid-template-columns: minmax(0, 1fr); }
}

/* =============================================================================
   ⬆ AJOUTS DE LA MAQUETTE « ABONNEMENTS » — briques GÉNÉRIQUES
   -----------------------------------------------------------------------------
   Tout ce qui suit est sans métier et a vocation à REMONTER vers le maître,
   _bac-a-sable/claude-design/portail-iot-link/code/components.css. Bloc gardé
   d'un seul tenant pour que le report soit un copier-coller.
   ========================================================================== */

/* --- Sélecteur de profil, dans la barre de mode ---------------------------- */
.profile-switch { display: flex; align-items: center; gap: 8px; flex-grow: 0 !important; }
.profile-switch .seg { background: rgba(255, 255, 255, .55); }
.profile-switch select {
  height: 28px; padding: 0 8px; border: 1px solid rgba(23, 61, 86, .22); border-radius: 8px;
  background: var(--white); font-family: inherit; font-size: 12px; color: var(--text); cursor: pointer;
}

/* --- Montants : toujours alignés sur la virgule ---------------------------- */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.neg { color: var(--red); }
.money.zero { color: var(--muted); }

/* --- Tuile de KPI teintée ------------------------------------------------- */
.stat.tone-ok   { background: rgba(92, 168, 110, .10); }
.stat.tone-warn { background: rgba(232, 161, 58, .12); }
.stat.tone-bad  { background: rgba(217, 83, 79, .10); }
.stat.tone-bad .val { color: #a33a36; }
.stat .sub { font-size: 11.5px; color: var(--muted); }

/* --- Encart d'alerte, plus fort que .banner -------------------------------- */
.alert {
  display: flex; align-items: flex-start; gap: 14px; padding: 17px 20px; border-radius: 12px;
  border: 1px solid transparent; font-size: 13px; line-height: 1.6;
}
.alert .ico { flex-shrink: 0; margin-top: 1px; }
.alert .body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.alert .t { font-size: 14px; font-weight: 600; }
.alert .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.alert.bad  { background: rgba(217, 83, 79, .08); border-color: rgba(217, 83, 79, .32); color: #8f322e; }
.alert.bad .t { color: #7d2b28; }
.alert.warn { background: #fffdf8; border-color: #e3cfa4; color: #7a5a12; }
.alert.warn .t { color: #6b4e0d; }
.alert.ok   { background: rgba(92, 168, 110, .09); border-color: rgba(92, 168, 110, .35); color: #2f6b41; }
.alert.ok .t { color: #235232; }

/* --- État vide ------------------------------------------------------------- */
.empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty strong { display: block; color: var(--navy); font-size: 14px; margin-bottom: 5px; }

/* --- Fil chronologique ----------------------------------------------------- */
.tl { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; padding: 0 0 16px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item .mark { flex-shrink: 0; width: 26px; display: flex; justify-content: center; position: relative; }
.tl-item .mark i { display: block; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--blue); }
.tl-item .mark::before {
  content: ''; position: absolute; top: 18px; bottom: -16px; left: 50%;
  width: 1.5px; margin-left: -.75px; background: var(--line);
}
.tl-item:last-child .mark::before { display: none; }
.tl-item.ok i   { background: var(--green); }
.tl-item.warn i { background: var(--amber); }
.tl-item.bad i  { background: var(--red); }
.tl-item .body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tl-item .lbl { font-size: 13px; font-weight: 500; color: var(--navy); }
.tl-item .sub { font-size: 12px; color: var(--muted); }
.tl-item .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* --- Menu « … » d'une ligne de liste --------------------------------------- */
.menu-wrap { position: relative; display: inline-flex; }
.btn-dots {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer;
}
.btn-dots:hover { background: var(--bg-soft); border-color: var(--line); color: var(--navy); }
.menu {
  position: absolute; top: 32px; right: 0; z-index: 40; min-width: 236px; padding: 6px;
  background: var(--white); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: 0 12px 30px rgba(23, 61, 86, .16);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px;
  border: 0; border-radius: 8px; background: none; text-align: left;
  font-family: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; white-space: nowrap;
}
.menu-item:hover { background: var(--bg-soft); color: var(--navy); }
.menu-item[disabled] { color: #b6c2cc; cursor: default; }
.menu-item[disabled]:hover { background: none; color: #b6c2cc; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--line-soft); }
.menu-head { padding: 7px 11px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; color: var(--muted); }

/* --- Fenêtre modale -------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15, 44, 64, .48);
}
.modal {
  display: flex; flex-direction: column; width: 100%; max-width: 560px; max-height: 92vh;
  background: var(--white); border-radius: 16px; box-shadow: 0 26px 60px rgba(15, 44, 64, .30);
  overflow: hidden;
}
.modal.wide { max-width: 720px; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 17px; font-weight: 600; color: var(--navy); letter-spacing: -.2px; }
.modal-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-close {
  flex-shrink: 0; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: var(--bg-soft); color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1;
}
.modal-close:hover { background: var(--line); color: var(--navy); }
.modal-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 15px 22px; border-top: 1px solid var(--line); background: #fbfcfd;
}
.modal-foot .spacer { margin-right: auto; font-size: 12px; color: var(--muted); }

/* --- Choix en cartes (dans une modale) ------------------------------------- */
.pick { display: flex; flex-direction: column; gap: 8px; }
.pick-opt {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--white); cursor: pointer;
}
.pick-opt:hover { border-color: #cfd8e0; }
.pick-opt.is-on { border-color: var(--orange); background: rgba(255, 165, 88, .07); }
.pick-opt .mark {
  flex-shrink: 0; width: 17px; height: 17px; border: 2px solid #cfd8e0; border-radius: 50%;
}
.pick-opt.is-on .mark { border-color: var(--orange); border-width: 5px; }
.pick-opt .txt { display: flex; flex-direction: column; gap: 1px; flex-grow: 1; min-width: 0; }
.pick-opt .t { font-size: 13.5px; font-weight: 500; color: var(--navy); }
.pick-opt .d { font-size: 11.5px; color: var(--muted); }
.pick-opt .p { font-size: 14px; font-weight: 600; color: var(--navy); white-space: nowrap; }

/* --- Bouton d'expansion d'une ligne de tableau ----------------------------- */
.expand {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.expand:hover { background: var(--bg-soft); color: var(--navy); }
.expand svg { transition: transform .16s ease; }
.expand.is-open svg { transform: rotate(90deg); }

/* --- Barre de répartition empilée ------------------------------------------ */
.dist { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); }
.dist i { display: block; height: 100%; }
.dist-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.dist-legend .it { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.dist-legend .it b { color: var(--navy); font-weight: 600; font-variant-numeric: tabular-nums; }
.dist-legend .sw { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

/* --- Bouton « ? » et bulle d'explication ------------------------------------
   Posé à côté de tout terme qui n'est pas évident pour quelqu'un qui découvre
   l'écran. Au clic, pas au survol : le survol ne marche pas au doigt et se
   déclenche par accident. */
.exp {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 16px; height: 16px; margin-left: 6px; padding: 0; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--white); color: var(--muted);
  font-family: inherit; font-size: 10px; font-weight: 700; line-height: 1; cursor: pointer;
}
.exp:hover { border-color: var(--blue); color: var(--blue); }
.exp.is-on { border-color: var(--blue); background: var(--blue); color: #fff; }
.pop {
  position: absolute; z-index: 80; width: 340px; padding: 16px 18px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(23, 61, 86, .18);
}
.pop .t { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 7px; }
.pop .d { font-size: 12.5px; color: var(--text); line-height: 1.7; }
.pop .d strong { color: var(--navy); font-weight: 600; }
.pop .d em { font-style: normal; color: var(--muted); }
