/* ============================================================
   PhotoFiche — feuille de style unique
   Langage visuel iOS 26 « Liquid Glass ».

   Principe directeur : le chrome qui flotte (barre supérieure, boutons,
   feuilles modales) est translucide et capte l'arrière-plan ; les surfaces
   qui portent de la donnée dense (tableau, champs de saisie) restent
   opaques. C'est ce contraste qui donne la profondeur — pas le flou partout.
   ============================================================ */

/* ---------- Réinitialisation ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
::selection { background: var(--accent-soft); color: var(--text); }

/* ---------- Jetons de couleur — clair ---------- */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text",
          "Segoe UI", Inter, system-ui, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, monospace;

  --bg: #f4f5f7;
  /* Fond volontairement sobre : un souvenir de couleur, pas un dégradé —
     l'app affiche désormais des tableaux denses (clients, commandes…) que
     le fond d'origine, plus décoratif, distrayait. */
  --mesh-1: rgba(10, 108, 255, 0.05);
  --mesh-2: rgba(120, 80, 255, 0.04);
  --mesh-3: rgba(0, 190, 160, 0.03);

  /* Verre : le fond est très clair et très transparent, la lisibilité venant
     du flou et non de l'opacité. */
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.80);
  --glass-border: rgba(255, 255, 255, 0.70);
  --glass-edge: rgba(15, 23, 42, 0.08);
  --glass-shine: rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 12px 40px -12px rgba(15, 23, 42, 0.28);

  /* Surfaces opaques : tableau, champs, cartes de contenu. */
  --surface: rgba(255, 255, 255, 0.96);
  --surface-2: #f6f8fc;
  --surface-3: #eceff5;
  --hairline: rgba(15, 23, 42, 0.09);

  --text: #14161a;
  --text-2: #5c6472;
  --text-3: #8b93a1;

  --accent: #0a6cff;
  --accent-hover: #0059dd;
  --accent-soft: rgba(10, 108, 255, 0.13);
  --accent-text: #ffffff;

  --green: #12a150;
  --green-soft: rgba(18, 161, 80, 0.13);
  --orange: #c96a06;
  --orange-soft: rgba(201, 106, 6, 0.14);
  --red: #d92c3c;
  --red-soft: rgba(217, 44, 60, 0.13);
  --violet: #7b4bdb;
  --violet-soft: rgba(123, 75, 219, 0.13);

  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;

  /* Courbe d'animation iOS : départ franc, arrivée amortie. */
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --blur: saturate(180%) blur(28px);
  --blur-heavy: saturate(200%) blur(44px);
}

/* ---------- Jetons de couleur — sombre ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c10;
    --mesh-1: rgba(10, 108, 255, 0.09);
    --mesh-2: rgba(140, 90, 255, 0.07);
    --mesh-3: rgba(0, 200, 170, 0.05);

    --glass: rgba(30, 34, 44, 0.58);
    --glass-strong: rgba(34, 38, 49, 0.82);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-edge: rgba(0, 0, 0, 0.5);
    --glass-shine: rgba(255, 255, 255, 0.20);
    --glass-shadow: 0 16px 48px -12px rgba(0, 0, 0, 0.72);

    --surface: rgba(24, 27, 35, 0.96);
    --surface-2: #1b1f28;
    --surface-3: #22262f;
    --hairline: rgba(255, 255, 255, 0.10);

    --text: #f2f4f8;
    --text-2: #a3abbb;
    --text-3: #6f7789;

    --accent: #4b95ff;
    --accent-hover: #6aa8ff;
    --accent-soft: rgba(75, 149, 255, 0.20);
    --accent-text: #06101f;

    --green: #34d17a;
    --green-soft: rgba(52, 209, 122, 0.18);
    --orange: #ffb238;
    --orange-soft: rgba(255, 178, 56, 0.18);
    --red: #ff6b78;
    --red-soft: rgba(255, 107, 120, 0.18);
    --violet: #b48bff;
    --violet-soft: rgba(180, 139, 255, 0.18);
  }
}

:root[data-theme="dark"] {
  --bg: #0a0c10;
  --mesh-1: rgba(10, 108, 255, 0.09);
  --mesh-2: rgba(140, 90, 255, 0.07);
  --mesh-3: rgba(0, 200, 170, 0.05);
  --glass: rgba(30, 34, 44, 0.58);
  --glass-strong: rgba(34, 38, 49, 0.82);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-edge: rgba(0, 0, 0, 0.5);
  --glass-shine: rgba(255, 255, 255, 0.20);
  --glass-shadow: 0 16px 48px -12px rgba(0, 0, 0, 0.72);
  --surface: rgba(24, 27, 35, 0.96);
  --surface-2: #1b1f28;
  --surface-3: #22262f;
  --hairline: rgba(255, 255, 255, 0.10);
  --text: #f2f4f8;
  --text-2: #a3abbb;
  --text-3: #6f7789;
  --accent: #4b95ff;
  --accent-hover: #6aa8ff;
  --accent-soft: rgba(75, 149, 255, 0.20);
  --accent-text: #06101f;
  --green: #34d17a;
  --green-soft: rgba(52, 209, 122, 0.18);
  --orange: #ffb238;
  --orange-soft: rgba(255, 178, 56, 0.18);
  --red: #ff6b78;
  --red-soft: rgba(255, 107, 120, 0.18);
  --violet: #b48bff;
  --violet-soft: rgba(180, 139, 255, 0.18);
}

/* ============================================================
   Arrière-plan : nappes de couleur fixes que le verre échantillonne.
   ============================================================ */

.mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(58% 44% at 12% 4%,  var(--mesh-1) 0%, transparent 62%),
    radial-gradient(48% 40% at 92% 12%, var(--mesh-2) 0%, transparent 60%),
    radial-gradient(64% 50% at 50% 98%, var(--mesh-3) 0%, transparent 62%);
}

/* Grain très léger : casse le dégradé pur, qui « bande » sur grand écran. */
.mesh::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ============================================================
   Matériau « verre »
   ============================================================ */

.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow:
    var(--glass-shadow),
    inset 0 1px 0 var(--glass-shine),
    inset 0 0 0 1px var(--glass-edge);
}

/* Reflet spéculaire du bord supérieur — la signature du matériau. */
.glass::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 45%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent);
  pointer-events: none;
}

/* Repli pour les navigateurs sans backdrop-filter : on remonte l'opacité,
   sinon le texte passe sur un fond quasi transparent. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

/* ============================================================
   Barre supérieure flottante
   ============================================================ */

.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 14px clamp(12px, 3vw, 28px) 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px 11px 18px;
  border-radius: var(--radius-xl);
  -webkit-backdrop-filter: var(--blur-heavy);
  backdrop-filter: var(--blur-heavy);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-shine);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--violet));
  box-shadow: 0 4px 14px -4px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.brand-mark svg { width: 19px; height: 19px; color: #fff; }

.brand-text { min-width: 0; }
.brand-name {
  font-size: 15px; font-weight: 650; letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub {
  font-size: 11.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topbar-spacer { flex: 1 1 auto; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- Compteur de consommation ---------- */

.meter {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  flex: none;
}
.meter-dial { position: relative; width: 26px; height: 26px; flex: none; }
.meter-dial svg { width: 26px; height: 26px; transform: rotate(-90deg); }
.meter-dial circle { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.meter-track { stroke: var(--hairline); }
.meter-fill  { stroke: var(--accent); transition: stroke-dashoffset 0.6s var(--spring), stroke 0.3s; }
.meter.is-warn  .meter-fill { stroke: var(--orange); }
.meter.is-full  .meter-fill { stroke: var(--red); }
.meter-label { line-height: 1.25; }
.meter-value { font-size: 12.5px; font-weight: 620; font-variant-numeric: tabular-nums; }
.meter-unit  { font-size: 10.5px; color: var(--text-3); }

/* ============================================================
   Boutons
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 15px;
  height: 36px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 560;
  white-space: nowrap;
  transition: transform 0.18s var(--spring), background 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.btn:active { transform: scale(0.955); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 5px 16px -5px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-glass {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-shine);
}
.btn-glass:hover:not(:disabled) { background: var(--surface-3); }

.btn-plain { background: var(--surface-2); border: 1px solid var(--hairline); }
.btn-plain:hover:not(:disabled) { background: var(--surface-3); }

.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red); color: #fff; }

.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }

/* ============================================================
   Menu du compte
   ============================================================ */

.user-menu {
  position: fixed;
  top: 68px;
  right: clamp(12px, 3vw, 28px);
  z-index: 70;
  width: 240px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur-heavy);
  backdrop-filter: var(--blur-heavy);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-shine);
  animation: sheet-in 0.22s var(--spring);
}
.user-menu-name { font-size: 13.5px; font-weight: 620; }
.user-menu-role { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.user-menu-sep { height: 1px; background: var(--hairline); margin: 11px 0; }
.user-menu-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 520;
  color: var(--text);
  text-decoration: none;
  transition: background 0.16s;
  /* Le menu mêle des liens (<a>) et des actions (<button>) : ces règles
     leur donnent le même rendu. */
  width: 100%;
  text-align: left;
}
.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item svg { width: 15px; height: 15px; color: var(--text-3); }
.user-menu-item.is-danger { color: var(--red); }
.user-menu-item.is-danger svg { color: var(--red); }

/* ============================================================
   Menu latéral (navigation entre pages — Catalogue, Clients…)
   ============================================================ */

.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0;
  width: 232px; flex: none;
  height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  z-index: 55;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--hairline);
  flex: none;
}
.sidebar-brand .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
/* Logo importé : cadré comme la pastille par défaut, mais sans rogner un
   logo large — d'où le contain plutôt que le cover. */
.brand-logo {
  width: 32px; height: 32px; flex: none;
  border-radius: 9px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--hairline);
  padding: 2px;
}
.sidebar-brand .brand-mark svg { width: 17px; height: 17px; }
.sidebar-brand .brand-name { font-size: 14.5px; }

.sidebar-nav {
  flex: 1 1 auto;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto;
}

.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 550;
  color: var(--text-2);
  transition: background 0.16s, color 0.16s;
  text-align: left;
  width: 100%;
}
.sidebar-link:hover:not(.is-disabled) { background: var(--surface-2); color: var(--text); }
.sidebar-link.is-active { background: var(--accent-soft); color: var(--accent); }
.sidebar-link svg { width: 17px; height: 17px; flex: none; }
.sidebar-link span:not(.sidebar-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-link.is-disabled { opacity: 0.42; cursor: default; }

.sidebar-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700;
  background: var(--surface-3); color: var(--text-2);
  flex: none;
}
.sidebar-link.is-active .sidebar-badge { background: rgba(255, 255, 255, 0.25); color: var(--accent); }

.app-main { flex: 1 1 auto; min-width: 0; }

@media (max-width: 860px) {
  .sidebar { width: 68px; }
  .sidebar-brand { justify-content: center; padding: 16px 8px; }
  .sidebar-brand .brand-text { display: none; }
  .sidebar-link { justify-content: center; padding: 11px; }
  .sidebar-link span { display: none; }
  .sidebar-badge { position: absolute; margin-left: 0; transform: translate(10px, -10px); }
  .sidebar-link { position: relative; }
}

/* ============================================================
   Mise en page
   ============================================================ */

.shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 28px) 120px;
  display: flex; flex-direction: column; gap: 18px;
}

/* Aperçu carré d'un visuel de personnalisation (logo, favicon). */
.branding-tile {
  width: 56px; height: 56px; flex: none;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--text-3);
  cursor: pointer;
  transition: border-color 0.16s;
}
.branding-tile:hover { border-color: var(--accent); }

/* Barre d'actions en pied de carte — pendant non flottant de .sheet-foot,
   pour les sections de page normales (ex. la page Clients). */
.card-foot {
  display: flex; align-items: center; gap: 9px;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.card { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 640; letter-spacing: -0.015em; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.card-head-spacer { flex: 1 1 auto; }

/* ============================================================
   Zone de dépôt
   ============================================================ */

.drop {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1.5px dashed var(--glass-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent);
  padding: 34px 22px;
  text-align: center;
  transition: border-color 0.22s, background 0.22s, transform 0.22s var(--spring);
}
.drop.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.008);
}
.drop-icon {
  width: 54px; height: 54px;
  margin: 0 auto 13px;
  border-radius: 17px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  transition: transform 0.4s var(--spring);
}
.drop.is-over .drop-icon { transform: translateY(-4px) scale(1.06); }
.drop-icon svg { width: 25px; height: 25px; }
.drop-title { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.drop-hint { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.drop-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 17px; }

.drop-mode {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.drop-mode-hint { font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------- Galerie de vues ---------- */

.views { display: flex; gap: 6px; flex-wrap: wrap; }
.view-thumb {
  width: 34px; height: 34px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  cursor: zoom-in;
  transition: transform 0.2s var(--spring);
}
.view-thumb:hover { transform: scale(1.12); }

.view-count {
  position: absolute; right: 3px; bottom: 3px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 680;
  color: #fff;
  background: rgba(10, 20, 40, 0.74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.thumb-wrap { position: relative; display: inline-block; line-height: 0; }

.detail-gallery { display: flex; flex-direction: column; gap: 7px; flex: none; }
.detail-gallery .view-thumb { width: 44px; height: 44px; border-radius: 10px; }

/* ---------- Réglages repliables ---------- */

.settings { margin-top: 15px; }
.settings > summary {
  list-style: none;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 550; color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 0.18s;
}
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary:hover { background: var(--surface-3); color: var(--text); }
.settings > summary svg { width: 14px; height: 14px; transition: transform 0.28s var(--spring); }
.settings[open] > summary svg { transform: rotate(90deg); }

.settings-body {
  margin-top: 13px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  animation: sheet-in 0.3s var(--spring);
}

/* ============================================================
   Champs de saisie
   ============================================================ */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label {
  font-size: 11px; font-weight: 620; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-3);
}
.field-hint { font-size: 11.5px; color: var(--text-3); }

.input, .textarea, .select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--hairline);
  font-size: 13.5px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 66px; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238b93a1' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 6.5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px;
}

/* ---------- Interrupteur ---------- */

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 44px; height: 27px; flex: none;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  position: relative;
  transition: background 0.26s var(--spring);
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24);
  transition: transform 0.26s var(--spring);
}
.switch input:checked + .switch-track { background: var(--accent); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(17px); }
.switch-text { font-size: 13px; }

/* ---------- Contrôle segmenté ---------- */

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  gap: 2px;
}
.segmented button {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 550;
  color: var(--text-2);
  transition: background 0.22s var(--spring), color 0.22s, box-shadow 0.22s;
}
.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   File d'analyse
   ============================================================ */

.queue { display: flex; flex-direction: column; gap: 9px; margin-top: 15px; }

.queue-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  animation: row-in 0.34s var(--spring);
}
/* Élément déposé, pas encore envoyé à l'analyse : il porte un champ de
   précisions, donc il s'aligne en haut plutôt qu'au centre. */
.queue-item.is-draft { align-items: flex-start; }
.queue-item.is-draft .queue-note { margin-top: 7px; }

.queue-thumb {
  width: 44px; height: 44px; flex: none;
  border-radius: 11px;
  object-fit: cover;
  background: var(--surface-3);
}
.queue-body { flex: 1 1 auto; min-width: 0; }
.queue-name {
  font-size: 13.5px; font-weight: 560;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue-state { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.queue-item.is-error .queue-state { color: var(--red); white-space: normal; }
.queue-item.is-done  .queue-state { color: var(--green); }

/* Barre de progression déterminée — estimation par le temps écoulé (aucun
   signal réel du serveur : une analyse est un seul aller-retour, pas un flux). */
.queue-progress { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.queue-bar {
  flex: 1 1 auto;
  height: 3px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.queue-bar-fill {
  display: block; height: 100%; width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s linear;
}
.queue-pct {
  flex: none;
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--text-3);
  min-width: 30px; text-align: right;
}

/* ---------- Anneau de progression ---------- */

.spinner {
  width: 18px; height: 18px; flex: none;
  border-radius: 50%;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}

/* ============================================================
   Tableau
   ============================================================ */

.table-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  margin-bottom: 14px;
}

.search {
  position: relative;
  flex: 1 1 210px;
  min-width: 160px;
  max-width: 320px;
}
.search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-3); pointer-events: none;
}
.search input { padding-left: 33px; }

/* Barre de défilement horizontal dupliquée en haut du tableau : sur un
   tableau long, la barre native (en bas de .table-scroll) n'est atteignable
   qu'après avoir déjà tout parcouru. Un simple div dont la largeur interne
   mime celle du tableau, avec sa propre scrollbar, synchronisé par JS. */
.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;
  border: 1px solid var(--hairline);
  border-bottom: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--surface);
}
.table-scroll-top > div { height: 1px; }
.table-scroll-top.hide { display: none; }
/* Le tableau perd son propre arrondi supérieur quand la barre du haut est
   visible juste au-dessus, pour que les deux se lisent comme un seul bloc. */
.table-scroll-top:not(.hide) + .table-scroll {
  border-top: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.table-scroll {
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  overflow: auto;
  max-height: 68vh;
  background: var(--surface);
  /* La donnée dense reste sur une surface opaque : le verre ici nuirait
     à la lisibilité au lieu de la servir. */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }

thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 10px 13px;
  text-align: left;
  font-size: 11px; font-weight: 640; letter-spacing: 0.035em; text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--hairline);
}

tbody td {
  padding: 9px 13px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  font-size: 13px;
  max-width: 300px;
}
tbody tr { transition: background 0.14s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.is-selected { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }

/* Colonnes épinglées à gauche : case à cocher, photo et nom du produit
   restent visibles pendant le défilement horizontal. Photo et nom n'existent
   que si leur colonne est active (réglage Colonnes) — le décalage (`left`,
   posé en style inline par le JS) et le trait de séparation (`.col-pin-end`,
   posé sur la dernière colonne réellement présente) s'adaptent en conséquence. */
.col-pin-1, .col-pin-2, .col-pin-3 { position: sticky; z-index: 2; background: var(--surface); }
.col-pin-1 { left: 0; width: 44px; }
/* left de .col-pin-2 : sans valeur ici, l'élément sticky n'a aucun point
   d'ancrage et défile comme une colonne normale — c'est ce qui faisait
   « perdre » la photo au moindre défilement horizontal. */
.col-pin-2 { left: 44px; }
thead .col-pin-1, thead .col-pin-2, thead .col-pin-3 { z-index: 4; background: var(--surface-2); }
tbody tr:hover .col-pin-1, tbody tr:hover .col-pin-2, tbody tr:hover .col-pin-3 { background: var(--surface-2); }
tbody tr.is-selected .col-pin-1, tbody tr.is-selected .col-pin-2, tbody tr.is-selected .col-pin-3 { background: #e5eeff; }
:root[data-theme="dark"] tbody tr.is-selected .col-pin-1,
:root[data-theme="dark"] tbody tr.is-selected .col-pin-2,
:root[data-theme="dark"] tbody tr.is-selected .col-pin-3 { background: #1c2635; }
.col-pin-end::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: var(--hairline);
}

.cell-clamp {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  line-clamp: 3; overflow: hidden;
  white-space: pre-line;
}
.cell-mono { font-family: var(--mono); font-size: 12px; }
.cell-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.row-thumb {
  width: 46px; height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-3);
  cursor: zoom-in;
  transition: transform 0.22s var(--spring);
}
.row-thumb:hover { transform: scale(1.09); }

.row-name { font-weight: 570; }
.row-brand { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

/* ---------- Case à cocher ---------- */

.check {
  appearance: none;
  width: 19px; height: 19px;
  border-radius: 6px;
  border: 1.5px solid var(--text-3);
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: background 0.18s, border-color 0.18s;
  flex: none;
}
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after {
  content: ""; position: absolute; inset: 0;
  background: no-repeat center / 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 5'/%3E%3C/svg%3E");
}
.check:indeterminate { background: var(--accent); border-color: var(--accent); }
.check:indeterminate::after {
  content: ""; position: absolute; inset: 0;
  background: no-repeat center / 11px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 8h8'/%3E%3C/svg%3E");
}

/* ============================================================
   Pastilles et indicateurs
   ============================================================ */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 580;
  white-space: nowrap;
}
.pill svg { width: 12px; height: 12px; }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-green  { background: var(--green-soft);  color: var(--green); }
.pill-orange { background: var(--orange-soft); color: var(--orange); }
.pill-red    { background: var(--red-soft);    color: var(--red); }
.pill-violet { background: var(--violet-soft); color: var(--violet); }
.pill-mute   { background: var(--surface-3);   color: var(--text-2); }

/* Jauge de certitude */
.confidence { display: flex; align-items: center; gap: 7px; }
.confidence-bar {
  width: 42px; height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  flex: none;
}
.confidence-bar span { display: block; height: 100%; border-radius: 999px; transition: width 0.5s var(--spring); }
.confidence-val { font-size: 12px; font-weight: 580; font-variant-numeric: tabular-nums; }

/* ============================================================
   État vide
   ============================================================ */

.empty { padding: 54px 22px; text-align: center; }
.empty-icon {
  width: 62px; height: 62px; margin: 0 auto 15px;
  border-radius: 19px;
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--text-3);
}
.empty-icon svg { width: 28px; height: 28px; }
.empty-title { font-size: 15.5px; font-weight: 620; }
.empty-text { font-size: 13px; color: var(--text-3); margin-top: 5px; max-width: 400px; margin-inline: auto; }

/* ============================================================
   Feuille modale (bottom sheet iOS)
   ============================================================ */

.scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 10, 14, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in 0.26s ease;
}
.scrim[hidden] { display: none; }

.sheet {
  position: fixed; z-index: 101;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(920px, 100%);
  max-height: 92vh;
  display: flex; flex-direction: column;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur-heavy);
  backdrop-filter: var(--blur-heavy);
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  box-shadow: 0 -18px 60px -14px rgba(0, 0, 0, 0.5), inset 0 1px 0 var(--glass-shine);
  animation: sheet-up 0.42s var(--spring);
}
.sheet[hidden] { display: none; }

.sheet-grabber {
  width: 38px; height: 5px;
  margin: 9px auto 0;
  border-radius: 999px;
  background: var(--text-3);
  opacity: 0.4;
  flex: none;
}

.sheet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px 13px;
  border-bottom: 1px solid var(--hairline);
  flex: none;
}
.sheet-title { font-size: 16.5px; font-weight: 650; letter-spacing: -0.02em; }
.sheet-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.sheet-head-spacer { flex: 1 1 auto; }

.sheet-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sheet-foot {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 20px;
  padding-bottom: max(13px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: var(--glass);
  flex: none;
}
.sheet-foot-spacer { flex: 1 1 auto; }

/* Sur grand écran la feuille se centre en fenêtre plutôt que collée en bas. */
@media (min-width: 860px) and (min-height: 700px) {
  .sheet {
    bottom: auto; top: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-xl);
    border-bottom: 1px solid var(--glass-border);
    max-height: 86vh;
    animation: sheet-in 0.36s var(--spring);
  }
  .sheet-grabber { display: none; }
  .sheet-head { padding-top: 17px; }
}

/* ============================================================
   Détail produit
   ============================================================ */

.detail-hero { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-photo {
  width: 148px; height: 148px; flex: none;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.detail-hero-body { flex: 1 1 260px; min-width: 0; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

.section { margin-top: 22px; }
.section:first-child { margin-top: 0; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 660; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}
/* Seul contexte à icône du projet sans cette règle : sans elle, le SVG prend
   sa taille intrinsèque par défaut du navigateur au lieu de 14px. */
.section-title svg { width: 14px; height: 14px; flex: none; }
.section-title::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--hairline); }

.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Cartes entrepôt/contact — listes imbriquées du formulaire client. */
.rel-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.rel-card {
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 14px 40px 14px 14px;
}
.rel-remove { position: absolute; top: 8px; right: 8px; }
.rel-empty { font-size: 12.5px; color: var(--text-3); margin: 0 0 10px; }
.rel-warehouse-picks { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.rel-pick {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}
.rel-pick input { accent-color: var(--accent); }

.kv {
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.kv-key { font-size: 10.5px; font-weight: 620; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.kv-val { font-size: 13.5px; font-weight: 520; margin-top: 3px; word-break: break-word; }
.kv-val.is-num { font-variant-numeric: tabular-nums; }

.bullets { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.bullets li {
  display: flex; gap: 9px;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.bullets li::before { content: "◆"; color: var(--accent); font-size: 9px; line-height: 1.7; flex: none; }
.bullets.is-benefit li::before { content: "✔"; color: var(--green); font-size: 11px; line-height: 1.35; }

.store-block {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  max-height: 340px;
  overflow-y: auto;
}

/* ---------- Rapport de contrôle logistique ---------- */

.audit { display: flex; flex-direction: column; gap: 7px; }
.audit-line {
  display: flex; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
  border: 1px solid transparent;
}
.audit-line svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.audit-ok      { background: var(--green-soft);  color: var(--green); }
.audit-fixed   { background: var(--accent-soft); color: var(--accent); }
.audit-info    { background: var(--surface-2);   color: var(--text-2); border-color: var(--hairline); }
.audit-warning { background: var(--orange-soft); color: var(--orange); }
.audit-error   { background: var(--red-soft);    color: var(--red); }

/* ---------- Schéma de palette ---------- */

.pallet-viz { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.pallet-svg {
  flex: none;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 12px;
}
.pallet-stats { flex: 1 1 200px; display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

/* ============================================================
   Sélecteur de colonnes
   ============================================================ */

.col-groups { display: flex; flex-direction: column; gap: 18px; }
.col-group-title {
  font-size: 11px; font-weight: 660; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 8px;
}
.col-list { display: flex; flex-direction: column; gap: 5px; }
.col-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: 13.5px;
  transition: background 0.16s;
}
.col-item:hover { background: var(--surface-3); }
.col-item-name { flex: 1 1 auto; min-width: 0; }
.col-move { display: flex; gap: 3px; flex: none; }
.col-move button {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  color: var(--text-3);
  transition: background 0.16s, color 0.16s;
}
.col-move button:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.col-move button:disabled { opacity: 0.28; cursor: not-allowed; }
.col-move svg { width: 14px; height: 14px; }

/* ============================================================
   Caméra
   ============================================================ */

.cam-stage {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}
.cam-stage video, .cam-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame {
  position: absolute; inset: 9%;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.cam-tip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  white-space: nowrap;
}
.cam-shutter {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.16s var(--spring);
  margin: 0 auto;
  display: block;
}
.cam-shutter:active { transform: scale(0.9); }

/* ============================================================
   Aperçu photo plein écran
   ============================================================ */

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 26px;
  background: rgba(5, 7, 11, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  animation: fade-in 0.22s ease;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: sheet-in 0.3s var(--spring);
}

/* ============================================================
   Notifications
   ============================================================ */

.toasts {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; gap: 9px;
  align-items: center;
  pointer-events: none;
  width: min(460px, calc(100vw - 26px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 17px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 520;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur-heavy);
  backdrop-filter: var(--blur-heavy);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-shine);
  animation: toast-in 0.4s var(--spring);
  pointer-events: auto;
  max-width: 100%;
}
.toast.is-leaving { animation: toast-out 0.28s ease forwards; }
.toast svg { width: 17px; height: 17px; flex: none; }
.toast-ok    svg { color: var(--green); }
.toast-warn  svg { color: var(--orange); }
.toast-error svg { color: var(--red); }
.toast span { min-width: 0; }

/* ============================================================
   Bandeau de configuration manquante
   ============================================================ */

.banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 17px;
  border-radius: var(--radius-lg);
  background: var(--orange-soft);
  border: 1px solid color-mix(in srgb, var(--orange) 32%, transparent);
  font-size: 13.5px;
  color: var(--text);
}
.banner svg { width: 19px; height: 19px; color: var(--orange); flex: none; margin-top: 1px; }
.banner code {
  font-family: var(--mono); font-size: 12.5px;
  padding: 1px 5px; border-radius: 5px;
  background: rgba(0, 0, 0, 0.08);
}
:root[data-theme="dark"] .banner code { background: rgba(255, 255, 255, 0.12); }

/* ============================================================
   Animations
   ============================================================ */

@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes fade-in   { from { opacity: 0; } to { opacity: 1; } }
@keyframes row-in    { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up  { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes sheet-in  { from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
                       to   { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes toast-in  { from { opacity: 0; transform: translateY(16px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(0.96); } }

/* La feuille centrée sur grand écran n'utilise pas la même transformation :
   sheet-in est réécrite dans la requête média correspondante. */
@media (max-width: 859px) {
  @keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Écran de connexion
   ============================================================ */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 26px; }
.login { width: min(390px, 100%); padding: 30px; text-align: center; }
.login .brand-mark { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 17px; }
.login .brand-mark svg { width: 27px; height: 27px; }
.login-title { font-size: 20px; font-weight: 680; letter-spacing: -0.025em; }
.login-sub { font-size: 13.5px; color: var(--text-3); margin-top: 5px; }
.login form { margin-top: 22px; display: flex; flex-direction: column; gap: 11px; }
.login-error { font-size: 13px; color: var(--red); text-align: left; }
.login-notice { font-size: 13px; color: var(--text-2); text-align: left; }

.code-input {
  text-align: center;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0.35em;
  padding-left: 8px; /* compense visuellement le tracking pour un centrage propre */
}

.login-links {
  margin-top: 16px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 12.5px;
}
.login-link {
  color: var(--accent);
  font-weight: 550;
  background: none;
  text-decoration: none;
}
.login-link:hover { text-decoration: underline; }
.login-links-sep { color: var(--text-3); }

/* ============================================================
   Utilitaires et responsive
   ============================================================ */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.hide { display: none !important; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-3); }

@media (max-width: 900px) {
  .brand-sub { display: none; }
  .meter-label { display: none; }
  .meter { padding: 6px 8px; }
  .btn-label-wide { display: none; }
}

@media (max-width: 620px) {
  body { font-size: 14.5px; }
  .shell { padding-bottom: 96px; }
  .card { padding: 15px; }
  .drop { padding: 26px 15px; }
  .table-scroll { max-height: 62vh; }
  tbody td { max-width: 210px; }
  .detail-photo { width: 100%; height: 190px; }
  .topbar { padding: 9px 10px 9px 13px; gap: 9px; }
}
