/* ============================================================
   BENNY'S ORIGINAL MOTOR WORKS — Design system « Atelier »
   Pointeuse d'usine × tableau de bord auto × paperasse de garage.
   Aucune dépendance externe. Thème sombre unique, assumé.
   ============================================================ */

/* ------------------------------ Tokens ------------------------------ */
:root {
  /* Surfaces (asphalte -> tôle) */
  --asphalt-0: #08090b;
  --asphalt-1: #0e1013;
  --asphalt-2: #14161a;
  --asphalt-3: #1a1d22;
  --asphalt-4: #22252c;

  /* Lignes */
  --line-1: #22252b;
  --line-2: #2e323a;
  --line-3: #3c414b;

  /* Encres */
  --ink-1: #ece9e2;
  --ink-2: #a9a59b;
  --ink-3: #6e6c64;

  /* Bleu acier Benny's (accent) */
  --accent-1: #3d8bfd;
  --accent-2: #6faeff;
  --accent-dim: rgba(61, 139, 253, 0.13);
  --amber: #ffb020;

  /* Sémantique */
  --ok: #46d17c;
  --ok-dim: rgba(70, 209, 124, 0.13);
  --danger: #ff4438;
  --danger-soft: #ff6f64;
  --danger-dim: rgba(255, 68, 56, 0.12);
  --warn: #ffc247;
  --warn-dim: rgba(255, 194, 71, 0.12);
  --info: #58a6ff;
  --info-dim: rgba(88, 166, 255, 0.12);
  --gold: #ffce54;
  --violet: #a78bfa;

  /* Typo */
  --font-display: 'Big Shoulders', 'Arial Narrow', sans-serif;
  --font-stencil: 'Big Shoulders Stencil', 'Big Shoulders', sans-serif;
  --font-body: 'Barlow', 'Segoe UI', sans-serif;
  --font-table: 'Barlow Semi Condensed', 'Barlow', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

  /* Géométrie */
  --r-s: 4px;
  --r-m: 7px;
  --r-l: 10px;
  --sidebar-w: 236px;
  --header-h: 62px;

  /* Ombres dures d'atelier */
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 48px rgba(0, 0, 0, 0.55);

  /* Textures */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  --hazard: repeating-linear-gradient(-45deg,
      rgba(255, 176, 32, 0.16) 0 10px,
      rgba(0, 0, 0, 0) 10px 20px);
  --blueprint:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
}

/* ------------------------------ Reset ------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--asphalt-0);
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(61, 139, 253, 0.35); color: #fff; }

/* Grain global au-dessus de tout, très discret */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--noise);
  opacity: 0.022;
  pointer-events: none;
  z-index: 9999;
}

/* Scrollbars d'établi */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--asphalt-4);
  border-radius: 6px;
  border: 2px solid var(--asphalt-0);
}
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* Focus clavier */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ------------------------------ Typo utils ------------------------------ */
.stencil {
  font-family: var(--font-stencil);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }

/* Étiquette pochoir de section : « ─ EFFECTIF ─────── » */
.stencil-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.stencil-label::after {
  content: '';
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, var(--line-2), transparent);
}
.stencil-label .accent { color: var(--accent-2); }

/* ------------------------------ Plaques (cartes) ------------------------------ */
.plate {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 42%),
    var(--asphalt-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-1);
}
.plate--pad { padding: 18px; }

/* Rivets de coin (plaque boulonnée) */
.plate--riveted::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 35% 35%, #454b55, #101216 68%),
    radial-gradient(circle at 35% 35%, #454b55, #101216 68%),
    radial-gradient(circle at 35% 35%, #454b55, #101216 68%),
    radial-gradient(circle at 35% 35%, #454b55, #101216 68%);
  background-position: 9px 9px, calc(100% - 9px) 9px, 9px calc(100% - 9px), calc(100% - 9px) calc(100% - 9px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
  opacity: 0.5;
}

.plate--hover { transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; }
.plate--hover:hover {
  transform: translateY(-2px);
  border-color: var(--line-3);
  box-shadow: var(--shadow-2);
}

/* Zone dangereuse : liseré hachures */
.plate--danger { border-color: rgba(255, 68, 56, 0.35); }
.plate--danger::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  border-radius: var(--r-m) var(--r-m) 0 0;
  background: repeating-linear-gradient(-45deg,
      rgba(255, 68, 56, 0.5) 0 10px,
      rgba(0, 0, 0, 0.35) 10px 20px);
  pointer-events: none;
}

/* ------------------------------ Boutons ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #20242a, #171a1f);
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}
.btn:hover { border-color: var(--line-3); background: linear-gradient(180deg, #262a31, #1b1e24); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn--primary {
  background: linear-gradient(180deg, #4292ff, #2b6fdd);
  border-color: #5c9ffb;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  box-shadow: 0 6px 18px rgba(61, 139, 253, 0.24), 0 1px 0 rgba(255, 255, 255, 0.18) inset;
}
.btn--primary:hover {
  background: linear-gradient(180deg, #59a1ff, #3a7ce6);
  border-color: #79b1ff;
  box-shadow: 0 8px 24px rgba(61, 139, 253, 0.34), 0 1px 0 rgba(255, 255, 255, 0.18) inset;
}
/* Reflet balayant au survol du bouton principal */
.btn--primary { position: relative; overflow: hidden; }
.btn--primary::after {
  content: '';
  position: absolute;
  inset: -1px;
  transform: translateX(-130%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.26), transparent);
  transition: transform 0.55s ease;
  pointer-events: none;
}
.btn--primary:hover::after { transform: translateX(130%); }

.btn--danger {
  border-color: rgba(255, 68, 56, 0.45);
  color: var(--danger-soft);
  background: linear-gradient(180deg, rgba(255, 68, 56, 0.10), rgba(255, 68, 56, 0.03));
}
.btn--danger:hover {
  border-color: var(--danger);
  color: #ffd7d3;
  background: linear-gradient(180deg, rgba(255, 68, 56, 0.2), rgba(255, 68, 56, 0.08));
}

.btn--ok {
  border-color: rgba(70, 209, 124, 0.45);
  color: var(--ok);
  background: linear-gradient(180deg, rgba(70, 209, 124, 0.10), rgba(70, 209, 124, 0.03));
}
.btn--ok:hover { border-color: var(--ok); color: #d5ffe6; }

.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink-1); border-color: transparent; }

.btn--icon { padding: 8px; }
.btn--icon svg { width: 16px; height: 16px; }
.btn--sm { padding: 6px 10px; font-size: 12px; }
.btn--sm svg { width: 13px; height: 13px; }

/* ------------------------------ Champs ------------------------------ */
.field {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-2);
  background: var(--asphalt-1);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
  color: var(--ink-1);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field::placeholder { color: var(--ink-3); }
.field:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35), 0 0 0 3px var(--accent-dim);
}
.field--mono { font-family: var(--font-mono); letter-spacing: 0.04em; }
textarea.field { resize: vertical; min-height: 74px; }
select.field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6c64' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
.field-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}

/* Interrupteur (toggle payé, etc.) */
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--asphalt-1);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #565d68, #3a4049);
  transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.4, 1);
}
.switch[aria-checked="true"] { background: rgba(70, 209, 124, 0.22); border-color: rgba(70, 209, 124, 0.6); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: linear-gradient(180deg, #6fe8a0, #2fae63); }

/* ------------------------------ Badges & tags ------------------------------ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--line-2);
  background: var(--asphalt-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  white-space: nowrap;
}
.tag--flame { color: var(--accent-2); border-color: rgba(61, 139, 253, 0.4); background: var(--accent-dim); }
.tag--ok { color: var(--ok); border-color: rgba(70, 209, 124, 0.4); background: var(--ok-dim); }
.tag--danger { color: var(--danger-soft); border-color: rgba(255, 68, 56, 0.4); background: var(--danger-dim); }
.tag--warn { color: var(--warn); border-color: rgba(255, 194, 71, 0.4); background: var(--warn-dim); }
.tag--info { color: var(--info); border-color: rgba(88, 166, 255, 0.4); background: var(--info-dim); }
.tag--gold { color: var(--gold); border-color: rgba(255, 206, 84, 0.45); background: rgba(255, 206, 84, 0.1); }
.tag--violet { color: var(--violet); border-color: rgba(167, 139, 250, 0.4); background: rgba(167, 139, 250, 0.1); }

/* Voyant d'état (lampe) */
.lamp {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}
.lamp--on {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(70, 209, 124, 0.18), 0 0 10px rgba(70, 209, 124, 0.7);
  animation: lampPulse 2.2s ease-in-out infinite;
}
.lamp--warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(255, 194, 71, 0.16), 0 0 9px rgba(255, 194, 71, 0.6); }
.lamp--danger {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 68, 56, 0.16), 0 0 10px rgba(255, 68, 56, 0.7);
  animation: lampBlink 1s steps(2, start) infinite;
}
@keyframes lampPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(70, 209, 124, 0.18), 0 0 10px rgba(70, 209, 124, 0.7); }
  50% { box-shadow: 0 0 0 5px rgba(70, 209, 124, 0.08), 0 0 16px rgba(70, 209, 124, 0.9); }
}
@keyframes lampBlink { 50% { opacity: 0.35; } }

/* Tampon encreur */
.stamp {
  display: inline-block;
  padding: 3px 10px 2px;
  border: 2.5px solid currentColor;
  border-radius: 5px;
  font-family: var(--font-stencil);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-3.5deg);
  opacity: 0.92;
  -webkit-mask-image: var(--noise), linear-gradient(#fff, #fff);
  -webkit-mask-composite: source-over;
  mask-image: var(--noise), linear-gradient(#fff, #fff);
  white-space: nowrap;
}
.stamp--ok { color: var(--ok); }
.stamp--danger { color: var(--danger-soft); }
.stamp--warn { color: var(--warn); }
.stamp--info { color: var(--info); }
.stamp--gold { color: var(--gold); }
.stamp--muted { color: var(--ink-3); }
.stamp--big { font-size: 19px; padding: 5px 14px 4px; border-width: 3px; }
.stamp--animated { animation: stampIn 0.45s cubic-bezier(0.2, 1.2, 0.35, 1) both; }
@keyframes stampIn {
  0% { transform: rotate(-3.5deg) scale(2.1); opacity: 0; filter: blur(3px); }
  55% { transform: rotate(-3.5deg) scale(0.94); opacity: 0.95; filter: blur(0); }
  75% { transform: rotate(-3.5deg) scale(1.05); }
  100% { transform: rotate(-3.5deg) scale(1); opacity: 0.92; }
}

/* Plaque d'immatriculation */
.plate-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1.5px solid #4a5160;
  background: linear-gradient(180deg, #1d2531, #141a24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 5px rgba(0, 0, 0, 0.4);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  color: #cfd8e6;
  text-transform: uppercase;
  white-space: nowrap;
}
.plate-tag--free { border-color: rgba(70, 209, 124, 0.5); color: #a9f0c6; background: linear-gradient(180deg, #14251c, #0f1c15); }

/* Pastille d'équipe */
.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-table);
  font-weight: 600;
  font-size: 11.5px;
  border: 1px solid;
  white-space: nowrap;
}

/* ------------------------------ Avatars ------------------------------ */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: var(--asphalt-3);
  object-fit: cover;
  flex: none;
}
.avatar--sm { width: 26px; height: 26px; border-width: 1.5px; }
.avatar--lg { width: 58px; height: 58px; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .lamp {
  position: absolute;
  right: -1px; bottom: -1px;
  border: 2px solid var(--asphalt-2);
  width: 11px; height: 11px;
}

/* ------------------------------ Tables d'établi ------------------------------ */
.wb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wb-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-table);
  font-size: 13.5px;
}
.wb-table th {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
  user-select: none;
}
.wb-table th.sortable { cursor: pointer; }
.wb-table th.sortable:hover { color: var(--ink-2); }
.wb-table th .sort-arrow { display: inline-block; margin-left: 4px; color: var(--accent-2); }
.wb-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-1); vertical-align: middle; }
.wb-table tbody tr { transition: background 0.13s ease, box-shadow 0.13s ease; }
.wb-table tbody tr.rowlink { cursor: pointer; }
.wb-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.022);
  box-shadow: inset 3px 0 0 var(--accent-1);
}
.wb-table tbody tr:last-child td { border-bottom: none; }

/* Apparition en cascade des lignes (uniquement à l'arrivée sur la vue) */
.view-enter .wb-table tbody tr { animation: rowIn 0.32s cubic-bezier(0.2, 1, 0.3, 1) both; }
.view-enter .wb-table tbody tr:nth-child(1) { animation-delay: 0.015s; }
.view-enter .wb-table tbody tr:nth-child(2) { animation-delay: 0.035s; }
.view-enter .wb-table tbody tr:nth-child(3) { animation-delay: 0.055s; }
.view-enter .wb-table tbody tr:nth-child(4) { animation-delay: 0.075s; }
.view-enter .wb-table tbody tr:nth-child(5) { animation-delay: 0.095s; }
.view-enter .wb-table tbody tr:nth-child(6) { animation-delay: 0.115s; }
.view-enter .wb-table tbody tr:nth-child(7) { animation-delay: 0.135s; }
.view-enter .wb-table tbody tr:nth-child(8) { animation-delay: 0.155s; }
.view-enter .wb-table tbody tr:nth-child(9) { animation-delay: 0.175s; }
.view-enter .wb-table tbody tr:nth-child(10) { animation-delay: 0.195s; }
.view-enter .wb-table tbody tr:nth-child(n+11) { animation-delay: 0.215s; }
@keyframes rowIn {
  from { opacity: 0; transform: translateY(5px); }
}

/* Balayage lumineux unique (heatmap) — à l'arrivée sur la vue seulement */
.scan-wrap { position: relative; overflow: hidden; }
.view-enter .scan-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(111, 174, 255, 0.06) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: scanOnce 1.5s cubic-bezier(0.5, 0, 0.3, 1) 0.4s forwards;
  pointer-events: none;
}
@keyframes scanOnce { to { transform: translateX(100%); } }

/* ------------------------------ Barres de progression ------------------------------ */
.gauge-track {
  position: relative;
  height: 7px;
  border-radius: 4px;
  background: var(--asphalt-1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  overflow: visible;
}
.gauge-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #2b6fdd, var(--accent-2));
  box-shadow: 0 0 8px rgba(61, 139, 253, 0.4);
  transition: width 0.8s cubic-bezier(0.25, 1, 0.35, 1);
  transform-origin: left center;
}
.view-enter .gauge-fill { animation: gaugeIn 0.9s cubic-bezier(0.25, 1, 0.35, 1) both; }
@keyframes gaugeIn { from { transform: scaleX(0); } }
.gauge-fill--ok { background: linear-gradient(90deg, #2fae63, #6fe8a0); box-shadow: 0 0 8px rgba(70, 209, 124, 0.4); }
.gauge-fill--warn { background: linear-gradient(90deg, #c98a12, #ffd479); box-shadow: 0 0 8px rgba(255, 194, 71, 0.4); }
.gauge-fill--muted { background: rgba(255, 255, 255, 0.18); box-shadow: none; }
.gauge-fill--danger { background: linear-gradient(90deg, #c22317, #ff6f64); box-shadow: 0 0 8px rgba(255, 68, 56, 0.4); }
.gauge-tick {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 13px;
  background: var(--ink-3);
  border-radius: 1px;
}
.gauge-tick--gold { background: var(--gold); }

/* ------------------------------ Odomètre ------------------------------ */
.odo {
  display: inline-flex;
  align-items: flex-start;
  overflow: hidden;
  height: 1em;
  line-height: 1;
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.odo-reel { display: block; }
.odo-reel > span { display: block; height: 1em; }
.odo-sep { display: block; height: 1em; opacity: 0.4; }

/* ------------------------------ Modales ------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: rgba(4, 5, 7, 0.72);
  -webkit-backdrop-filter: blur(7px) saturate(0.75);
  backdrop-filter: blur(7px) saturate(0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.modal-backdrop.open { opacity: 1; }
.modal-panel {
  width: min(560px, 100%);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  transform: translateY(26px) scale(0.965);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.2, 1.1, 0.3, 1), opacity 0.22s ease;
  box-shadow: var(--shadow-2);
}
.modal-backdrop.open .modal-panel { transform: none; opacity: 1; }
.modal-panel--lg { width: min(940px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-1);
  flex: none;
}
.modal-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--line-1);
  flex: none;
}
.modal-close { margin-left: auto; }

/* ------------------------------ Toasts (bons de travaux) ------------------------------ */
#toast-rack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 336px;
  max-width: calc(100vw - 36px);
}
.toast {
  position: relative;
  padding: 11px 14px 11px 16px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--accent-1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)), var(--asphalt-3);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  transform: translateX(calc(100% + 30px)) rotate(2deg);
  transition: transform 0.42s cubic-bezier(0.2, 1.15, 0.3, 1), opacity 0.3s ease;
}
.toast.show { transform: none; }
.toast.hide { opacity: 0; transform: translateX(40px); }
.toast-kicker {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 3px;
}
.toast-kicker time { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0; }
.toast-msg { font-size: 13px; color: var(--ink-1); }
.toast--ok { border-left-color: var(--ok); }
.toast--ok .toast-kicker { color: var(--ok); }
.toast--error { border-left-color: var(--danger); }
.toast--error .toast-kicker { color: var(--danger-soft); }
.toast--warn { border-left-color: var(--warn); }
.toast--warn .toast-kicker { color: var(--warn); }

/* ------------------------------ Palette Ctrl+K ------------------------------ */
.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(4, 5, 7, 0.6);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 15vh 20px 20px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.palette-backdrop.open { opacity: 1; }
.palette {
  width: min(580px, 100%);
  overflow: hidden;
  transform: translateY(-14px) scale(0.985);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.2, 1.2, 0.3, 1), opacity 0.18s ease;
}
.palette-backdrop.open .palette { transform: none; opacity: 1; }
.palette-input-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-1);
}
.palette-input-row svg { width: 17px; height: 17px; color: var(--accent-2); flex: none; }
.palette-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 14.5px;
  color: var(--ink-1);
}
.palette-input::placeholder { color: var(--ink-3); }
.palette-results { max-height: 380px; overflow-y: auto; padding: 7px; }
.palette-group {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 9px 11px 4px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-s);
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13.5px;
}
.palette-item svg { width: 15px; height: 15px; flex: none; opacity: 0.8; }
.palette-item img { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.palette-item .hint { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.palette-item.active {
  background: var(--accent-dim);
  color: #dbe9ff;
  box-shadow: inset 3px 0 0 var(--accent-1);
}
.palette-empty { padding: 26px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ------------------------------ Menus contextuels ------------------------------ */
.ctx-menu {
  position: fixed;
  z-index: 750;
  min-width: 195px;
  padding: 6px;
  background: var(--asphalt-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-2);
  transform-origin: top right;
  animation: ctxIn 0.16s cubic-bezier(0.2, 1.2, 0.3, 1);
}
@keyframes ctxIn { from { transform: scale(0.92); opacity: 0; } }
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--r-s);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.ctx-item svg { width: 14.5px; height: 14.5px; flex: none; }
.ctx-item:hover { background: rgba(255, 255, 255, 0.055); color: var(--ink-1); }
.ctx-item--danger:hover { background: var(--danger-dim); color: var(--danger-soft); }
.ctx-sep { height: 1px; margin: 5px 8px; background: var(--line-1); border: none; }

/* ------------------------------ Layout coquille ------------------------------ */
/* 100dvh : sur iOS, 100vh inclut la barre Safari repliable et fausse la hauteur. */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

/* --- Barre latérale --- */
.sidebar {
  position: fixed;
  z-index: 500;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 120px),
    var(--asphalt-1);
  border-right: 1px solid var(--line-1);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-1);
  position: relative;
}
.brand::after {
  /* fin liseré accent sous le logo */
  content: '';
  position: absolute;
  left: 16px; right: 16px; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-1), transparent);
  opacity: 0.55;
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.brand-name {
  font-family: var(--font-stencil);
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: 0.06em;
  color: var(--ink-1);
  line-height: 1.05;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.28em;
  color: var(--accent-2);
  text-transform: uppercase;
  margin-top: 2px;
}
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 11px 20px;
}
.nav-group {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 15px 10px 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-group::after { content: ''; height: 1px; flex: 1; background: var(--line-1); }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  margin: 1.5px 0;
  border: none;
  background: none;
  border-radius: var(--r-s);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, transform 0.14s ease;
}
.nav-item svg { width: 16.5px; height: 16.5px; flex: none; opacity: 0.78; transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.4, 1); }
.nav-item:hover { background: rgba(255, 255, 255, 0.035); color: var(--ink-1); transform: translateX(2px); }
.nav-item:hover svg { transform: scale(1.08); }
.nav-item.active {
  background: linear-gradient(90deg, var(--accent-dim), transparent 85%);
  color: #dbe9ff;
}
.nav-item.active svg { opacity: 1; color: var(--accent-2); }

/* Curseur coulissant le long de la nav (positionné par main.js) */
.nav { position: relative; }
.nav-glider {
  position: absolute;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-1);
  box-shadow: 0 0 10px rgba(61, 139, 253, 0.8);
  transition: top 0.4s cubic-bezier(0.3, 1.25, 0.35, 1), height 0.25s ease;
  pointer-events: none;
}
.nav-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--asphalt-3);
  border: 1px solid var(--line-2);
  color: var(--ink-3);
}
.nav-item .count.hot { color: var(--ok); border-color: rgba(70, 209, 124, 0.4); }

.sidebar-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--line-1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bot-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}

/* --- Zone principale --- */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 85% -200px, rgba(61, 139, 253, 0.045), transparent 60%),
    var(--blueprint),
    var(--asphalt-0);
  background-size: auto, 26px 26px, auto;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 400;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: rgba(10, 11, 13, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-1);
}
.view-title-wrap { overflow: hidden; min-width: 0; }
.view-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 12px;
  animation: titleIn 0.4s cubic-bezier(0.2, 1, 0.3, 1);
}
.view-title small {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink-3);
}
@keyframes titleIn {
  from { transform: translateY(115%); opacity: 0; }
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 11px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-1);
  background: var(--asphalt-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip b { color: var(--ink-1); font-weight: 600; }
.chip--click { cursor: pointer; transition: border-color 0.15s ease; }
.chip--click:hover { border-color: var(--line-3); }
.chip .label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}
.user-plate {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 10px 0 5px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--asphalt-2);
}
.user-plate img { width: 26px; height: 26px; border-radius: 50%; }
.user-plate span { font-weight: 600; font-size: 12.5px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bandeau archive */
.archive-tape {
  display: none;
  align-items: center;
  gap: 13px;
  padding: 9px 22px;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 176, 32, 0.09) 0 14px, transparent 14px 28px),
    rgba(255, 176, 32, 0.06);
  border-bottom: 1px solid rgba(255, 176, 32, 0.3);
  color: var(--warn);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.archive-tape.on { display: flex; animation: tapeIn 0.35s cubic-bezier(0.2, 1, 0.3, 1); }
@keyframes tapeIn { from { transform: translateY(-100%); } }
.archive-tape .mono { letter-spacing: 0.02em; }

/* Bandeau d'emprunt d'identité : violet franc, à ne pas confondre avec
   l'ambre du bandeau d'archive. Toujours visible tant que l'emprunt dure. */
.imp-tape {
  display: none;
  align-items: center;
  gap: 13px;
  padding: 9px 22px;
  background:
    repeating-linear-gradient(-45deg, rgba(167, 139, 250, 0.1) 0 14px, transparent 14px 28px),
    rgba(167, 139, 250, 0.07);
  border-bottom: 1px solid rgba(167, 139, 250, 0.35);
  color: var(--violet);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.imp-tape.on { display: flex; animation: tapeIn 0.35s cubic-bezier(0.2, 1, 0.3, 1); }
.imp-tape b { color: var(--ink-1); }

.content {
  flex: 1;
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

/* Grilles de vue.
   min-width: 0 sur les enfants : sans lui, un tableau ou un canvas large
   impose sa largeur min à la colonne et fait déborder toute la page. */
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid--kpi { grid-template-columns: repeat(4, 1fr); }
.grid--2-1 { grid-template-columns: 2fr 1fr; }
.grid--1-1 { grid-template-columns: 1fr 1fr; }
.grid--1-2 { grid-template-columns: 1fr 2fr; }
.section-gap { margin-top: 16px; }

/* Apparition d'une vue : révélation en cascade.
   Scopée à .view-enter (posée ~1,6 s à l'arrivée sur la vue) pour que les
   re-rendus silencieux (auto-refresh 30 s) ne rejouent pas les animations. */
.view-enter .view-anim > * { animation: reveal 0.5s cubic-bezier(0.2, 1, 0.3, 1) both; }
.view-enter .view-anim > *:nth-child(1) { animation-delay: 0.02s; }
.view-enter .view-anim > *:nth-child(2) { animation-delay: 0.07s; }
.view-enter .view-anim > *:nth-child(3) { animation-delay: 0.12s; }
.view-enter .view-anim > *:nth-child(4) { animation-delay: 0.17s; }
.view-enter .view-anim > *:nth-child(5) { animation-delay: 0.22s; }
.view-enter .view-anim > *:nth-child(6) { animation-delay: 0.27s; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(14px); }
}

/* Segments (sous-onglets) */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-1);
  background: var(--asphalt-1);
}
.seg button {
  padding: 7px 15px;
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.seg button:active { transform: scale(0.96); }
.seg button .count { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.seg button:hover { color: var(--ink-1); }
.seg button.active {
  background: linear-gradient(180deg, #23272e, #1b1e24);
  color: var(--accent-2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.seg button.active .count { color: var(--accent-2); }

/* États vides */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty svg { width: 42px; height: 42px; opacity: 0.5; }
.empty .display { font-size: 15px; letter-spacing: 0.14em; color: var(--ink-2); }
.empty p { font-size: 12.5px; max-width: 380px; }

/* Skeleton de chargement */
.skel {
  border-radius: var(--r-s);
  background: linear-gradient(100deg, var(--asphalt-3) 40%, var(--asphalt-4) 50%, var(--asphalt-3) 60%);
  background-size: 200% 100%;
  animation: skel 1.3s ease-in-out infinite;
}
@keyframes skel { to { background-position: -200% 0; } }

/* ------------------------------ Écran d'allumage (porte de garage) ------------------------------ */
#ignition {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background:
    repeating-linear-gradient(180deg, #15171b 0 44px, #0e1013 44px 47px),
    var(--asphalt-1);
  box-shadow: inset 0 -40px 80px rgba(0, 0, 0, 0.6);
  transition: transform 0.75s cubic-bezier(0.65, 0, 0.25, 1);
}
#ignition.lift { transform: translateY(-102%); }
#ignition .ign-logo {
  width: 92px; height: 92px;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 6px rgba(255, 255, 255, 0.02);
  animation: ignLogo 1s cubic-bezier(0.2, 1, 0.3, 1) both;
}
@keyframes ignLogo {
  0% { transform: scale(0.82); opacity: 0; filter: grayscale(1) brightness(0.6); }
  60% { opacity: 1; }
  100% { transform: scale(1); filter: none; }
}
#ignition .ign-rpm { width: 200px; height: 100px; overflow: visible; }
#ignition .ign-status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-3);
}
#ignition .ign-status .ok { color: var(--ok); }
#ignition .ign-handle {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px; height: 9px;
  border-radius: 6px;
  background: linear-gradient(180deg, #3a404a, #23272e);
  border: 1px solid var(--line-3);
}

/* ------------------------------ Divers ------------------------------ */
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 4px; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.clickable { cursor: pointer; }

.hr-hazard {
  border: none;
  height: 5px;
  border-radius: 3px;
  background: repeating-linear-gradient(-45deg, rgba(255, 176, 32, 0.35) 0 9px, rgba(0, 0, 0, 0.25) 9px 18px);
  opacity: 0.6;
  margin: 14px 0;
}

.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: var(--asphalt-3);
  color: var(--ink-2);
}

/* Compteur en direct (topbar) */
.live-dot-count { display: inline-flex; align-items: center; gap: 7px; }

/* ------------------------------ Responsive ------------------------------ */
@media (max-width: 1240px) {
  .grid--kpi { grid-template-columns: repeat(2, 1fr); }
  .grid--2-1, .grid--1-1, .grid--1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  :root { --sidebar-w: 60px; }
  .brand-name, .brand-sub, .nav-item span, .nav-group, .nav-item .count, .bot-status span,
  .sidebar-foot .btn span { display: none; }
  .brand { justify-content: center; padding: 13px 8px; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-item.active::before { left: -8px; }
  .sidebar-foot { align-items: center; }
  .sidebar-foot .btn { justify-content: center !important; }
}
/* --- Téléphones : la barre latérale devient une barre d'atelier en bas
       d'écran (icône + libellé), les modales des tiroirs, et tout le
       contenu respire dans une seule colonne. --- */
@media (max-width: 760px) {
  :root { --header-h: 54px; --bottombar-h: 58px; }

  .topbar { padding: 0 12px; gap: 8px; }
  .chip--optional { display: none; }
  .view-title { font-size: 17px; }
  .view-title small { display: none; }
  .user-plate span { display: none; }
  .user-plate { padding: 0 5px; }

  /* Barre latérale -> barre du bas */
  .sidebar {
    top: auto;
    bottom: 0;
    width: 100%;
    height: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    flex-direction: row;
    align-items: stretch;
    border-right: none;
    border-top: 1px solid var(--line-2);
    background: rgba(11, 12, 15, 0.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.5);
  }
  .brand, .nav-group, .bot-status, .nav-glider { display: none; }
  .nav {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 2px;
    padding: 5px 6px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .nav-item {
    flex: 1 0 58px;
    width: auto;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    margin: 0;
    padding: 3px 7px;
    border-radius: 8px;
  }
  .nav-item:hover { transform: none; }
  .nav-item svg { width: 19px; height: 19px; }
  .nav-item span {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nav-item .count { display: none; }
  .nav-item.active {
    background: var(--accent-dim);
    box-shadow: inset 0 -2px 0 var(--accent-1);
  }
  .sidebar-foot {
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 0;
    padding: 0 6px;
    border-top: none;
    border-left: 1px solid var(--line-1);
  }
  .sidebar-foot .btn span { display: none; }

  .main { margin-left: 0; }
  .content {
    padding: 16px 12px calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px) + 26px);
  }

  /* Toasts au-dessus de la barre du bas, pleine largeur */
  #toast-rack {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px) + 10px);
  }

  /* Modales en tiroir (bottom sheet) */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-panel, .modal-panel--lg {
    width: 100%;
    max-height: 92dvh;
    border-radius: 14px 14px 0 0;
    transform: translateY(48px);
  }
  .modal-backdrop.open .modal-panel { transform: none; }
  .modal-foot { padding-bottom: calc(13px + env(safe-area-inset-bottom, 0px)); }

  /* Palette plus haute sur l'écran */
  .palette-backdrop { padding: 8vh 10px 10px; }

  /* Sous-onglets (segments) : défilement horizontal plutôt que débordement —
     la rangée « Équipe / Équipes / Inactifs / Absents / Blâmes » coupait
     l'accès aux derniers onglets sur téléphone. */
  .seg {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: none; padding: 7px 12px; }

  /* Les étiquettes pochoir peuvent passer à la ligne (sinon « Organigramme ·
     Benny's Original Motor Works » force un scroll horizontal de la page). */
  .stencil-label { white-space: normal; }

  .archive-tape, .imp-tape { flex-wrap: wrap; padding: 9px 12px; gap: 8px; }
  .modal-foot { flex-wrap: wrap; }
  .modal-body { -webkit-overflow-scrolling: touch; }
}

/* Très petits écrans : tout en une colonne, chiffres resserrés */
@media (max-width: 560px) {
  .grid--kpi { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px 12px; }
  .kpi .kpi-value { font-size: 26px; }
  .plate--pad { padding: 14px; }
  .content { padding-left: 10px; padding-right: 10px; }
  .topbar-right { gap: 6px; }
  .chip { padding: 0 8px; }
}

/* Écrans minuscules : la topbar garde l'essentiel (lampe + compteur) */
@media (max-width: 480px) {
  .view-title { font-size: 15.5px; letter-spacing: 0.05em; }
  .topbar { gap: 6px; padding: 0 10px; }
  .topbar .chip .label { display: none; }
  .topbar .chip { gap: 6px; }
}

/* Mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
/* Mode capture (?nofx=1) : état final immédiat */
.nofx *, .nofx *::before, .nofx *::after {
  animation: none !important;
  transition: none !important;
}

/* Icônes dans les tags */
.tag svg { width: 11px; height: 11px; }
