:root {
  --bnav-h: 3.75rem; /* hauteur de la barre d'onglets mobile (hors zone de sécurité iPhone) */
  --c-primary: #e4570f;
  --c-primary-dark: #c2470a;
  --c-bg: #f3efe6;
  --c-surface: #ffffff;
  --c-border: #ddd5c5;
  --c-text: #1c1d1f;
  --c-text-2: #514d46;
  --c-text-3: #958f83;
  --c-danger: #ef4444;
  --c-success: #10b981;
  --c-warning: #f59e0b;
  --radius: .6rem;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
}

a { color: var(--c-primary); text-decoration: none; }

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.auth-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.auth-card h1 { font-size: 1.4rem; margin: 0 0 1.5rem; }

input, select, textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--c-border);
  border-radius: .4rem;
  font-size: .9rem;
  margin-bottom: .9rem;
}
label { font-size: .85rem; font-weight: 600; color: var(--c-text-2); display: block; margin-bottom: .3rem; }

button {
  cursor: pointer;
  border: none;
  border-radius: .4rem;
  padding: .55rem 1.1rem;
  font-size: .9rem;
  font-weight: 600;
}
.btn-primary { background: var(--c-primary); color: white; width: 100%; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-secondary { background: #ebe5d8; color: var(--c-text-2); }
.btn-danger { background: #fee2e2; color: var(--c-danger); }
.btn-sm { font-size: .78rem; padding: .35rem .7rem; }

.error-box {
  background: #fef2f2; color: var(--c-danger);
  padding: .6rem .9rem; border-radius: .4rem; margin-bottom: .9rem; font-size: .85rem;
  display: none;
}

/* ── Layout principal ─────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; background: var(--c-text); color: #c9c1b1;
  padding: 1.25rem 1rem; flex-shrink: 0;
}
.sidebar h2 { color: white; font-size: 1.15rem; margin: 0 0 1.5rem; }
.sidebar nav a {
  display: block; color: #c9c1b1; padding: .55rem .7rem; border-radius: .4rem;
  margin-bottom: .2rem; font-size: .88rem;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.1); color: white; }
.main { flex: 1; padding: 1.75rem; max-width: 1100px; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; font-size: 1.4rem; }

/* Onglets horizontaux (page Listes) */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--c-border); margin-bottom: 1.25rem; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: .6rem 1rem; margin-bottom: -1px; font-size: .9rem; font-weight: 600;
  color: var(--c-text-3); cursor: pointer;
}
.tabs button:hover { color: var(--c-text-2); }
.tabs button.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tabs .count { font-weight: 500; font-size: .75rem; color: var(--c-text-3); margin-left: .3rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card { background: var(--c-surface); border-radius: var(--radius); padding: 1.1rem; border: 1px solid var(--c-border); }
.kpi-card .value { font-size: 1.8rem; font-weight: 700; }
.kpi-card .label { font-size: .8rem; color: var(--c-text-3); }

table.data-table { width: 100%; border-collapse: collapse; background: var(--c-surface); border-radius: var(--radius); overflow: hidden; }
table.data-table th, table.data-table td { padding: .65rem .85rem; text-align: left; font-size: .85rem; border-bottom: 1px solid var(--c-border); }
table.data-table th { color: var(--c-text-3); font-weight: 600; font-size: .75rem; text-transform: uppercase; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 1rem; font-size: .75rem; font-weight: 600; }
.badge-in { background: #dcfce7; color: #15803d; }

/* Liste de pièces d'un projet : ligne entièrement sortie du stock (préparée) */
table.data-table tr.row-done { background: #dcfce7; }
table.data-table tr.row-ordered { background: #fdf0e8; }
/* Case modifiable dans un tableau (ex. « En commande », « Livraison prévue » du tableau de bord). */
.cell-edit { margin: 0; padding: .25rem .4rem; font-size: .85rem; border: 1px solid var(--c-border); border-radius: .3rem; background: #fff; }
input[type="number"].cell-edit { width: 4.5rem; text-align: right; font-weight: 600; color: #c2470a; }
input[type="date"].cell-edit { width: 9.2rem; }
.cell-edit:hover:not(:disabled) { border-color: #f0a47a; }
.cell-edit:focus { border-color: var(--c-primary); outline: none; box-shadow: 0 0 0 2px #f6c7aa; }
.cell-edit:disabled { background: transparent; border-style: dashed; color: #c9c1b1; }
.cell-edit.late { color: var(--c-danger); font-weight: 600; border-color: #fca5a5; }
button.cell-multi { cursor: pointer; font-weight: 600; color: #c2470a; min-width: 4.5rem; text-align: right; white-space: nowrap; }
button.cell-multi small { font-weight: 400; color: #6b675f; }
button.cell-multi.late { color: var(--c-danger); }
.cell-more { margin: 0 0 0 .25rem; padding: .1rem .4rem; border: 1px solid var(--c-border); border-radius: .3rem; background: #fff; color: #6b675f; cursor: pointer; font-size: .85rem; line-height: 1.2; }
.cell-more:hover { border-color: #f0a47a; color: #c2470a; }
.late-flag { cursor: help; }
/* … sortie pour le projet mais absente de la liste (« Hors liste ») */
table.data-table tr.row-offlist { background: #ffedd5; }
.badge-out { background: #fef3c7; color: #b45309; }
.badge-low { background: #fee2e2; color: #b91c1c; }

#toast-container { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast { background: var(--c-text); color: white; padding: .7rem 1.1rem; border-radius: .4rem; font-size: .85rem; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.toast.error { background: var(--c-danger); }

#app-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9998; display: flex; align-items: center; justify-content: center; padding: 1rem; }
#app-modal .modal-box { background: white; border-radius: .75rem; padding: 1.75rem; width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; }
.form-buttons { margin-top: 1.25rem; display: flex; gap: .6rem; }

.scan-box { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1.5rem; max-width: 460px; }

/* ── Alertes ──────────────────────────────────────────────────────────── */
.nav-badge {
  display: inline-block; min-width: 1.25rem; padding: 0 .35rem; margin-left: .35rem;
  border-radius: 1rem; background: var(--c-warning); color: white;
  font-size: .7rem; font-weight: 700; line-height: 1.25rem; text-align: center;
}
.nav-badge.critical { background: var(--c-danger); }
.badge-critical { background: #fee2e2; color: #b91c1c; }
.badge-warning  { background: #fef3c7; color: #b45309; }
.badge-info     { background: #fbe3d4; color: #9a3a08; }
.badge-muted    { background: #ebe5d8; color: var(--c-text-2); }

/* ── Page Paramètres ──────────────────────────────────────────────────── */
.settings-section {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; max-width: 720px;
}
.settings-section h2 { font-size: 1rem; margin: 0 0 1rem; }
.settings-section .hint { font-size: .78rem; color: var(--c-text-3); margin: -.6rem 0 .9rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .form-row-2 { grid-template-columns: 1fr; } }
.checkbox-line { display: flex; align-items: center; gap: .55rem; font-weight: 500; cursor: pointer; margin-bottom: .9rem; }
.checkbox-line input { width: auto; margin: 0; }
.settings-actions { display: flex; gap: .6rem; align-items: center; }
.settings-actions .btn-primary { width: auto; }
.settings-msg { font-size: .82rem; margin: .6rem 0 0; min-height: 1em; }
.settings-msg.ok  { color: #15803d; }
.settings-msg.err { color: var(--c-danger); }

/* Lien à copier (invitation sans SMTP) */
.copy-box { display: flex; gap: .5rem; margin-bottom: .9rem; } /* comme un champ : le texte d'aide (.hint) suit sans chevaucher */
.copy-box input { font-family: monospace; font-size: .78rem; margin: 0; }

/* ── Scanner ──────────────────────────────────────────────────────────── */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .9rem; }
.segmented button {
  padding: .8rem .5rem; font-size: 1rem; border: 2px solid var(--c-border);
  background: var(--c-surface); color: var(--c-text-2);
}
.segmented button.active[data-action="out"] { border-color: #f59e0b; background: #fffbeb; color: #b45309; }
.segmented button.active[data-action="in"]  { border-color: #10b981; background: #ecfdf5; color: #047857; }
.stepper { display: flex; align-items: stretch; margin-bottom: .9rem; }
.stepper button { width: 3.2rem; font-size: 1.3rem; background: #ebe5d8; color: var(--c-text); padding: 0; }
.stepper button:first-child { border-radius: .4rem 0 0 .4rem; }
.stepper button:last-child  { border-radius: 0 .4rem .4rem 0; }
.stepper input { margin: 0; border-radius: 0; text-align: center; font-size: 1.1rem; font-weight: 600; }
.cam-btn { width: 100%; padding: .9rem; font-size: 1rem; margin-bottom: .9rem; }
.cam-wrap { position: relative; margin-bottom: .9rem; display: none; }
.cam-wrap video { width: 100%; border-radius: .5rem; background: #000; display: block; }
.cam-wrap .cam-frame {
  position: absolute; inset: 18% 22%; border: 3px solid rgba(255,255,255,.85); border-radius: .75rem;
  box-shadow: 0 0 0 999px rgba(0,0,0,.25); pointer-events: none;
}
.cam-wrap .cam-stop { position: absolute; top: .5rem; right: .5rem; background: rgba(0,0,0,.55); color: white; }
.sku-preview {
  font-size: .85rem; padding: .55rem .75rem; border-radius: .4rem; margin: -.4rem 0 .9rem;
  background: #ebe5d8; color: var(--c-text-2);
}
.sku-preview.error { background: #fef2f2; color: var(--c-danger); }
.btn-big { width: 100%; padding: .95rem; font-size: 1.05rem; }

/* ── Navigation mobile (cachée sur PC) ────────────────────────────────── */
.bottom-nav, .more-sheet { display: none; }

/* ════════════════════════════════════════════════════════════════════════
   MOBILE (≤ 768 px) — même application, mise en page adaptée :
   barre d'onglets en bas, tableaux en cartes, popups plein écran.
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* iOS zoome sur les champs < 16 px : on les garde à 16 px */
  input, select, textarea { font-size: 16px; }

  .app-shell { display: block; }
  .sidebar { display: none; }
  .main {
    max-width: none;
    padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(var(--bnav-h) + 1.75rem + env(safe-area-inset-bottom));
  }

  .page-header { flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
  .page-header h1 { font-size: 1.25rem; }
  .page-header > div { flex-wrap: wrap; }
  .page-header .btn-primary { width: auto; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .kpi-card { padding: .85rem; }
  .kpi-card .value { font-size: 1.5rem; }

  .btn-sm { padding: .5rem .8rem; font-size: .82rem; }

  /* Barre d'onglets */
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); align-items: center;
    height: calc(var(--bnav-h) + env(safe-area-inset-bottom));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    background: var(--c-text); padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,.15);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    padding: .55rem 0 .5rem; color: #958f83; font-size: .7rem; font-weight: 600;
    background: none; border-radius: 0;
  }
  .bottom-nav .bn-icon { font-size: 1.35rem; line-height: 1; position: relative; }
  .bottom-nav .nav-badge { position: absolute; top: -.35rem; left: 1rem; margin: 0; }
  .bottom-nav .active { color: white; }

  /* Panneau « Plus » */
  .more-sheet:not([hidden]) {
    display: flex; align-items: flex-end;
    position: fixed; inset: 0; z-index: 950; background: rgba(0,0,0,.4);
  }
  .more-panel {
    width: 100%; background: var(--c-surface); border-radius: 1rem 1rem 0 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); max-height: 85vh; overflow-y: auto;
  }
  .more-head { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--c-text-2); margin-bottom: .5rem; }
  #moreLinks a {
    display: block; padding: .85rem .5rem; color: var(--c-text); font-size: 1rem;
    border-bottom: 1px solid var(--c-border);
  }
  #moreLinks a.active { color: var(--c-primary); font-weight: 600; }
  .more-logout { display: block; padding: .85rem .5rem; color: var(--c-danger); }

  /* Tableaux → cartes (intitulés de colonnes posés par app.js en data-label) */
  table.data-table, table.data-table tbody { display: block; background: none; }
  table.data-table thead { display: none; }
  table.data-table tr {
    display: block; background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--radius); padding: .4rem .85rem; margin-bottom: .6rem;
  }
  table.data-table td {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .4rem 0; border-bottom: 1px solid #ebe5d8; text-align: right !important;
    white-space: normal !important; max-width: none !important;
  }
  table.data-table td:last-child { border-bottom: none; }
  table.data-table td::before {
    content: attr(data-label); flex-shrink: 0; text-align: left;
    font-size: .72rem; font-weight: 600; text-transform: uppercase; color: var(--c-text-3);
  }
  /* Cellule sans intitulé (boutons d'action) ou fusionnée : pleine largeur */
  table.data-table td[data-label=""]::before, table.data-table td.td-full::before { display: none; }
  table.data-table td[data-label=""] { justify-content: flex-end; flex-wrap: wrap; gap: .4rem; }
  table.data-table td.td-full { display: block; text-align: left !important; }

  /* Onglets défilants (page Listes) */
  .tabs { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .tabs button { flex-shrink: 0; }

  /* Popups en plein écran */
  #app-modal { padding: 0; align-items: stretch; }
  #app-modal .modal-box {
    max-width: none; max-height: none; height: 100%; border-radius: 0;
    padding: calc(1.25rem + env(safe-area-inset-top)) 1.1rem calc(1.25rem + env(safe-area-inset-bottom));
  }
  .form-buttons { position: sticky; bottom: 0; background: white; padding-top: .75rem; }
  .form-buttons button { flex: 1; padding: .8rem; }

  #toast-container { left: 1rem; right: 1rem; bottom: calc(var(--bnav-h) + 5rem + env(safe-area-inset-bottom)); }

  .scan-box { max-width: none; padding: 1rem; border: none; background: none; }
  .settings-section { padding: 1rem; }
}

/* ── Assistant Scanner mobile (pages/scan-wizard.js) ──────────────────── */
.wz { display: flex; flex-direction: column; min-height: calc(100vh - 7.5rem - env(safe-area-inset-bottom)); }
.wz-head { display: flex; justify-content: space-between; align-items: center; min-height: 2.25rem; margin-bottom: .5rem; }
.wz-back { background: none; color: var(--c-primary); padding: .4rem 0; font-size: 1rem; }
.wz-step { font-size: .8rem; color: var(--c-text-3); font-weight: 600; }
.wz-title { font-size: 1.35rem; margin: 0 0 1rem; }
.wz-body { flex: 1; }
.wz-footer { padding-top: 1rem; text-align: center; }
.wz-hint { text-align: center; color: var(--c-text-3); font-size: .9rem; }
.wz-link { display: inline-block; padding: .75rem; font-size: .95rem; }

.wz-scan-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem;
  width: 100%; aspect-ratio: 1 / 1; max-height: 55vh; margin: 0 auto;
  border-radius: 1.5rem; background: var(--c-primary); color: white; font-size: 1.25rem;
  box-shadow: 0 10px 25px rgba(28, 29, 31, .25);
}
.wz-scan-btn:disabled { background: #c9c1b1; box-shadow: none; }
.wz-scan-icon { font-size: 4rem; line-height: 1; }

.wz-cam { position: relative; border-radius: 1rem; overflow: hidden; background: #000; }
.wz-cam video { width: 100%; height: 62vh; object-fit: cover; display: block; }
.wz-cam .cam-frame {
  position: absolute; inset: 25% 15%; border: 3px solid rgba(255,255,255,.9); border-radius: 1rem;
  box-shadow: 0 0 0 999px rgba(0,0,0,.3); pointer-events: none;
}

.wz-sku {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: .9rem 1rem; margin-bottom: 1.5rem;
}
.wz-sku-name { font-weight: 700; font-size: 1.05rem; }
.wz-sku-meta { font-size: .85rem; color: var(--c-text-2); margin-top: .25rem; }

.wz-stepper { display: flex; align-items: stretch; justify-content: center; gap: .75rem; margin-bottom: 1rem; }
.wz-stepper button {
  width: 4.5rem; height: 4.5rem; border-radius: 50%; font-size: 2rem; padding: 0;
  background: #ebe5d8; color: var(--c-text);
}
.wz-stepper input {
  width: 7rem; height: 4.5rem; margin: 0; text-align: center; font-size: 2rem; font-weight: 700;
}

.wz-choices { display: flex; flex-direction: column; gap: .5rem; }
.wz-choice {
  display: flex; align-items: center; gap: .75rem; margin: 0; cursor: pointer;
  background: var(--c-surface); border: 2px solid var(--c-border); border-radius: var(--radius);
  padding: .9rem 1rem; font-weight: 400; font-size: .95rem; color: var(--c-text);
}
.wz-choice input { width: 1.2rem; height: 1.2rem; margin: 0; flex-shrink: 0; }
.wz-choice:has(input:checked) { border-color: var(--c-primary); background: #fdf0e8; }

.wz-recap {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: .4rem 1rem; margin-bottom: 1rem;
}
.wz-recap div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid #ebe5d8; }
.wz-recap div:last-child { border-bottom: none; }
.wz-recap span { color: var(--c-text-3); font-size: .85rem; }
.wz-recap strong { text-align: right; }

/* Assistant mobile : bouton de validation toujours visible, juste au-dessus
   de la barre d'onglets (pas besoin de faire défiler). */
@media (max-width: 768px) {
  .wz.has-footer { padding-bottom: 5.5rem; }
  .wz-footer {
    position: fixed; left: 0; right: 0; z-index: 850;
    bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom));
    padding: .75rem 1rem; background: var(--c-bg);
    box-shadow: 0 -6px 12px -6px rgba(28, 29, 31, .12);
  }
  .wz-footer .wz-link { padding: .35rem; }
  .wz { min-height: auto; }
}

/* Étape « Sortie ou entrée ? » : deux grands choix, un appui passe à la suite */
.wz-actions { display: grid; gap: .9rem; }
.wz-action {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: 1.4rem 1rem; border-radius: 1rem; font-size: 1.3rem; border: 2px solid;
}
.wz-action small { font-size: .8rem; font-weight: 500; opacity: .8; }
.wz-action-icon { font-size: 2rem; line-height: 1; }
.wz-action.out { background: #fffbeb; border-color: #fcd34d; color: #b45309; }
.wz-action.in  { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }
.wz-action.out.active { border-color: #f59e0b; box-shadow: 0 0 0 3px #fde68a; }
.wz-action.in.active  { border-color: #10b981; box-shadow: 0 0 0 3px #a7f3d0; }

/* Assistant en cours (après l'écran de départ) : barre d'onglets masquée,
   le bouton de validation descend tout en bas — rien en dessous à toucher
   par erreur. */
@media (max-width: 768px) {
  body.wz-focus .bottom-nav { display: none; }
  body.wz-focus .wz-footer { bottom: 0; padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
  body.wz-focus .main { padding-bottom: calc(1.75rem + env(safe-area-inset-bottom)); }
  body.wz-focus #toast-container { bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}

/* En-tête « titre puis bouton d'ajout en dessous » (Références, Projets) */
.page-header.stacked { flex-direction: column; align-items: flex-start; gap: .75rem; }
.page-header.stacked .btn-primary { width: auto; }

/* ── Page Documents : éditeur de modèle (réglages + aperçu cliquable) ── */
.doc-editor { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 1000px) { .doc-editor { grid-template-columns: 1fr; } }
.doc-help { font-size: .78rem; color: #6b675f; margin: -.6rem 0 .9rem; }
.doc-help-inline { font-size: .78rem; color: #958f83; font-weight: 400; }
.doc-check { display: flex; gap: .5rem; align-items: baseline; font-weight: 400; margin: .25rem 0; }
.doc-check input { width: auto; margin: 0; }
.doc-pick-row { display: flex; gap: .4rem; align-items: flex-start; }
.doc-pick-row button { margin-top: .3rem; white-space: nowrap; }
.doc-col { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .45rem .6rem;
           margin-bottom: .4rem; border: 1px solid var(--c-border); border-left: 4px solid; border-radius: .4rem; background: var(--c-surface); }
.doc-pick-hint { background: #fef3c7; color: #92400e; border-radius: .4rem; padding: .5rem .75rem; font-size: .85rem; margin-bottom: .5rem; }
.doc-page { position: relative; width: 100%; background: white; border: 1px solid var(--c-border); border-radius: .4rem;
            overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.05); margin-bottom: .4rem; }
.doc-line { position: absolute; left: 0; right: 0; }
.doc-word { position: absolute; white-space: nowrap; color: #3a3732; line-height: 1; }
.doc-page.picking .doc-line:hover { background: rgba(250, 204, 21, .25); cursor: pointer; }
.doc-page.picking .doc-word:hover { outline: 2px solid #f59e0b; background: #fef3c7; }

/* ── Licence : titulaire sous le logo, bannière en haut des pages ── */
.license-holder { font-size: .72rem; color: #958f83; margin: -.6rem 0 1.2rem; }
.license-banner { border-radius: var(--radius); padding: .6rem .85rem; margin-bottom: 1rem; font-size: .85rem; line-height: 1.45; }
.license-banner.info     { background: #fbe3d4; color: #7a2e06; }
.license-banner.warning  { background: #fef3c7; color: #92400e; }
.license-banner.critical { background: #fee2e2; color: #991b1b; }
.license-banner .license-link { color: inherit; font-weight: 600; margin-left: .3rem; }

/* ── Assistant de première configuration (#/welcome) ── */
.wizard-steps { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.wizard-step { display: flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: 2rem;
               background: #ebe5d8; color: #6b675f; font-size: .8rem; font-weight: 600; }
.wizard-step.current { background: var(--c-primary); color: white; }
.wizard-step.past { background: #dcfce7; color: #15803d; }
.wizard-num { display: inline-flex; align-items: center; justify-content: center; width: 1.3rem; height: 1.3rem;
              border-radius: 50%; background: rgba(255,255,255,.35); font-size: .75rem; }
.wizard-buttons { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }
.wizard-buttons .btn-primary { width: auto; }
@media (max-width: 768px) { .wizard-name { display: none; } .wizard-step.current .wizard-name { display: inline; } }

/* ── Tableau de bord ── */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 1.6rem 0 .4rem; }
.dash-head h2 { font-size: 1.05rem; margin: 0; }
.dash-hint { font-size: .8rem; color: #6b675f; margin: 0 0 .6rem; }
.dash-empty { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: .8rem 1rem; color: #6b675f; font-size: .9rem; }
.dash-todo { display: flex; flex-direction: column; gap: .35rem; }
.dash-todo a { display: block; background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: .55rem .85rem; color: #78350f; font-size: .88rem; text-decoration: none; }
.dash-todo a:hover { background: #fef3c7; }
table.data-table tr.dash-group td { background: #ebe5d8; font-weight: 600; font-size: .8rem; color: #3a3732; }
.dash-system { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap;
               border-radius: var(--radius); padding: .55rem .85rem; margin-bottom: .4rem; font-size: .88rem; }
.dash-system.ok       { background: #f0fdf4; color: #166534; }
.dash-system.warning  { background: #fef3c7; color: #92400e; }
.dash-system.critical { background: #fee2e2; color: #991b1b; }
.dash-system a { color: inherit; font-weight: 600; white-space: nowrap; }

/* ── Bascule « Mes projets / Tous » ── */
.segmented.scope-toggle { display: inline-flex; gap: 0; margin: 0; border: 1px solid var(--c-border); border-radius: 2rem; overflow: hidden; background: var(--c-surface); }
.segmented.scope-toggle button { border: 0; border-radius: 0; padding: .35rem .85rem; font-size: .82rem; font-weight: 500; min-height: 0; background: transparent; color: var(--c-text-2); }
.segmented.scope-toggle button.active { background: #1c1d1f; color: #fff; }
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }

/* ── Inventaire ── */
.inv-filters { display: flex; gap: .35rem; flex-wrap: wrap; }
.inv-filter { border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-2); border-radius: 2rem; padding: .3rem .75rem; font-size: .82rem; font-weight: 500; }
.inv-filter span { background: #ddd5c5; border-radius: 1rem; padding: 0 .4rem; margin-left: .2rem; font-size: .75rem; }
.inv-filter.active { background: #1c1d1f; color: #fff; border-color: #1c1d1f; }
.inv-filter.active span { background: #514d46; color: #fff; }
.inv-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0 0 .6rem; font-size: .85rem; color: #6b675f; }
.inv-choice { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: .7rem .85rem; margin-bottom: .8rem; font-size: .9rem; }
.inv-choice p { margin: 0 0 .5rem; }
.inv-choice-buttons { display: flex; gap: .4rem; flex-wrap: wrap; }
table.data-table tr.inv-row-diff td { background: #fff7ed; }
.inv-banner { display: flex; align-items: center; gap: .6rem; background: #fdf0e8; border: 1px solid #f6c7aa; color: #7a2e06; border-radius: var(--radius); padding: .65rem .85rem; margin-bottom: .8rem; text-decoration: none; font-size: .9rem; max-width: 520px; }
.inv-banner span { flex: 1; }
.inv-banner small { display: block; color: #e4570f; }
.inv-banner b { white-space: nowrap; }
.proj-banner { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.proj-banner small { color: #15803d; }
.wz-proj { font-size: .82rem; font-weight: 600; color: #15803d; margin: -.2rem 0 .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-actions button, .inv-choice-buttons button, .dash-head button { width: auto; }


.inv-mobile-start { text-align: center; margin: 0 0 1.5rem; }
.inv-scan-btn { aspect-ratio: auto; padding: 1.6rem 1rem; max-height: none; }
.inv-scan-btn .wz-scan-icon { font-size: 3rem; }

/* ── Titres de groupe du menu (gauche et panneau « Plus ») ── */
.nav-group { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b675f; margin: 1.1rem 0 .3rem .75rem; }
#moreLinks .nav-group { margin: .9rem 0 .2rem; color: var(--c-text-3); }
#moreLinks .nav-group:first-child { margin-top: 0; }

/* Menu masqué le temps de charger la langue (évite le français en éclair) */
.i18n-pending .sidebar nav, .i18n-pending .bottom-nav { visibility: hidden; }
.lang-select { width: auto; padding: .3rem .5rem; font-size: .82rem; margin: 0; }

/* Sélecteur de langue des pages de connexion */
.auth-card { position: relative; }
.auth-lang { position: absolute; top: .9rem; right: .9rem; }
.i18n-pending .auth-card { visibility: hidden; }

/* ── Tableaux par lot (liste de pièces, matériel à commander) ── */
.lot-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin: 1rem 0 .4rem; }
.lot-head h3 { font-size: .95rem; margin: 0; }
.lot-progress { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; }
.lot-progress .bar { width: 110px; height: .4rem; background: #ddd5c5; border-radius: 1rem; overflow: hidden; display: inline-block; }
.lot-progress .bar span { display: block; height: 100%; background: #22c55e; }

/* Bouton désactivé (ex. « Marquer comme commandé » sans ligne cochée). */
button.btn-primary:disabled, button.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

/* Hébergé (certificat public) : pas d'autorité Onito à installer (assets/js/hosting.js). */
.no-cert .js-cert-link { display: none !important; }
