/* Feuille de style commune — direction « Cockpit × Apricot » (planche validée le 16/09/2026).
   Thème sombre par défaut : fond en dégradé ardoise → noir, panneaux translucides, cyan pour
   l'action, rouge/orange réservés aux signaux qui appellent une décision. Thème clair en option
   (Mon compte → Apparence), mémorisé dans le navigateur ; la barre latérale reste sombre. */
:root {
  --bg-grad: radial-gradient(1200px 640px at 14% -10%, rgba(165,185,200,0.38), rgba(165,185,200,0) 62%),
             radial-gradient(760px 520px at 70% 40%, rgba(120,140,155,0.14), rgba(120,140,155,0) 65%),
             radial-gradient(820px 500px at 108% 112%, rgba(25,182,198,0.16), rgba(25,182,198,0) 60%),
             linear-gradient(160deg, #2a353d 0%, #161f25 46%, #0a0f13 100%);
  --bg-solid: #131b21;
  --surface: rgba(255,255,255,0.06); --surface-solid: #1a232a; --surface-2: rgba(0,0,0,0.25);
  --ink: #e6edf0; --muted: #8ea3ae; --faint: #5f7480;
  --line: rgba(255,255,255,0.11); --line-soft: rgba(255,255,255,0.07);
  --accent: #19b6c6; --accent-ink: #06171a; --accent-soft: rgba(25,182,198,0.16); --accent-text: #6cc9d8;
  --ok: #3fbf7f; --warn: #e8a33d; --danger: #ef5d5d;
  --ok-soft: rgba(63,191,127,0.14); --warn-soft: rgba(232,163,61,0.16); --danger-soft: rgba(239,93,93,0.16);
  --shadow: 0 10px 30px rgba(0,0,0,0.30);
  --nav-bg: rgba(5,9,12,0.42); --nav-ink: #a9bcc6; --nav-active: rgba(25,182,198,0.16); --nav-line: rgba(255,255,255,0.07);
  --radius: 3px;
  --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg-grad: radial-gradient(1200px 640px at 14% -10%, rgba(255,255,255,0.9), rgba(255,255,255,0) 62%),
             radial-gradient(820px 500px at 108% 112%, rgba(25,182,198,0.10), rgba(25,182,198,0) 60%),
             linear-gradient(160deg, #eef1f4 0%, #e3e8ec 60%, #d9dfe5 100%);
  --bg-solid: #e8ecf0;
  --surface: rgba(255,255,255,0.78); --surface-solid: #ffffff; --surface-2: rgba(255,255,255,0.9);
  --ink: #1b2430; --muted: #5b6675; --faint: #8592a0;
  --line: rgba(20,30,40,0.14); --line-soft: rgba(20,30,40,0.08);
  --accent: #0f8a99; --accent-ink: #ffffff; --accent-soft: rgba(15,138,153,0.12); --accent-text: #0f7d8b;
  --ok: #2f9e6b; --warn: #c97d1a; --danger: #d64545;
  --ok-soft: rgba(47,158,107,0.12); --warn-soft: rgba(201,125,26,0.14); --danger-soft: rgba(214,69,69,0.12);
  --shadow: 0 8px 24px rgba(20,30,40,0.10);
  --nav-bg: #1b2530; --nav-ink: #b7c4cd; --nav-active: rgba(25,182,198,0.22); --nav-line: rgba(255,255,255,0.09);
  color-scheme: light;
}
:root[data-theme="light"] .nav .search input { background: rgba(0,0,0,0.3); }
:root[data-theme="light"] .topbar .chip svg, :root[data-theme="light"] .nav a.active svg { color: #6cc9d8; }
:root[data-theme="light"] .nav .me .avatar, :root[data-theme="light"] .topbar .avatar { color: #6cc9d8; }
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; min-height: 100vh; background: var(--bg-grad) fixed, var(--bg-solid); color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif; line-height: 1.5;
}
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
svg.ic { width: 15px; height: 15px; flex: none; vertical-align: -2px; }

/* ---------- Barre supérieure ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 16px; background: var(--nav-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--nav-line); color: #e6edf0; }
.topbar .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; min-width: 0; }
.topbar .brand .app { font-weight: 700; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.topbar .brand .app i { color: var(--accent); font-style: normal; }
.topbar .sep { width: 1px; height: 18px; background: var(--nav-line); }
.topbar .chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #a9bcc6; white-space: nowrap; }
.topbar .chip svg { color: var(--accent-text); }
.topbar .spacer { flex: 1; }
.topbar .chip.net { padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.topbar .chip.net.off { background: var(--warn-soft); color: var(--warn); } .topbar .chip.net.off svg { color: var(--warn); }
.topbar .chip.net.pending { background: var(--accent-soft); color: var(--accent-text); }
@media (max-width: 860px) { .topbar .chip.net { display: inline-flex; } }
.pending-mark { color: var(--warn); }
.dictate { padding: 6px 10px; font-size: 13px; }
.dictate.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.topbar a.link { color: #a9bcc6; text-decoration: none; font-size: 12px; white-space: nowrap; }
.topbar a.link:hover { color: #fff; }
.topbar .back { display: inline-flex; align-items: center; gap: 6px; max-width: 46vw; padding: 5px 12px 5px 8px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-soft); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.topbar .back:hover { background: var(--accent); color: var(--accent-ink); }
.topbar .back span { overflow: hidden; text-overflow: ellipsis; }
.topbar .back small { font-size: 12px; font-weight: 400; opacity: .85; }
@media (max-width: 860px) { .topbar .back small { display: none; } .topbar .back { display: inline-flex; } }
.topbar .burger { display: none; background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #fff; padding: 5px 10px; border-radius: var(--radius); }
.logo { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 800; letter-spacing: .12em; font-size: 15px; line-height: 1; }
.logo svg { height: 22px; width: auto; }
.logo.big { font-size: 34px; gap: 14px; letter-spacing: .14em; }
.logo.big svg { height: 44px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 700; flex: none; }

/* ---------- Gabarit : barre latérale + contenu ---------- */
.shell { display: grid; grid-template-columns: 212px minmax(0, 1fr); min-height: calc(100vh - 48px); }
.nav { position: sticky; top: 48px; align-self: start; height: calc(100vh - 48px); overflow-y: auto; background: var(--nav-bg); backdrop-filter: blur(10px); border-right: 1px solid var(--nav-line); color: var(--nav-ink); display: flex; flex-direction: column; padding: 10px 0 12px; }
.nav .search { margin: 2px 12px 8px; }
.nav .search input { width: 100%; padding: 7px 10px 7px 30px; border: 1px solid var(--nav-line); border-radius: 4px; background: rgba(0,0,0,0.25); color: #e6edf0; font-size: 12px; }
.nav .search { position: relative; }
.nav .search svg { position: absolute; left: 10px; top: 9px; width: 13px; height: 13px; color: var(--faint); }
.nav .group { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 12px 16px 4px; }
.nav a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 19px; font-size: 13px; border-left: 3px solid transparent; }
.nav a svg { color: inherit; opacity: .9; }
.nav a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav a.active { background: var(--nav-active); color: #fff; font-weight: 600; border-left-color: var(--accent); }
.nav a.active svg { color: var(--accent-text); }
.nav a .badge { margin-left: auto; font-size: 10px; font-weight: 700; background: var(--danger); color: #fff; padding: 2px 6px; border-radius: 8px; line-height: 1.2; }
.nav a.soon { opacity: .45; cursor: default; }
.nav a.soon small { font-size: 10px; }
.nav .spacer { flex: 1; }
.nav .me { display: flex; align-items: center; gap: 10px; font-size: 12px; padding: 12px 16px 4px; border-top: 1px solid var(--nav-line); margin-top: 8px; color: var(--nav-ink); }
.nav .me b { color: #fff; display: block; font-size: 13px; }
.nav .me small { display: block; }
.nav .foot { display: flex; gap: 12px; padding: 4px 16px 0; font-size: 12px; }
.nav .foot a { padding: 4px 0; border: 0; font-size: 12px; color: var(--nav-ink); }
.nav .foot a:hover { background: transparent; color: #fff; }
.main { padding: 20px 28px 48px; min-width: 0; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { display: none; position: fixed; left: 0; right: 0; top: 48px; height: auto; max-height: calc(100dvh - 48px - var(--tabbar-h, 0px)); z-index: 25; background: #0b1216; padding-bottom: 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 16px 12px 19px; font-size: 15px; }
  .nav .search input { padding: 10px 10px 10px 32px; font-size: 16px; }
  .nav .search svg { top: 12px; }
  .nav .foot { gap: 18px; padding-top: 8px; } .nav .foot a { padding: 8px 0; font-size: 14px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar .burger { display: inline-block; padding: 8px 12px; }
  body.has-tabbar:not(.focus) .topbar .burger { display: none; }
  .topbar .brand .app, .topbar .brand .sep { display: none; }
  .topbar .chip, .topbar a.link, .topbar .sep { display: none; }
  .topbar .back { max-width: 52vw; padding: 7px 12px 7px 8px; font-size: 13px; }
  .main { padding: 14px 14px 32px; }
  body.has-tabbar .main { padding-bottom: calc(var(--tabbar-h) + 24px); }
}

/* ---------- En-tête de page ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.page-head h1 { font-size: 22px; margin: 0; line-height: 1.2; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 70ch; }
.crumb-nav { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.crumb-nav b { color: var(--accent-text); font-weight: 700; }
.crumbs { font-size: 12px; color: var(--muted); }
.crumbs b { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 600; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cartes, tableaux ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.card h2 { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 12px; }
.card h2::before { content: ""; width: 8px; height: 8px; background: var(--accent); flex: none; }
.card h2.warn::before { background: var(--warn); }
.card h2.danger::before { background: var(--danger); }
.card h2 small { color: var(--muted); font-weight: 400; font-size: 11px; letter-spacing: 0; text-transform: none; margin-left: auto; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; background: rgba(0,0,0,0.18); white-space: nowrap; }
:root[data-theme="light"] th { background: rgba(20,30,40,0.05); }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-soft); }
tr.inactive td { color: var(--muted); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 24px; color: var(--muted); text-align: center; }

/* ---------- Formulaires ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px 18px; }
.form .full { grid-column: 1 / -1; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.field > span b { color: var(--danger); }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font-size: 14px; width: 100%; }
.field textarea { min-height: 80px; resize: vertical; }
.field input:disabled, .field select:disabled { opacity: .6; }
select option { background: var(--surface-solid); color: var(--ink); }
.help { font-size: 12px; color: var(--muted); margin: 0; }
.form-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"], .toolbar select, .toolbar input[type="text"], .toolbar input[type="date"] { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font-size: 13px; }
.toolbar input[type="search"] { min-width: 220px; }

/* ---------- Étiquettes ---------- */
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.danger { color: var(--danger); border-color: var(--danger); }
.pill.accent { color: var(--accent-text); border-color: var(--accent); }
.pill svg.ic { width: 11px; height: 11px; vertical-align: -1px; margin-right: 2px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(0,0,0,.15); }
.tag { display: inline-block; background: var(--accent-soft); color: var(--accent-text); padding: 1px 8px; border-radius: 3px; font-size: 12px; margin: 2px 4px 2px 0; }

/* ---------- Messages ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: 14px; font-size: 13px; }
.alert.error { border-color: var(--danger); background: var(--danger-soft); }
.alert.ok { border-color: var(--ok); background: var(--ok-soft); }
.alert.warn { border-color: var(--warn); background: var(--warn-soft); }
.brand-picks { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 0 2px; }
.brand-picks .check { font-size: 13px; }
.toast { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--surface-solid); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 16px 26px; border-radius: 6px; font-size: 16px; font-weight: 600; text-align: center; box-shadow: 0 16px 48px rgba(0,0,0,0.45); z-index: 50; max-width: min(90vw, 520px); pointer-events: none; animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---------- Fenêtre modale ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(5, 9, 12, .65); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 40; overflow: auto; }
.modal { background: var(--surface-solid); border-radius: 4px; border: 1px solid var(--line); width: min(720px, 100%); padding: 20px 22px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 14px; font-size: 16px; }

/* ---------- Page centrée (connexion, invitation) ---------- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.center .card { width: min(440px, 100%); margin: 0; padding: 26px 28px 28px; }
.center .logo { justify-content: center; margin-bottom: 18px; width: 100%; }
.center h1 { font-size: 20px; margin: 0 0 4px; }
.center .eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; text-align: center; }
.center .eyebrow i { color: var(--accent-text); font-style: normal; font-weight: 700; }

/* ---------- Matrice de droits ---------- */
.rights th:first-child, .rights td:first-child { width: 36px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rights td.desc { color: var(--muted); font-size: 12px; }
.rights .inactive-note { color: var(--warn); font-size: 12px; display: block; }
.switch { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.switch button { border: 0; background: var(--surface-2); padding: 3px 12px; font-size: 12px; cursor: pointer; color: var(--muted); }
.switch button.on { background: var(--accent); color: var(--accent-ink); }
.switch button:disabled { cursor: default; }

/* ---------- Tableau de bord ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.kpi:hover { border-color: var(--accent); }
.kpi .tag { display: inline-block; margin: -1px 0 0; background: var(--line); color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 4px 10px; border-radius: 0; }
.kpi .tag::before { content: "● "; }
.kpi.danger .tag { background: var(--danger); color: #fff; }
.kpi.warn .tag { background: var(--warn); color: #06171a; }
.kpi.accent .tag { background: var(--accent); color: var(--accent-ink); }
.kpi.accent .v svg { color: var(--accent-text); }
.kpi .v { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.kpi .v svg { width: 22px; height: 22px; align-self: center; color: var(--muted); }
.kpi.danger .v svg { color: var(--danger); }
.kpi.warn .v svg { color: var(--warn); }
.kpi .n { font-size: 40px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi.danger .n { color: var(--danger); }
.kpi .u { font-size: 13px; color: var(--muted); }
.kpi .s { font-size: 11px; color: var(--muted); margin-top: 8px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.hero > div { padding: 14px 18px; min-width: 0; }
.hero > div + div { border-left: 1px solid var(--line-soft); }
.hero h2, .panel h2 { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 10px; }
.hero h2::before, .panel h2::before { content: ""; width: 8px; height: 8px; background: var(--accent); flex: none; }
.hero h2.warn::before, .panel h2.warn::before { background: var(--warn); }
.panel h2.danger::before { background: var(--danger); }
.hero h2 .legend { margin-left: auto; }
.legend i.ln { width: 10px; height: 2px; border-radius: 0; vertical-align: 3px; }
.chart { display: block; width: 100%; height: 170px; }
.chart .grid { stroke: var(--line-soft); }
.chart .target { stroke: var(--faint); stroke-dasharray: 4 4; }
.chart .area { fill: var(--accent); fill-opacity: .12; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.chart .dot { fill: var(--accent); }
.chart .pt { fill: var(--surface-solid); stroke: var(--accent-text); stroke-width: 1.5; }
.chart .pt:hover { fill: var(--accent); }
.chart text { fill: var(--faint); font-size: 10px; font-family: inherit; }
.chart text.val { fill: var(--ink); font-size: 12px; font-family: var(--mono); }
.chart-empty { height: 170px; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; }
.visit { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; text-decoration: none; color: inherit; }
.visit:last-child { border-bottom: 0; }
.visit .d { width: 40px; flex: none; text-align: center; background: var(--surface-2); border: 1px solid var(--line-soft); padding: 3px 0; }
.visit .d b { display: block; font-family: var(--mono); font-size: 15px; font-weight: 500; line-height: 1; }
.visit .d small { font-size: 9px; color: var(--faint); text-transform: uppercase; }
.visit .t b { display: block; font-weight: 600; }
.visit .t span { color: var(--muted); font-size: 11px; }
.dash { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.panel h2 small { margin-left: auto; color: var(--muted); font-weight: 400; letter-spacing: 0; text-transform: none; }
.rank { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 34px; gap: 10px; align-items: center; font-size: 12px; padding: 4px 0; text-decoration: none; color: inherit; }
.rank .b { height: 8px; background: var(--line-soft); }
.rank .b span { display: block; height: 100%; background: var(--warn); }
.rank.danger .b span { background: var(--danger); }
.rank.ok .b span { background: var(--ok); }
.rank .n { font-family: var(--mono); text-align: right; }
.rank .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proof { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; text-decoration: none; color: inherit; }
.proof:last-child { border-bottom: 0; }
.proof .t b { display: block; font-weight: 600; }
.proof .t span { color: var(--muted); font-size: 11px; }
@media (max-width: 1000px) { .hero { grid-template-columns: 1fr; } .hero > div + div { border-left: 0; border-top: 1px solid var(--line-soft); } .dash { grid-template-columns: 1fr; } }
/* anciennes tuiles (autres écrans) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; }
.tile:hover { border-color: var(--accent); }
.tile .n { font-size: 30px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.tile.soon { opacity: .55; }

/* ---------- Champ ou onglet à corriger (après un message d'erreur) ---------- */
.flag { outline: 2px solid var(--danger) !important; outline-offset: 3px; border-radius: 4px; animation: flag-pulse 1.2s ease-in-out 3; }
.tabs button.flag { outline-offset: -2px; color: var(--danger); }
@keyframes flag-pulse { 0%, 100% { outline-color: var(--danger); } 50% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .flag { animation: none; } }

/* ---------- Participants d'une action (trois groupes) ---------- */
.parts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.parts .col { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius); padding: 8px 10px; min-height: 120px; max-height: 280px; overflow: auto; }
.parts h4 { margin: 0 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.parts label { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; padding: 3px 0; cursor: pointer; }
.parts label > span { display: flex; flex-direction: column; line-height: 1.3; }
.parts label .help { font-size: 11px; }
.parts label .pill { align-self: flex-start; margin-top: 2px; }
.parts input[type="search"] { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink); font-size: 13px; margin-bottom: 6px; }
@media (max-width: 900px) { .parts { grid-template-columns: 1fr; } }

/* ---------- Logos de marque ---------- */
.brand-logo { height: 20px; width: auto; max-width: 64px; vertical-align: middle; border-radius: 3px; background: #fff; padding: 1px 3px; object-fit: contain; }
.brand-logo.big { height: 32px; max-width: 110px; margin-right: 8px; }

/* ---------- Apparence (Mon compte) ---------- */
.themes { display: flex; flex-wrap: wrap; gap: 12px; }
.themes button { display: flex; flex-direction: column; gap: 8px; width: 180px; padding: 10px; border: 2px solid var(--line); border-radius: 4px; background: var(--surface-2); cursor: pointer; text-align: left; font-size: 13px; }
.themes button.on { border-color: var(--accent); }
.themes .sw { height: 56px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); }
.themes .sw.dark { background: linear-gradient(160deg, #2a353d, #0a0f13); }
.themes .sw.light { background: linear-gradient(160deg, #ffffff, #d9dfe5); }

/* ---------- Listes réordonnables ---------- */
.sortable li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius); margin-bottom: 6px; background: var(--surface-2); }
.sortable li .grow { flex: 1; }
.sortable li .mini { display: flex; gap: 4px; }
.sortable li.off { opacity: .55; }
.sortable { list-style: none; padding: 0; margin: 0; }
pre.json { font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 0; color: var(--muted); }

/* ---------- Phase C : arbre des axes, barres, onglets, plan d'action ---------- */
.split { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 18px; border-left: 1px solid var(--line-soft); }
.tree li { margin: 2px 0; }
.tree .node { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: var(--radius); cursor: pointer; font-size: 13px; }
.tree .node:hover { background: var(--accent-soft); }
.tree .node.selected { background: var(--accent); color: var(--accent-ink); }
.tree .node.selected .help, .tree .node.selected .code { color: inherit; opacity: .85; }
.tree .tw { width: 16px; text-align: center; color: var(--muted); font-size: 11px; flex: none; }
.tree .code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tree .cnt { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tree .cnt .late { color: var(--danger); font-weight: 600; }
.bar { display: inline-flex; align-items: center; position: relative; width: 110px; height: 16px; background: var(--line-soft); border-radius: 3px; overflow: hidden; vertical-align: middle; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.bar > b { position: relative; font-size: 11px; font-weight: 600; padding-left: 6px; color: var(--ink); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; cursor: pointer; color: var(--muted); font-size: 13px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 120px; }
.stat .n { font-size: 24px; font-weight: 300; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat.danger .n { color: var(--danger); }
.hbar { display: flex; height: 14px; border-radius: 2px; overflow: hidden; background: var(--line-soft); margin: 6px 0 4px; }
.hbar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.note { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: var(--surface-2); }
.note .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.note h4 { margin: 4px 0 6px; font-size: 14px; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.files a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; text-decoration: none; color: var(--accent-text); background: var(--surface-2); }
.files .x { color: var(--danger); cursor: pointer; border: 0; background: transparent; font-size: 14px; padding: 0 2px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 12px; font-size: 12px; color: var(--muted); }
.picker { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; background: var(--surface-2); }
.picker label { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 0; cursor: pointer; }
/* Les cases et boutons radio des sélecteurs ne prennent jamais la largeur d'un champ de saisie. */
.field .picker input[type="checkbox"], .field .picker input[type="radio"], .field .parts input[type="checkbox"], .picker input[type="checkbox"], .picker input[type="radio"] { width: 16px; height: 16px; padding: 0; margin: 0; flex: none; }
.picker .primary-pick { display: none; align-items: center; gap: 4px; margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.picker label:has(input[type="checkbox"]:checked) .primary-pick { display: inline-flex; }
.picker label:has(input[type="radio"]:checked) .primary-pick { color: var(--accent-text); font-weight: 600; }
.picker .lvl1 { padding-left: 16px; } .picker .lvl2 { padding-left: 32px; } .picker .lvl3 { padding-left: 48px; } .picker .lvl4 { padding-left: 64px; }
.event { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.event .when { color: var(--muted); white-space: nowrap; font-family: var(--mono); font-size: 11px; }
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
@media (max-width: 700px) { .map-grid { grid-template-columns: 1fr; } }
.map-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.map-grid select { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); }

/* ---------- Documents : arborescence des dossiers ---------- */
.library { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .library { grid-template-columns: 1fr; } }
.folders { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; max-height: 76vh; overflow: auto; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.folders ul { list-style: none; margin: 0; padding-left: 14px; }
.folders > ul { padding-left: 0; }
.folders .fo { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: var(--radius); cursor: pointer; font-size: 13px; min-height: 30px; }
.folders .fo:hover { background: var(--accent-soft); }
.folders .fo.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.folders .fo .tw { width: 12px; color: var(--muted); font-size: 10px; flex: none; }
.folders .fo.on .tw, .folders .fo.on .c { color: inherit; }
.folders .fo .c { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.folders .fo span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.path b { color: var(--ink); }

/* ---------- Phase E1 : audits ---------- */
.pill a, a.pill { text-decoration: none; }
.quick-val { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: 4px; }
.quick-val:hover { background: var(--accent-soft); }
.quick select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--ink); font-size: 13px; }

/* ======================= Adaptation téléphone (après les règles de base qu'elle surcharge) ======================= */
@media (max-width: 860px) {
  .page-head { margin-bottom: 14px; padding-bottom: 10px; gap: 10px; }
  .page-head h1 { font-size: 20px; }
  .page-head p { font-size: 12px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; justify-content: center; }
  /* Cibles tactiles : 44 px minimum, saisies à 16 px (pas de zoom automatique sur iPhone) */
  .btn { min-height: 44px; padding: 8px 14px; font-size: 14px; }
  .btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
  .field input, .field select, .field textarea, .toolbar input[type="search"], .toolbar select, .toolbar input[type="text"], .toolbar input[type="date"] { font-size: 16px; padding: 10px 12px; }
  .toolbar { gap: 8px; }
  .toolbar input[type="search"], .toolbar select { width: 100%; min-width: 0; }
  .toolbar .check { min-height: 40px; }
  .check input { width: 20px; height: 20px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-left: -14px; margin-right: -14px; padding: 0 14px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; padding: 10px 12px; font-size: 14px; }
  .card { padding: 14px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92dvh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); width: 100%; }
  .modal h2 { font-size: 17px; }
  .form-foot .btn { flex: 1 1 auto; justify-content: center; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 0 12px 12px; } .kpi .n { font-size: 30px; } .kpi .s { font-size: 11px; }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .hero > div { padding: 12px 14px; }
  .rank { grid-template-columns: minmax(90px, 1fr) 1fr 30px; }
  .event { grid-template-columns: 1fr; gap: 2px; }
  .toast { font-size: 15px; padding: 14px 20px; }
}
/* Ce qui n'a de sens que sur un grand écran (export Excel, colonnes secondaires) ou qu'au téléphone */
.m-only { display: none !important; }
@media (max-width: 700px) { .m-hide { display: none !important; } .m-only { display: inline-flex !important; } }

/* ---------- Barre d'onglets du bas (téléphone) : les trois écrans du quotidien + le menu complet ---------- */
:root { --tabbar-h: 0px; }
.tabbar { display: none; }
@media (max-width: 860px) {
  :root { --tabbar-h: calc(58px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 26; display: flex; height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom); background: #0b1216; border-top: 1px solid var(--nav-line); }
  body.focus .tabbar { display: none; }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--nav-ink); font-size: 11px; font-weight: 600; background: transparent; border: 0; padding: 4px 0; position: relative; cursor: pointer; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .on { color: #fff; } .tabbar .on svg { color: var(--accent-text); }
  .tabbar .on::before { content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 2px; background: var(--accent); }
  .tabbar .badge { position: absolute; top: 4px; left: calc(50% + 6px); font-size: 10px; font-weight: 700; background: var(--danger); color: #fff; padding: 1px 5px; border-radius: 8px; line-height: 1.3; }
}

/* ---------- Listes sur téléphone : chaque ligne du tableau devient une carte lisible ---------- */
@media (max-width: 700px) {
  .tablewrap:not(.keep) table, .tablewrap:not(.keep) tbody, .tablewrap:not(.keep) tr, .tablewrap:not(.keep) td { display: block; }
  .tablewrap:not(.keep) thead { display: none; }
  .tablewrap:not(.keep) tr { display: flex; flex-direction: column; padding: 10px 14px 12px; border-bottom: 1px solid var(--line); }
  .tablewrap:not(.keep) td.m-main { order: -1; }
  .tablewrap:not(.keep) tr:last-child { border-bottom: 0; }
  .tablewrap:not(.keep) tr.clickable:hover td { background: transparent; }
  .tablewrap:not(.keep) tr.clickable:active { background: var(--accent-soft); }
  .tablewrap:not(.keep) td { border: 0; padding: 3px 0; display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
  .tablewrap:not(.keep) td::before { content: attr(data-label); color: var(--faint); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; flex: 0 0 88px; padding-top: 3px; }
  .tablewrap:not(.keep) td.m-main { display: block; font-weight: 600; font-size: 15px; line-height: 1.35; padding-bottom: 6px; }
  .tablewrap:not(.keep) td.m-main::before { display: none; }
  .tablewrap:not(.keep) td.m-blank::before { visibility: hidden; }
  .tablewrap:not(.keep) td:empty, .tablewrap:not(.keep) td.m-empty { display: none; }
  .tablewrap:not(.keep) td.empty { display: block; }
  .tablewrap:not(.keep) .bar { width: 100%; max-width: 200px; }
  .pager { justify-content: center; flex-wrap: wrap; padding: 12px; }
  .pager .btn.small { min-height: 40px; }
}

/* ---------- Filtres repliés sur téléphone : la recherche reste visible, le reste derrière un bouton ---------- */
.tb-more { display: contents; }
.tb-toggle { display: none; }
@media (max-width: 860px) {
  .toolbar .tb-toggle { display: inline-flex; flex: 1 1 auto; justify-content: center; }
  .toolbar .tb-toggle.active { border-color: var(--accent); color: var(--accent-text); }
  .toolbar .tb-more { display: none; width: 100%; }
  .toolbar .tb-more.open { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
  .toolbar input[type="search"] { flex: 1 1 100%; }
}
