/* Portail Rézau Backup — console dense et sobre.
   Tout ce qui se règle (couleurs, espacements, rayons, durées) est dans les variables ci-dessous.
   Le bleu sert aux actions et aux états actifs ; le rouge et l'orange, aux alertes seulement. */

@font-face { font-family: "Inter Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-latin.woff2") format("woff2-variations"); 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: "Inter Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-latin-ext.woff2") format("woff2-variations"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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; }

:root {
  color-scheme: light dark;

  /* Couleurs — clair */
  --c-bg: #fafbfc;
  --c-surface: #ffffff;
  --c-raised: #ffffff;
  --c-subtle: #f4f5f8;
  --c-hover: #f6f7fa;
  --c-border: #e5e7ee;
  --c-border-strong: #d3d7e1;
  --c-text: #091135;
  --c-text-2: #3a4257;
  --c-text-3: #5f6880;
  --c-brand: #1068f8;
  --c-brand-hover: #0a56d6;
  --c-brand-text: #0b5ae0;
  --c-brand-subtle: #edf3ff;
  --c-on-brand: #ffffff;
  --c-ok: #12813f;
  --c-ok-dot: #1fa855;
  --c-warn: #9a5b00;
  --c-warn-dot: #e28a00;
  --c-warn-subtle: #fff5e0;
  --c-warn-border: #f3d9a4;
  --c-danger: #b4232c;
  --c-danger-dot: #dc3640;
  --c-danger-subtle: #fdecee;
  --c-danger-border: #f3c2c6;
  --c-overlay: rgb(9 17 53 / 0.32);
  --c-ring: rgb(16 104 248 / 0.45);

  /* Espacements (base 4 px) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-12: 3rem;

  /* Rayons */
  --r-sm: 0.375rem;
  --r-md: 0.5rem;
  --r-lg: 0.625rem;
  --r-xl: 0.875rem;
  --r-full: 999px;

  /* Typographie */
  --f-sans: "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --f-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-md: 0.875rem;
  --t-lg: 1rem;
  --t-xl: 1.25rem;
  --t-2xl: 1.5rem;

  /* Ombres, hauteurs, durées */
  --sh-1: 0 1px 2px rgb(9 17 53 / 0.04);
  --sh-2: 0 4px 12px rgb(9 17 53 / 0.08), 0 1px 2px rgb(9 17 53 / 0.04);
  --sh-3: 0 24px 64px rgb(9 17 53 / 0.2), 0 2px 6px rgb(9 17 53 / 0.08);
  --h-control: 2rem;
  --h-row: 2.625rem;
  --d-fast: 150ms;
  --d-base: 180ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --side-w: 15rem;

  accent-color: var(--c-brand);
  font-family: var(--f-sans);
  font-feature-settings: "cv11", "calt";
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0a0c11;
    --c-surface: #101319;
    --c-raised: #161a22;
    --c-subtle: #161a22;
    --c-hover: #151920;
    --c-border: #222733;
    --c-border-strong: #323949;
    --c-text: #eef0f5;
    --c-text-2: #c5cad6;
    --c-text-3: #9299a9;
    --c-brand: #1068f8;
    --c-brand-hover: #2b7bff;
    --c-brand-text: #6ba4ff;
    --c-brand-subtle: #12213f;
    --c-on-brand: #ffffff;
    --c-ok: #5ad48a;
    --c-ok-dot: #34c96c;
    --c-warn: #f5bd5c;
    --c-warn-dot: #f0a020;
    --c-warn-subtle: #2c2210;
    --c-warn-border: #5a4418;
    --c-danger: #ff8d93;
    --c-danger-dot: #f2555e;
    --c-danger-subtle: #311518;
    --c-danger-border: #6b2a2f;
    --c-overlay: rgb(0 0 0 / 0.6);
    --c-ring: rgb(107 164 255 / 0.6);
    --sh-1: none;
    --sh-2: 0 4px 16px rgb(0 0 0 / 0.4);
    --sh-3: 0 24px 64px rgb(0 0 0 / 0.6);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--c-bg); color: var(--c-text-2); font-size: var(--t-md); }
a { color: var(--c-brand-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; color: var(--c-text); font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
p { margin: 0 0 var(--s-3); }
.muted { color: var(--c-text-3); }
.small { font-size: var(--t-sm); }
.pad { padding: var(--s-6); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--c-ring); outline-offset: 2px; border-radius: var(--r-sm); }
.skip { position: absolute; left: -999px; top: 0; background: var(--c-surface); padding: var(--s-2) var(--s-3); z-index: 50; border-radius: var(--r-md); border: 1px solid var(--c-border); }
.skip:focus { left: var(--s-2); top: var(--s-2); }
kbd { font: 500 0.6875rem/1 var(--f-sans); padding: 0.2rem 0.35rem; border: 1px solid var(--c-border-strong); border-bottom-width: 2px; border-radius: var(--r-sm); background: var(--c-surface); color: var(--c-text-3); }

/* --- Ossature ---------------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: auto 1fr; min-height: 100%; }
.side { width: var(--side-w); background: var(--c-bg); border-right: 1px solid var(--c-border); display: flex; flex-direction: column; padding: var(--s-3); gap: var(--s-3); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: var(--s-2); height: 2.25rem; padding: 0 var(--s-2); color: var(--c-text); font-size: var(--t-md); }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 500; color: var(--c-text-2); }
/* Logo officiel de Rézau (fichier du site, réduit). */
.brand .logo { height: 1.625rem; width: auto; flex: none; }
.welcome .logo { height: 2.75rem; width: auto; margin: 0 auto var(--s-5); display: block; }
/* Marque composée en texte : repli si le logo manque. */
.brand-mark { position: relative; display: inline-grid; place-items: center; height: 1.5rem; padding: 0 0.4rem; margin-left: 0.4rem; border: 1.5px solid var(--c-brand); border-radius: 0.35rem; color: var(--c-brand-text); font-weight: 700; font-size: var(--t-sm); letter-spacing: -0.02em; flex: none; }
.brand-mark::before { content: ""; position: absolute; right: 100%; top: 50%; width: 0.4rem; height: 1.5px; margin-top: -0.75px; background: var(--c-brand); }
.side-search { display: flex; align-items: center; gap: var(--s-2); width: 100%; height: var(--h-control); padding: 0 var(--s-2); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text-3); font-size: var(--t-sm); font-weight: 400; box-shadow: var(--sh-1); }
.side-search:hover { border-color: var(--c-border-strong); background: var(--c-surface); color: var(--c-text-2); }
.side-search span { flex: 1; text-align: left; }
.org { border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--s-2) var(--s-3); font-size: var(--t-sm); background: var(--c-surface); }
.org:empty { display: none; }
.org .label { color: var(--c-text-3); font-size: var(--t-xs); }
.org .name { color: var(--c-text); font-weight: 600; font-size: var(--t-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Lanceur de modules de la suite : un contrôle segmenté, visible dès qu'il y a plus d'un module. */
.modules { display: flex; gap: 1px; background: var(--c-subtle); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 2px; }
.modules:empty { display: none; }
.modules a { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; height: 1.625rem; min-width: 0; padding: 0 var(--s-2); border-radius: calc(var(--r-md) - 2px); color: var(--c-text-3); font-size: var(--t-sm); font-weight: 500; white-space: nowrap; transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease); }
.modules a:hover { color: var(--c-text); text-decoration: none; }
.modules a[aria-current="page"] { background: var(--c-surface); color: var(--c-text); box-shadow: var(--sh-1), 0 0 0 1px var(--c-border); }
.modules svg { width: 0.875rem; height: 0.875rem; flex: none; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav .group { color: var(--c-text-3); font-size: var(--t-xs); font-weight: 500; padding: var(--s-3) var(--s-2) var(--s-1); }
.nav a { display: flex; align-items: center; gap: var(--s-2); height: var(--h-control); padding: 0 var(--s-2); border-radius: var(--r-md); color: var(--c-text-2); font-weight: 500; font-size: var(--t-md); transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease); }
.nav a:hover { background: var(--c-subtle); color: var(--c-text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--c-subtle); color: var(--c-text); font-weight: 600; }
.nav svg { width: 1rem; height: 1rem; flex: none; color: var(--c-text-3); transition: color var(--d-fast) var(--ease); }
.nav a[aria-current="page"] svg { color: var(--c-brand); }
.nav .count { margin-left: auto; min-width: 1.125rem; text-align: center; background: var(--c-danger-subtle); color: var(--c-danger); border: 1px solid var(--c-danger-border); border-radius: var(--r-full); font-size: 0.6875rem; font-weight: 600; padding: 0 0.3rem; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding: var(--s-3) var(--s-2) 0; font-size: var(--t-sm); display: grid; gap: var(--s-2); border-top: 1px solid var(--c-border); }
.side-foot .person { color: var(--c-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .role { color: var(--c-text-3); margin-top: calc(-1 * var(--s-2)); font-size: var(--t-xs); }
.side-foot button { width: 100%; justify-content: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
/* Sans menu (page de connexion) : le contenu prend toute la largeur. */
.side[hidden] + .main { grid-column: 1 / -1; }
.bar { display: flex; align-items: center; gap: var(--s-4); min-height: 3.5rem; padding: var(--s-3) var(--s-8); border-bottom: 1px solid var(--c-border); background: var(--c-bg); position: sticky; top: 0; z-index: 20; }
.bar-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.bar-title h1 { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.02em; }
.bar-title .crumb { order: 2; color: var(--c-text-3); font-size: var(--t-sm); }
.bar-title .crumb a { color: inherit; }
.bar-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; }
.menu-button { display: none; width: var(--h-control); padding: 0; justify-content: center; }
.menu-button::before { content: ""; display: block; width: 0.9rem; height: 0.625rem; border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; background: linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat; }
main#view { padding: var(--s-6) var(--s-8) var(--s-12); max-width: 84rem; width: 100%; outline: none; }

@media (max-width: 60rem) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 17rem; transform: translateX(-100%); transition: transform var(--d-base) var(--ease); box-shadow: var(--sh-3); background: var(--c-surface); }
  .side.open { transform: none; }
  .menu-button { display: inline-flex; }
  .bar { padding: var(--s-2) var(--s-4); flex-wrap: wrap; gap: var(--s-2); }
  .bar-title { flex: 1 1 60%; }
  .bar-actions { width: 100%; justify-content: flex-start; }
  .bar-actions:empty { display: none; }
  main#view { padding: var(--s-4) var(--s-4) var(--s-12); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; } }

/* --- Commandes --------------------------------------------------------------------------------- */
button, .button { font: 500 var(--t-sm) / 1 var(--f-sans); height: var(--h-control); padding: 0 var(--s-3); border-radius: var(--r-md); border: 1px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-text); cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; box-shadow: var(--sh-1); transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease), box-shadow var(--d-fast) var(--ease), transform var(--d-fast) var(--ease); }
button:hover, .button:hover { background: var(--c-hover); text-decoration: none; }
button:active, .button:active { transform: translateY(0.5px); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }
button.primary, .button.primary { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); font-weight: 600; }
button.primary:hover, .button.primary:hover { background: var(--c-brand-hover); border-color: var(--c-brand-hover); }
button.danger { color: var(--c-danger); }
button.danger:hover { border-color: var(--c-danger-border); background: var(--c-danger-subtle); }
button.ghost, .button.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--c-brand-text); padding: 0 var(--s-2); height: 1.75rem; }
button.ghost:hover, .button.ghost:hover { background: var(--c-brand-subtle); }
button.ghost.danger { color: var(--c-danger); }
button.ghost.danger:hover { background: var(--c-danger-subtle); }
button svg, .button svg { width: 0.875rem; height: 0.875rem; }

input[type="text"], input[type="search"], select { font: 400 var(--t-md) / 1.2 var(--f-sans); height: var(--h-control); padding: 0 var(--s-3); border: 1px solid var(--c-border-strong); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text); min-width: 0; box-shadow: var(--sh-1); transition: border-color var(--d-fast) var(--ease), box-shadow var(--d-fast) var(--ease); }
input[type="text"]:focus-visible, input[type="search"]:focus-visible, select:focus-visible { outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px var(--c-ring); }
input::placeholder { color: var(--c-text-3); }
input[type="search"] { width: min(20rem, 100%); }
input[type="checkbox"] { width: 1rem; height: 1rem; margin: 0; }
label { font-weight: 500; color: var(--c-text); font-size: var(--t-sm); }
.field { margin-bottom: var(--s-4); display: grid; gap: var(--s-1); }
.field input[type="text"], .field input[type="search"], .field select { width: 100%; }
textarea.code { font: 400 var(--t-sm) / 1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; width: 100%; min-height: 16rem; padding: var(--s-3); border: 1px solid var(--c-border-strong); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text); resize: vertical; tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--sh-1); }
textarea.code:focus-visible { outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px var(--c-ring); }
.check { display: flex; align-items: center; gap: var(--s-2); font-weight: 400; font-size: var(--t-md); padding: var(--s-1) 0; }

/* --- Surfaces ---------------------------------------------------------------------------------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--sh-1); margin-bottom: var(--s-5); overflow: clip; }
.card > .card-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; min-height: 2.75rem; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--c-border); }
.card > .card-head h2 { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.005em; flex: 1; }
.card > .card-body { padding: var(--s-4); }
.card-foot { padding: var(--s-2) var(--s-4); border-top: 1px solid var(--c-border); color: var(--c-text-3); font-size: var(--t-xs); background: var(--c-bg); }

/* État vide : un pictogramme, un titre, une phrase, une action. */
.card .empty { padding: var(--s-12) var(--s-4); text-align: center; color: var(--c-text-3); font-size: var(--t-sm); }
.card .empty::before { content: ""; display: block; width: 2.25rem; height: 2.25rem; margin: 0 auto var(--s-3); border-radius: var(--r-lg); border: 1px dashed var(--c-border-strong); background: var(--c-subtle) center / 1rem no-repeat linear-gradient(var(--c-text-3), var(--c-text-3)); background-size: 0.875rem 1.5px; }
.card .empty strong { display: block; color: var(--c-text); font-size: var(--t-md); font-weight: 600; margin-bottom: var(--s-1); }
.card .empty .button, .card .empty button { margin-top: var(--s-4); }

.grid { display: grid; gap: var(--s-4); margin-bottom: var(--s-5); }
.grid.services { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 70rem) { .grid.two { grid-template-columns: 1fr; } }
.grid > .card { margin: 0; }
.grid > * { min-width: 0; }

/* Chiffres clés : une seule bande, des cellules séparées par un filet. Secondaire par rapport au tableau. */
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: clip; }
.grid.kpis > .kpi { border: 0; border-radius: 0; box-shadow: none; margin: 0; background: transparent; border-left: 1px solid var(--c-border); margin-left: -1px; }
.kpi { padding: var(--s-3) var(--s-4) var(--s-4); }
.kpi .label { color: var(--c-text-3); font-size: var(--t-xs); font-weight: 500; }
.kpi .value { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; margin: var(--s-1) 0 0; font-variant-numeric: tabular-nums; color: var(--c-text); }
.kpi .value small { font-size: var(--t-md); font-weight: 400; letter-spacing: 0; color: var(--c-text-3); }
.kpi .hint { color: var(--c-text-3); font-size: var(--t-xs); margin-top: 0.125rem; }
/* La couleur ne vient que pour alerter. */
.kpi.warn .value { color: var(--c-warn); }
.kpi.bad .value { color: var(--c-danger); }
.meter { height: 0.25rem; border-radius: var(--r-full); background: var(--c-subtle); overflow: hidden; margin-top: var(--s-2); }
.meter > span { display: block; height: 100%; background: var(--c-text-3); border-radius: inherit; }
.meter.good > span { background: var(--c-ok-dot); }
.meter.warn > span { background: var(--c-warn-dot); }
.meter.bad > span { background: var(--c-danger-dot); }

.service { padding: var(--s-4); display: grid; gap: var(--s-2); align-content: start; }
.service .head { display: flex; align-items: center; gap: var(--s-2); }
.service .icon { width: 1.75rem; height: 1.75rem; border-radius: var(--r-md); border: 1px solid var(--c-border); color: var(--c-text-2); display: grid; place-items: center; flex: none; }
.service .icon svg { width: 0.9375rem; height: 0.9375rem; }
.service h3 { font-size: var(--t-md); font-weight: 600; }
.service .figure { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--c-text); font-variant-numeric: tabular-nums; }
.service .figure small { font-size: var(--t-xs); font-weight: 400; letter-spacing: 0; color: var(--c-text-3); }
.service .figure.words { font-size: var(--t-md); letter-spacing: -0.005em; }
.service .foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }
.service p { font-size: var(--t-sm); margin: 0; }
.service .notice { margin: 0; font-size: var(--t-xs); padding: var(--s-1) var(--s-2); }

/* Pastilles d'état : neutres ; seul le point porte la couleur, sauf pour une alerte. */
.pill { display: inline-flex; align-items: center; gap: 0.375rem; height: 1.375rem; padding: 0 var(--s-2); border-radius: var(--r-full); font-size: var(--t-xs); font-weight: 500; white-space: nowrap; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-2); font-variant-numeric: tabular-nums; }
.pill::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--c-text-3); flex: none; }
.pill.good::before { background: var(--c-ok-dot); }
.pill.info::before { background: var(--c-brand); }
.pill.warn { background: var(--c-warn-subtle); border-color: var(--c-warn-border); color: var(--c-warn); }
.pill.warn::before { background: var(--c-warn-dot); }
.pill.bad { background: var(--c-danger-subtle); border-color: var(--c-danger-border); color: var(--c-danger); }
.pill.bad::before { background: var(--c-danger-dot); }
.pill.plain::before { display: none; }

.chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s-1); align-items: end; height: 8rem; }
.chart .col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 1px; }
.chart .seg { border-radius: 2px; min-height: 2px; }
.chart .seg.ok { background: var(--c-text-3); }
.chart .seg.partial { background: var(--c-warn-dot); }
.chart .seg.failed { background: var(--c-danger-dot); }
.chart .none { height: 2px; background: var(--c-border); border-radius: var(--r-full); }
.chart-axis { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s-1); margin-top: var(--s-2); font-size: 0.6875rem; color: var(--c-text-3); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--t-xs); color: var(--c-text-3); }
.legend i { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 2px; margin-right: 0.375rem; background: var(--c-text-3); }
.legend i.partial { background: var(--c-warn-dot); }
.legend i.failed { background: var(--c-danger-dot); }

.toolbar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--c-border); min-height: 2.75rem; }
.toolbar .spacer { flex: 1; }
/* Sélecteur segmenté. */
.chips, .tabs { display: inline-flex; gap: 1px; background: var(--c-subtle); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 2px; max-width: 100%; overflow-x: auto; }
.chips button, .tabs a { display: inline-flex; align-items: center; height: 1.5rem; padding: 0 var(--s-3); border: 0; border-radius: calc(var(--r-md) - 2px); background: transparent; box-shadow: none; color: var(--c-text-3); font-size: var(--t-sm); font-weight: 500; white-space: nowrap; transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease); }
.chips button:hover, .tabs a:hover { color: var(--c-text); background: transparent; text-decoration: none; }
.chips button[aria-pressed="true"], .tabs a[aria-current="page"] { background: var(--c-surface); color: var(--c-text); box-shadow: var(--sh-1), 0 0 0 1px var(--c-border); }
.tabs { margin-bottom: var(--s-4); }

/* Tableaux : denses, alignés, survol discret. */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { text-align: left; padding: 0 var(--s-3); height: var(--h-row); border-bottom: 1px solid var(--c-border); vertical-align: middle; }
th { height: 2.125rem; font-size: var(--t-xs); color: var(--c-text-3); font-weight: 500; white-space: nowrap; background: var(--c-bg); }
th:first-child, td:first-child { padding-left: var(--s-4); }
th:last-child, td:last-child { padding-right: var(--s-4); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--d-fast) var(--ease); }
tbody tr:hover td { background: var(--c-hover); }
td { color: var(--c-text-2); }
td a strong, td strong { font-weight: 500; color: var(--c-text); }
td a:hover strong { color: var(--c-brand-text); }
td.num, th.num { font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
td.actions > div { display: flex; align-items: center; justify-content: flex-end; gap: 0.125rem; }
td.actions > div + div { margin-top: 1px; }
td.actions .muted { margin-right: var(--s-1); }
td.box, th.box { width: 2.25rem; padding-right: 0; }
.who-cell { display: grid; gap: 0; min-width: 0; padding: var(--s-1) 0; line-height: 1.35; }
.who-cell .sub { color: var(--c-text-3); font-size: var(--t-xs); max-width: 26rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { display: grid; gap: 0.2rem; min-width: 8rem; }
.progress .meter { margin: 0; }
.progress .meter > span { background: var(--c-brand); }

.notice { display: flex; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); border: 1px solid var(--c-warn-border); background: var(--c-warn-subtle); color: var(--c-warn); margin-bottom: var(--s-4); font-size: var(--t-sm); font-weight: 500; }
.notice.bad { background: var(--c-danger-subtle); border-color: var(--c-danger-border); color: var(--c-danger); }
.notice.info { background: var(--c-subtle); border-color: var(--c-border); color: var(--c-text-2); font-weight: 400; }
.error { color: var(--c-danger); min-height: 1.4em; margin: var(--s-2) 0 0; font-size: var(--t-sm); }

/* Chargement : des squelettes à la forme de ce qui arrive. */
.skeleton { display: grid; gap: var(--s-4); }
.sk { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--c-subtle) 25%, var(--c-border) 37%, var(--c-subtle) 63%) 0 0 / 400% 100%; animation: sk 1.4s ease infinite; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: 0 0; } }
.sk-strip { height: 5rem; border-radius: var(--r-lg); }
.sk-card { border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); overflow: clip; }
.sk-card > div { display: flex; align-items: center; gap: var(--s-4); height: var(--h-row); padding: 0 var(--s-4); border-bottom: 1px solid var(--c-border); }
.sk-card > div:last-child { border-bottom: 0; }
.sk-line { height: 0.625rem; flex: 1; }
.sk-line.short { flex: 0 0 5rem; }

/* --- Suivi en direct --------------------------------------------------------------------------- */
.live { padding: 0 var(--s-8); max-width: 84rem; width: 100%; }
.live:empty { display: none; }
.live-card { margin: var(--s-6) 0 0; border-color: var(--c-brand); box-shadow: 0 0 0 3px var(--c-brand-subtle); }
.live-card .card-head h2 { flex: 0 1 auto; }
.live-card .card-head .muted { margin-left: auto; }
.pulse { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c-brand); flex: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--c-ring); } 50% { box-shadow: 0 0 0 5px transparent; } }
.live-row { display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr) 3.5rem; gap: var(--s-4); align-items: center; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-border); font-size: var(--t-sm); }
.live-row:last-child { border-bottom: 0; }
.live-what strong { font-weight: 500; color: var(--c-text); }
.live-progress { display: grid; gap: var(--s-2); min-width: 0; }
.live-progress .meter { margin: 0; height: 0.375rem; }
.live-progress .meter > span { background: var(--c-brand); transition: width 600ms var(--ease); }
.meter.busy > span { width: 35%; animation: busy 1.4s ease-in-out infinite; }
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.live-figures { display: flex; gap: var(--s-1) var(--s-4); flex-wrap: wrap; color: var(--c-text-3); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.live-figures span:first-child { color: var(--c-text); font-weight: 500; }
.live-figures .bad { color: var(--c-danger); }
.live-percent { font-size: var(--t-lg); font-weight: 600; color: var(--c-text); letter-spacing: -0.01em; }
@media (max-width: 60rem) { .live { padding: 0 var(--s-4); } .live-row { grid-template-columns: 1fr 3rem; } .live-what { grid-column: 1 / -1; } }

/* --- Explorateur de restauration --------------------------------------------------------------- */
.steps { display: flex; gap: var(--s-2) var(--s-5); flex-wrap: wrap; margin: 0 0 var(--s-4); padding: 0; list-style: none; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: var(--s-2); color: var(--c-text-3); font-weight: 500; font-size: var(--t-sm); counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 1px solid var(--c-border-strong); font-size: 0.6875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.steps li[aria-current="step"] { color: var(--c-text); font-weight: 600; }
.steps li[aria-current="step"]::before { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); }
.steps li.done::before { content: "✓"; color: var(--c-ok); }
.explorer { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: var(--s-4); align-items: start; }
@media (max-width: 70rem) { .explorer { grid-template-columns: 1fr; } }
.explorer > .card { margin: 0; }
.points { max-height: 32rem; overflow-y: auto; padding: var(--s-1); }
.points .day { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--t-xs); color: var(--c-text-3); font-weight: 500; }
.points button { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--s-2); width: 100%; height: auto; text-align: left; border: 0; box-shadow: none; border-radius: var(--r-md); background: transparent; padding: var(--s-2) var(--s-3); font-weight: 500; white-space: normal; line-height: 1.35; font-variant-numeric: tabular-nums; }
.points button:hover { background: var(--c-hover); }
.points button[aria-pressed="true"] { background: var(--c-brand-subtle); color: var(--c-brand-text); }
.points button .pill { height: 1.125rem; font-size: 0.6875rem; }
.points button .sub { grid-column: 1 / -1; color: var(--c-text-3); font-size: var(--t-xs); font-weight: 400; }
.crumbs { display: flex; align-items: center; gap: 0.125rem; flex-wrap: wrap; font-weight: 600; font-size: var(--t-sm); color: var(--c-text); }
.crumbs button { border: 0; box-shadow: none; background: transparent; color: var(--c-brand-text); padding: 0 var(--s-1); height: 1.5rem; }
.crumbs button:hover { background: var(--c-brand-subtle); }
.crumbs span.sep { color: var(--c-text-3); }
.file-name { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.file-name svg { width: 1rem; height: 1rem; flex: none; color: var(--c-text-3); }
.file-name.folder svg { color: var(--c-brand); }
.file-name button { border: 0; box-shadow: none; background: transparent; padding: 0; height: auto; color: var(--c-text); font-weight: 500; white-space: normal; text-align: left; line-height: 1.35; }
.file-name button:hover { color: var(--c-brand-text); background: transparent; }
.file-name span { overflow-wrap: anywhere; }
.tray { position: sticky; bottom: 0; display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-2) var(--s-4); border-top: 1px solid var(--c-border); background: var(--c-surface); font-size: var(--t-sm); }
.tray .spacer { flex: 1; }
.summary { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-5); margin: 0 0 var(--s-4); font-size: var(--t-sm); }
.summary dt { color: var(--c-text-3); }
.summary dd { margin: 0; font-weight: 500; color: var(--c-text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.picker { max-height: 45vh; overflow-y: auto; border: 1px solid var(--c-border); border-radius: var(--r-md); }
.picker label { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); margin: 0; font-weight: 400; font-size: var(--t-sm); border-bottom: 1px solid var(--c-border); cursor: pointer; transition: background var(--d-fast) var(--ease); }
.picker label:last-child { border-bottom: 0; }
.picker label:hover { background: var(--c-hover); }
.linkbox { display: flex; gap: var(--s-2); }
.linkbox input { flex: 1; min-width: 0; font-family: var(--f-mono); font-size: var(--t-xs); }

/* --- Dialogues, palette, messages -------------------------------------------------------------- */
dialog { border: 1px solid var(--c-border); border-radius: var(--r-xl); background: var(--c-raised); color: var(--c-text-2); padding: var(--s-5); width: min(30rem, calc(100vw - 2rem)); box-shadow: var(--sh-3); opacity: 0; transform: translateY(6px) scale(0.985); transition: opacity var(--d-base) var(--ease), transform var(--d-base) var(--ease), overlay var(--d-base) allow-discrete, display var(--d-base) allow-discrete; }
dialog[open] { opacity: 1; transform: none; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(6px) scale(0.985); } }
dialog h2 { font-size: var(--t-lg); font-weight: 600; margin-bottom: var(--s-3); }
dialog p { font-size: var(--t-md); }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: var(--c-overlay); opacity: 0; transition: opacity var(--d-base) var(--ease), overlay var(--d-base) allow-discrete, display var(--d-base) allow-discrete; }
dialog[open]::backdrop { opacity: 1; }
@starting-style { dialog[open]::backdrop { opacity: 0; } }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-5); }

dialog.palette { padding: 0; width: min(36rem, calc(100vw - 2rem)); margin-top: 14vh; overflow: clip; }
.palette-input { display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-4); border-bottom: 1px solid var(--c-border); }
.palette-input input { flex: 1; height: 3rem; border: 0; box-shadow: none; background: transparent; padding: 0; font-size: var(--t-lg); }
.palette-input input:focus-visible { box-shadow: none; }
.palette-list { max-height: 22rem; overflow-y: auto; padding: var(--s-1); margin: 0; list-style: none; }
.palette-list .group { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--t-xs); color: var(--c-text-3); font-weight: 500; }
.palette-list [role="option"] { display: flex; align-items: center; gap: var(--s-2); height: 2.25rem; padding: 0 var(--s-3); border-radius: var(--r-md); color: var(--c-text); font-size: var(--t-md); cursor: pointer; }
.palette-list [role="option"] svg { width: 1rem; height: 1rem; color: var(--c-text-3); flex: none; }
.palette-list [role="option"][aria-selected="true"] { background: var(--c-brand-subtle); color: var(--c-brand-text); }
.palette-list [role="option"][aria-selected="true"] svg { color: var(--c-brand); }
.palette-list .hint { margin-left: auto; color: var(--c-text-3); font-size: var(--t-xs); }
.palette-empty { padding: var(--s-6); text-align: center; color: var(--c-text-3); font-size: var(--t-sm); }
.palette-foot { display: flex; gap: var(--s-4); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--c-border); color: var(--c-text-3); font-size: var(--t-xs); background: var(--c-bg); }

.toasts { position: fixed; right: var(--s-4); bottom: var(--s-4); display: grid; gap: var(--s-2); z-index: 60; }
.toast { display: flex; align-items: center; gap: var(--s-2); background: var(--c-raised); color: var(--c-text); border: 1px solid var(--c-border); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); box-shadow: var(--sh-2); font-size: var(--t-sm); font-weight: 500; max-width: 24rem; animation: toast var(--d-base) var(--ease); }
.toast::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--c-ok-dot); flex: none; }
@keyframes toast { from { opacity: 0; transform: translateY(6px); } }

.welcome { max-width: 26rem; margin: 16vh auto 0; padding: var(--s-8); text-align: center; }
.welcome .brand-mark { height: 2rem; font-size: var(--t-lg); padding: 0 0.6rem; margin: 0 auto var(--s-5); }
.welcome .brand-mark::before { width: 0.6rem; }
.welcome h1 { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -0.025em; margin-bottom: var(--s-2); }
.welcome h1 em { font-style: normal; color: var(--c-brand-text); }
.welcome .button { margin-top: var(--s-3); height: 2.25rem; padding: 0 var(--s-4); }
main.message { max-width: 32rem; margin: var(--s-12) auto; padding: var(--s-6); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); }

/* --- Module Signatures ------------------------------------------------------------------------- */
.grid.sig-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 70rem) { .grid.sig-editor { grid-template-columns: 1fr; } }
.grid.sig-editor > div > .card:last-child { margin-bottom: 0; }
.var-chips { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.var-chip { height: 1.625rem; padding: 0 var(--s-2); font-size: var(--t-xs); font-weight: 500; border-radius: var(--r-full); box-shadow: none; }
.sig-frame { display: block; width: 100%; height: 16rem; border: 1px solid var(--c-border); border-radius: var(--r-md); background: #fff; margin-top: var(--s-3); }
.sig-note { margin: var(--s-2) 0 0; font-size: var(--t-sm); min-height: 1.4em; }
.picker-current { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-2); font-size: var(--t-sm); }
.picker input[type="search"] { width: 100%; }
.picker-list { display: grid; gap: 1px; margin-top: var(--s-1); }
.picker-list:empty { display: none; }
.picker-item, .starter { display: flex; align-items: baseline; gap: var(--s-2); width: 100%; height: auto; min-height: 2rem; padding: var(--s-2) var(--s-3); text-align: left; white-space: normal; box-shadow: none; }
.starter-list { display: grid; gap: var(--s-2); }
.starter { flex-direction: column; gap: 2px; }
table.rules select, table.rules input[type="text"] { width: 100%; min-width: 8rem; }
input[type="date"], input[type="number"], input[type="url"] { font: 400 var(--t-md) / 1.2 var(--f-sans); height: var(--h-control); padding: 0 var(--s-3); border: 1px solid var(--c-border-strong); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text); min-width: 0; width: 100%; box-shadow: var(--sh-1); }
input[type="date"]:focus-visible, input[type="number"]:focus-visible, input[type="url"]:focus-visible { outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px var(--c-ring); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--s-3); }
.starter-list.scrolling { max-height: 22rem; overflow-y: auto; padding: 2px; }
tr.current > td { background: var(--c-brand-subtle); }
.grid.sig-editor > div > .card { margin-bottom: var(--s-4); }

/* Signatures : mise en service */
.setup { list-style: none; margin: 0; padding: 0; }
.setup-step { padding: 16px 20px; border-top: 1px solid var(--c-border); }
.setup-step:first-child { border-top: 0; }
.setup-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.setup-head h3 { margin: 0; font-size: 1rem; flex: 1 1 auto; }
.setup-number { display: inline-grid; place-items: center; inline-size: 26px; block-size: 26px; border-radius: 50%; border: 1px solid currentColor; font-size: 0.85rem; font-weight: 600; opacity: 0.8; }
.setup-body { margin-inline-start: 36px; }
.setup-body p { margin: 8px 0; }
.setup-body ol { margin: 8px 0; padding-inline-start: 20px; }
.setup-body .linkbox { max-inline-size: 640px; }
fieldset.checks { border: 0; padding: 0; margin-inline: 0; }
fieldset.checks legend { padding: 0; font-weight: 600; margin-block-end: 4px; }
fieldset.checks label { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: 18px; font-weight: 400; }
@media (max-width: 600px) { .setup-body { margin-inline-start: 0; } }
