/* Grille façon tableur (grille.js) : conventions Datamine Studio, allure Excel.
   Utilise seulement les jetons de app.css (docs/INTERFACE.md, point B) ; fonctionne dans les deux thèmes.
   Aucune couleur en dur : les teintes dérivées passent par color-mix des jetons.
   Positions et largeurs calculées (colonnes, éditeur, listes, menus) : posées par grille.js via le CSSOM. */

.grl {
  --grl-survol: var(--survol, color-mix(in srgb, var(--ink) 7%, transparent));
  --grl-choisi: var(--choisi, color-mix(in srgb, var(--accent) 20%, var(--grid-bg)));
  --grl-plage: color-mix(in srgb, var(--focus) 16%, transparent);
  --grl-saisie: var(--saisie-bg, color-mix(in srgb, var(--accent) 12%, var(--grid-bg)));
  --grl-tete: var(--bg-2);
  --grl-num: var(--bg-1);
  --grl-hs: 0px;
  position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; min-width: 0;
  background: var(--grid-bg); color: var(--ink); font: var(--fs-m, 12px)/1.2 var(--font);
}
/* Texte masqué : .sr de app.css. Pictogrammes : jeu unique .ic de app.css (symboles 24 x 24, trait 1,7). */

/* ---------- Zone qui défile (seule partie mobile de l'écran) ---------- */
.grl-zone { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; outline: none; overscroll-behavior: contain; scrollbar-width: thin; }
.grl-zone:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.grl.redim, .grl.redim * { cursor: col-resize !important; user-select: none; }
.grl.glisse { user-select: none; }

/* ---------- Tableau ---------- */
.grl-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; font-variant-numeric: tabular-nums; }
.grl-table th, .grl-table td {
  height: var(--h-ligne); padding: 0 var(--e3, 6px); border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; font-weight: 400; vertical-align: middle;
}
.grl-table td.n, .grl-table th.n { text-align: right; }
.grl-table td.c { background: var(--grid-calc); color: var(--ink-2); }
.grl-table .grl-fin { border-right: 0; padding: 0; }

/* En-tête collant : libellé puis unité en petit */
.grl-table thead th {
  position: sticky; top: 0; z-index: 3; height: var(--h-entete); padding: 2px 18px 2px var(--e3, 6px);
  background: var(--grl-tete); color: var(--ink); border-bottom: 1px solid var(--line-fort); user-select: none; cursor: pointer;
}
.grl-table thead th.n { text-align: right; }
.grl-table thead th.c { background: color-mix(in srgb, var(--grid-calc) 55%, var(--grl-tete)); }
.grl-table thead th.cur { box-shadow: inset 0 -2px 0 var(--accent); }
.grl-tete { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.grl-lib { display: flex; align-items: center; gap: 2px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.grl-table thead th.n .grl-lib { justify-content: flex-end; }
.grl-tete small { font-size: var(--fs-xs, 10px); color: var(--ink-2); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.grl-eg { color: var(--info); font-weight: 700; margin-right: 2px; }
.grl-ob { color: var(--accent-texte, var(--accent)); font-weight: 700; }
.grl-tri { display: inline-flex; color: var(--accent-texte, var(--accent)); }
.grl-tri .ic { width: 11px; height: 11px; }
.grl-fb {
  position: absolute; right: 3px; bottom: 3px; width: 15px; height: 15px; padding: 0; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r1, 2px); background: transparent; color: var(--ink-2); cursor: pointer;
}
.grl-fb .ic { width: 11px; height: 11px; }
.grl-table thead th:hover .grl-fb, .grl-fb:focus-visible { opacity: 1; border-color: var(--line); background: var(--grid-bg); }
.grl-table thead th.filtre .grl-fb { opacity: 1; color: var(--accent-texte, var(--accent)); border-color: var(--accent); }
.grl-table thead th.filtre .grl-lib { color: var(--accent-texte, var(--accent)); }
.grl-poignee { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 1; }
.grl-poignee:hover { background: color-mix(in srgb, var(--focus) 45%, transparent); }

/* Coin et colonne des numéros de ligne, collants à gauche */
.grl-table .grl-coin, .grl-table .grl-num {
  position: sticky; left: 0; z-index: 2; padding: 0 var(--e2, 4px); text-align: right; color: var(--ink-2);
  background: var(--grl-num); border-right: 1px solid var(--line-fort); font-size: var(--fs-s, 11px); cursor: default;
}
.grl-table thead .grl-coin { z-index: 5; background: var(--grl-tete); }
.grl-coin-b { position: absolute; left: 2px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; padding: 0; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: var(--r1, 2px); background: var(--grid-bg); color: var(--accent-texte, var(--accent)); cursor: pointer; }
.grl-enr { position: absolute; right: 3px; top: 3px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--focus); border-right-color: transparent; animation: grl-tourne .8s linear infinite; }
@keyframes grl-tourne { to { transform: rotate(1turn); } }
.grl-table tbody .grl-num { cursor: pointer; }
.grl-table tbody .grl-num:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, var(--grl-num)); }
.grl-table .grl-num.cur { color: var(--ink); font-weight: 700; box-shadow: inset -2px 0 0 var(--accent); }
.grl-alg { width: 9px; height: 9px; margin-right: 3px; vertical-align: -1px; }
.grl-alg.a { fill: var(--warn); }
.grl-alg.e { fill: var(--bad); }

/* Colonnes figées (jusqu'à 20) : décalage gauche posé par grille.js dans --grl-l2 … --grl-l21 */
.grl-table .fz { position: sticky; z-index: 1; background: var(--grid-bg); }
.grl-table td.fz.c { background: var(--grid-calc); }
.grl-table thead th.fz { z-index: 4; background: var(--grl-tete); }
.grl-table tfoot .fz { z-index: 3; }
.grl-table .fz-fin { box-shadow: 2px 0 0 color-mix(in srgb, var(--line-fort) 70%, transparent); }
.grl-table tr > .fz:nth-child(2) { left: var(--grl-l2); } .grl-table tr > .fz:nth-child(3) { left: var(--grl-l3); }
.grl-table tr > .fz:nth-child(4) { left: var(--grl-l4); } .grl-table tr > .fz:nth-child(5) { left: var(--grl-l5); }
.grl-table tr > .fz:nth-child(6) { left: var(--grl-l6); } .grl-table tr > .fz:nth-child(7) { left: var(--grl-l7); }
.grl-table tr > .fz:nth-child(8) { left: var(--grl-l8); } .grl-table tr > .fz:nth-child(9) { left: var(--grl-l9); }
.grl-table tr > .fz:nth-child(10) { left: var(--grl-l10); } .grl-table tr > .fz:nth-child(11) { left: var(--grl-l11); }
.grl-table tr > .fz:nth-child(12) { left: var(--grl-l12); } .grl-table tr > .fz:nth-child(13) { left: var(--grl-l13); }
.grl-table tr > .fz:nth-child(14) { left: var(--grl-l14); } .grl-table tr > .fz:nth-child(15) { left: var(--grl-l15); }
.grl-table tr > .fz:nth-child(16) { left: var(--grl-l16); } .grl-table tr > .fz:nth-child(17) { left: var(--grl-l17); }
.grl-table tr > .fz:nth-child(18) { left: var(--grl-l18); } .grl-table tr > .fz:nth-child(19) { left: var(--grl-l19); }
.grl-table tr > .fz:nth-child(20) { left: var(--grl-l20); } .grl-table tr > .fz:nth-child(21) { left: var(--grl-l21); }

/* ---------- Lignes : survol, sélection, plage, cellule active ---------- */
.grl-table tbody tr:hover > td { background-image: linear-gradient(var(--grl-survol), var(--grl-survol)); }
.grl-table tbody tr.sel > td, .grl-table tbody tr.sel > th { background-color: var(--grl-choisi); }
.grl-table tbody tr.sel > .grl-num { color: var(--ink); font-weight: 600; }
.grl-table td.pl { background-image: linear-gradient(var(--grl-plage), var(--grl-plage)); }
.grl-table td.actif { outline: 2px solid var(--focus); outline-offset: -2px; background-image: none; }
.grl-table td.edite { color: transparent; }
.grl-table td.enr { color: var(--ink-2); font-style: italic; }
.grl-table td.err { box-shadow: inset 0 0 0 1px var(--bad); background-color: var(--bad-bg, color-mix(in srgb, var(--bad) 14%, var(--grid-bg))); }
.grl-table td.trouve { background-color: color-mix(in srgb, var(--warn) 22%, var(--grid-bg)); }
.grl-table td.trouve-k { background-color: color-mix(in srgb, var(--warn) 45%, var(--grid-bg)); color: var(--ink); font-weight: 600; }

/* Alertes (contrat R4). La forme change avec le niveau, jamais la couleur seule, et le niveau est écrit en texte masqué.
   Ligne entière : fond teinté du niveau le plus grave, liseré gauche (4 px bloquant, 3 px à vérifier, 2 px information) et
   glyphe dans le numéro (losange, triangle, rond). Cellule du champ en cause : triangle d'angle (grand si bloquant, petit
   si à vérifier, point rond si information), plus un cadre (bloquant) ou un soulignement (à vérifier).
   Une ligne choisie garde le fond de la sélection : liseré, glyphe et marques de cellule restent. */
.grl-table tbody tr.al-e:not(.sel) > td:not(.err, .trouve, .trouve-k) { background-color: color-mix(in srgb, var(--bad-bg) 72%, var(--grid-bg)); }
.grl-table tbody tr.al-a:not(.sel) > td:not(.err, .trouve, .trouve-k) { background-color: color-mix(in srgb, var(--warn-bg) 72%, var(--grid-bg)); }
.grl-table tbody tr.al-i:not(.sel) > td:not(.err, .trouve, .trouve-k) { background-color: color-mix(in srgb, var(--info-bg) 55%, var(--grid-bg)); }
.grl-table tbody tr.al-e:not(.sel) > td.c:not(.err, .trouve, .trouve-k) { background-color: color-mix(in srgb, var(--bad-bg) 55%, var(--grid-calc)); }
.grl-table tbody tr.al-a:not(.sel) > td.c:not(.err, .trouve, .trouve-k) { background-color: color-mix(in srgb, var(--warn-bg) 55%, var(--grid-calc)); }
.grl-table tbody tr.al-i:not(.sel) > td.c:not(.err, .trouve, .trouve-k) { background-color: color-mix(in srgb, var(--info-bg) 40%, var(--grid-calc)); }
.grl-table tbody tr.al-e:not(.sel) > .grl-num { background-color: color-mix(in srgb, var(--bad-bg) 80%, var(--grl-num)); color: var(--ink); }
.grl-table tbody tr.al-a:not(.sel) > .grl-num { background-color: color-mix(in srgb, var(--warn-bg) 80%, var(--grl-num)); color: var(--ink); }
.grl-table tbody tr.al-i:not(.sel) > .grl-num { background-color: color-mix(in srgb, var(--info-bg) 60%, var(--grl-num)); }
.grl-table tr.al-e > .grl-num { box-shadow: inset 4px 0 0 var(--bad); }
.grl-table tr.al-a > .grl-num { box-shadow: inset 3px 0 0 var(--warn); }
.grl-table tr.al-i > .grl-num { box-shadow: inset 2px 0 0 var(--info); }
.grl-table tr.al-e > .grl-num.cur { box-shadow: inset 4px 0 0 var(--bad), inset -2px 0 0 var(--accent); }
.grl-table tr.al-a > .grl-num.cur { box-shadow: inset 3px 0 0 var(--warn), inset -2px 0 0 var(--accent); }
.grl-table tr.al-i > .grl-num.cur { box-shadow: inset 2px 0 0 var(--info), inset -2px 0 0 var(--accent); }
.grl-table td.al:not(.fz) { position: relative; } /* une cellule figée reste « sticky » (déjà positionnée) */
.grl-table td.al::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent var(--warn) transparent transparent; }
.grl-table td.al:not(.al-e, .al-i) { box-shadow: inset 0 -2px 0 var(--warn); }
.grl-table td.al.al-e { box-shadow: inset 0 0 0 1.5px var(--bad); }
.grl-table td.al.al-e::after { border-width: 0 11px 11px 0; border-right-color: var(--bad); }
.grl-table td.al.al-i::after { top: 2px; right: 2px; width: 5px; height: 5px; border: 0; border-radius: 50%; background: var(--info); }
.grl-alg.i { fill: var(--info); }

/* Espaceurs du rendu fenêtré et état vide */
.grl-table .grl-esp td { padding: 0; border: 0; height: 0; }
.grl-table .grl-vide td { height: auto; padding: var(--e5, 12px); white-space: normal; color: var(--ink-2); text-align: center; border-right: 0; }

/* ---------- Statut du circuit : lettre, forme et libellé ----------
   Pastille identique au symbole .statut::before de app.css (14 px, filet de 1 px, angles faibles ; mêmes formes par statut),
   pour que la grille, le panneau Détail et le tableau de bord montrent le même statut de la même façon. */
.grl-table .grl-st { text-align: left; color: var(--ink-2); }
.grl-table thead .grl-st { cursor: default; padding-right: var(--e3, 6px); }
.grl-table thead .grl-st small { display: block; font-size: var(--fs-xs, 10px); font-weight: 400; color: var(--ink-2); }
.grl-pastille {
  display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; margin-right: var(--e2, 4px); vertical-align: -3px;
  border: 1px solid currentColor; border-radius: var(--r1, 2px); color: var(--ink-2); font: 700 var(--fs-xxs)/1 var(--font);
}
.grl-pastille[data-st="brouillon"] { color: var(--st-brouillon); border-style: dashed; }
.grl-pastille[data-st="soumis"] { color: var(--st-soumis); }
.grl-pastille[data-st="verifie"] { color: var(--st-verifie); border-width: 2px; }
.grl-pastille[data-st="valide"] { color: var(--grid-bg); background: var(--st-valide); border-radius: 50%; }
.grl-pastille[data-st="retourne"] { color: var(--st-retourne); border-width: 2px; border-radius: 0; }
.grl-stx { font-size: var(--fs-m, 12px); }

/* ---------- Pied : totaux puis ligne de saisie, collés en bas ---------- */
.grl-table tfoot th, .grl-table tfoot td { position: sticky; z-index: 2; }
.grl-table .grl-totaux > * {
  bottom: var(--grl-hs); height: var(--h-ligne); background: var(--bg-2); color: var(--ink); font-weight: 600;
  border-top: 1px solid var(--line-fort); border-bottom: 1px solid var(--line);
}
.grl-table .grl-totaux > td.c { background: color-mix(in srgb, var(--grid-calc) 60%, var(--bg-2)); }
.grl-table .grl-totaux > .grl-num { z-index: 4; text-align: center; font-size: var(--fs-m, 12px); }
.grl-table .grl-saisie > * {
  bottom: 0; height: var(--h-saisie); padding: 0; background: var(--grl-saisie);
  border-top: 2px solid var(--accent); border-bottom: 0;
}
.grl-table .grl-saisie > td.c { padding: 0 var(--e3, 6px); color: var(--ink-2); font-style: italic; font-size: var(--fs-s, 11px); text-align: right; background: color-mix(in srgb, var(--grid-calc) 70%, var(--grl-saisie)); }
.grl-table .grl-saisie > .grl-num { z-index: 4; text-align: center; color: var(--accent-texte, var(--accent)); background: var(--grl-saisie); }
.grl-table .grl-saisie > .grl-st { padding: 0 var(--e2, 4px); }
.grl-in {
  width: 100%; height: 100%; min-width: 0; padding: 0 var(--e3, 6px); border: 0; outline: 0; margin: 0;
  background: transparent; color: var(--ink); font: inherit; font-variant-numeric: tabular-nums;
}
.grl-table td.n .grl-in { text-align: right; }
/* Indication de format (JJ/MM/AAAA, HH:MM, HH, unité) : même encre que .tableau .saisie-form et .champ (4,5:1). */
.grl-in::placeholder { color: var(--ink-2); opacity: 1; }
.grl-in:focus { background: var(--grid-bg); box-shadow: inset 0 0 0 2px var(--focus); }
.grl-table td.inv { box-shadow: inset 0 0 0 1.5px var(--bad); background: var(--bad-bg, color-mix(in srgb, var(--bad) 16%, var(--grl-saisie))); }
.grl-table td.inv-a { box-shadow: inset 0 -2px 0 var(--warn); background: var(--warn-bg); }
.grl-table td.inv::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 9px 9px 0; border-color: transparent var(--bad) transparent transparent; pointer-events: none; }
.grl-table td.inv-a::after { border-width: 0 7px 7px 0; border-right-color: var(--warn); }
.grl-envoi {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 20px; padding: 0 var(--e3, 6px);
  border: 1px solid var(--accent-plein, var(--accent)); border-radius: var(--r2, 3px); background: var(--accent-plein, var(--accent)); color: var(--accent-ink);
  font: 600 var(--fs-s, 11px)/1 var(--font); cursor: pointer;
}
.grl-envoi:hover { filter: brightness(1.08); }
.grl-envoi:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.grl-envoi .ic { width: 12px; height: 12px; }

/* ---------- Éditeur posé sur la cellule ---------- */
.grl-ed { position: absolute; z-index: 6; display: flex; background: var(--grid-bg); box-shadow: 0 0 0 2px var(--focus), var(--ombre); }
.grl-ed.fz { z-index: 7; }
.grl-ed input { flex: 1; min-width: 0; height: 100%; padding: 0 var(--e3, 6px); border: 0; outline: 0; background: transparent; color: var(--ink); font: var(--fs-m, 12px)/1 var(--font); font-variant-numeric: tabular-nums; }
.grl-ed.n input { text-align: right; }

/* ---------- Listes, menu contextuel et filtre (positions fixes posées par grille.js) ----------
   Le menu contextuel est un .menu-ctx de app.css (éléments de 24 px, largeur minimale 170 px, fond « choisi ») :
   seul le libellé, qui pousse le raccourci à droite, lui est propre. */
.grl-liste, .grl-filtre {
  position: fixed; z-index: 60; margin: 0; background: var(--bg-1); color: var(--ink);
  border: 1px solid var(--line-fort); border-radius: var(--r2, 3px); box-shadow: var(--ombre);
}
.grl-liste { list-style: none; padding: var(--e1, 2px) 0; overflow: auto; font-size: var(--fs-m, 12px); }
.grl-liste li { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: var(--h-ligne); padding: 0 var(--e4, 8px); cursor: pointer; white-space: nowrap; }
.grl-liste li small { color: var(--ink-2); font-size: var(--fs-xs, 10px); }
.grl-liste li:hover { background: var(--grl-survol); }
/* Option choisie : même marque que la palette de commandes (.palette-option, app.css) */
.grl-liste li[aria-selected="true"] { background: var(--choisi-panneau); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.grl-liste li.vide { color: var(--ink-2); font-style: italic; cursor: default; }

.grl-m-lib { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.grl-filtre { width: 272px; display: flex; flex-direction: column; gap: var(--e3, 6px); padding: var(--e4, 8px); overflow: auto; font-size: var(--fs-m, 12px); }
.grl-f-tete { display: flex; align-items: baseline; gap: var(--e3, 6px); }
.grl-f-tete small { color: var(--ink-2); }
.grl-f-x { width: 20px; height: 20px; padding: 0; display: grid; place-items: center; border: 0; border-radius: var(--r1, 2px); background: transparent; color: var(--ink-2); cursor: pointer; }
.grl-f-x:hover { background: var(--grl-survol); color: var(--ink); }
.grl-f-tri { display: grid; gap: 1px; padding-bottom: var(--e3, 6px); border-bottom: 1px solid var(--line); }
.grl-f-b, .grl-f-l {
  display: flex; align-items: center; gap: var(--e3, 6px); height: 24px; padding: 0 var(--e3, 6px); border: 1px solid transparent;
  border-radius: var(--r1, 2px); background: transparent; color: var(--ink); font: var(--fs-m, 12px)/1 var(--font); text-align: left; cursor: pointer;
}
.grl-f-b:hover:not(:disabled), .grl-f-l:hover:not(:disabled) { background: var(--grl-survol); }
.grl-f-b[aria-pressed="true"], .grl-f-l[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-texte, var(--accent)); }
.grl-f-b:disabled, .grl-f-l:disabled { opacity: .45; cursor: default; }
.grl-f-int { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e3, 6px); }
.grl-f-int label { display: flex; align-items: center; gap: 4px; }
.grl-f-int span { color: var(--ink-2); font-size: var(--fs-s, 11px); }
.grl-f-int input, .grl-f-q, .grl-f-w {
  min-width: 0; width: 100%; height: var(--h-cmd); padding: 0 5px; border: 1px solid var(--champ-bord); border-radius: var(--r1, 2px);
  background: var(--grid-bg); color: var(--ink); font: var(--fs-m, 12px)/1 var(--font);
}
.grl-f-int input:focus, .grl-f-q:focus, .grl-f-w:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
.grl-f-choix { display: flex; align-items: center; gap: var(--e2, 4px); }
.grl-f-choix .grl-f-l { height: 20px; color: var(--info); }
.grl-f-nb { margin-left: auto; color: var(--ink-2); font-size: var(--fs-s, 11px); }
.grl-f-liste { max-height: 220px; min-height: 60px; overflow: auto; padding: 2px; border: 1px solid var(--line); border-radius: var(--r1, 2px); background: var(--grid-bg); }
.grl-f-v { display: flex; align-items: center; gap: var(--e3, 6px); height: 22px; padding: 0 4px; cursor: pointer; }
.grl-f-v:hover { background: var(--grl-survol); }
.grl-f-v input { margin: 0; accent-color: var(--accent); }
.grl-f-v span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grl-f-v small { color: var(--ink-2); font-size: var(--fs-xs, 10px); font-variant-numeric: tabular-nums; }
.grl-f-plus { margin: 4px; color: var(--ink-2); font-size: var(--fs-s, 11px); }
.grl-f-actions { display: flex; align-items: center; gap: var(--e3, 6px); padding-top: var(--e3, 6px); border-top: 1px solid var(--line); }
.grl-f-col, .grl-f-masq { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding-top: var(--e3, 6px); border-top: 1px solid var(--line); }
.grl-f-masq > span { color: var(--ink-2); font-size: var(--fs-s, 11px); margin-right: 4px; }
.grl-f-larg { display: inline-flex; align-items: center; gap: 3px; }
.grl-f-larg .grl-f-w { width: 52px; text-align: right; }
.grl-f-larg span { color: var(--ink-2); font-size: var(--fs-s, 11px); }

/* ---------- Recherche (Ctrl+F), en haut à droite de la grille ---------- */
.grl-cherche {
  position: absolute; top: calc(var(--h-entete) + 6px); right: 18px; z-index: 8; display: flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 8px; background: var(--bg-1); border: 1px solid var(--line-fort); border-radius: var(--r2, 3px);
  box-shadow: var(--ombre); color: var(--ink-2);
}
.grl-c-q { width: 200px; height: var(--h-cmd); padding: 0 5px; border: 1px solid var(--champ-bord); border-radius: var(--r1, 2px); background: var(--grid-bg); color: var(--ink); font: var(--fs-m, 12px)/1 var(--font); }
.grl-c-q:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
.grl-cherche.rien .grl-c-q { border-color: var(--bad); background: var(--bad-bg, color-mix(in srgb, var(--bad) 14%, var(--grid-bg))); }
.grl-c-nb { min-width: 52px; font-size: var(--fs-s, 11px); text-align: right; font-variant-numeric: tabular-nums; }
.grl-c-b { width: var(--h-cmd); height: var(--h-cmd); padding: 0; display: grid; place-items: center; border: 0; border-radius: var(--r1, 2px); background: transparent; color: var(--ink-2); cursor: pointer; }
.grl-c-b:hover { background: var(--grl-survol); color: var(--ink); }

/* ---------- Confirmation (suppression de brouillons) : boîte .dlg de app.css (.dlg-tete, .dlg-corps, .dlg-pied) ---------- */
.grl-dlg { width: min(420px, calc(100vw - 32px)); }
.grl-dlg p { margin: 0; font-size: var(--fs-m, 12px); line-height: 1.45; }

/* ---------- Bulle des motifs d'alerte (contrat R4) ----------
   Élément unique posé dans <body> par grille.js (role tooltip), position fixe calculée au plus près de l'ancre et bornée
   à la fenêtre. Hors de .grl : seulement les jetons de app.css. Ne capte jamais le pointeur (l'édition reste libre).
   Liseré gauche du niveau le plus grave ; chaque motif porte son niveau écrit, son glyphe et un filet de forme propre. */
.grl-bulle {
  position: fixed; left: 0; top: 0; z-index: 86; width: max-content; max-width: min(400px, calc(100vw - 12px)); max-height: calc(100vh - 12px);
  overflow: hidden; padding: var(--e2, 4px) var(--e4, 8px) var(--e3, 6px); background: var(--bg-1); color: var(--ink);
  border: 1px solid var(--line-fort); border-left: 4px solid var(--warn); border-radius: var(--r2, 3px); box-shadow: var(--ombre);
  font: var(--fs-s, 11px)/1.4 var(--font); white-space: normal; overflow-wrap: anywhere; pointer-events: none;
}
.grl-bulle[data-niv="e"] { border-left-color: var(--bad); }
.grl-bulle[data-niv="i"] { border-left-color: var(--info); border-left-width: 2px; }
.grl-b-tete { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--e3, 6px); padding-bottom: var(--e2, 4px); margin-bottom: var(--e2, 4px); border-bottom: 1px solid var(--line); }
.grl-b-tete strong { font-weight: 700; }
.grl-b-tete span { color: var(--ink-2); }
.grl-b-liste { display: grid; gap: var(--e2, 4px); margin: 0; padding: 0; list-style: none; }
.grl-b-m { display: grid; gap: 1px; padding: 2px 0 2px var(--e3, 6px); border-left: 2px solid var(--warn); }
.grl-b-m.e { border-left: 3px solid var(--bad); }
.grl-b-m.a { border-left-style: dashed; }
.grl-b-m.i { border-left: 2px dotted var(--info); }
.grl-b-m.cible { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.grl-b-niv { display: inline-flex; align-items: center; font-weight: 700; color: var(--warn); }
.grl-b-m.e .grl-b-niv { color: var(--bad); }
.grl-b-m.i .grl-b-niv { color: var(--info); }
.grl-b-champ { color: var(--ink-2); }
.grl-b-champ b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.grl-b-cor b { font-weight: 600; }
.grl-b-plus, .grl-b-pied { margin: var(--e2, 4px) 0 0; color: var(--ink-2); font-size: var(--fs-xs, 10px); }
.grl-b-pied { padding-top: var(--e2, 4px); border-top: 1px solid var(--line); }

/* ---------- Focus, mouvement réduit ---------- */
.grl :focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; }
@media (prefers-reduced-motion: reduce) { .grl-enr { animation: none; border-right-color: var(--focus); } }
@media print {
  .grl-zone { overflow: visible; }
  .grl-saisie, .grl-fb, .grl-poignee, .grl-cherche, .grl-menu, .grl-filtre, .grl-liste, .grl-bulle { display: none !important; }
  .grl-table thead th, .grl-table .grl-num, .grl-table .fz, .grl-table tfoot td, .grl-table tfoot th { position: static; }
}
