/* Console Rempart — système de design de Nebus (nebus.fr, app.nebus.fr) : mêmes jetons, polices, formes et
   composants (cartes, badges, boutons, alertes, formulaires, tableaux), même cadre de panel (barre du haut,
   fond doux, en-tête de page). Thème clair, comme Nebus. Polices embarquées dans le binaire (SIL OFL). */

/* ---------------------------------------------------------------- Polices */
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/polices/Onest-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/polices/Onest-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/polices/JetBrainsMono-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/polices/JetBrainsMono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------------------------------------------------------------- Jetons (identiques à Nebus) */
:root {
  --ink: #12141f; --ink-2: #3a3f55; --muted: #676d85; --faint: #9298ad;
  --line: #e4e6ee; --line-strong: #cfd3df;
  --bg: #ffffff; --bg-soft: #f6f7fa; --bg-sunken: #eef0f5;
  --accent: #5a45f0; --accent-hover: #4733d8; --accent-ink: #3a28b8; --accent-soft: #efedff; --accent-line: #d6d0ff;
  --ok: #15803d; --ok-soft: #e9f8ef; --ok-line: #bfe8cd;
  --warn: #a15c07; --warn-soft: #fff6e5; --warn-line: #f6d9a8;
  --err: #c81e1e; --err-soft: #fdeeee; --err-line: #f5c2c2;
  --info: #1d5fc9; --info-soft: #ecf3ff; --info-line: #c7dafc;
  --night: #12141f;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(18, 20, 31, 0.06);
  --shadow-sm: 0 1px 2px rgba(18, 20, 31, 0.05), 0 2px 8px rgba(18, 20, 31, 0.05);
  --shadow-md: 0 2px 4px rgba(18, 20, 31, 0.04), 0 12px 32px rgba(18, 20, 31, 0.08);
  --ring: 0 0 0 3px rgba(90, 69, 240, 0.22);
  --font: 'Onest', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --topbar-h: 68px; --barre-l: 248px;
  /* graphiques : palette validée (contraste, daltonisme) sur fond blanc, violet de la marque en premier */
  --serie-1: #5a45f0; --serie-2: #eb6834; --serie-3: #1baf7a; --serie-4: #eda100;
  --grille: #eef0f5; --axe: #cfd3df; --encre-muette: #676d85;
  color-scheme: light;
}

/* ---------------------------------------------------------------- Base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink-2);
  background: var(--bg-soft); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.625rem, 1.35rem + 0.9vw, 2rem); letter-spacing: -0.03em; }
h2 { font-size: 1.0625rem; letter-spacing: -0.01em; margin: 24px 0 14px; }
h3 { font-size: 1rem; margin: 18px 0 10px; }
p { margin: 0 0 1em; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong, b { color: var(--ink); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--ink); }
code, kbd, pre, .mono { font-family: var(--mono); font-size: 0.8125rem; }
code { background: var(--bg-sunken); color: var(--ink); padding: 0.12em 0.4em; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
pre { background: var(--night); color: #e6e8f2; padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; line-height: 1.55; }
.chargement { padding: 2rem; color: var(--muted); }

/* ---------------------------------------------------------------- Barre du haut (cadre du panel Nebus) */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--topbar-h); padding: 0 24px; }
.topbar-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.marque { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.04em; text-decoration: none; }
.marque:hover { text-decoration: none; }
.marque img { width: 28px; height: 28px; flex: none; }
.brand-sub { padding-left: 14px; border-left: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; font-weight: 500; white-space: nowrap; }
.fil { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); font-size: 0.9375rem; font-weight: 600; }
.fil a { color: var(--muted); font-weight: 500; }
.fil .sep { color: var(--faint); }
.fil .dom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink-2); font-size: 0.875rem; font-weight: 600; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { border-color: var(--line-strong); color: var(--ink); }
.user-menu[open] > summary { border-color: var(--accent-line); box-shadow: var(--ring); }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.8125rem; font-weight: 700; flex: none; text-transform: uppercase; }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 50; }
.menu-head { display: grid; gap: 2px; padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.8125rem; }
.menu-head strong { font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.menu-panel a, .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-2); font: inherit; font-size: 0.9375rem; text-align: left; cursor: pointer; }
.menu-panel a:hover, .menu-item:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }

/* ---------------------------------------------------------------- Cadre : navigation latérale + contenu */
.coquille { display: grid; grid-template-columns: var(--barre-l) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.barre { position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 20px 12px 24px; background: var(--bg); border-right: 1px solid var(--line); }
.nav { display: grid; gap: 2px; }
.nav a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; font-size: 0.9375rem; }
.nav a:hover { color: var(--ink); background: var(--bg-soft); text-decoration: none; }
.nav a.actif { color: var(--ink); background: var(--bg-sunken); font-weight: 600; }
.nav .section { margin: 18px 12px 6px; color: var(--faint); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.retour-compte { color: var(--muted) !important; font-size: 0.875rem !important; }
.domaine-courant { margin: 10px 12px 8px; color: var(--ink); font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.pied-barre { margin: 24px 12px 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.8125rem; }
.contenu { width: 100%; max-width: 1180px; padding: 36px 40px 80px; }
.contenu > * + * { margin-top: 20px; }
.contenu > h1 { margin-bottom: 4px; }
@media (max-width: 900px) {
  .topbar-inner { padding: 0 16px; }
  .brand-sub { display: none; }
  .coquille { grid-template-columns: minmax(0, 1fr); }
  .barre { position: sticky; top: var(--topbar-h); z-index: 30; height: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .barre::-webkit-scrollbar { display: none; }
  .nav { display: flex; gap: 4px; }
  .nav a { white-space: nowrap; padding: 8px 10px; font-size: 0.875rem; }
  .nav .section, .domaine-courant, .pied-barre { display: none; }
  .contenu { padding: 24px 16px 64px; }
}

/* ---------------------------------------------------------------- En-tête de page */
.entete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.entete h1 { margin: 0; }
.entete > a:not(.bouton) { color: var(--muted); font-size: 0.875rem; font-weight: 500; }
.entete > a:not(.bouton):hover { color: var(--ink); text-decoration: none; }

/* ---------------------------------------------------------------- Cartes */
.carte { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-xs); }
.carte > :last-child { margin-bottom: 0; }
.carte > h2:first-child, .carte > h3:first-child, .sans-marge { margin-top: 0 !important; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.grille > .carte { margin: 0; }
a.carte-domaine { display: block; color: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
a.carte-domaine:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); text-decoration: none; }
a.carte-domaine h3 { font-size: 1.0625rem; }

/* ---------------------------------------------------------------- Tuiles (chiffres clés, style « specs » de Nebus) */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, calc(50% - 6px)), 1fr)); gap: 12px; }
.tuile { display: grid; gap: 2px; padding: 16px 18px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.tuile .etiquette { color: var(--muted); font-size: 0.8125rem; }
.tuile .valeur { color: var(--ink); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.25; }
.tuile .sous { color: var(--muted); font-size: 0.8125rem; }

/* ---------------------------------------------------------------- Badges */
.pastille { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; margin: 0 4px 4px 0; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); background: var(--bg-soft); }
.pastille.ok::before, .pastille.erreur::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pastille.ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.pastille.erreur { color: var(--err); background: var(--err-soft); border-color: var(--err-line); }
.pastille.accent { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-line); }

/* ---------------------------------------------------------------- Boutons */
button, .bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); color: var(--ink); font: inherit; font-size: 0.9375rem; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none; box-shadow: var(--shadow-xs); transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
button:hover, .bouton:hover { background: var(--bg-soft); border-color: var(--faint); color: var(--ink); text-decoration: none; }
button:focus-visible, .bouton:focus-visible { outline: none; box-shadow: var(--ring); }
button.principal, .bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
button.principal:hover, .bouton.principal:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
button.danger { background: var(--bg); color: var(--err); border-color: var(--err-line); }
button.danger:hover { background: var(--err-soft); color: var(--err); border-color: var(--err); }
button.petit, .bouton.petit { height: 30px; padding: 0 10px; font-size: 0.8125rem; border-radius: var(--radius-sm); }
button:disabled { opacity: 0.5; cursor: wait; box-shadow: none; }
.plein { display: flex; width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ---------------------------------------------------------------- Alertes */
.message { display: block; padding: 12px 16px; border: 1px solid; border-left-width: 4px; border-radius: var(--radius); margin: 16px 0 0; font-size: 0.9375rem; }
.message.erreur { color: #8a1414; background: var(--err-soft); border-color: var(--err-line); border-left-color: var(--err); }
.message.ok { color: #0f5130; background: var(--ok-soft); border-color: var(--ok-line); border-left-color: var(--ok); }
.message.info { color: #133f86; background: var(--info-soft); border-color: var(--info-line); border-left-color: var(--info); }
.secret { margin-top: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 0.8125rem; color: var(--ink); word-break: break-all; background: var(--bg-sunken); border: 1px dashed var(--line-strong); border-radius: var(--radius); user-select: all; }

/* ---------------------------------------------------------------- Formulaires */
label { display: block; margin: 16px 0 0; font-size: 0.875rem; font-weight: 600; color: var(--ink); }
label .aide, .aide { font-weight: 400; color: var(--muted); font-size: 0.8125rem; }
p.aide { margin: 0 0 14px; font-size: 0.875rem; }
input, select, textarea { font: inherit; color: var(--ink); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  display: block; width: 100%; height: 44px; margin-top: 6px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 1rem; font-weight: 400; box-shadow: var(--shadow-xs); transition: border-color 0.15s, box-shadow 0.15s; }
textarea { height: auto; min-height: 90px; padding: 10px 12px; font-family: var(--mono); font-size: 0.875rem; line-height: 1.5; }
textarea.grand { min-height: 60vh; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: var(--faint); }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[readonly], textarea[readonly], select:disabled { background: var(--bg-soft); color: var(--muted); box-shadow: none; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 3px 0 0; flex: none; }
.case { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0 0; font-weight: 400; color: var(--ink-2); }
.case.fixe { margin: 0; align-self: center; }
.ligne { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-end; }
.ligne > * { flex: 1 1 180px; min-width: 0; }
.ligne > .fixe { flex: 0 0 auto; }
.paires .ligne { margin-bottom: 6px; }

/* ---------------------------------------------------------------- Tableaux */
.tableau-conteneur { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; background: var(--bg); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-soft); color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--bg-soft); }
td { color: var(--ink-2); }
.carte table { border: 1px solid var(--line); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
table.zone td { padding: 8px 6px; vertical-align: middle; }
table.zone input:not([type="checkbox"]), table.zone select { height: 38px; margin: 0; font-size: 0.9375rem; }
tr.options-ligne td, tr.options-ligne:hover td { background: var(--bg-soft); }

/* ---------------------------------------------------------------- Écran de connexion (comme app.nebus.fr) */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 56px 20px 88px; }
.auth { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: center; gap: 72px; width: 100%; max-width: 1040px; }
.connexion .carte { width: 100%; max-width: 440px; padding: 32px; box-shadow: var(--shadow-sm); }
.connexion .marque { margin-bottom: 28px; }
.connexion h1 { margin-bottom: 6px; font-size: 1.625rem; letter-spacing: -0.03em; }
.auth-lead { margin: 0 0 8px; color: var(--muted); }
.auth-aside h2 { max-width: 420px; margin: 0 auto 14px; font-size: 1.125rem; }
.auth-aside > p { max-width: 420px; margin: 0 auto 20px; color: var(--muted); }
.checklist { max-width: 420px; margin: 0 auto; padding: 0; list-style: none; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.checklist svg { width: 18px; height: 18px; margin-top: 3px; color: var(--accent); flex: none; }
.separateur { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 0.8125rem; margin: 22px 0; }
.separateur::before, .separateur::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.qr { display: block; margin: 16px auto; width: 200px; height: 200px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
@media (max-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr); max-width: 460px; gap: 0; } .auth-aside { display: none; } .connexion { padding: 32px 16px 64px; } }
@media (max-width: 480px) { .connexion .carte { padding: 24px 20px; } }

/* ---------------------------------------------------------------- Blocs d'édition (routes, règles) */
.route { margin: 12px 0; padding: 4px 18px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }
.route-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-top: 12px; }
.route-tete h3 { margin: 0; }
.route-tete .actions { margin: 0; }
.zone-depot { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--bg-soft); }
.zone-depot.survol { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
details.avance { margin-top: 16px; }
details.avance > summary, details.carte > summary { cursor: pointer; color: var(--muted); font-size: 0.9375rem; font-weight: 500; }
details.avance > summary:hover, details.carte > summary:hover { color: var(--ink); }
details.carte > summary { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- Graphiques */
.graphique { position: relative; margin-top: 8px; }
.graphique svg { display: block; width: 100%; overflow: visible; }
.graphique .grille { stroke: var(--grille); stroke-width: 1; }
.graphique .axe { stroke: var(--axe); stroke-width: 1; }
.graphique text { fill: var(--encre-muette); font-family: var(--font); font-size: 11px; font-variant-numeric: tabular-nums; }
.graphique .ligne { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphique .aire { opacity: 0.12; }
.graphique .reticule { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.graphique .point { stroke: var(--bg); stroke-width: 2; }
.infobulle { position: absolute; z-index: 2; pointer-events: none; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); font-size: 0.8125rem; white-space: nowrap; }
.infobulle .titre { color: var(--muted); margin-bottom: 2px; }
.infobulle .rang { display: flex; align-items: center; gap: 8px; }
.infobulle .rang strong { min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.cle { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 8px; color: var(--muted); font-size: 0.875rem; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.s1 { background: var(--serie-1); } .s2 { background: var(--serie-2); } .s3 { background: var(--serie-3); } .s4 { background: var(--serie-4); }

/* ---------------------------------------------------------------- Utilitaires */
.doux { color: var(--muted); }
.petit { font-size: 0.875rem; }
.espace-haut { margin-top: 8px; }
.espace-gauche { margin-left: 6px; }
.centre { justify-content: center; }
.defilant { overflow: auto; max-height: 70vh; }
.lien-marque { color: inherit; }
.lien-marque:hover { text-decoration: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
input.etroit { width: 6em; }
select.choix-pop { min-width: 7em; }

/* ---------------------------------------------------------------- Éditeur de workers */
.editeur-grille { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .editeur-grille { grid-template-columns: minmax(0, 1fr); } }
.entete-carte { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.code { font-variant-ligatures: none; display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-soft);
  height: 60vh; min-height: 320px; overflow: hidden; font-family: var(--mono); font-size: 13px; line-height: 20px; }
.code-numeros { flex: none; width: 3.2em; padding: 10px 8px 10px 0; text-align: right; color: var(--faint);
  background: var(--bg-sunken); white-space: pre; overflow: hidden; user-select: none; border-right: 1px solid var(--line); }
.code-corps { position: relative; flex: 1; min-width: 0; }
.code-rendu, .code-saisie { position: absolute; inset: 0; margin: 0; padding: 10px; border: 0; font: inherit; line-height: inherit;
  white-space: pre; tab-size: 2; overflow: auto; box-sizing: border-box; letter-spacing: normal; }
.code-corps { background: var(--bg); }
.code .code-rendu { color: var(--ink); background: transparent; border-radius: 0; box-shadow: none; pointer-events: none; overflow: hidden; }
.code .code-saisie { color: transparent; background: transparent; caret-color: var(--ink); resize: none; outline: none;
  border-radius: 0; box-shadow: none; min-height: 0; width: 100%; height: 100%; }
.code-saisie::selection { background: rgba(90, 69, 240, 0.25); color: transparent; }
.js-com { color: #6a737d; font-style: italic; } .js-ch { color: #0b7a3e; } .js-nb { color: #b35900; } .js-mot { color: var(--accent-ink); font-weight: 600; }
.essai-pre { color: var(--ink); background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px;
  max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 4px 0 10px; }
.journal-erreur { color: var(--err); }
.ligne-essai { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
.cases { display: flex; flex-wrap: wrap; gap: 0 22px; margin-bottom: 14px; }
.cases .case { margin-top: 8px; }
.journal-direct { max-height: 360px; min-height: 120px; overflow-y: auto; white-space: pre-wrap; }

/* comptes */
.auth-pied { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 0.9375rem; }
.bandeau-compte { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; margin-bottom: 20px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }
.bandeau-compte button { margin-left: auto; }
.aire { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.aire > span { flex: 1 1 220px; min-width: 0; }
.aire > select { flex: 0 0 150px; width: 150px; margin: 0; }
td.fixe { text-align: right; }

/* constructeur d'expressions */
.tete-expression { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 14px 0 6px; }
.tete-expression label { margin: 0; }
.constructeur { display: grid; gap: 8px; justify-items: start; }
.groupe-conditions { width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); }
.condition { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.condition > select, .condition > input { flex: 0 1 150px; min-width: 0; margin: 0; }
.condition > select:nth-of-type(2) { flex-basis: 225px; }
.condition select, .condition input { height: 44px; box-sizing: border-box; }
.condition .cond-valeur { flex: 1 1 120px; min-width: 0; }
.condition > button { flex: 0 0 auto; }
.condition .cond-valeur input, .condition .cond-valeur select, .condition .cond-valeur textarea { display: block; width: 100%; margin: 0 !important; box-sizing: border-box; }
.lien-condition, .lien-groupe { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.lien-condition { margin: 6px 0; }
.groupe-conditions > button { margin-top: 8px; }
.apercu { display: block; margin: 4px 0 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); font-family: "JetBrains Mono", monospace; font-size: 0.8125rem; overflow-wrap: anywhere; white-space: pre-wrap; }
