/* App A (binaires) — mise en page moderne */
.loader-grid { display: grid; grid-template-columns: 380px 1fr; gap: 16px; height: 100%; }

/* ---- Bandeau : stockage non persistant ---- */
.storage-warn {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 10500; max-width: 92vw;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #3a2a08; color: #ffe4a3;
  border: 1px solid #a9750f; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 13px; line-height: 1.4;
}
.storage-warn .sw-ic { font-size: 16px; flex: none; }
.storage-warn .sw-txt { flex: 1; min-width: 0; }
.storage-warn button {
  background: transparent; border: 1px solid transparent; color: inherit;
  cursor: pointer; font-size: 12.5px; padding: 4px 8px; border-radius: 6px; flex: none;
}
.storage-warn .sw-dont { border-color: #a9750f; }
.storage-warn .sw-dont:hover { background: rgba(255, 255, 255, 0.08); }
.storage-warn .sw-close { font-size: 15px; }
.storage-warn .sw-close:hover { color: #fff; }

/* ---- Publications & références (Éléments orbitaux) ---- */
.orb-links { list-style: none; margin: 8px 0 0; padding: 0; }
.orb-links li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.orb-links li.hint { color: var(--fg-dim); }
.orb-links a {
  color: var(--accent); text-decoration: none; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.orb-links a:hover { text-decoration: underline; }
.orb-link-del {
  background: transparent; border: none; color: var(--fg-dim);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 5px; flex: none;
}
.orb-link-del:hover { color: #f87171; }

/* ---- Démarrage rapide : fenêtre d'accueil (modale) ---- */
.qs-backdrop {
  position: fixed; inset: 0; z-index: 11000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 9, 16, 0.66); backdrop-filter: blur(2px);
  padding: 20px;
}
.qs-modal {
  position: relative;
  width: 560px; max-width: 94vw; max-height: 90vh; overflow: auto;
  background: var(--bg-panel); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  padding: 22px 24px 18px;
}
.qs-topbar { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 6px; }
.qs-lang { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-dim); font-size: 13px; }
.qs-lang select {
  background: var(--bg-elev); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: 13px; font-family: inherit; cursor: pointer;
}
.qs-x {
  background: transparent; border: none; color: var(--fg-dim);
  font-size: 17px; cursor: pointer; line-height: 1; padding: 4px;
}
.qs-x:hover { color: var(--fg); }
.qs-title { margin: 0 0 8px; font-size: 20px; }
.qs-intro { margin: 0 0 12px; color: var(--fg-dim); font-size: 13.5px; line-height: 1.5; }
.qs-steps { margin: 0 0 16px; padding-left: 22px; line-height: 1.7; font-size: 14px; }
.qs-steps li { margin-bottom: 2px; }
.qs-load {
  display: block; width: 100%; padding: 12px 16px; margin: 0 0 18px;
  font-size: 15px; font-weight: 600;
}
.qs-explore { margin: 0 0 10px; font-size: 13px; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 1px; }
.qs-tabs { list-style: none; margin: 0 0 18px; padding: 0; }
.qs-tabs li {
  display: flex; align-items: baseline; gap: 9px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; line-height: 1.45;
}
.qs-tabs li:last-child { border-bottom: none; }
.qs-tabs .qs-ic { font-size: 15px; flex: none; width: 20px; text-align: center; }
.qs-tabs b { color: var(--accent); font-weight: 600; }
.qs-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qs-dontshow { display: flex; align-items: center; gap: 7px; color: var(--fg-dim); font-size: 12.5px; cursor: pointer; }
.qs-dontshow input { cursor: pointer; }

/* ---- Schéma orbital (Explications) : zones de survol + infobulle ---- */
.expl-diag-wrap { position: relative; display: block; }
.expl-hotspot {
  position: absolute;
  width: 44px; height: 32px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: help;
  background: transparent;
  transition: background .12s;
}
.expl-hotspot:hover,
.expl-hotspot:focus {
  outline: none;
  background: radial-gradient(circle, rgba(91,141,239,0.30) 0%, rgba(91,141,239,0) 72%);
}
.expl-tip {
  position: absolute;
  transform: translate(-50%, -118%);
  max-width: 240px;
  padding: 7px 10px;
  background: rgba(10,14,26,0.97);
  color: #e7eaf3;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 12px; line-height: 1.4; text-align: left;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity .12s;
  z-index: 20;
}
.expl-tip.show { opacity: 1; visibility: visible; }
.expl-tip.below { transform: translate(-50%, 18%); }

/* ---- Champ Notes : surlignage des valeurs interprétées (i, Te1/Te2, R1/R2) ----
   Le textarea (transparent) est superposé à un calque « backdrop » qui réaffiche
   le même texte avec des <mark> derrière les portions réellement interprétées.
   Les deux DOIVENT partager exactement la même métrique de texte pour rester alignés. */
.notes-hl-wrap { position: relative; }
.notes-hl-wrap textarea,
.notes-hl-backdrop {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: 13px/1.45 var(--mono, monospace);
  letter-spacing: normal;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.notes-hl-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: transparent;                 /* seul le texte du textarea est visible */
  background: #ffffff;                 /* le fond blanc du cadre de notes */
  border-color: transparent;
}
.notes-hl-wrap textarea {
  position: relative;
  display: block;
  background: transparent;            /* laisse voir le backdrop (fond + surlignage) */
  color: #1b1f2a;
  resize: vertical;
}
.notes-hl-backdrop mark {
  color: transparent;
  background: rgba(91, 141, 239, 0.22);   /* surlignage discret aux couleurs de l'accent */
  border-radius: 2px;
}

.card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset;
}
.card h3 {
  margin: 0 0 12px; font-size: 11px; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field > label { font-size: 12px; color: var(--fg-dim); }
.radios { display: flex; gap: 14px; flex-wrap: wrap; }
.radios label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.radios input[type=radio] { accent-color: var(--accent); }

.file-list { list-style: none; margin: 0; padding: 0; overflow: auto; font-size: 12.5px; }
.file-list li {
  display: flex; align-items: center; gap: 10px; padding: 7px 4px;
  border-bottom: 1px solid var(--border);
}
.file-list li:hover { background: rgba(255,255,255,0.025); }
.file-list li.failed .v { color: var(--err); }
.file-list input[type=checkbox] { accent-color: var(--accent); }
.file-list .fn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .v { font-family: var(--mono); color: var(--accent-2); font-size: 11.5px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* La colonne droite (liste) prend toute la hauteur, liste scrollable */
.loader-grid > .card:last-child { display: flex; flex-direction: column; min-height: 0; }
.loader-grid > .card:last-child .file-list { flex: 1; min-height: 0; }

/* ---- Visualisation : les graphes remplissent l'espace ---- */
.viz-grid { display: grid; grid-template-rows: auto minmax(0, 1fr) 64px; gap: 12px; height: 100%; }
.viz-head { display: flex; flex-direction: column; gap: 8px; }
.viz-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.viz-info { font-family: var(--mono); color: var(--fg-dim); font-size: 12.5px; margin-left: 6px; }
.viz-toolbar button.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.viz-banner { background: #4a1f1f; color: #ff9aa8; border: 1px solid #6e2b2b; border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
#graph-main, #graph-resid {
  width: 100%; height: 100%; min-height: 0;
  background: #0b0d14; border: 1px solid var(--border); border-radius: var(--radius);
}
.dygraph-legend {
  background: rgba(14,16,22,0.92) !important; color: var(--fg) !important;
  font-size: 12px !important; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px !important;
}
.dygraph-axis-label { color: var(--fg-dim) !important; }

/* ---- Panneau flottant d'ajustement des bornes (déplaçable, sans assombrir le fond) ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 190; background: rgba(6, 8, 14, 0.55); backdrop-filter: blur(1px); }
.ra-tab.active { border-color: var(--accent); color: var(--accent); background: var(--bg-elev2); }

/* tooltip + menu contextuel des points du diagramme de phase */
.phase-tooltip {
  position: fixed; z-index: 320; pointer-events: none;
  background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 6px 9px; font-size: 12px; line-height: 1.45; color: var(--text);
  box-shadow: var(--shadow); max-width: 320px;
}
.phase-ctxmenu {
  position: fixed; z-index: 330; min-width: 168px; padding: 4px;
  background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 8px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.phase-ctxitem {
  text-align: left; background: none; border: none; color: var(--text);
  padding: 7px 10px; border-radius: 5px; font-size: 13px; cursor: pointer;
}
.phase-ctxitem:hover { background: var(--bg-elev2); }
.float-panel {
  position: fixed; z-index: 200; width: 560px; max-width: 92vw; max-height: 84vh;
  display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.fp-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg-elev2); border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0; cursor: move; user-select: none;
}
.fp-title { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-close { background: transparent; border: none; color: var(--fg-dim); cursor: pointer; padding: 4px; border-radius: 6px; }
.fp-close:hover { color: var(--fg); background: rgba(255,255,255,0.06); }
.fp-body { padding: 14px 16px; overflow: auto; }
.bounds-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.bounds-col h4 { margin: 0 0 12px; font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.6px; }
.slider-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 8px; margin-bottom: 12px; }
.slider-row > label { font-size: 11px; color: var(--fg-dim); font-family: var(--mono); }
canvas.rs { width: 100%; height: 32px; display: block; touch-action: none; }
.fp-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---- Onglet orbital (M4) ---- */
.orbital-grid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; height: 100%; }
.orbital-controls { align-self: start; max-height: 100%; overflow: auto; }
.orbital-controls .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg); }
.orbital-controls button.primary, .orbital-controls #orb-reset-excl { width: 100%; }
.orbital-controls .radios { gap: 16px; }
.orb-prow { display: grid; grid-template-columns: auto 64px 1fr; align-items: center; gap: 8px; margin-bottom: 7px; }
.orb-prow .chk { font-size: 12px; color: var(--fg-dim); }
.orb-plabel { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); }
.orb-pval { width: 100%; }
#period-canvas { width: 100%; display: block; background: #0b0d14; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; cursor: crosshair; }
.hint { color: var(--fg-dim); font-size: 11.5px; margin: 10px 0 0; line-height: 1.4; }
.orbital-plot { display: flex; flex-direction: column; min-height: 0; }
#graph-phase { flex: 1; width: 100%; min-height: 360px; background: #0b0d14; border: 1px solid var(--border); border-radius: var(--radius); }
.orbital-plot .viz-info { margin-top: 10px; }

.elements-grid { display: grid; grid-template-columns: minmax(300px, 480px) 1fr; gap: 16px; height: 100%; }
.orbit3d-card { display: flex; flex-direction: column; min-height: 0; }
#orbit3d-host { flex: 1; min-height: 660px; position: relative; }
.orbit3d-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; }

/* Ligne 3D : colonnes de contrôles verticales (gauche i/R₁/R₂/Teff, droite boutons) flanquant le canvas */
.o3d-3d-row { flex: 1.7 1 0; min-height: 240px; display: flex; gap: 8px; }
.o3d-stage { position: relative; flex: 1 1 auto; min-height: 0; }
#orbit3d-canvas { width: 100%; height: 100%; display: block; border-radius: var(--radius); outline: none; touch-action: none; }
.o3d-sidebar { display: flex; flex-direction: column; gap: 7px; flex: 0 0 auto; padding: 6px; background: rgba(11,13,20,0.55); border-radius: 8px; }
.o3d-sidebar.o3d-left { width: 168px; }
.o3d-sidebar.o3d-right { width: 168px; }
.o3d-sidebar label { display: flex; align-items: center; gap: 5px; color: var(--fg-dim); font-size: 11.5px; }
.o3d-sidebar label input[type=number] { width: 80px; margin-left: auto; }
.o3d-irow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 5px; }
.o3d-irow input[type=range] { width: 100%; min-width: 0; accent-color: var(--accent); }
.o3d-sidebar button { width: 100%; padding: 6px 8px; text-align: left; }
.o3d-sidebar button.active { border-color: var(--accent); color: var(--accent); background: var(--bg-elev2); }
.o3d-sidebar button.o3d-help { width: 34px; line-height: 1; }
.o3d-help { color: #ffd24a; }
.o3d-help:hover { border-color: #ffd24a; background: rgba(255, 210, 74, 0.12); }

/* Ligne 2D : card (contrôle JD + stats) à GAUCHE + diagramme à droite, extensible en hauteur */
.o3d-2d-row { flex: 1 1 0; min-height: 210px; display: flex; gap: 8px; }
/* flex-basis 0 (PAS auto) : sinon le flex-basis suit l'attribut width du canvas que draw2D réécrit
   à clientWidth·dpr → boucle de redimensionnement (tremblement). min-width 0 pour pouvoir rétrécir. */
.orbit2d { flex: 1 1 0; min-width: 0; height: 100%; display: block; background: #0b0d14; border: 1px solid var(--border); border-radius: var(--radius); }
.o3d-2d-card { flex: 0 0 250px; height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow: auto; }
.o3d-jd { display: flex; flex-direction: column; gap: 6px; }
.o3d-jd label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--fg-dim); }
.o3d-jd input { background: var(--bg-elev); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 6px; font-size: 11.5px; }
.o3d-jd-btns { display: flex; gap: 6px; }
.o3d-jd-btns button { flex: 1; padding: 5px 6px; font-size: 11px; }
.orbit2d-info { font-family: var(--mono); font-size: 11px; line-height: 1.5; display: flex; flex-direction: column; gap: 2px; }
.orbit2d-info .c1 { color: #9ec1ff; }
.orbit2d-info .c2 { color: #9ff0e2; }
.ecl-row { padding: 8px 0; border-top: 1px solid var(--border); font-size: 12.5px; line-height: 1.55; }
.ecl-row:first-child { border-top: none; }
.orbit3d-legend {
  position: absolute; top: 10px; right: 12px; font-size: 11px; color: var(--fg-dim);
  background: rgba(11,13,20,0.6); padding: 4px 9px; border-radius: 6px; pointer-events: none;
}
.header-star {
  margin-left: 16px; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.5px; color: var(--accent); background: var(--bg-elev2); border: 1px solid var(--border-strong);
  white-space: nowrap; display: none;
}
.header-star:not(:empty) { display: inline-block; }
.hdr-btn {
  margin-left: 12px; width: 34px; height: 30px; cursor: pointer; font-size: 16px; line-height: 1;
  background: var(--bg-elev); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
.hdr-btn:hover { border-color: var(--accent); background: var(--bg-elev2); }
.hdr-btn.active { border-color: var(--accent); color: var(--accent); }

#calc-banner {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: none; align-items: center; gap: 12px;
  background: var(--bg-elev2); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 10px 18px; box-shadow: 0 8px 30px rgba(0,0,0,0.45); font-size: 13px; color: var(--fg);
}
#calc-banner .cb-spin {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.2); border-top-color: var(--accent);
  border-radius: 50%; animation: cb-rot 0.7s linear infinite; flex: 0 0 auto;
}
@keyframes cb-rot { to { transform: rotate(360deg); } }
#calc-banner .cb-txt { font-family: var(--mono); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
#calc-banner .cb-bar { width: 170px; height: 6px; background: var(--bg-elev); border-radius: 4px; overflow: hidden; flex: 0 0 auto; }
#calc-banner .cb-fill { height: 100%; background: var(--accent-grad); width: 0; transition: width 0.15s; }

.tool-block { padding: 10px 0; border-top: 1px solid var(--border); }
.tool-block:first-of-type { border-top: none; }
.tool-block b { font-size: 12.5px; display: block; margin-bottom: 6px; }
.tool-block .row { margin-bottom: 6px; }
.tool-block .tl { font-size: 12px; color: var(--fg-dim); width: 120px; }
.tool-out { font-family: var(--mono); font-size: 12px; color: var(--accent-2); margin-top: 4px; line-height: 1.5; }

.elements-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.elements-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.elements-table tr { position: relative; cursor: default; }
.elements-table tr:hover { background: rgba(255,255,255,0.04); }
.el-key { color: var(--fg-dim); width: 45%; }
.el-val { font-family: var(--mono); color: var(--fg); }

/* ── Onglet Explications ──────────────────────────────────────────── */
[data-panel="explications"] { overflow-y: auto; }

.expl-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.5fr) minmax(300px, 1fr);
  gap: 16px;
  padding: 16px;
  align-items: start;
}
.expl-h3 {
  margin: 0 0 14px; font-size: 11px; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.expl-diag-card canvas { display: block; width: 100%; border-radius: 6px; }
.expl-right { display: flex; flex-direction: column; gap: 14px; }
.expl-eq-card { padding: 16px 18px; }

/* Équations */
.eq-block { margin: 10px 0 8px; }
.eq-line {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 8px; font-size: 14px;
}
.eq-lhs { font-style: italic; color: var(--accent); min-width: 80px; font-family: var(--mono); }
.eq-op  { color: var(--fg-dim); }
.eq-rhs { font-family: var(--mono); color: var(--fg); line-height: 1.9; }
.eq-small { color: var(--fg-dim); font-size: 12px; margin-top:-4px; padding-left: 100px; font-style: italic; }
.eq-note { color: var(--fg-dim); font-size: 12px; margin: 4px 0 2px; }
.eq-frac {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: middle; margin: 0 4px;
}
.eq-num { border-bottom: 1px solid var(--fg-dim); padding: 0 4px 2px; font-size: 13px; }
.eq-den { padding: 2px 4px 0; font-size: 13px; }
.eq-frac-inline {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: middle; font-size: 11px; margin: 0 2px; line-height: 1.3;
}
.eq-half { font-size: 11px; vertical-align: middle; }

/* Table paramètres */
.expl-param-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.expl-param-table th {
  text-align: left; color: var(--fg-dim); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .8px;
  border-bottom: 1px solid var(--border-strong); padding: 6px 10px;
}
.expl-param-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.expl-param-table tr:hover td { background: rgba(255,255,255,0.03); }
.expl-param-table td:first-child { font-family: var(--mono); color: var(--accent); white-space: nowrap; }
.expl-param-table td:last-child  { color: var(--fg-dim); white-space: nowrap; }

@media (max-width: 900px) {
  .expl-layout { grid-template-columns: 1fr; }
}

/* Icône ? et tooltip sur les éléments orbitaux */
.el-tip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; border-radius: 50%;
  background: rgba(255,255,255,0.10); color: var(--fg-dim);
  font-size: 9px; font-family: sans-serif; font-weight: 700;
  vertical-align: middle; margin-left: 5px; cursor: help;
  transition: background 0.15s, color 0.15s;
}
.elements-table tr:hover .el-tip-icon {
  background: var(--accent); color: #fff;
}
/* Tooltip natif enrichi via [title] — rendu cross-navigateur amélioré via ::after */
.elements-table tr[title]:hover::after {
  content: attr(title);
  position: fixed;
  left: 50%; bottom: 2.5rem;
  transform: translateX(-50%);
  max-width: 360px;
  background: #1a2340;
  color: #c8d4ee;
  font-size: 12px; line-height: 1.55;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid rgba(91,141,239,0.35);
  box-shadow: 0 4px 18px rgba(0,0,0,0.55);
  pointer-events: none;
  white-space: normal;
  z-index: 9999;
}

/* ---- Onglet EW ---- */
.ew-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; height: 100%; }
.ew-controls { align-self: start; }
.ew-controls button.primary, .ew-controls #ew-copy { width: 100%; }
.ew-controls .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg); }
.ew-legend { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 12.5px; color: var(--fg-dim); }
.ew-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ew-plot { display: flex; flex-direction: column; min-height: 0; }
#ew-canvas { width: 100%; display: block; background: #0b0d14; border: 1px solid var(--border); border-radius: var(--radius); cursor: crosshair; }
.ew-plot .viz-info { margin-top: 10px; }

/* ---- sous-onglets (panneau Chargement) ---- */
.subtabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.subtab {
  background: transparent; color: var(--fg-dim); border: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 8px 16px; cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.subtab:hover { color: var(--fg); background: rgba(255,255,255,0.03); }
.subtab.active { color: var(--fg); background: var(--bg-panel); box-shadow: inset 0 -2px 0 var(--accent); }
.subpanel { display: none; }
.subpanel.active { display: block; }

/* ---- bibliothèque IndexedDB ---- */
.lib-tree { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.lib-star { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 12px; }
.lib-star > summary { cursor: pointer; padding: 8px 0; font-weight: 600; list-style: none; }
.lib-star > summary::-webkit-details-marker { display: none; }
.lib-star > summary::before { content: '▸ '; color: var(--accent); }
.lib-star[open] > summary::before { content: '▾ '; }
.lib-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.lib-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-bottom: 10px; }
.lib-cols b { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
.lib-cols .file-list { max-height: 220px; margin-top: 6px; }
.lib-notes { padding: 2px 0 10px; }
.lib-notes b { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
.lib-notes .v { font-family: var(--mono); color: var(--accent-2); font-size: 11.5px; margin-left: 8px; }
.lib-notes pre { margin: 6px 0 0; padding: 8px 10px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 11px; white-space: pre-wrap; max-height: 140px; overflow: auto; color: var(--fg-dim); font-family: var(--mono); }

/* ---- sous-onglet Résultats ---- */
.results-table { overflow: auto; margin-top: 10px; max-height: calc(100vh - 240px); }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border-strong);
  color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  position: sticky; top: 0; background: var(--bg-panel);
}
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); font-family: var(--mono); }
.data-table td.fn { font-family: inherit; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr:hover td { background: rgba(255,255,255,0.025); }
