/* Balise : console. Système visuel sobre : un seul accent (rouge #E5383B), réservé au bouton principal et aux états critiques.
   Encre #161A1D pour la barre latérale. Geist et Geist Mono, servis par la console (licence OFL, fonts/OFL.txt).
   Grille de 8 px, rayon de 10 px, aucune ombre hors des calques flottants (menu, tiroir, fenêtre).
   Niveaux, issues et statuts : un point de couleur et un libellé sur fond très léger. Les niveaux suivent une seule échelle
   séquentielle, du gris au rouge (--s1 à --s4). Clair et sombre au même niveau de finition. Contrastes AA pour le texte courant. */

@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/geist-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: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/geist-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/geist-mono-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: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/geist-mono-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Jetons ---------- */
:root {
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f7f7f8; --hover: #f3f3f4; --line: #e4e4e7; --line-2: #ededef;
  --text: #18181b; --muted: #52525b; --faint: #6b6b74;
  --side: #161a1d; --side-2: #262b2f; --side-text: #d6d9dc; --side-muted: #959ca2;
  --accent: #e5383b; --primary: #d22f33; --primary-hover: #b4262a; --on-primary: #ffffff;
  --link: var(--text);
  /* Échelle séquentielle des niveaux, du gris au rouge */
  --s1: #a1a1aa; --s2: #e8a07c; --s3: #e0603c; --s4: #c42b2f;
  /* Sémantique discrète : seulement en point de couleur ou en texte */
  --ok: #15803d; --warn: #b45309; --bad: #c42b2f; --info: #52525b;
  --bad-soft: #fdf1f1; --warn-soft: #fdf6ec; --ok-soft: #f0f8f3;
  --ring: #18181b;
  --radius: 10px; --radius-sm: 8px;
  --shadow-lg: 0 12px 32px rgba(24, 24, 27, .14), 0 0 0 1px rgba(24, 24, 27, .06);
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111416; --panel: #111416; --panel-2: #181c1f; --hover: #1e2226; --line: #2b3035; --line-2: #22272b;
    --text: #f4f4f5; --muted: #a8aeb4; --faint: #8f969c;
    --side: #0a0c0e; --side-2: #1e2327; --side-edge: #23282d;
    --primary: #f0595b; --primary-hover: #f47577; --on-primary: #161a1d;
    --s1: #71717a; --s2: #d88a66; --s3: #e8673f; --s4: #f0595b;
    --ok: #4ade80; --warn: #f0b35a; --bad: #f87171; --info: #a8aeb4;
    --bad-soft: #2a1718; --warn-soft: #2a2114; --ok-soft: #13251a;
    --ring: #f4f4f5;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111416; --panel: #111416; --panel-2: #181c1f; --hover: #1e2226; --line: #2b3035; --line-2: #22272b;
  --text: #f4f4f5; --muted: #a8aeb4; --faint: #8f969c;
  --side: #0a0c0e; --side-2: #1e2327; --side-edge: #23282d;
  --primary: #f0595b; --primary-hover: #f47577; --on-primary: #161a1d;
  --s1: #71717a; --s2: #d88a66; --s3: #e8673f; --s4: #f0595b;
  --ok: #4ade80; --warn: #f0b35a; --bad: #f87171; --info: #a8aeb4;
  --bad-soft: #2a1718; --warn-soft: #2a2114; --ok-soft: #13251a;
  --ring: #f4f4f5;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 15px; line-height: 1.4; margin: 0; font-weight: 600; }
h3 { font-size: 13px; margin: 16px 0 8px; font-weight: 600; color: var(--text); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.ico { display: inline-flex; width: 16px; height: 16px; flex: none; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:focus-visible, .dd:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .iconbtn:focus-visible, .pill:focus-visible, .zone > button:focus-visible, .term:focus-visible, summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; box-shadow: none; }
.side :focus-visible { outline-color: #fff; }

/* ---------- Cadre ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 16px 12px 12px; z-index: 10; border-right: 1px solid var(--side-edge, transparent); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; color: #fff; font-weight: 600; font-size: 16px; }
.brand .logo { height: 26px; width: auto; display: block; }
.brand .logo-light { display: none; }
.login .brand .logo-dark { display: none; } .login .brand .logo-light { display: block; }
:root[data-theme="dark"] .login .brand .logo-dark { display: block; } :root[data-theme="dark"] .login .brand .logo-light { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .login .brand .logo-dark { display: block; } :root:not([data-theme="light"]) .login .brand .logo-light { display: none; } }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--side-muted); margin-top: 2px; }
.side nav { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.side nav a { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 400; font-size: 13.5px; text-decoration: none; }
.side nav a .ico { width: 16px; height: 16px; color: inherit; }
.side nav a:hover { background: color-mix(in srgb, var(--side-2) 60%, transparent); color: #fff; }
.side nav a.on { background: var(--side-2); color: #fff; font-weight: 500; }
.side nav a .count { margin-left: auto; background: rgba(255, 255, 255, .12); color: #fff; border-radius: 6px; font-size: 11.5px; padding: 0 6px; font-weight: 600; line-height: 18px; }
.zone { margin-top: 12px; }
.zone > button { display: flex; align-items: center; gap: 8px; width: 100%; height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--side-muted); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; text-align: left; }
.zone > button:hover { color: #fff; }
.zone > button .ico { width: 12px; height: 12px; margin-left: auto; transition: transform .15s, opacity .15s; opacity: 0; }
.zone > button:hover .ico, .zone > button:focus-visible .ico, .zone:not(.open) > button .ico { opacity: 1; }
.zone.open > button .ico { transform: rotate(90deg); }
.zone > div { display: none; }
.zone.open > div { display: grid; gap: 1px; }
.me { margin-top: auto; flex: none; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px; border: 0; border-top: 1px solid var(--side-2); border-radius: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.me:hover, .me[aria-expanded="true"] { background: var(--side-2); border-radius: var(--radius-sm); border-top-color: transparent; }
.me > .ico { color: var(--side-muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--side-2); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 11.5px; flex: none; }
.me .who { line-height: 1.25; min-width: 0; flex: 1; }
.me .who b { display: block; color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { display: block; font-size: 12px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--side-muted); cursor: pointer; }
.iconbtn:hover { background: var(--side-2); color: #fff; }
.mtop { display: none; }
main { min-width: 0; padding: 32px 40px 96px; }
.wrap { max-width: 1280px; margin: 0 auto; }
#loader { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--text); z-index: 50; transition: width .4s ease, opacity .3s; opacity: 0; }
#loader.on { width: 70%; opacity: .5; }

/* ---------- En-tête de page : titre et statut, puis métadonnées en gris ; actions à droite, regroupées ---------- */
.ph { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 24px; margin-bottom: 32px; }
.ph .t { min-width: 0; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--text); }
.crumb .ico { width: 12px; height: 12px; }
.ph h1 { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; min-height: 32px; }
.ph h1 .ttl { min-width: 0; overflow-wrap: anywhere; }
.ph .meta { color: var(--muted); margin-top: 4px; font-size: 13px; }
.ph .btns { flex-wrap: nowrap; justify-content: flex-end; }
.helpbtn { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0; }
.helpbtn:hover, .helpbtn[aria-expanded="true"] { color: var(--text); background: var(--hover); }
.phelp { margin-top: 12px; max-width: 760px; color: var(--muted); font-size: 13px; background: var(--panel-2); border-radius: var(--radius); padding: 12px 16px; }
.phelp[hidden] { display: none; }
@media (max-width: 1100px) { .ph { grid-template-columns: minmax(0, 1fr); } .ph .btns { justify-content: flex-start; flex-wrap: wrap; } }

/* ---------- Sections : pas de carte dans la carte, des filets et de l'espace ---------- */
.card { margin-bottom: 32px; min-width: 0; }
.card > .ch { display: flex; align-items: center; gap: 8px; min-height: 32px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.card > .ch .cs { color: var(--muted); font-size: 13px; }
.card > .cb { padding: 16px 0 0; }
.card > .cb.flush { padding: 0; }
.card > .cb.flush > .tbl { margin: 0 -12px; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 6px; background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 500; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 40px; }
.cols.cols-wide { grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); }
@media (max-width: 600px) { .cols.cols-wide { grid-template-columns: 1fr; } }
.cols > * { min-width: 0; }
.stack > * + * { margin-top: 24px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary { justify-content: flex-start; gap: 8px; }
details.card > summary .fold { width: 14px; height: 14px; color: var(--faint); transition: transform .15s; }
details.card[open] > summary .fold { transform: rotate(90deg); }
details.card > summary:hover .fold { color: var(--text); }

/* Indicateurs : chiffre de 28 px, libellé gris, rouge seulement quand une action est attendue */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 24px 32px; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.tile { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; min-width: 0; }
.tile .l { font-size: 13px; color: var(--muted); font-weight: 400; }
.tile .l .ico { display: none; }
.tile .v { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.tile .s { font-size: 13px; color: var(--faint); }
a.tile:hover .l { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.tile.hot .v, .tile.bad .v { color: var(--primary); }

/* Barre de répartition : échelle séquentielle */
.dist { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--hover); gap: 2px; }
.dist span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.legend b { color: var(--text); font-weight: 500; }

/* ---------- Tableaux : lignes de 44 px, survol visible, chevron au survol, chiffres à droite ---------- */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0 12px; height: 44px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
td { padding-top: 8px; padding-bottom: 8px; }
th { height: 36px; font-size: 12px; color: var(--faint); font-weight: 500; white-space: nowrap; border-bottom-color: var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
tr.click > td:last-child { position: relative; padding-right: 32px; }
tr.click > td:last-child::after { content: ""; position: absolute; right: 10px; top: 50%; width: 14px; height: 14px; margin-top: -7px; background: var(--faint); opacity: 0; transition: opacity .1s;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; }
tr.click:hover > td:last-child::after { opacity: 1; }
tr.click > td.act:last-child { padding-right: 12px; }
tr.click > td.act:last-child::after { display: none; }
tr.sel td { background: var(--panel-2); }
td.num, th.num { text-align: right; }
td.act { width: 1%; white-space: nowrap; text-align: right; }
td b { font-weight: 500; }
td code, .rcode { font-family: var(--mono); font-size: 12.5px; color: var(--muted); font-weight: 400; }

/* Vide */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 16px; color: var(--muted); text-align: center; font-size: 13px; }
.empty .ico { width: 20px; height: 20px; color: var(--faint); }
.empty .btn { margin-top: 8px; }
.empty .btn .ico { width: 16px; height: 16px; color: inherit; }
.empty b { color: var(--text); font-size: 14px; font-weight: 500; }

/* ---------- Boutons : un principal par page, les autres secondaires ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1; cursor: pointer; background: var(--primary); color: var(--on-primary); white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--primary-hover); }
.btn.ghost { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--hover); }
.btn.quiet { background: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--hover); color: var(--text); }
.btn.ok { background: var(--primary); color: var(--on-primary); } .btn.ok:hover { background: var(--primary-hover); }
.btn.bad { background: var(--bad); color: #fff; } .btn.bad:hover { filter: brightness(.94); }
:root[data-theme="dark"] .btn.bad { color: #161a1d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.bad { color: #161a1d; } }
.btn.danger-ghost { background: var(--panel); color: var(--bad); border-color: var(--line); }
.btn.danger-ghost:hover { background: var(--bad-soft); }
.btn.lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn.quiet.icon .ico { color: var(--faint); } .btn.quiet.icon:hover .ico { color: var(--text); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
/* Bouton divisé : action principale, et ses variantes dans le menu */
.split { display: inline-flex; align-items: stretch; flex: none; }
.split .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.split .btn.arr { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 0 8px; margin-left: 1px; }
.split .btn.arr[aria-expanded="true"] { background: var(--primary-hover); }
.btn.more[aria-expanded="true"] { background: var(--hover); }
/* Menu flottant */
.menu { position: fixed; z-index: 70; min-width: 220px; max-width: 320px; display: grid; align-content: start; gap: 2px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: fade .1s ease; }
:root[data-theme="dark"] .menu { background: var(--panel-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .menu { background: var(--panel-2); } }
.menu .mi { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 400; text-align: left; cursor: pointer; }
.menu .mi .ico { color: var(--faint); }
.menu .mi:hover, .menu .mi:focus-visible { background: var(--hover); outline: none; }
.menu .mi[disabled] { opacity: .45; cursor: not-allowed; }
.menu .mi small { display: block; color: var(--muted); font-size: 12px; }
.menu .mh { font-size: 12px; font-weight: 500; color: var(--faint); padding: 6px 8px 2px; }
.menu .pill { width: 100%; justify-content: flex-start; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Badges : un point et un libellé, fond très léger, sans couleur saturée ---------- */
.pill { --c: var(--s1); display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; font: inherit; font-size: 12.5px; font-weight: 500; line-height: 1; letter-spacing: 0; color: var(--text); white-space: nowrap; background: color-mix(in srgb, var(--c) 9%, var(--panel)); vertical-align: middle; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
h1 .pill { font-size: 13px; height: 24px; }
button.pill { cursor: pointer; transition: border-color .12s; }
button.pill:hover { border-color: var(--line); }
button.pill::after { content: ""; width: 10px; height: 10px; margin-right: -2px; background: var(--faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
/* Statuts de version : neutres ; seul « Rejetée » prend le rouge, et « Soumise » le ton d'attente de l'échelle */
.st-draft { --c: var(--s1); } .st-submitted { --c: var(--s2); } .st-approved { --c: var(--muted); }
.st-active { --c: var(--text); } .st-retired { --c: var(--line); color: var(--muted); } .st-rejected { --c: var(--s4); }
/* Issues de décision, résultats de règle, diligences : échelle du gris au rouge */
.oc-approve { --c: var(--s1); } .oc-review { --c: var(--s2); } .oc-block_and_review { --c: var(--s3); } .oc-decline { --c: var(--s4); }
.r-hit { --c: var(--s4); } .r-no_hit { --c: var(--s1); color: var(--muted); } .r-no_data { --c: var(--s2); } .r-error { --c: var(--s3); }
.d-SDD { --c: var(--s1); } .d-CDD { --c: var(--s2); } .d-EDD { --c: var(--s3); } .d-REFUSE { --c: var(--s4); }
/* Étiquettes neutres ; t-* ajoute un point */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--hover); font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; vertical-align: middle; }
.tag.t-bad, .tag.t-warn, .tag.t-ok { color: var(--text); }
.tag.t-bad::before, .tag.t-warn::before, .tag.t-ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.tag.t-bad::before { background: var(--s4); } .tag.t-warn::before { background: var(--s2); } .tag.t-ok::before { background: var(--text); }
.tag.t-grey { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.tag.tag-wrap { white-space: normal; height: auto; min-height: 22px; padding: 2px 8px; line-height: 1.35; }
.tag .term { border-bottom: 0; }
/* Points : chiffres neutres, signés, sans pastille */
.score { display: inline-block; min-width: 24px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }
.score.neg { color: var(--muted); }
.show-m { display: none; }
select.fluid, .dd.fluid { width: 100%; min-width: 0; max-width: 320px; }
.smap { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.4fr) auto; gap: 8px; align-items: center; }
.smap > input, .smap > select, .smap > .dd { width: 100%; min-width: 0; }
table.cmp td.eq { color: var(--muted); }
table.cmp td:first-child { white-space: nowrap; }
table.cmp td { overflow-wrap: anywhere; }
table.cmp .tag { white-space: normal; height: auto; min-height: 22px; max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  table.cmp thead tr, table.cmp tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  table.cmp thead th:first-child { display: none; }
  table.cmp td:first-child { grid-column: 1 / -1; white-space: normal; padding-bottom: 0; border-bottom: 0; font-weight: 600; }
}
.kind-add, .kind-del, .kind-mod { color: var(--text); background: var(--hover); gap: 6px; padding: 0 8px; }
.kind-add::before, .kind-del::before, .kind-mod::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.kind-add::before { background: var(--text); } .kind-del::before { background: var(--s4); } .kind-mod::before { background: var(--s2); }

/* Formules lisibles : champs en mono gris, listes en texte souligné au survol */
.fx { font-size: 13.5px; line-height: 1.8; }
.fx .f { font-family: var(--mono); font-size: 12px; background: var(--hover); color: var(--text); padding: 1px 6px; border-radius: 4px; }
.fx .k { font-weight: 500; }
.fx .v { font-family: var(--mono); font-size: 12px; color: var(--text); }
.fx .l { font-weight: 500; color: var(--text); }
.fx .l:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Seuils et paliers */
.scale { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.scale input { width: 72px; }
.scale > div { border-radius: var(--radius); padding: 12px; background: var(--panel-2); }
.scale > div > b { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.scale > div > b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.scale .from { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* ---------- Formulaires ---------- */
input, select, textarea { font: inherit; font-size: 13.5px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 10px; min-height: 32px; max-width: 100%; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
textarea { font-family: var(--mono); font-size: 12.5px; width: 100%; min-height: 160px; line-height: 1.5; padding: 8px 10px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
input.w-xs { width: 80px; }
.tbl td input.w-s, .tbl td input.w-m, .tbl td input.w-l { width: 100%; min-width: 64px; } input.w-s { width: 128px; } input.w-m { width: 224px; } input.w-l { width: 344px; } .grow-f { flex: 1; min-width: 200px; } .grow-f input { width: 100%; }
.search { position: relative; }
.search .ico { position: absolute; left: 10px; top: 8px; color: var(--faint); }
.search input { padding-left: 32px; width: 240px; }
.seg { display: inline-flex; background: var(--hover); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; padding: 0 10px; height: 28px; border-radius: 6px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.seg button .chip { height: 18px; background: transparent; }

/* Éditeur en arbre : l'indentation porte la hiérarchie */
.node { padding: 4px 0 4px 16px; margin: 4px 0; }
.node .bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.node .slot { font-size: 12px; color: var(--faint); margin-top: 8px; font-weight: 500; }
.node .dd.kind { font-weight: 500; background: var(--hover); border-color: transparent; }
.node .dd.kind:hover { background: color-mix(in srgb, var(--text) 8%, var(--panel)); }
.tabs { display: inline-flex; background: var(--hover); border-radius: var(--radius-sm); padding: 2px; margin-bottom: 12px; }
.tabs button { border: 0; background: transparent; border-radius: 6px; padding: 4px 12px; cursor: pointer; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.preview { background: var(--panel-2); border-radius: var(--radius); padding: 12px 16px; margin-top: 12px; }
.preview .lbl { font-size: 12px; color: var(--faint); font-weight: 500; display: block; margin-bottom: 2px; }

/* Changements */
.diff { display: flex; flex-direction: column; }
.diff .d { display: grid; grid-template-columns: 112px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.diff .d:last-child { border-bottom: 0; }
.diff .d .badge { align-self: start; display: inline-flex; height: 22px; align-items: center; border-radius: 6px; font-size: 12.5px; font-weight: 500; }
.diff .d .what { font-weight: 500; margin-bottom: 4px; }
.diff .ba { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.diff .ba > div { background: var(--panel-2); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.diff .ba > div::before { display: block; font-size: 12px; color: var(--faint); font-weight: 500; margin-bottom: 2px; }
.diff .ba .b::before { content: "Avant"; } .diff .ba .a::before { content: "Après"; }

/* Messages */
.alert { display: flex; gap: 10px; border-radius: var(--radius); padding: 12px 16px; margin: 0 0 24px; font-size: 13.5px; background: var(--panel-2); color: var(--text); }
.alert > .ico { margin-top: 2px; color: var(--faint); }
.alert.bad { background: var(--bad-soft); } .alert.bad > .ico { color: var(--bad); }
.alert.warn { background: var(--warn-soft); } .alert.warn > .ico { color: var(--warn); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); background: #18181b; color: #fafafa; padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: center; }
:root[data-theme="dark"] #toast { background: #f4f4f5; color: #18181b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #toast { background: #f4f4f5; color: #18181b; } }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }
pre.json { background: var(--panel-2); border-radius: var(--radius); padding: 12px 16px; overflow: auto; font-family: var(--mono); font-size: 12.5px; max-height: 420px; margin: 0; }

/* Aide repliable : grise, fermée par défaut */
details.help { background: var(--panel-2); border-radius: var(--radius); margin-bottom: 24px; }
details.help > summary { display: flex; align-items: center; gap: 8px; padding: 10px 16px; cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 500; color: var(--muted); }
details.help > summary::-webkit-details-marker { display: none; }
details.help > summary:hover { color: var(--text); }
details.help > summary .ico { width: 14px; height: 14px; transition: transform .15s; }
details.help[open] > summary .ico { transform: rotate(90deg); }
details.help > summary .hint { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--faint); }
details.help > div { padding: 0 16px 16px 38px; font-size: 13.5px; color: var(--text); }

/* Barre d'enregistrement */
.savebar { position: sticky; bottom: 16px; z-index: 8; margin-top: 24px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border-radius: var(--radius); padding: 8px 8px 8px 16px; box-shadow: var(--shadow-lg); }
:root[data-theme="dark"] .savebar { background: var(--panel-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .savebar { background: var(--panel-2); } }
.savebar .state { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.savebar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s1); }
.savebar.dirty .dot { background: var(--accent); }
.savebar.dirty .state { color: var(--text); font-weight: 500; }
.kbd { font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--faint); }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--panel-2); }
.login .box { width: 100%; max-width: 400px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 32px; }
.login .brand { color: var(--text); padding: 0 0 16px; }
.login input { width: 100%; margin: 16px 0 8px; height: 40px; }
.login .btn { width: 100%; height: 40px; margin-top: 8px; font-size: 14px; }
.login-alt { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.login-alt summary { cursor: pointer; list-style: none; }
.login-alt summary::-webkit-details-marker { display: none; }
.login-alt[open] summary { margin-bottom: 4px; }

/* Fenêtre modale et panneau latéral */
.modal-bg, .drawer-bg { position: fixed; inset: 0; background: rgba(9, 9, 11, .4); z-index: 40; animation: fade .15s ease; }
.modal-bg { display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; padding: 24px; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); }
:root[data-theme="dark"] .modal, :root[data-theme="dark"] .drawer { background: var(--panel-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .modal, :root:not([data-theme="light"]) .drawer { background: var(--panel-2); } }
.modal h2 { margin-bottom: 8px; font-size: 16px; }
.modal textarea, .modal input { width: 100%; font-family: inherit; font-size: 13.5px; margin-top: 8px; }
.modal textarea { min-height: 90px; }
.modal .btns { justify-content: flex-end; margin-top: 16px; }
.modal > .btns { position: sticky; bottom: -24px; margin: 16px -24px -24px; padding: 12px 24px 16px; background: inherit; border-top: 1px solid var(--line); }
.formgrid input, .formgrid select, .formgrid .dd, .formgrid textarea { margin-top: 2px; }
.formgrid textarea { min-height: 64px; }
.formgrid .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.formgrid .row3 > .hint { grid-column: 1 / -1; margin-top: -6px; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--panel); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease; }
.drawer.narrow { width: min(560px, 100vw); }
.drawer > header { display: flex; align-items: center; gap: 8px; padding: 16px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.drawer > header h2 { font-size: 15px; flex: 1; min-width: 0; }
.drawer > header .iconbtn { color: var(--muted); }
.drawer > header .iconbtn:hover { background: var(--hover); color: var(--text); }
.drawer > header .dsum { flex-basis: 100%; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 24px 32px; }
.drawer > footer { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }

/* Panneau de test : résultat en tête, fixe */
.tres { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; align-items: center; padding: 8px 0 4px; }
.tres .big { grid-row: span 2; font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.tres .lv { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tres .why { font-size: 13px; color: var(--muted); }
.tres .cmpto { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin-top: 8px; }
.trule { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.trule:last-child { border-bottom: 0; }
.trule .th { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.trule .th .rcode { min-width: 72px; }
.trule .th .score { margin-left: auto; }
.trule .xnode { margin-top: 6px; }
details.tfalse { margin-top: 8px; }
details.tfalse > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--muted); padding: 12px 0 8px; border-top: 1px solid var(--line); }
details.tfalse > summary::-webkit-details-marker { display: none; }
details.tfalse > summary:hover { color: var(--text); }
details.tfalse > summary .ico { width: 14px; height: 14px; transition: transform .15s; }
details.tfalse[open] > summary .ico { transform: rotate(90deg); }

@media (min-width: 901px) and (max-width: 1100px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }

/* Téléphone et tablette */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; }
  body.menu .side { transform: none; box-shadow: var(--shadow-lg); }
  body.menu::after { content: ""; position: fixed; inset: 0; background: rgba(9, 9, 11, .4); z-index: 9; }
  .mtop { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 8; background: var(--side); color: #fff; padding: 8px 12px; }
  .mtop .brand { padding: 0; font-size: 15px; }
  .mtop .brand .logo { height: 22px; }
  main { padding: 24px 16px 96px; }
  .ph { margin-bottom: 24px; }
  .hide-m { display: none; }
  .show-m { display: block !important; }
  .search input, input.w-l, input.w-m { width: 100%; }
  .search { width: 100%; }
  .scale { grid-template-columns: 1fr 1fr; }
  .diff .d { grid-template-columns: 1fr; gap: 6px; }
  .diff .ba { grid-template-columns: 1fr; }
  th, td { padding-left: 8px; padding-right: 8px; }
  .card > .cb.flush > .tbl { margin: 0 -8px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 16px 24px; }
  .tile .v { font-size: 24px; }
  .btn { height: 36px; } .btn.sm { height: 32px; } .btn.icon { width: 36px; } .btn.sm.icon { width: 32px; }
  .side nav a { min-height: 40px; }
  .drawer-body, .drawer > header, .drawer > footer { padding-left: 16px; padding-right: 16px; }
}

/* Notions expliquées : mot souligné en pointillé, infobulle au survol, au focus et au toucher */
.term { border-bottom: 1px dotted currentColor; cursor: help; text-decoration: none; }
.term .ico { width: 13px; height: 13px; margin-left: 3px; vertical-align: -2px; color: var(--faint); }
.tipbox { position: fixed; z-index: 80; max-width: 300px; background: #18181b; color: #f4f4f5; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; line-height: 1.45; box-shadow: var(--shadow-lg); pointer-events: none; animation: fade .1s ease; }
.tipbox b { display: block; color: #fff; margin-bottom: 2px; font-weight: 500; }
:root[data-theme="dark"] .tipbox { background: #f4f4f5; color: #18181b; } :root[data-theme="dark"] .tipbox b { color: #09090b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tipbox { background: #f4f4f5; color: #18181b; } :root:not([data-theme="light"]) .tipbox b { color: #09090b; } }

/* Premiers pas sur un moteur vide */
.steps { display: grid; counter-reset: st; }
.steps .st { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.steps .st:last-child { border-bottom: 0; }
.steps .st::before { counter-increment: st; content: counter(st); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-weight: 500; font-size: 12.5px; }
.steps .st.done::before { content: "✓"; background: var(--text); color: var(--bg); box-shadow: none; }
.steps .st b { display: block; font-size: 14px; font-weight: 500; }
.steps .st span { font-size: 13px; color: var(--muted); }

/* Éditeur de modèle */
.fieldrow { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto minmax(0, 1.6fr) auto; gap: 8px; align-items: center; }
.fieldrow input, .fieldrow select, .fieldrow .dd { width: 100%; min-width: 0; }
.fieldrow label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.fieldhead { font-size: 12px; color: var(--faint); font-weight: 500; }
.fields { display: grid; gap: 8px; }
.formgrid { display: grid; gap: 16px; margin-top: 12px; }
.formgrid label.f input, .formgrid label.f select, .formgrid label.f .dd { width: 100%; }
.formgrid .hint { font-size: 12.5px; color: var(--faint); font-weight: 400; }
@media (max-width: 700px) {
  .fieldrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fieldrow .fdesc { grid-column: 1 / -1; }
  .fieldhead { display: none; }
}

/* ---------- Données : imports, objets, conservation ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ellip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsteps { display: flex; flex-wrap: wrap; gap: 8px 24px; list-style: none; margin: 0 0 24px; padding: 0 0 16px; border-bottom: 1px solid var(--line); }
.wsteps li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.wsteps li span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; font-weight: 500; }
.wsteps li.on { color: var(--text); }
.wsteps li.on span { background: var(--text); color: var(--bg); box-shadow: none; }
.wsteps li.done span { background: var(--hover); color: var(--text); box-shadow: none; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel-2); text-align: center; cursor: pointer; color: var(--muted); font-size: 13px; }
.dropzone .ico { width: 24px; height: 24px; color: var(--faint); }
.dropzone b { color: var(--text); font-size: 14px; font-weight: 500; }
.dropzone:hover, .dropzone.over, #imp-file:focus-visible + .dropzone { border-color: var(--text); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; font-size: 13.5px; margin-bottom: 16px; }
.kv > span:nth-child(odd) { color: var(--muted); }
tr.chg td { background: var(--warn-soft); }
@media (max-width: 600px) { .ellip { max-width: 140px; } .dropzone { padding: 24px 12px; } .card > .ch { flex-wrap: wrap; row-gap: 8px; } .card > .ch .btn { max-width: 100%; } }

/* ---------- Atelier RBA ---------- */
.warn-t { color: var(--warn); font-weight: 500; }
.calc-steps { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.example { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
.example-total { margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); overflow-wrap: anywhere; }
.matrix td.diag { color: var(--faint); }
.matrix td.up { background: var(--bad-soft); font-weight: 600; }
.matrix td.down { background: var(--hover); font-weight: 600; }
.matrix th.from, .matrix td.from { white-space: nowrap; }
@media (max-width: 600px) { .matrix th.from, .matrix td.from { white-space: normal; } .matrix th, .matrix td { padding-left: 6px; padding-right: 6px; } }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; min-height: 32px; }
label.check input { width: 16px; height: 16px; min-height: 0; accent-color: var(--text); }
/* Un seul accent : les cases et boutons radio prennent la couleur de Balise, jamais le bleu du navigateur. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.brk { overflow-wrap: anywhere; }
/* Test d'une règle : chaque nœud de la formule et son résultat ; l'indentation porte la hiérarchie */
.xnode { margin: 4px 0; }
.xrow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--panel-2); }
.xrow .xtext { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.xrow .xval { font-variant-numeric: tabular-nums; }
.xkids { margin-left: 16px; }
.xrule { margin-top: 16px; }
.xrule h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
@media (max-width: 600px) { .xkids { margin-left: 8px; } }
/* Chevron de ligne : visible au survol seulement */
.rowchev { opacity: 0; color: var(--faint); transition: opacity .1s; }
tr:hover .rowchev, tr:focus-within .rowchev { opacity: 1; }
/* Notions dans un titre : ni soulignées ni expliquées (l'explication reste dans les textes) */
h1 .term, h2 .term, h3 .term, th .term, .ch .term { border-bottom: 0; cursor: inherit; }
/* Sélecteur d'organisation, sous le logo */
.orgsw { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; margin: -4px 0 12px; padding: 0 10px; border: 1px solid var(--side-2); border-radius: var(--radius-sm); background: none; color: #fff; font: inherit; font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; }
.orgsw:hover, .orgsw[aria-expanded="true"] { background: var(--side-2); }
.orgsw-n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orgsw .ico { width: 14px; height: 14px; color: var(--side-muted); }
.orgsw .orgsw-i { width: 16px; height: 16px; }

/* Liste déroulante maison (remplace le select natif) */
.dd { display: inline-flex; align-items: center; gap: 8px; height: 32px; min-width: 120px; max-width: 100%; padding: 0 8px 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 400; text-align: left; cursor: pointer; transition: background .12s, border-color .12s; }
.dd:hover { background: var(--hover); }
.dd[aria-expanded="true"] { border-color: color-mix(in srgb, var(--text) 30%, var(--line)); }
.dd .dd-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd .dd-c { width: 14px; height: 14px; flex: none; color: var(--faint); transition: transform .15s; }
.dd[aria-expanded="true"] .dd-c { transform: rotate(180deg); }
.dd[disabled] { opacity: .45; cursor: not-allowed; }
.dd-pop { position: fixed; z-index: 80; max-width: min(420px, calc(100vw - 16px)); display: flex; flex-direction: column; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: fade .1s ease; overflow: hidden; }
:root[data-theme="dark"] .dd-pop { background: var(--panel-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dd-pop { background: var(--panel-2); } }
.dd-pop .dd-s { margin: 4px 4px 0; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; background: transparent; min-height: 34px; padding: 0 8px; outline: none; box-shadow: none; }
.dd-l { max-height: 360px; overflow-y: auto; padding: 4px; display: grid; gap: 1px; scrollbar-width: thin; }
.dd-o { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 8px; border-radius: 6px; font-size: 13.5px; color: var(--text); cursor: pointer; user-select: none; }
.dd-o .dd-ol { flex: 1; min-width: 0; }
.dd-o.act { background: var(--hover); }
.dd-o.on { font-weight: 500; }
.dd-o .dd-k { width: 15px; height: 15px; flex: none; color: var(--text); }
.dd-g { font-size: 12px; font-weight: 500; color: var(--faint); padding: 8px 8px 2px; }
.dd-g:first-child { padding-top: 4px; }
.dd-e { padding: 8px; color: var(--muted); font-size: 13px; }
.dd-l.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }

/* Grille en mode simple (L17) */
.modebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.seg > button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.seg > button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }
.seg > button:not(.on):not([disabled]):hover { color: var(--text); }
.seg > button[disabled] { cursor: default; }
.mods { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.mod { display: inline-flex; align-items: center; gap: 6px; }
.synres { padding: 12px 14px; display: grid; gap: 10px; }
.exgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.exgrid .dd { width: 100%; }
.exout { font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Surveillance par palier (lot L18) */
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
tr.off td { color: var(--muted); }
.tag.prio-low { background: color-mix(in srgb, var(--s1) 18%, transparent); }
.tag.prio-medium { background: color-mix(in srgb, var(--s2) 22%, transparent); }
.tag.prio-high { background: color-mix(in srgb, var(--s3) 24%, transparent); }
.tag.prio-critical { background: color-mix(in srgb, var(--s4) 26%, transparent); }

/* Grille unique (22/11/2026) : pastille de niveau, raccourcis de score, valeurs d'une liste fermée. */
.bad-t { color: var(--bad); font-weight: 500; }
.lvdot { --c: var(--s1); display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--c); vertical-align: 1px; }
.shortcuts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chipbtn { height: 24px; min-width: 32px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.chipbtn:hover { color: var(--text); border-color: var(--muted); }
.chipbtn.on { color: var(--text); border-color: var(--text); }
.chipbtn:focus-visible { outline: 2px solid var(--focus, var(--text)); outline-offset: 1px; }
.fx-inline { display: inline; font-family: var(--mono, ui-monospace, monospace); font-size: 12px; }
.enumvals { display: grid; gap: 6px; margin: -2px 0 10px 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.enumrow { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(120px, 1.4fr) minmax(120px, 1.4fr) auto; gap: 6px; align-items: center; }
@media (max-width: 640px) { .enumrow { grid-template-columns: 1fr 1fr auto; } .enumrow input:nth-child(3) { display: none; } }
