/* ==========================================================================
   Interface v2 : outil pour tous les joueurs (voir web/templates_v2/AGENTS.md)
   Graphite chaud, or pour l'action et l'ISK, signaux vert / orange / rouge.
   Toutes les couleurs sont ici, dans :root : le propriétaire les ajuste lui-même.
   ========================================================================== */
:root {
  /* Surfaces */
  --bg: #0f1012;
  --bg-raised: #16171a;
  --bg-raised-2: #1b1c20;
  --bg-sunken: #0b0c0d;
  --bg-hover: #202126;
  --border: #26272c;
  --border-strong: #363840;
  /* Texte */
  --text: #eeece6;
  --text-2: #a8a59c;
  --text-3: #8a8880;   /* ≥ 4,5:1 sur --bg et --bg-sunken (accessibilité) */
  /* Action et ISK */
  --gold: #f2bd4b;
  --gold-strong: #ffcd66;
  --gold-ink: #1e1503;
  --gold-soft: rgba(242, 189, 75, .12);
  --gold-line: rgba(242, 189, 75, .35);
  /* Signaux */
  --ok: #3fd39a;
  --ok-soft: rgba(63, 211, 154, .12);
  --warn: #ff8b3d;
  --warn-soft: rgba(255, 139, 61, .12);
  --bad: #ff5f57;
  --bad-soft: rgba(255, 95, 87, .12);
  --info: #8fb6ff;
  --info-soft: rgba(143, 182, 255, .12);
  /* Formes */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --scrim: rgba(4, 5, 6, .6);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
  --row-hover: rgba(255, 255, 255, .02);
  --topbar: 60px;
  --page: 1240px;
  --gutter: 24px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Consolas, monospace;

  /* Noms de la v1, encore lus par les feuilles propres aux pages (carte.css, ia.css, fitting.css…) */
  --panel: var(--bg-raised);
  --panel-2: var(--bg-hover);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --muted: var(--text-2);
  --accent: var(--gold);
  --accent-2: var(--gold-strong);
  --accent-ink: var(--gold-ink);
  --good: var(--ok);
  --radius: var(--r-sm);

  /* Carte de New Eden (web/pages/carte : feuille carte.css et dessin de carte.js) */
  --map-bg: #03060a;
  --map-panel: #0d1621;               /* bulle de survol, fiche d'un système */
  --map-window: rgba(10, 16, 24, .94); /* fenêtre des paramètres */
  --map-locate: rgba(10, 16, 24, .92); /* bouton « ma position » */
  --map-shadow: 0 10px 34px rgba(0, 0, 0, .55);
  --map-text-halo: 0 0 3px #000, 0 0 6px #000;
  --map-legend-line: rgba(255, 255, 255, .25);
  --map-edge: rgba(120, 150, 190, .13);
  --map-quiet: rgba(70, 105, 140, .55);  /* système sans kill */
  --map-label: #e8eef6;
  --map-halo: rgba(4, 7, 12, .85);       /* contour des noms et du trajet */
  --map-hover: #ffffff;
  --map-focus: #6fd0ff;
  --map-route: #6fd0ff;
  --map-start: #4ade80;                  /* départ, vaisseau du pilote */
  --map-end: #ffb347;
  --map-step: #e8eef6;
  --map-node-line: #03060a;
  --map-avoid: rgb(255, 77, 77);         /* période « Ce que le calcul contourne » */
  --map-caution: rgb(255, 179, 71);
  --map-seen: rgb(246, 226, 122);
  --map-avoid-text: #ff7b7b;
  --map-caution-text: #ffb347;
  --map-sec-bg: transparent;            /* sous la sécurité (couleurs du jeu) des suggestions */
  /* Échelle des kills, du plus calme au plus touché (rouge vert bleu, sans virgule) */
  --map-heat-0: 253 224 71;
  --map-heat-1: 245 158 11;
  --map-heat-2: 239 68 68;
  --map-heat-3: 217 70 239;
  --map-heat-4: 139 92 246;
}

/* Thème clair (bouton soleil / lune de la barre du haut ou du menu du pilote, cookie « theme ») : mêmes rôles,
   valeurs claires, à ajuster ici comme celles du dessus (carte de New Eden comprise). */
:root[data-theme="light"] {
  color-scheme: light;
  /* Surfaces */
  --bg: #f4f3ef;
  --bg-raised: #ffffff;
  --bg-raised-2: #faf9f6;
  --bg-sunken: #ebe9e3;
  --bg-hover: #ecebe6;
  --border: #dcd9d1;
  --border-strong: #c4c0b5;
  /* Texte */
  --text: #1b1a17;
  --text-2: #57544c;
  --text-3: #66625a;
  /* Action et ISK */
  --gold: #8a5c00;
  --gold-strong: #6f4900;
  --gold-ink: #ffffff;
  --gold-soft: rgba(138, 92, 0, .10);
  --gold-line: rgba(138, 92, 0, .35);
  /* Signaux */
  --ok: #0b6e49;
  --ok-soft: rgba(11, 110, 73, .10);
  --warn: #a04a00;
  --warn-soft: rgba(160, 74, 0, .10);
  --bad: #c62828;
  --bad-soft: rgba(198, 40, 40, .09);
  --info: #2a5db0;
  --info-soft: rgba(42, 93, 176, .10);
  /* Formes */
  --shadow: 0 10px 30px rgba(40, 32, 10, .10);
  --scrim: rgba(30, 28, 22, .35);
  --shadow-lg: 0 24px 60px rgba(40, 32, 10, .16);
  --row-hover: rgba(0, 0, 0, .025);

  /* Carte de New Eden */
  --map-bg: #e6e4dd;
  --map-panel: #ffffff;
  --map-window: rgba(255, 255, 255, .95);
  --map-locate: rgba(255, 255, 255, .95);
  --map-shadow: 0 10px 34px rgba(40, 32, 10, .16);
  --map-text-halo: 0 0 3px #fff, 0 0 6px #fff;
  --map-legend-line: rgba(0, 0, 0, .2);
  --map-edge: rgba(60, 70, 90, .22);
  --map-quiet: rgba(95, 110, 130, .55);
  --map-label: #1b1a17;
  --map-halo: rgba(255, 255, 255, .9);
  --map-hover: #1b1a17;
  --map-focus: #0b6fa8;
  --map-route: #0b6fa8;
  --map-start: #15803d;
  --map-end: #c2410c;
  --map-step: #475569;
  --map-node-line: #ffffff;
  --map-avoid: rgb(220, 38, 38);
  --map-caution: rgb(234, 120, 12);
  --map-seen: rgb(176, 138, 0);
  --map-avoid-text: #c62828;
  --map-caution-text: #a04a00;
  --map-sec-bg: #23252b;
  --map-heat-0: 190 150 20;
  --map-heat-1: 234 120 12;
  --map-heat-2: 220 38 38;
  --map-heat-3: 192 38 211;
  --map-heat-4: 109 40 217;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar) + 12px); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
img { max-width: 100%; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-strong); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.12rem; margin-bottom: .6rem; }
h3 { font-size: .98rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
small, .small-note { color: var(--text-3); font-size: .8rem; line-height: 1.45; }
code, kbd { font-family: var(--mono); font-size: .85em; }
kbd { padding: .05rem .4rem; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--text-2); background: var(--bg-sunken); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.good { color: var(--ok); }
.eyebrow { margin: 0 0 .4rem; color: var(--text-3); font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
::selection { background: var(--gold); color: var(--gold-ink); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* --- Barre du haut ---------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar);
  display: flex; align-items: center; gap: 1rem; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(140%) blur(12px); -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.wordmark { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.wordmark:hover { color: var(--text); text-decoration: none; }
.wordmark .mark { width: 38px; height: 28px; flex: none; color: var(--gold); }
/* Jeu d'icônes des outils (templates_v2/_icons.html) : dessiné en or, comme les visuels du propriétaire */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.wordmark .beta-tag { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold-line); border-radius: 99px; padding: .05rem .45rem; }
.tools { display: flex; align-items: center; gap: .15rem; margin-left: .75rem; min-width: 0; }
.tool-link {
  display: inline-flex; align-items: center; gap: .45rem; height: 36px; padding: 0 .75rem; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 550; font-size: .93rem; white-space: nowrap;
}
.tool-link svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-link:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.tool-link.active { color: var(--text); background: var(--bg-raised-2); box-shadow: inset 0 -2px 0 var(--gold); }
.tool-link.locked { color: var(--text-3); }
.tool-link .lock { width: 13px; height: 13px; stroke-width: 2.2; }
.tool-link .tool-ic { width: 21px; height: 21px; color: var(--gold); }
.tool-link.locked .tool-ic { color: var(--text-3); }
.topbar .spacer { flex: 1; }
.cmd-open {
  display: inline-flex; align-items: center; gap: .6rem; height: 36px; padding: 0 .6rem 0 .75rem; min-width: 210px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-sunken); color: var(--text-3); font: inherit; font-size: .88rem; cursor: pointer;
}
.discord-btn { display: inline-flex; align-items: center; gap: .4rem; height: 36px; padding: 0 .7rem; border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-2); font-size: .88rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.discord-btn:hover { border-color: var(--border-strong); color: var(--text); }
.discord-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 1560px) { .discord-btn span { display: none; } .discord-btn { padding: 0 .6rem; } }
/* Barre connectée : sept outils, Discord, palette et pilote. La place va d'abord aux noms des outils. */
@media (max-width: 1500px) { .cmd-open { min-width: 0; } .cmd-open .cmd-label { display: none; } }
@media (max-width: 1360px) { .me-btn .name { display: none; } .tool-link { padding: 0 .5rem; gap: .35rem; } }
@media (min-width: 721px) and (max-width: 1240px) { .tools:not(.tools-public) .tool-link span { display: none; } }
/* Mêmes paliers, posés par ui.js (fitTopbar) quand la barre déborde quand même : sa longueur dépend du nombre
   d'outils, des cadenas et de la langue, pas seulement de la largeur de la fenêtre. */
.topbar.fit-1 .discord-btn { padding: 0 .6rem; }
.topbar.fit-1 .discord-btn span { display: none; }
.topbar.fit-2 .cmd-open { min-width: 0; }
.topbar.fit-2 .cmd-open .cmd-label { display: none; }
.topbar.fit-3 .me-btn .name { display: none; }
.topbar.fit-3 .tool-link { padding: 0 .5rem; gap: .35rem; }
.topbar.fit-4 .tools:not(.tools-public) .tool-link span { display: none; }
.topbar.fit-5 .wordmark .name, .topbar.fit-5 .cmd-open kbd { display: none; }
.cmd-open:hover { border-color: var(--border-strong); color: var(--text-2); }
.cmd-open svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.cmd-open kbd { margin-left: auto; font-size: .72rem; }
.me { position: relative; }
.me-btn {
  display: inline-flex; align-items: center; gap: .55rem; height: 40px; padding: 0 .55rem 0 .3rem; border-radius: 99px;
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--text); font: inherit; cursor: pointer;
}
.me-btn:hover { border-color: var(--border-strong); }
.me-btn img { width: 30px; height: 30px; border-radius: 50%; }
.me-btn .name { font-weight: 600; font-size: .9rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-btn svg { width: 14px; height: 14px; fill: none; stroke: var(--text-3); stroke-width: 2; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 250px; padding: .4rem;
  background: var(--bg-raised-2); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow-lg);
}
.menu .menu-head { padding: .55rem .7rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .35rem; }
.menu .menu-head b { display: block; }
.menu a, .menu button {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .7rem; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text); font: inherit; font-size: .92rem; text-align: left; cursor: pointer; text-decoration: none;
}
.menu a:hover, .menu button:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: .35rem 0; }
.menu form { margin: 0; }
/* Thème clair / sombre et langue : dans le menu du pilote, ou dans la barre du haut sans compte */
.menu-prefs { display: flex; gap: .35rem; padding: .15rem .35rem; }
.menu .menu-prefs .theme-btn, .menu .menu-prefs .lang-link { width: auto; flex: 1; justify-content: center; }
.theme-btn, .lang-link { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: 36px; min-width: 36px; padding: 0 .6rem;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: transparent; color: var(--text-2); font: 600 .82rem/1 var(--font); letter-spacing: .04em; cursor: pointer; }
.theme-btn:hover, .lang-link:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.theme-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .moon, [data-theme="light"] .theme-btn .sun { display: none; }
[data-theme="light"] .theme-btn .moon { display: block; }
.burger { display: none; }

/* --- Pages ------------------------------------------------------------------ */
main { display: block; }
.page { width: 100%; max-width: var(--page); margin: 0 auto; padding: 2rem var(--gutter) 4rem; }
/* Pages restées sur leur gabarit v1 (Admin…) : même cadre que .page */
main:not(.map-page):not(.ia-page):not(:has(> .page)) { width: 100%; max-width: var(--page); margin: 0 auto; padding: 2rem var(--gutter) 4rem; }
.page.narrow { max-width: 860px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head .lead { margin: .4rem 0 0; color: var(--text-2); font-size: 1.02rem; max-width: 68ch; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.section { margin-top: 2rem; }
.section > h2 { margin-bottom: .9rem; }

/* --- Cartes ----------------------------------------------------------------- */
.card { position: relative; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r); padding: 1.15rem 1.25rem; margin-bottom: 1rem; }
.card > h2:first-child, .card > header:first-child h2 { margin-bottom: .55rem; }
.card.flat { background: transparent; }
.card.tight { padding: .85rem 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid .card { margin-bottom: 0; }
.stat { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.empty-state { padding: 3rem 1.5rem; border: 1px dashed var(--border-strong); border-radius: var(--r); text-align: center; color: var(--text-2); }
.empty-state h3 { margin: 0 0 .35rem; color: var(--text); font-size: 1.05rem; }
.empty-state p { max-width: 52ch; margin: 0 auto; }
.empty-state .icon { width: 40px; height: 40px; margin: 0 auto .8rem; color: var(--text-3); fill: none; stroke: currentColor; stroke-width: 1.6; }

/* --- Boutons ---------------------------------------------------------------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 38px; padding: .45rem .95rem;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg-raised-2); color: var(--text);
  font: inherit; font-weight: 550; font-size: .93rem; line-height: 1.2; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.btn:hover, button:hover { border-color: var(--text-3); background: var(--bg-hover); color: var(--text); text-decoration: none; }
.btn:active, button:active { transform: translateY(1px); }
.btn svg, button svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary, button.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 650; }
.btn.primary:hover, button.primary:hover { background: var(--gold-strong); border-color: var(--gold-strong); color: var(--gold-ink); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover, button.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.danger, button.danger { color: var(--bad); }
.btn.danger:hover, button.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.small, button.small { min-height: 30px; padding: .3rem .65rem; font-size: .84rem; border-radius: 7px; }
.btn.large, button.large { min-height: 48px; padding: .7rem 1.35rem; font-size: 1rem; border-radius: 10px; }
.btn.block, button.block { display: flex; width: 100%; }
.btn.discord, button.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.discord:hover { background: #6b77f5; border-color: #6b77f5; color: #fff; }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: progress; transform: none; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--gold); font-weight: 500; }
button.link:hover { background: none; text-decoration: underline; }
.run .actions button { white-space: normal; text-align: left; }

/* --- Formulaires ------------------------------------------------------------ */
form { margin: 0; }
form.stack, div.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
label { display: grid; gap: .35rem; color: var(--text-2); font-size: .86rem; font-weight: 500; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.row > label { flex: 1; min-width: 130px; }
.field { min-width: 0; }
.field-head { display: flex; align-items: center; gap: .4rem; color: var(--text-2); font-size: .86rem; font-weight: 500; }
input[type=text], input[type=number], input[type=search], input[type=email], input[type=url], input[type=password], select, textarea {
  width: 100%; min-width: 0; height: 40px; padding: 0 .8rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-sunken); color: var(--text); font: inherit; font-size: .95rem;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 140px; padding: .65rem .8rem; font-family: var(--mono); font-size: .86rem; line-height: 1.5; }
select { padding-right: 2rem; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
input:disabled, select:disabled, textarea:disabled { opacity: .5; }
label.check { display: flex; align-items: flex-start; gap: .55rem; color: var(--text); font-size: .9rem; font-weight: 450; cursor: pointer; }
label.check input { width: 17px; height: 17px; margin: .12rem 0 0; flex: none; accent-color: var(--gold); }
input[type=range] { width: 100%; height: 22px; margin: 0; padding: 0; background: none; accent-color: var(--gold); cursor: pointer; }
.risk-scale { display: flex; justify-content: space-between; gap: .5rem; color: var(--text-3); font-size: .72rem; }
#risk-label { display: none; }
#qty-label, #kills-label { color: var(--text); font-weight: 600; }

/* Interrupteur */
.switch { display: flex; align-items: center; gap: .65rem; color: var(--text); font-size: .92rem; font-weight: 550; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 38px; height: 22px; flex: none; border-radius: 99px; background: var(--bg-sunken); border: 1px solid var(--border-strong); transition: background .15s, border-color .15s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: transform .15s, background .15s; }
.switch input:checked + .track { background: var(--gold-soft); border-color: var(--gold); }
.switch input:checked + .track .knob { transform: translateX(16px); background: var(--gold); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Choix segmenté (prudence…) : boutons reliés à un curseur caché */
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-sunken); }
.seg button { min-height: 32px; padding: .3rem .7rem; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: .86rem; font-weight: 550; }
.seg button:hover { background: var(--bg-hover); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--bg-raised-2); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong), 0 1px 3px rgba(0, 0, 0, .4); }
.seg button[aria-pressed="true"]::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: .4rem; border-radius: 50%; background: var(--seg-dot, var(--gold)); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }

/* --- Barre de lancement d'un outil (réglages essentiels, sur une ligne) ----- */
.brief {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.25rem; padding: 1.1rem 1.25rem;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.bf { display: grid; gap: .4rem; min-width: 0; }
.brief > .bf.grow { flex: 1 1 280px; }
.brief > .bf.w-sm { flex: 0 1 170px; }
.brief > .bf.w-md { flex: 0 1 230px; }
.bf-label { display: flex; align-items: center; gap: .35rem; color: var(--text-2); font-size: .8rem; font-weight: 600; }
.brief .go { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.brief .go .primary { min-height: 44px; padding: .55rem 1.3rem; font-size: .98rem; }
.brief .bf .row { gap: .5rem; }
.expert-chip {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 30px; padding: .2rem .35rem .2rem .7rem; border-radius: 99px;
  border: 1px solid var(--gold-line); background: var(--gold-soft); color: var(--gold); font-size: .82rem; font-weight: 600;
}
.expert-chip button { min-height: 22px; width: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--gold); font-size: 1rem; }
.expert-chip button:hover { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-strong); }
html.simple .expert-chip { display: none; }
.context-line { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: .8rem .25rem 0; color: var(--text-3); font-size: .84rem; }
.context-line b { color: var(--text-2); font-weight: 600; }

/* --- Panneau latéral des réglages experts ---------------------------------- */
.scrim { position: fixed; inset: 0; z-index: 70; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80; width: min(460px, 100vw); display: flex; flex-direction: column;
  background: var(--bg-raised); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  transform: translateX(102%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
}
.sheet.on { transform: none; visibility: visible; }
.sheet-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.sheet-head h2 { margin: 0; font-size: 1.05rem; }
.sheet-head .close { margin-left: auto; width: 34px; min-height: 34px; padding: 0; }
.sheet-mode { padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--bg-raised-2); }
.sheet-mode p { margin: .4rem 0 0; color: var(--text-3); font-size: .8rem; }
.sheet-body { flex: 1; overflow-y: auto; padding: 1.1rem 1.25rem 1.5rem; display: grid; align-content: start; gap: 1.1rem; }
.sheet-body .group { display: grid; gap: .85rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--border); }
.sheet-body .group:last-child { border-bottom: 0; padding-bottom: 0; }
.sheet-body .group > .eyebrow { margin: 0; }
.sheet-off { padding: 1rem; border: 1px dashed var(--border-strong); border-radius: var(--r); color: var(--text-2); font-size: .88rem; }
html:not(.simple) .sheet-off, html:not(.simple) .sheet-off-hint, html.simple .sheet-on-hint { display: none; }
.sheet-foot { display: flex; gap: .6rem; padding: .9rem 1.25rem; border-top: 1px solid var(--border); background: var(--bg-raised-2); }
.sheet-foot .primary { margin-left: auto; }
body.sheet-open { overflow: hidden; }

/* --- Progression d'un calcul ------------------------------------------------ */
#progress { margin: 1.25rem 0; padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-raised); }
#progress p { margin: .6rem 0 0; color: var(--text-2); font-size: .88rem; }
#progress-percent { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 6px; overflow: hidden; border-radius: 99px; background: var(--bg-sunken); }
.bar > span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--gold-strong)); transition: width .35s ease; }
.bar.small { height: 4px; }
.results { margin-top: 1.5rem; }
.results-count { margin: 0 0 .7rem; color: var(--text-3); font-size: .85rem; }
.restored { margin-bottom: 1rem; padding: .55rem .85rem; border-radius: var(--r-sm); background: var(--bg-raised); border: 1px solid var(--border); color: var(--text-2); font-size: .86rem; }

/* --- Tableaux --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .7rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th { color: var(--text-3); font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
td.num, th.num { text-align: right; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.item { min-width: 11rem; }
td.item img { width: 28px; height: 28px; vertical-align: middle; margin-right: .6rem; border-radius: 6px; background: var(--bg-sunken); }
td.bad { color: var(--bad); }
.actions-cell { width: 1%; white-space: nowrap; }
.actions-cell form { display: inline; }
.actions-cell .btn, .actions-cell button { margin: .1rem 0 .1rem .25rem; }
table.breakdown td { padding: .3rem .5rem; font-size: .86rem; border-bottom-style: dashed; }

/* --- Messages, pastilles ---------------------------------------------------- */
.alert { margin-bottom: 1rem; padding: .75rem 1rem; border: 1px solid; border-radius: var(--r-sm); font-size: .92rem; }
.alert.error { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-soft); }
.alert.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); }
.alert.info { border-color: var(--border); background: var(--bg-raised); color: var(--text-2); font-size: .88rem; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 99px; border: 1px solid var(--border-strong);
  color: var(--text-2); background: var(--bg-raised-2); font-size: .76rem; font-weight: 600; line-height: 1.4; white-space: nowrap; vertical-align: middle;
}
.badge.approved, .badge.low, .badge.up, .badge.good, .badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.badge.pending, .badge.medium, .badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); }
.badge.rejected, .badge.high, .badge.down, .badge.short, .badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); }
.badge.gold { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.alerts .badge { margin-left: .4rem; white-space: normal; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.gold { background: var(--gold); }
.role-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .45rem; }

#toast {
  position: fixed; left: 50%; bottom: 1.4rem; z-index: 120; transform: translateX(-50%); display: none; max-width: min(560px, 92vw);
  padding: .7rem 1.1rem; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--bg-raised-2); box-shadow: var(--shadow-lg); font-size: .92rem;
}
#toast.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
#toast.bad { border-color: color-mix(in srgb, var(--bad) 50%, transparent); }

/* --- Dépliants -------------------------------------------------------------- */
details > summary { cursor: pointer; }
details.drop, details.fold { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-raised); margin-top: .6rem; }
details.drop > summary, details.fold > summary {
  list-style: none; display: flex; align-items: center; gap: .5rem; padding: .6rem .85rem; color: var(--text); font-size: .9rem; font-weight: 550;
}
details.drop > summary::-webkit-details-marker, details.fold > summary::-webkit-details-marker { display: none; }
details.drop > summary::before, details.fold > summary::before {
  content: ""; width: 7px; height: 7px; flex: none; margin-right: .15rem; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(-45deg); transition: transform .15s;
}
details.drop[open] > summary::before, details.fold[open] > summary::before { transform: rotate(45deg); }
details.drop > summary .muted, details.fold > summary .muted { font-weight: 400; }
details.drop > :not(summary), details.fold > :not(summary) { margin-left: .85rem; margin-right: .85rem; }
details.drop > :last-child, details.fold > :last-child { margin-bottom: .85rem; }
details.drop > summary + *, details.fold > summary + * { margin-top: .2rem; }
details.drop details.drop { background: var(--bg-raised-2); }
details.drop ol { padding-left: 1.4rem; max-height: 40vh; overflow-y: auto; }
details.plain > summary { color: var(--gold); font-size: .88rem; }

/* --- Bulle d'aide (« ? ») ---------------------------------------------------- */
.info { display: inline-flex; vertical-align: middle; }
.info-btn {
  width: 17px; height: 17px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--border-strong); background: transparent;
  color: var(--text-3); font: 700 .66rem/1 var(--font); cursor: help;
}
.info-btn:hover, .info.open .info-btn { border-color: var(--gold); background: var(--gold); color: var(--gold-ink); transform: none; }
.info-pop {
  display: none; position: fixed; z-index: 130; width: min(360px, calc(100vw - 24px)); padding: .8rem .95rem;
  background: var(--bg-raised-2); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow-lg);
  color: var(--text); font-size: .84rem; font-weight: 400; line-height: 1.55; letter-spacing: 0; text-transform: none; text-align: left; white-space: normal;
}
.info.show .info-pop, .info.open .info-pop { display: block; }
.info-pop::before, .info-pop::after { content: ""; position: absolute; left: 0; right: 0; height: 14px; }
.info-pop::before { top: -14px; }
.info-pop::after { bottom: -14px; }
.tip-pop { display: none; position: fixed; z-index: 130; width: min(320px, calc(100vw - 16px)); padding: .6rem .8rem; pointer-events: none;
  background: var(--bg-raised-2); border: 1px solid var(--border-strong); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); font-size: .82rem; }
.tip-pop.show { display: block; }

/* --- Recherche avec suggestions -------------------------------------------- */
.combo { position: relative; }
.combo input { padding-right: 2.2rem; }
.combo .clear { position: absolute; right: .3rem; top: .3rem; min-height: 0; padding: .1rem .45rem; border: 0; background: transparent; color: var(--text-3); font-size: 1.1rem; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 90; max-height: 340px; overflow-y: auto; margin: 0; padding: .35rem; list-style: none;
  background: var(--bg-raised-2); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow-lg);
}
.suggest li { display: flex; align-items: center; gap: .65rem; padding: .45rem .6rem; border-radius: 7px; color: var(--text); cursor: pointer; }
.suggest li img { width: 28px; height: 28px; border-radius: 6px; }
.suggest li.active, .suggest li:hover { background: var(--bg-hover); }
.suggest li mark { background: transparent; color: var(--gold); font-weight: 650; }
.suggest li small { margin-left: auto; }
.chosen { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg-sunken); }
.chosen img { width: 32px; height: 32px; border-radius: 6px; }

/* Liste d'objets choisis (Commerce) et d'alertes */
.wanted { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.wanted li { display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; padding: .25rem .3rem .25rem .3rem; border: 1px solid var(--border-strong); border-radius: 99px; background: var(--bg-raised-2); font-size: .88rem; }
.wanted li img { width: 24px; height: 24px; flex: none; border-radius: 50%; }
.wanted .name { min-width: 0; overflow-wrap: anywhere; padding-right: .1rem; }
.wanted .qty { width: 78px; height: 26px; padding: 0 .5rem; border-radius: 99px; font-size: .82rem; }
.wanted .close { min-height: 0; width: 24px; height: 24px; padding: 0; border-radius: 50%; color: var(--text-3); font-size: 1.05rem; justify-content: center; }
.wanted .close:hover { background: var(--bad-soft); color: var(--bad); text-decoration: none; }
#alert-list.wanted { flex-direction: column; align-items: stretch; }
#alert-list.wanted li { border-radius: var(--r-sm); }

/* Sous-onglets */
.subtabs { display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 1.25rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-raised); }
.subtabs a { padding: .4rem 1rem; border-radius: 7px; color: var(--text-2); font-weight: 550; font-size: .92rem; }
.subtabs a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.subtabs a.active { color: var(--gold-ink); background: var(--gold); }
.subtabs .tab-count { margin-left: .35rem; }

/* --- Sécurité, itinéraires --------------------------------------------------- */
.path { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; line-height: 1.4; }
.sys { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .45rem; border-radius: 6px; border: 1px solid var(--border-strong); font-size: .8rem; white-space: nowrap; }
.sys.high { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.sys.low { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.sys.null { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.sys.risk-avoid { box-shadow: 0 0 0 2px var(--bad); }
.sys.risk-caution { box-shadow: 0 0 0 2px var(--warn); }
.hazards { display: grid; gap: .4rem; margin: .75rem 0 0; }
.hazard { padding: .55rem .8rem; border-radius: var(--r-sm); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); font-size: .87rem; }
.hazard.avoid { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); }
.hazard .info { margin-left: .35rem; }
.watch-banner { margin: .75rem 0 0; padding: .55rem .8rem; border-radius: var(--r-sm); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); font-size: .88rem; }
.watch-banner.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-soft); }

/* --- Résultats v1 (gabarits pas encore redessinés) ------------------------- */
.split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.split > .filters { position: sticky; top: calc(var(--topbar) + 1rem); max-height: calc(100vh - var(--topbar) - 2rem); overflow-y: auto; margin: 0; }
.run { position: relative; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-raised); }
.run > header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.run .route { font-weight: 650; }
.run .kpis, .kpis { display: flex; flex-wrap: wrap; gap: 1.5rem; padding: .85rem 1.1rem; }
.kpi b { display: block; font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--text-3); font-size: .8rem; }
.run .actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: .85rem 1.1rem; border-top: 1px solid var(--border); }
.run ol.stops { margin: 0; padding: .2rem 1.1rem .8rem 2.6rem; font-size: .9rem; }
.run .secline { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .6rem 1.1rem 0; }
.run .table-wrap { padding: 0 .5rem; }
.run > details.drop, .run .route-detail, .run .hazards, .run .watch-banner { margin-left: 1.1rem; margin-right: 1.1rem; }
.timing { font-size: .85rem; }
html.simple .secline.simple-only { display: flex; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; font-size: .9rem; }
dl.facts dt { color: var(--text-3); }
dl.facts dd { margin: 0; }
.who-cell { display: flex; align-items: center; gap: .6rem; }
.who-cell img { width: 32px; height: 32px; border-radius: 50%; }
.hero { max-width: 460px; margin: 4rem auto; text-align: center; }
.pilot { display: flex; align-items: center; gap: 1.2rem; }
.pilot img { width: 88px; height: 88px; border-radius: var(--r); }
.inline-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* --- Mode essentiel / expert ------------------------------------------------ */
.simple-only { display: none; }
html.simple .simple-only { display: block; }
html.simple [data-adv] { display: none !important; }
/* Champs toujours envoyés (curseurs de risque et de kills) mais montrés seulement en mode expert */
html.simple .adv-only { display: none !important; }
html:not(.simple) .simple-hide { display: none; }

/* --- Pages plein écran (carte, assistant) ----------------------------------- */
html:has(main.map-page), body:has(main.map-page) { height: 100%; overflow: hidden; }
main.map-page { position: relative; height: calc(100vh - var(--topbar)); }
main.map-page .map-wrap { height: 100%; }
html:has(main.ia-page), body:has(main.ia-page) { height: 100%; overflow: hidden; }
main.ia-page { height: calc(100vh - var(--topbar)); padding: 1rem var(--gutter); display: flex; flex-direction: column; max-width: 1400px; margin: 0 auto; }
main.ia-page > .split { flex: 1; min-height: 0; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
main.ia-page .split > .filters { position: static; max-height: none; height: 100%; }
main.ia-page .results-col { min-height: 0; display: flex; flex-direction: column; }
.map-full svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; margin: auto; }
.map-full .ico-exit, .map-full.on .ico-enter { display: none; }
.map-full.on .ico-exit { display: block; }

/* --- Palette de commandes (Ctrl K) ------------------------------------------ */
.cmd { position: fixed; inset: 0; z-index: 140; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; background: var(--scrim); }
.cmd-box { width: min(620px, 100%); overflow: hidden; background: var(--bg-raised-2); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.cmd-box input { height: 54px; padding: 0 1.1rem; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; font-size: 1.02rem; }
.cmd-box input:focus { box-shadow: none; }
.cmd-list { max-height: 50vh; overflow-y: auto; margin: 0; padding: .4rem; list-style: none; }
.cmd-list li { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--r-sm); cursor: pointer; }
.cmd-list li svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cmd-list li small { margin-left: auto; }
.cmd-list li.active { background: var(--bg-hover); }
.cmd-list li.active svg { stroke: var(--gold); }
.cmd-list li svg { color: var(--text-3); }
.cmd-list li.active svg { color: var(--gold); }
.cmd-foot { display: flex; gap: 1rem; padding: .55rem 1rem; border-top: 1px solid var(--border); color: var(--text-3); font-size: .76rem; }

/* --- Pied de page ----------------------------------------------------------- */
.site-foot { border-top: 1px solid var(--border); color: var(--text-3); font-size: .8rem; }
.site-foot .page { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; padding-top: 1.4rem; padding-bottom: 1.8rem; }
.site-foot a { color: var(--text-2); }
.site-foot p { margin: 0; max-width: 70ch; }

/* --- Petits écrans ------------------------------------------------------------ */
@media (max-width: 1080px) {
  .cmd-open { min-width: 0; }
  .cmd-open .cmd-label, .cmd-open kbd { display: none; }
  .tool-link span { display: none; }
  .tool-link { padding: 0 .6rem; }
  .tools-public .tool-link span { display: inline; }      /* une seule entrée : son nom reste lisible */
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .filters { position: static; max-height: none; }
}
@media (max-width: 720px) {

  :root { --gutter: 16px; --topbar: 56px; }
  h1 { font-size: 1.45rem; }
  /* Sans flou : un backdrop-filter ferait de la barre le repère de la barre d'outils fixée en bas */
  .topbar { gap: .5rem; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .wordmark .name { display: none; }
  .tools { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; justify-content: space-around; margin: 0; padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 96%, transparent); border-top: 1px solid var(--border); }
  .tool-link { flex-direction: column; gap: .15rem; height: auto; padding: .35rem .4rem; font-size: .66rem; }
  .tool-link span { display: block; }
  .tool-link.active { box-shadow: inset 0 2px 0 var(--gold); background: transparent; }
  body:has(.tools:not(.tools-public)) { padding-bottom: 64px; }
  /* Sans compte, la barre n'a que l'Annuaire : il reste en haut, pas de barre d'onglets en bas */
  .tools.tools-public { position: static; padding: 0; margin-left: 0; background: none; border: 0; justify-content: flex-start; }
  .tools-public .tool-link { flex-direction: row; padding: 0 .5rem; font-size: .85rem; }
  .tools-public .tool-link.active { box-shadow: inset 0 -2px 0 var(--gold); }
  .me-btn .name, .me-btn > svg { display: none; }
  .me-btn { padding: 0 .3rem; }
  .page { padding-top: 1.25rem; }
  .brief { padding: 1rem; }
  .brief > .bf { flex: 1 1 100%; }
  .brief .go { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .brief .go .primary { flex: 1 1 100%; justify-content: center; }
  .seg { display: flex; }
  .seg button { flex: 1; min-width: 0; padding: .3rem .2rem; font-size: .8rem; }
  .seg button[aria-pressed="true"]::before { display: none; }
  main.map-page, main.ia-page { height: calc(100vh - var(--topbar) - 64px); }
  main.ia-page { padding: .75rem var(--gutter); }
  .pilot { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 420px) { .tools-public .tool-link span { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* --- Connexion, accès refusé, messages -------------------------------------- */
.auth { padding-top: 4rem; }
.auth-card { max-width: 480px; margin: 0 auto; padding: 2rem; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-raised); box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: .6rem; }
.auth-card .btn { margin-top: .4rem; }
.auth-actions { margin: 1.4rem 0 1rem; gap: .6rem; }
.auth-notes { margin: 1rem 0 0; padding: 1rem 0 0 1.1rem; border-top: 1px solid var(--border); color: var(--text-3); font-size: .84rem; display: grid; gap: .4rem; }

/* Mentions légales et confidentialité (web/pages/legal) */
.legal-page > .card + .card { margin-top: 1rem; }
.legal-page h2 { font-size: 1.05rem; margin-bottom: .6rem; }
.legal-page ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .45rem; }
.legal-page code { white-space: normal; overflow-wrap: anywhere; font-size: .82rem; }
.legal-facts { display: grid; gap: .5rem; margin: 0 0 .8rem; }
.legal-facts div { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: .8rem; }
.legal-facts dt { color: var(--text-3); }
.legal-facts dd { margin: 0; overflow-wrap: anywhere; }
.legal-notice { margin: .8rem 0; padding: .7rem 1rem; border-left: 3px solid var(--border); color: var(--text-2); font-size: .9rem; }
@media (max-width: 600px) { .legal-facts div { grid-template-columns: 1fr; gap: .1rem; } }
