/*
    Palette adaptée depuis FRONTPAGE :
    fond #1c2129 · accent #aef22e · texte #dfe6ee / #b9c4d0
*/
*{
    --bg:#1c2129;
    --surface:rgba(255,255,255,0.04);
    --border:rgba(255,255,255,0.3);
    --border-strong:rgba(255,255,255,0.4);
    --accent:#aef22e;
    --accent-soft:rgba(172,255,47,0.35);
    --accent-faint:rgba(172,255,47,0.08);
    --accent-border:rgba(172,255,47,0.6);
    --text:#dfe6ee;
    --text-muted:#b9c4d0;
    --text-dim:#8fa0b3;
    --code-bg:#282f3d63;
    --hover-bg:rgba(0,0,0,0.55);
    --plot-axis-color: #b9c4d0;
    --plot-axis-font: monospace;
    --plot-axis-font-size: 12px;
    box-sizing: border-box;
    scrollbar-width:thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
    font-family: monospace;
    letter-spacing: -1px;
    font-size: auto;
}

body{
    background: var(--bg);
    color: var(--text);
}

button{
    border:none;
    border-radius:5px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width:auto;
    margin:1px;
}
button:hover{
    outline: 1px solid var(--accent);
    color: var(--text);
    background: var(--hover-bg);
    box-shadow: 0px 0px 20px 1px var(--accent-soft);
}
button:disabled{
    background-color: rgba(255,255,255,0.15);
    color: var(--text-dim);
    cursor: not-allowed;
}
select{
    border:none;
    border-radius:5px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width:auto;
    margin:1px;
}
select:hover{
    outline: 1px solid var(--accent);
    color: var(--text);
    background: var(--hover-bg);
    box-shadow: 0px 0px 20px 1px var(--accent-soft);
}
.dropzone{
    border:2px dashed var(--border-strong);
    padding:1em;
    margin-bottom:0.5em;
    text-align:center;
}
.dropzone.dragover{
    background:var(--accent-faint);
    border-color:var(--accent);
}

div{
    border:0px solid var(--border);
    background-color: rgba(255,255,255,0.0);
    padding:0px;
}

.child .parent .child{
    left:100%;
    top:-0%;
}

.parent {
    display: block;
    position:relative;
    float: left;
    margin: 0px;
    border-radius: 5px;
    margin-right: 0px;
    width:auto;
    padding:0px 5px 0px 5px;
    text-align: left;
    cursor:pointer;
    color: var(--text);
    white-space: nowrap;
}

.child .parent{
    position:relative;
    display: block;
    width:100%;
    background: var(--surface);
    margin:1px 0px 1px 0px;
    border-radius: 5px 5px 5px 5px;
    /*font-size: 11pt;*/
    border-bottom: 0px solid rgb(0, 0, 0);
    padding:0px 10px 0px 10px;
}

.parent:hover{
    outline: 1px solid var(--accent);
    color: var(--text);
    background: rgba(0, 0, 0, 0.30);
    box-shadow: 0px 0px 20px 1px var(--accent-soft);
}

.parent.open {
    outline: 2px solid var(--accent);
    box-shadow: 0px 0px 20px 1px black;
}

.parent.open>.child {
    display:block;
    position:absolute;
    z-index:1;
}

.child{
    display:none;
    position:relative;
    border: 1px solid var(--border);
    background: rgba(28, 33, 41, 0.92);
    list-style: none;
    padding: 1px 1px 1px 1px;
    margin: 50px;
    margin: 0px 0px 0px 0px;
    border-radius: 5px;
    float:left;
    width:auto;
}

.label{
    font-weight: normal;
    padding-bottom: 0px;
}

#mainMenu{
    border:0px solid green;
    height: 100%;
    position:relative;
    z-index:200;
}

#mainInterface{
    border:0px solid red;
    display:grid;
    /* `minmax(0,1fr)`, PAS `1fr` nu — voir l'explication à .app, plus bas.

       La rangée du milieu ne doit jamais pouvoir grow: c'est 1fr qui décide
       de ce qu'il y a entre le panneau du haut et celui du bas. */
    grid-template-rows:125px 5px minmax(0,1fr) 5px 100px;
    justify-items: stretch;
    justify-content: stretch;
    transition:300ms;
    overflow:hidden;
    /* Le filet: même avec la rangée ci-dessus verrouillée, l'item ne doit pas
       avoir de taille minimale automatique. `body.menu-open` le rend visible,
       et visible la réinstalle (voir .app). */
    min-height:0;
}

.horizontal.mid.panel{
    display: grid;
    grid-template-columns: 250px 5px 1fr 5px 250px;
    transition: 300ms;
    overflow:hidden;
}

.horizontal.septum{
    display:grid;
    grid-template-columns: 1fr 20px 1fr;
    position:relative;
}
.horizontal.resizer{
    cursor:row-resize;
}
.vertical.resizer{
    cursor: col-resize;
}
.vertical.septum{
    display:grid;
    grid-template-rows: 1fr 20px 1fr;
}
.resizer{
    justify-self: stretch;
    align-self: stretch;
    background-color: rgba(255,255,255,0.12);
}

.wrapper{
    background-color: #232936;
    border-radius: 5px;
    border:1px solid var(--border-strong);
    height: 100%;
    width:100%;
    justify-self: center;
    align-self: center;
    z-index:1;
}
.wrapper:hover{
    background-color: var(--accent-faint);
    opacity: 100%;
    scale: 3;
    border-radius: 5px;
    border: 0.1px solid var(--accent-border);
    transition: 100ms;
}

.content{
    height: 100%;
    min-height: 0;
    overflow:auto;
    border:0px solid violet;
    background: linear-gradient(135deg, #1f252fd7, #232b38d7, #1f252fd7);
    border-radius: 5px;
}
.panel{
    border:0px solid greenyellow;
    overflow: auto;
    position:relative;
}
.vertical.left.content{
    min-height:0;
    overflow:auto;
    scrollbar-width:none;
    -ms-overflow-style:none;
}
.vertical.left.content::-webkit-scrollbar{
    display:none;
}
.vertical.right.content{
    min-height:0;
    overflow:auto;
    scrollbar-width:none;
    -ms-overflow-style:none;
}
.vertical.right.content::-webkit-scrollbar{
    display:none;
}
.accordion.container{
    min-height:0;
    overflow:hidden;
}
.accordion.content{
    min-width:0;
    min-height:0;
}
.accordion.content.sizing-content{
    display:block;
    height:auto;
    overflow:visible;
}
.accordion.content.sizing-viewport{
    display:grid;
    grid-template-rows:minmax(0, 1fr);
    height:100%;
    overflow:hidden;
}

.app{
    display:grid;
    /* `minmax(0,1fr)`, PAS `1fr`. C'est ICI que se joue le bug.

       #mainInterface est l'item de cette rangée. Un `1fr` nu vaut
       `minmax(auto,1fr)`, et le `auto` — la TAILLE MINIMALE AUTOMATIQUE de
       l'item — vaut le min-content de ce dernier... sauf si l'item est un
       conteneur de défilement, où il vaut 0. #mainInterface défile
       (overflow:hidden), donc il restait cloué à la hauteur de la fenêtre et le
       panneau gauche scrollait dans son .vertical.left.content, quel que soit
       le nombre d'accordéons.

       `body.menu-open` le passe en overflow:visible pour que le sous-menu du
       flux puisse déborder par-dessus le panneau du milieu. Il perd alors son
       minimum à zéro: le min-content de #mainInterface — la hauteur réelle de
       son contenu, panneau gauche compris — devient le plancher de la rangée.
       La rangée du milieu grow, et le panneau bot est poussé hors de la fenêtre.

       C'est bien ce qu'on voyait: le panneau gauche « veut toute la place dont
       il a besoin ». Il ne la veut pas — il la PREND, parce qu'on avait retiré
       la seule règle qui l'en empêchait. */
    grid-template-rows: auto minmax(0,1fr);
    position: absolute;
    bottom:0px;
    top:0px;
    left:0px;
    right:0px;
}

.accordion.handler.menu{
    opacity:0.5;
}

/* ---- Réordonner les accordéons d'une colonne ---------------------------- */
/* La poignée du handler: elle était déjà peinte et vide, elle devient le seul
   endroit d'où l'on tire un panneau. Le curseur `grab` est la moitié du
   contrat — une poignée sans curseur de saisie se prend pour un décor. La
   poignée garde le focus après un déplacement au clavier, donc son anneau de
   focus doit être visible: c'est le seul moyen de savoir où l'on est. */
.accordion.handler.menu.grip{
    cursor:grab;
    touch-action:none;
}
.accordion.handler.menu.grip:hover{
    opacity:1;
    border-color:var(--accent-border);
}
.accordion.handler.menu.grip:active{
    cursor:grabbing;
}
.accordion.handler.menu.grip:focus-visible{
    outline:1px solid var(--accent);
}

/* La ligne d'insertion, en haut ou en bas de la ligne visée. Un box-shadow
   interne et non une bordure: la bordure ferait sauter la mise en page d'un
   pixel à chaque passage, et le panneau à côté clignoterait avec. */
.accordion.container.reorder-above{
    box-shadow: inset 0 3px 0 0 var(--accent);
}
.accordion.container.reorder-below{
    box-shadow: inset 0 -3px 0 0 var(--accent);
}
/* Le panneau emporté: il reste en place pendant le geste (on ne réordonne
   qu'au dépôt), donc il s'efface pour qu'on voie ce qu'on survole. */
.accordion.container.reordering{
    opacity:0.45;
}

.accordion.folder:hover{
    border:1px solid var(--accent);
}

.accordion.label{
    text-align: center;
    color: var(--text);
}

.accordion.folder{
    border:1px solid var(--accent-border);
    border-radius: 5px;
    background-color: rgba(172,255,47,0.18);
    width: 1em;
    height: 1em;
    align-self: center;
}

.accordion.menu{
    border:1px solid var(--border-strong);
    border-radius: 5px;
    background-color: #3a4250;
    width: 1em;
    height: 1em;
    align-self: center;
}

.dismisser{
    border:1px solid var(--border-strong);
    border-radius: 5px;
    background-color: rgba(104, 34, 34, 0.671);
}
.dismisser:hover{
    background-color: rgba(194, 26, 26, 0.671);
    border:1px solid var(--border-strong);
}
.popup.container.folded{
    grid-template-rows:auto;
}
/* LE CONTENU D'UNE FENÊTRE REPLIÉE DISPARAÎT VRAIMENT.

   `hidden` seul ne suffit pas: le graphe d'attribution pose un
   `display:grid` EN LIGNE sur ce bloc, et une propriété en ligne bat la règle
   `[hidden]{display:none}` du navigateur. Le contenu restait donc en place —
   et, avec son `height:100%`, il nourrissait la hauteur `auto` de la fenêtre:
   la fenêtre repliée CONTINUAIT DE GRANDIR au lieu de se réduire à sa barre
   de titre. `!important` est ici nécessaire, et c'est le seul endroit du
   projet qui s'en sert. */
.popup.container.folded > .popup.content{
    display:none !important;
}
.popup.container.maximized{
    resize:none;
}
.dismisser.disabled{
    background-color: rgba(143, 160, 179, 0.18);
    border-color: rgba(143, 160, 179, 0.45);
    cursor: not-allowed;
    opacity: 0.55;
}
.dismisser.disabled:hover{
    background-color: rgba(143, 160, 179, 0.18);
    border-color: rgba(143, 160, 179, 0.45);
}

/* Le bouton de grille, entre le vert du repli et le rouge de la fermeture.
   Le jaune est le seul qui n'était pas pris: le rouge ferme, le vert replie,
   et un troisième « fermer » serait illisible. */
.tiler{
    border:1px solid var(--border-strong);
    border-radius: 5px;
    background-color: rgba(172, 140, 34, 0.55);
    cursor: pointer;
    transition: 150ms ease;
}
.tiler:hover{
    background-color: rgba(214, 176, 42, 0.8);
    box-shadow: 0px 0px 20px 1px rgba(214, 176, 42, 0.35);
    outline: 1px solid var(--accent);
}
/* A tiler that does not apply: greyed, no hover, no cursor.

   The Dialog constructor adds `disabled` when the window does not live in the
   central panel, because that is the only panel whose windows can be tiled
   together. It is styled like the dismisser's disabled state rather than
   hidden, because a control that disappears from one panel and reappears in
   another is harder to learn than one that is visibly not applicable.

   The hover rule above is cancelled explicitly: a greyed button that still lit
   up on hover would be lying about being usable. */
.tiler.disabled{
    background-color: rgba(143, 160, 179, 0.18);
    border-color: rgba(143, 160, 179, 0.45);
    cursor: not-allowed;
    opacity: 0.55;
}
.tiler.disabled:hover{
    background-color: rgba(143, 160, 179, 0.18);
    border-color: rgba(143, 160, 179, 0.45);
    box-shadow: none;
    outline: none;
}

.selected{
    outline: 1px solid var(--text);
    box-shadow: 0px 0px 20px 1px var(--accent-soft);
}
.trace-group{
    display:grid;
    min-width:0;
    gap:4px;
}
.trace-item.selected{
    outline: 1px solid var(--accent);
    outline-offset: 1px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55), 0 0 10px rgba(172,255,47,0.28);
}
.trace-editor{
    background:rgba(42, 51, 63, 0.92);
    border:1px solid rgba(111, 132, 151, 0.72)!important;
    box-shadow:inset 0 0 0 1px rgba(167, 183, 198, 0.18), 0 1px 4px rgba(0,0,0,0.28);
}
.trace-editor::before{
    content:"Trace settings";
    color:#9aafc1;
    font-size:0.8em;
    font-weight:600;
    letter-spacing:0.04em;
    text-transform:uppercase;
}

/* ---- Peak picking: the two stages, each a collapsible section ---- */
/* Same visual language as the trace editor's ::before label (uppercase, spaced,
   blue-grey), so a section header reads the same wherever it appears. The
   number inputs carry a SIZE, not a width: an input sized to its digits must
   shrink last, or a wide placeholder pushes the buttons off the row. */
.pp-section{
    min-width:0;
}
/* the caption a <summary> used to carry: same visual language as the trace
   editor's ::before label (uppercase, spaced, blue-grey), on a plain row now
   that the sections no longer fold */
.pp-caption{
    color:#9aafc1;
    font-size:0.8em;
    font-weight:600;
    letter-spacing:0.04em;
    text-transform:uppercase;
    padding:2px 4px;
    user-select:none;
}
.pp-row{
    display:grid;
    align-items:center;
    gap:4px;
    padding:2px 4px;
    min-width:0;
}
/* the row of numeric controls: the two fields flex, the buttons and the
   readout keep their own size, and min-width:0 lets the fields be the ones
   that give way */
.pp-row input[type=number]{
    min-width:0;
    /* max-width, not only min-width: the 1fr track already lets the field give
       way, but an intrinsic size also sets a FLOOR. Capping it means the field
       can never grow past this and push the buttons off the row, however wide a
       value or placeholder it holds. */
    max-width:8em;
    width:100%;
    box-sizing:border-box;
    padding:2px;
    /* appearance on the INPUT, not only on the ::-webkit-inner-spin-button
       pseudo-element below: a generic `input { }` rule later in this file
       resets the element's own appearance, and on Chromium that brings the
       spinners straight back even though the pseudo-element rule still matches. */
    -webkit-appearance:none;
    appearance:none;
}
/* the native number spinners are useless on a threshold: you type a value or
   take one from the Guess button, you never nudge it by one step. Same reason
   as the trimmer cursors, and the same rules - the spinner also costs width on
   the narrowest element in the row. */
.pp-row input[type=number]::-webkit-outer-spin-button,
.pp-row input[type=number]::-webkit-inner-spin-button{
    -webkit-appearance:none;
    margin:0;
}
.pp-row input[type=number]::-moz-outer-spin-button,
.pp-row input[type=number]::-moz-inner-spin-button{
    -moz-appearance:none;
    display:none;
}
.pp-readout{
    opacity:0.8;
    white-space:nowrap;
    justify-self:end;
}

/* ---- Multiplexing: the controls that go grey when waves share one node ----
   A control that decides for ONE spectrum has no meaning while several are
   being treated the same way, so the nodes set `disabled` on it and the browser
   stops accepting it. This is what makes it LOOK greyed: a number field and a
   select carry their own text colour, and without this they would read as live
   settings while refusing every keystroke — which is worse than a control that
   is simply absent. `button:disabled` already exists above; an input is not a
   button, and that difference is what is paid for here. */
.pp-row input:disabled,
.trim-fields input:disabled,
.cal-row input:disabled,
.pp-row button:disabled,
.cal-row button:disabled{
    opacity:0.45;
    cursor:not-allowed;
}

/* ---- Calibration: same visual language as peak picking ---- */
.cal-section{
    min-width:0;
}
.cal-caption{
    color:#9aafc1;
    font-size:0.8em;
    font-weight:600;
    letter-spacing:0.04em;
    text-transform:uppercase;
    padding:2px 4px;
    user-select:none;
}
.cal-row{
    display:grid;
    align-items:center;
    gap:4px;
    padding:2px 4px;
    min-width:0;
}
.cal-row input[type=number],
.cal-row select{
    min-width:0;
    max-width:8em;
    width:100%;
    box-sizing:border-box;
    padding:2px;
    -webkit-appearance:none;
    appearance:none;
}
.cal-row input[type=number]::-webkit-outer-spin-button,
.cal-row input[type=number]::-webkit-inner-spin-button{
    -webkit-appearance:none;
    margin:0;
}
.cal-row input[type=number]::-moz-outer-spin-button,
.cal-row input[type=number]::-moz-inner-spin-button{
    -moz-appearance:none;
    display:none;
}
.cal-readout{
    opacity:0.8;
    white-space:nowrap;
    justify-self:end;
}

input[type=range].dual{
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    min-width: 0;
}
input[type=range].dual::-webkit-slider-runnable-track{
    background: transparent;
}
input[type=range].dual::-webkit-slider-thumb{
    pointer-events: auto;
    cursor: ew-resize;
}
input[type=range].dual::-moz-range-track{
    background: transparent;
}
input[type=range].dual::-moz-range-thumb{
    pointer-events: auto;
    cursor: ew-resize;
}

/* ---- Inspecteur SimpleXYPlot (accordéon droit) ---- */
.accordion.content details{
    min-width: 0;
}
.accordion.content details input,
.accordion.content details select,
.accordion.content details button{
    min-width: 0;
    max-width: 100%;
}

/* ---- Trimmer: cursor bounds ride their own histogram line ---- */
/* the native number spinners are useless on a threshold: you drag the
   cursor or type a value, you never nudge it by one step */
.trim-cursor input[type=number]::-webkit-outer-spin-button,
.trim-cursor input[type=number]::-webkit-inner-spin-button{
    -webkit-appearance:none;
    margin:0;
}
.trim-cursor input[type=number]::-moz-outer-spin-button,
.trim-cursor input[type=number]::-moz-inner-spin-button{
    -moz-appearance:none;
    display:none;
}

/* ---- Table (virtualisée) ---- */
.table.container{
    position:relative;
    width:100%;
    height:100%;
    overflow:auto;
    overflow-anchor:none;
    scroll-behavior:auto;
    white-space:nowrap;
}
.table.ruler.horizontal,
.table.ruler.vertical{
    border:none;
    opacity:0.5;
    cursor:auto;
    overflow:hidden;
}
.table.ruler.horizontal th,
.table.ruler.vertical th{
    font-size:12px;
    font-weight:normal;
    color:var(--text-muted);
    background:rgba(255,255,255,0.06);
    border-bottom:1px solid var(--border);
    overflow:hidden;
    text-overflow:ellipsis;
    cursor:auto;
}
.table.ruler.horizontal th[contenteditable]{
    background:rgba(172,255,47,0.12);
    color:var(--text);
}
.table.normal td{
    background:rgba(255,255,255,0.04);
    color:var(--text);
    text-align:center;
    overflow:hidden;
    text-overflow:ellipsis;
}
.table.normal tr{
    border-bottom:1px solid var(--border);
}

/* ---- Dialogs ---- */
.popup.container{
    background-color:rgba(28,33,41,0.5);
    border:1px dashed var(--accent-border);
    border-radius:10px;
}
.popup.content{
    background:var(--code-bg);
}

/* ---- Menus / navbar ---- */
#mainMenu{
    overflow:visible;
}
.menu.container{
    display:flow-root;
    height:auto;
    overflow:visible;
}
.menu.container>.menu{
    height:1.8em;
    display:flex;
    align-items:center;
    overflow:visible;
}
.menu.container .parent{
    height:1.7em;
    line-height:1.7em;
    padding:0 8px;
}

/* ---- Champs de formulaire (inspecteurs) ---- */
input, textarea{
    background:var(--code-bg);
    color:var(--text);
    border:1px solid var(--border);
    border-radius:3px;
}
input:focus, textarea:focus{
    outline:1px solid var(--accent);
}
input[type=color]{
    padding:0;
}
input[type=checkbox]{
    accent-color:var(--accent-soft);
}

/* ---- Chat (the first tools node) ---- */
.chat-bar{
    display:flex;
    gap:4px;
    align-items:center;
    flex-wrap:wrap;
}
.chat-bar input[type=text]{
    /* the URL is the long one and the nick and room are short: giving them
       all `1fr` would squeeze the URL down to nothing on a narrow window */
    min-width:0;
    flex:1 1 14em;
}
.chat-bar input[size="8"]{
    flex:0 1 8em;
}
.chat-status{
    flex:0 0 auto;
    color:var(--text-muted);
    font-size:0.85em;
    white-space:nowrap;
}
.chat-log{
    overflow-y:auto;
    overflow-anchor:none;
    min-height:0;
    border:1px solid var(--border);
    border-radius:5px;
    padding:4px;
    background:var(--code-bg);
}
.chat-line{
    padding:2px 4px;
    line-height:1.45;
    word-wrap:break-word;
}
.chat-line.system{
    color:var(--text-dim);
    font-style:italic;
    text-align:center;
    font-size:0.85em;
}
.chat-rooms{
    display:grid;
    gap:4px;
}
/* The private-room button is the one that starts a 1-to-1 session with the AI,
   so it gets the accent colour: it is a different action from "Create", not
   just another label. */
.chat-bar button.private-ai{
    border-color:var(--accent-soft);
    color:var(--accent-soft);
}

/* Sources cited by the doc-aware AI: a collapsible block under the answer. */
.chat-sources{
    margin-top:4px;
    border:1px solid var(--border);
    border-radius:4px;
    background:var(--bg-elevated);
    overflow:hidden;
}
.sources-toggle{
    width:100%;
    padding:4px 8px;
    background:none;
    border:none;
    color:var(--accent-soft);
    font-size:0.8em;
    text-align:left;
    cursor:pointer;
}
.sources-toggle:hover{
    background:var(--accent-soft);
    color:var(--bg);
}
.sources-panel{
    padding:4px 8px;
    font-size:0.75em;
    color:var(--text-dim);
}
.source-item{
    padding:2px 0;
    border-bottom:1px solid var(--border);
}
.source-item:last-child{
    border-bottom:none;
}
.source-item[cursor="pointer"]:hover{
    color:var(--accent-soft);
}

/* ---- Quadrillage du flux ---- */
.flow.container{
    background: url('../resources/pattern.svg');
    background-color:#20242e;
    /* le champ svg est agrandi pour contenir le dessin (Flow.fitField): une
       fois qu'il déborde, c'est CEhui-ci qui doit défiler, sinon les nœuds
       sont simplement hors cadre et hors d'atteinte */
    overflow:auto;
}

.flow.workspace{
    display:grid;
    grid-template-rows:auto minmax(0,1fr);
    height:100%;
    min-height:0;
    position:relative;
    overflow:hidden;
}
.flow.workspace>.menu.container{
    display:flow-root;
    position:relative;
    /* BELOW #mainMenu (200), and that is the whole point of the number.

       The first version put this at 300 to lift it over the graph dialogs. It
       did lift it — over the MAIN MENU too, which is a sibling in the same
       root stacking context (neither #mainMenu nor #mainInterface establishes
       one for its children). The main bar became unclickable: you could open a
       menu but not choose an item, because this menu's box sat on top of it.

       What it actually needs to beat is the GRAPH, whose windows start at
       z-index 1 and climb as they are focused. 150 is above all of that and
       below the main bar, so neither menu has to move when the other opens. */
    z-index:150;
}
.flow.workspace>.flow.container{
    min-height:0;
}

/* An open submenu hangs BELOW its item and is `position:absolute`, so it takes
   no part in any layout and simply floats outside the boxes it belongs to.
   Every one of those boxes says `overflow:hidden`, and each one clips in turn:

     #mainInterface   overflow:hidden   the whole workspace grid
     #top .panel      overflow:auto    the top row
     #topContent      .content, overflow:auto   the div that HOLDS the workspace
     .flow.workspace overflow:hidden   the menu bar and the field

   Relaxing only the outer one achieves nothing, because the next one down
   still cuts. That is what made this look like a z-index problem when it was
   a clipping one: the dropdown WAS being given a z-index, and it was still cut
   off one row under the menu bar, which reads exactly like "it is behind the
   other divs".

   So all four are relaxed together, by one class on the BODY — the only common
   ancestor of #topContent and .flow.workspace, which are not related to each
   other in the DOM.

   `#botContent` is deliberately NOT here: the bottom panel has no menu, and
   relaxing it would only risk letting something escape the window. */
body.menu-open #mainInterface,
body.menu-open #top,
body.menu-open #topContent,
body.menu-open .flow.workspace{
    overflow:visible;
}
/* And the list scrolls rather than running off the bottom of the window, so a
   category with many entries stays reachable without a scrollbar on the page. */
body.menu-open .flow.workspace .child{
    max-height:calc(100vh - 120px);
    overflow-y:auto;
}

.nodeContainer{
    /* le réagencement automatique (Flow.autoLayout) déplace les nœuds d'un
       coup: sans transition, un graphe se téléporte et l'œil perd le fil de
       ce qui a bougé. La durée est pilotée par LAYOUT_ANIMATION_MS côté JS */
    transition: transform 260ms ease-out;
}
.nodeContainer.dragging{
    /* pendant un glissement, le suivi doit être instantané: un nœud qui a un
       coup de retard sous le curseur passe pour cassé */
    transition: none;
}

.node{
    fill:rgb(209, 212, 159);
    stroke:rgb(130, 142, 158);
    stroke-width: 1px;
    fill-opacity: 85%;
    transition:300ms
}
.node.pending{
    fill:rgb(235, 200, 140);
}
.node.resolved{
    fill:rgb(150, 235, 110);
}
.node.error{
    fill:rgb(240, 140, 140);
}
/* There was a SECOND selection look here: `:focus` painted a solid tomato
   stroke, while `.selected` paints a dashed accent one. Two indicators for one
   state, and they disagreed — a node you had just deselected kept the focus
   ring, so "selected" and "has focus" looked like different things and neither
   matched the selection.

   Focus is now carried by the SELECTED class alone. The rect is still focused
   in the DOM (Delete and the keyboard still work on it), it just does not paint
   a ring of its own. */
.node:focus{
    outline:none;
}

.node:hover{
    cursor:move;
    fill-opacity: 75%;
    transition:300ms
}

/* A selected node, and there is now only ONE indication of it: this class.

   There used to be two — a solid tomato `:focus` ring and this dashed accent
   one — and the two disagreed, which is worse than either alone. A node you
   had just released kept the focus ring, so it still looked marked; a node you
   had just selected looked different from one that merely had the keyboard
   focus. With the ring gone there is a single state and a single look.

   SOLID accent stroke, not dashed: dashes read as "pending" or "not quite",
   and this is a definite, current, actionable state — Delete will take
   exactly these. */
/* THE GLOBAL `selected` RULE IS FOR HTML PANELS, NOT FOR NODES.

   `.selected` above draws a white CSS outline, which is right for a Dialog
   window (an HTML box) and completely wrong for a node. A node's rect is an
   SVG element: the browser draws that outline as a RECTANGLE AROUND the box,
   in white, on top of the accent stroke. Every selected node therefore wore
   two rings — a white one and a green one — which is exactly the "double
   level of selection" it looked like.

   It also explained the two other symptoms: the white ring showed up on nodes
   that were merely FOCUSED-and-selected rather than last-clicked, because
   `:focus` and `.selected` were two different truths; and it flashed on
   release, because the class was removed a frame before the outline repainted.

   So the outline is cancelled here and the accent STROKE is the single
   indicator. `outline:none` on an SVG rect removes the white box without
   touching the stroke, which is what we want to keep. */
.node.selected{
    outline: none;
    box-shadow: none;
    stroke: var(--accent);
    stroke-width: 3px;
    fill-opacity: 100%;
}

.anchor{
    fill: rgb(160, 172, 188);
    stroke: rgb(100, 110, 125);
    transition:300ms
}

.anchor:hover{
    fill: rgb(255, 0, 140);
    cursor: crosshair;
    transition:300ms;
}

.flow.field{
    fill:#141921;
    /* inline par défaut: le line box réserve le descender sous la baseline,
       donc SVG de hauteur clientHeight + ~4px → scrollbar fantôme Chrome,
       pas Firefox. display:block sort le champ du layout inline. */
    display:block;
}

.anchor.linked{
    fill: black
}

.link{
    stroke: rgb(170, 205, 253);
    stroke-width: 3px;
    fill: none;
    opacity:80%;
}

.link:hover{
    stroke-width: 3px;
    transition: 300ms;
    cursor:crosshair;
    opacity:75%;
}

.link:focus{
    outline:none;
    stroke:tomato;
    stroke-width: 3px;
    opacity:75%;
}

.plot-axis{
    fill: none;
}
.plot-axis .domain,
.plot-axis .tick line{
    stroke: var(--plot-axis-color);
}
.plot-axis .tick text,
.plot-axis text.axis-label{
    fill: var(--plot-axis-color);
    stroke: none;
    font-size: var(--plot-axis-font-size);
    font-family: var(--plot-axis-font);
}

/* ---- Formula collections: the left panel, level 1 and level 2 ---------- */
/* The vocabulary is the panel's own: a row is a grid of cells like .pp-row,
   the grip is the accordion's 1em square, and the accent is the same lime the
   folder buttons use. Nothing new is invented here, so the node reads as part
   of the application rather than as a widget dropped into it.

   ONE EXCEPTION TO THE APP'S TYPE, and it is a deliberate one. The global rule
   sets `letter-spacing:-1px`, which on a monospace face pulls the letters of
   each glyph together: fine for a menu, and at 0.85em on a column of formulae
   it is simply not readable. A column of keys and m/z is TEXT, so this panel
   gets the spacing back and a size that can be read without leaning in. */
.fc-collections,
.fc-formulas,
.fc-addrow-wrap{
    letter-spacing:0;
}
.fc-collection{
    display:grid;
    /* EIGHT columns, and the order here is the order the cells are appended in
       buildCollectionRow — the local dot FIRST, then the caret, then the name.

       The dot and the caret are SIZED columns: both are one glyph, and a `1fr`
       on either of them is what makes one of them eat the whole panel. The
       previous order put the caret on the `1fr` and the name on an `auto`, so
       the chevron stretched across the width while the name — the thing being
       read — was squeezed to its intrinsic size. One glyph, one `1.1em`. */
    grid-template-columns: 1.1em 1.1em minmax(0, 1fr) auto auto auto auto auto;
    align-items:center;
    gap:3px;
    padding:2px;
    font-size:0.95em;
    border:1px solid transparent;
    border-radius:4px;
}
.fc-collection:hover{
    background:var(--hover-bg);
}
/* the collection whose formulas are on screen below. One accent, on the row
   itself and not on its name: a lit button among unlit ones reads as "this one
   is enabled" rather than "this is where you are". */
.fc-collection.current{
    border-color:var(--accent-border);
    background:var(--accent-faint);
}
.fc-collection-open{
    background:transparent;
    border:none;
    color:var(--text-muted);
    line-height:1;
    /* the button FILLS its 1.1em cell — a caret you have to aim at is a caret
       you miss — but the GLYPH stays centred inside it rather than being
       stretched by justify-self, which is what a grid item does by default */
    width:100%;
    height:100%;
    padding:0;
    display:grid;
    place-items:center;
}
.fc-collection-open:hover{
    color:var(--accent);
}
.fc-collection-name{
    background:transparent;
    border:none;
    padding:0 2px;
    color:var(--text);
    font:inherit;
    text-align:left;
}
.fc-collection.current .fc-collection-name{
    color:var(--accent);
    font-weight:600;
}
.fc-collection-count{
    color:var(--text-dim);
    font-size:0.85em;
    white-space:nowrap;
}
/* the two checkboxes are told apart by their TITLE, never by a colour: a
   colour here would be a legend to learn, and the panel is already dense.

   And they are NOT the accent colour either. The lime is reserved for things
   that are chosen — the current collection, a lit scale, the collection that
   lives here — so a pair of green ticks sitting on every row of a list says
   "enabled" about rows that are not enabled, they are merely INCLUDED. Grey
   makes the state quieter than the object it belongs to, which is where it
   belongs: a checkbox is a filter on this row, not a claim about the node. */
.fc-collection input[type=checkbox]{
    margin:0;
    cursor:pointer;
    accent-color:var(--text-dim);
}

/* LEVEL 2 — the virtualized formula list. The spacer carries the full height
   of the list, so the scrollbar is honest; the layer on top of it carries only
   the rows that fit. `contain:strict` is set on the scroll box in JS: it tells
   the browser that nothing outside may influence the layout, which is what
   stops a hundred thousand rows from costing a full-panel reflow per scroll. */
.fc-viewport{
    position:absolute;
    inset:0;
}
/* the scroll box of the formula list. It is a separate element from .fc-formulas
   because that one is now a GRID with the write line above the list: the
   virtualized viewport is absolutely positioned inside the cell that holds it,
   and `contain:strict` on this box is what stops the browser from re-measuring
   a hundred thousand rows on every scroll. */
.fc-viewport-wrap{
    position:relative;
    min-height:0;
    overflow:auto;
    contain:strict;
}
.fc-spacer{
    width:1px;
}
.fc-layer{
    position:absolute;
    inset:0;
}
/* one line. Fixed height, because the offset arithmetic that makes the
   windowing cheap assumes it — and because a list whose rows breathe as the
   user types cannot be scrolled by muscle memory. 22px is the smallest height
   that carries the larger type without clipping the descenders. */
.fc-row{
    display:grid;
    /* SIX columns, and the first is the HANDLE. It is sized in `em` like the
       caret of a collection, and it is ALWAYS there — a line that cannot be
       opened keeps the column and shows nothing in it. A column that appears
       and disappears with the content is a column the eye cannot follow down a
       list, and the handle is the only thing on the line that says "there is
       something inside". */
    grid-template-columns: 1.1em minmax(0, 1fr) 5.4em 3.8em 5.6em 1.1em;
    align-items:center;
    gap:3px;
    height:22px;
    font-size:0.95em;
    cursor:pointer;
    border-bottom:1px solid rgba(255,255,255,0.04);
    /* the indent, one step per level of fold. The step itself is a CSS custom
       property, so the padding stays in the stylesheet where the row's geometry
       lives and this method only says WHICH line it is. */
    --fc-step:16px;
    --fc-depth:0;
    padding-left:calc(2px + var(--fc-step) * var(--fc-depth));
}
/* the handle: invisible until the line has something to open, and a button that
   FILLS its column so there is nothing to aim at. `visibility:hidden` rather
   than `display:none` because the column must keep its place either way. */
.fc-fold{
    background:transparent;
    border:none;
    color:var(--text-muted);
    line-height:1;
    width:100%;
    height:100%;
    padding:0;
    display:grid;
    place-items:center;
    visibility:hidden;
    cursor:pointer;
}
.fc-row.foldable .fc-fold{
    visibility:visible;
}
.fc-row.foldable .fc-fold:hover{
    color:var(--accent);
}
.fc-row:hover{
    background:var(--hover-bg);
}
.fc-row.selected{
    background:var(--accent-faint);
    outline:1px solid var(--accent-border);
    outline-offset:-1px;
}
/* an unfolded row carries a left bar rather than a different colour: the row
   is already tinted when it is selected, and two tints on one row is one too
   many signals in a list this dense. */
.fc-row.unfolded{
    box-shadow:inset 2px 0 0 var(--accent-border);
}
/* a CHILD row — a peak under its formula, a formula under its molecule. It is
   dimmed rather than coloured: it is context for the line above it, and a
   child drawn at the same weight as its parent would be read as an entry of
   its own, which is exactly what it is not. */
.fc-row.child .fc-notation{
    color:var(--text-muted);
}
.fc-row.child .fc-note{
    opacity:0.7;
}
.fc-cell{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.fc-notation{
    /* the notation is the identity on screen: it gets the room, and it is the
       only cell allowed to shrink */
    min-width:0;
}
.fc-num{
    text-align:right;
    color:var(--text-muted);
    font-variant-numeric:tabular-nums;
}
.fc-count{
    text-align:right;
    color:var(--accent);
    font-variant-numeric:tabular-nums;
}
.fc-note{
    text-align:center;
    color:var(--text-dim);
    font-size:0.9em;
}

/* the "this collection lives here" dot: one glyph, the accent colour, and
   nothing at all when the collection belongs to a parent */
.fc-collection-local{
    color:var(--accent);
    font-size:0.7em;
    text-align:center;
}
.fc-collection-local.off{
    color:transparent;
}

/* ---- writing: the collection button, and the one-line formula field ---- */
/* A verb, and it is written like one. It was the accent colour, which made it
   the loudest object on a panel whose job is a quiet column of formulae — and
   the lime already says "this is the collection you are reading". Creating a
   collection is not that; it is one of several things you can do here, and it
   belongs to the same register as the field below it. */
.fc-newcollection{
    justify-self:start;
    font-size:0.85em;
    color:var(--text-muted);
    border-color:var(--border);
}
/* The field is the FKMD gesture, not a form: write, read, press Enter. The
   readout sits on the SAME line and carries the reading, so "is this what I
   meant" is answered without moving the eyes anywhere else. */
.fc-addrow-wrap{
    padding:0 0 3px 0;
    border-bottom:1px solid var(--border);
    margin-bottom:2px;
}
.fc-addrow{
    display:grid;
    /* field, live reading, commit button, and the outcome of the last Enter.
       The hint takes the WHOLE second line rather than a fourth column: a
       refusal message is a sentence, and a sentence squeezed into an `auto`
       column next to a button is a sentence nobody reads. */
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "field readout commit" "hint hint hint";
    align-items:center;
    gap:4px;
}
.fc-addrow input{grid-area:field}
.fc-addrow .fc-readout{grid-area:readout}
.fc-addrow>button{grid-area:commit}
.fc-addrow .fc-addrow-note{grid-area:hint}
/* the two outcomes, told apart by colour AND by the words themselves */
.fc-addrow-ok{
    color:var(--accent);
}
.fc-addrow-bad{
    color:#ff8f6b;
}
.fc-addrow input{
    width:100%;
    min-width:0;
    font-family:inherit;
    font-size:1em;
    padding:4px 5px;
    color:var(--text);
    background:var(--code-bg);
    border:1px solid var(--border);
    border-radius:4px;
}
.fc-addrow input:focus{
    outline:1px solid var(--accent);
}
/* the reason there is no field, spelled out rather than greyed out */
.fc-addrow-note{
    font-size:0.85em;
    color:var(--text-dim);
    padding:1px 2px;
    line-height:1.35;
}
.fc-readout{
    font-size:0.85em;
    color:var(--text-muted);
    white-space:nowrap;
    font-variant-numeric:tabular-nums;
}
.fc-readout-error{
    color:#ff8f6b;
}
.fc-readout-warn{
    color:#ffb347;
}

/* the band that holds the toolbar, the write line, the list and the
   diagnostics. FOUR ROWS: the toolbar (what the list shows, keeps and how it is
   ordered), the write line, the list, the diagnostics. The list takes the rest
   because it is the only row that can absorb the space. It is a GRID, and
   nothing more: it does not scroll and it does not contain. Both belong to
   .fc-viewport-wrap, the scrolling row — `contain:strict` on the band would
   bring SIZE containment with it, and a size-contained grid is laid out as if it
   were empty, which collapses the list to nothing. */
.fc-formulas{
    min-height:0;
    display:grid;
    grid-template-rows:auto auto minmax(0, 1fr) auto;
}
.fc-menu{
    position:fixed;
    z-index:60;
    display:grid;
    gap:1px;
    min-width:14em;
    padding:3px;
    background:rgba(42, 51, 63, 0.97);
    border:1px solid rgba(111, 132, 151, 0.72);
    border-radius:5px;
    box-shadow:0 4px 14px rgba(0,0,0,0.45);
}
.fc-menu button{
    display:grid;
    gap:1px;
    width:100%;
    padding:3px 6px;
    text-align:left;
    background:transparent;
    border:none;
    color:var(--text);
    font:inherit;
    cursor:pointer;
}
.fc-menu button:hover:not(:disabled){
    background:var(--hover-bg);
    outline:1px solid var(--accent-border);
    color:var(--text);
    box-shadow:none;
}
.fc-menu button:disabled{
    opacity:0.45;
    cursor:not-allowed;
}
.fc-menu-label{
    font-size:0.95em;
}
.fc-menu-hint{
    font-size:0.8em;
    color:var(--text-dim);
}

/* LA BANDE D'ISOTOPES — un rang de boutons ronds ancré sous un élément de la
   table (Ctrl+survol). Même squelette que .fc-menu: fixe, z-index 60, ombre.
   La différence est la disposition HORIZONTALE et les ronds. */
.iso-band{
    position:fixed;
    z-index:60;
    display:flex;
    gap:4px;
    padding:4px;
    background:rgba(42, 51, 63, 0.97);
    border:1px solid rgba(111, 132, 151, 0.72);
    border-radius:6px;
    box-shadow:0 4px 14px rgba(0,0,0,0.45);
}
.iso-band-round{
    width:24px;
    height:24px;
    min-width:24px;
    min-height:24px;
    padding:0;
    border-radius:50%;
    border:1px solid var(--border);
    background:var(--surface);
    color:var(--text);
    font:inherit;
    font-size:0.75em;
    font-weight:700;
    line-height:1;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
}
.iso-band-round:hover{
    border-color:var(--accent);
    outline:1px solid var(--accent-border);
}

/* the right panel: the detail of one formula */
.fc-bigkey{
    font-size:1.15em;
    color:var(--accent);
    word-break:break-all;
    padding:2px 0;
}
.fc-field{
    display:grid;
    grid-template-columns:4.5em minmax(0, 1fr);
    gap:4px;
    align-items:baseline;
}
.fc-field-label{
    color:var(--text-dim);
    font-size:0.9em;
}
/* the value wraps instead of being cut: an m/z or a key that ends in an
   ellipsis is a number the user cannot check against anything */
.fc-field-value{
    min-width:0;
    overflow-wrap:anywhere;
    font-variant-numeric:tabular-nums;
}
.fc-targets{
    display:grid;
    gap:1px;
    font-variant-numeric:tabular-nums;
}
.fc-targets-line{
    display:grid;
    grid-template-columns:minmax(0, 1fr) 4.6em 3.6em 3.2em;
    gap:3px;
    font-size:0.9em;
}
.fc-targets-head{
    color:var(--text-dim);
    font-size:0.8em;
    text-transform:uppercase;
    letter-spacing:0.04em;
}
.fc-note{
    width:100%;
    box-sizing:border-box;
    resize:vertical;
    font:inherit;
    font-size:0.85em;
    padding:3px 4px;
    color:var(--text);
    background:var(--code-bg);
    border:1px solid var(--border);
    border-radius:4px;
}
.fc-diagnostics{
    padding:2px 3px;
    font-size:0.78em;
    color:var(--text-dim);
    border-top:1px solid var(--border);
    overflow:auto;
}

/* the container becomes a stacking context so that the negative z-index of
   the back layer can never escape behind another panel */
.plot2d.container{
    position:relative;
    z-index:0;
}
/* the persistent WebGL canvas, exactly as wide/high as the graphzone
   (left/top/width/height are written by Plot2DWebGL.syncTraceViewport) */
canvas.trace-layer{
    position:absolute;
    z-index:-1;
    display:block;
    pointer-events:none;
}
/* the D3/SVG overlay stays in front, interaction included */
.plot2d.container>svg.main{
    position:relative;
    z-index:1;
}

/* ---- hover / pick overlay (Plot2DWebGL) ----
   Its OWN svg, and a SIBLING of svg.main rather than a child of it: the
   main overlay carries the graphzone opacity (0.5 by default) and a group
   opacity is multiplicative, so a marker nested inside would be greyed
   down no matter what it declares. Above both the canvas and the axes,
   and transparent to the pointer: the hover is read from the container. */
svg.pick-overlay{
    position:absolute;
    left:0px;
    top:0px;
    z-index:2;
    display:block;
    pointer-events:none;
    /*the glow is a filter, so it must not be clipped by the plot box */
    overflow:visible;
}
/* the actual glow: a blur on the marker itself. It is composited, so it
   costs nothing per frame on the handful of nodes that carry it — and it
   is the difference between "a white ring" and "a lit point" */
.pick-hover,.pick-pin{
    will-change:transform;
    filter:drop-shadow(0 0 2.5px rgba(255,255,255,0.95))
           drop-shadow(0 0 6px rgba(160,210,255,0.55));
}
/* the halo is the second, wider ring of the glow. A blurred drop-shadow on
   a SMALL white dot reads as light around the point; a big translucent
   ring reads as a UI affordance, which is not what a hover marker is. */
.pick-halo{
    fill:none;
    stroke:rgba(255,255,255,0.5);
    stroke-width:1.25;
}
.pick-core{
    fill:#ffffff;
}
/* the hover marker: a tight ring so the user sees the point itself, with
   the glow doing the talking. NOT the pick radius — that is a distance,
   and drawing it makes the marker look like a bug */
.pick-hover .pick-halo{
    r:5.5px;
    stroke-width:1.25;
}
.pick-hover .pick-core{
    r:2.6px;
}
/* a pinned point CLOSES IN and stays: born with the hover radii (see
   Plot2DWebGL.addPickPin), then handed over to the tight ones. `r` is
   animatable as a CSS geometry property, and the transition is what turns
   "a marker appeared" into "it closed and it is staying". The attribute
   carries the same values, so a browser that ignores the CSS property
   still draws the marker — only without the animation. */
.pick-pin .pick-halo,
.pick-pin .pick-core{
    transition:r 140ms ease-out;
}
.pick-pin .pick-halo{
    r:3.6px;
    stroke:rgba(255,255,255,0.65);
    stroke-width:1;
}
.pick-pin .pick-core{
    r:2px;
}
/* the frame the pin is born in: identical to the hover marker, so the
   handover starts from exactly where the user left the cursor */
.pick-pin.settling .pick-halo{
    r:5.5px;
    stroke:rgba(255,255,255,0.5);
    stroke-width:1.25;
}
.pick-pin.settling .pick-core{
    r:2.6px;
}

/* the tooltip: a sibling div, not SVG text, so a long value or a long
   trace title wraps instead of overflowing the plot */
.pick-tip{
    position:absolute;
    z-index:3;
    pointer-events:auto;
    min-width:110px;
    max-width:260px;
    padding:6px 8px 6px 9px;
    font:12px/1.45 var(--plot-axis-font);
    color:var(--text);
    background:rgba(10,14,20,0.94);
    border:1px solid var(--border);
    border-radius:4px;
    box-shadow:0 6px 18px rgba(0,0,0,0.55);
    cursor:default;
    user-select:none;
}
.pick-head{
    display:flex;
    align-items:center;
    gap:6px;
    margin-bottom:4px;
    padding-right:14px;
}
.pick-swatch{
    flex:none;
    width:9px;
    height:9px;
    border-radius:50%;
    box-shadow:0 0 0 1px rgba(255,255,255,0.35);
}
.pick-title{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:var(--text-dim);
}
.pick-row{
    display:flex;
    justify-content:space-between;
    gap:14px;
}
.pick-key{
    color:var(--text-dim);
}
/* tabular figures: a column of x/y values must not shimmer as it changes */
.pick-val{
    font-variant-numeric:tabular-nums;
}
.pick-close{
    position:absolute;
    top:2px;
    right:2px;
    width:16px;
    height:16px;
    padding:0;
    font:13px/14px inherit;
    color:var(--text-dim);
    background:transparent;
    border:none;
    border-radius:3px;
    cursor:pointer;
}
.pick-close:hover{
    color:var(--text);
    background:var(--hover-bg);
    box-shadow:none;
    outline:none;
}
