/* Contrôle DLC — feuille de style mobile-first.
   Toutes les couleurs, rayons et ombres sont des variables : pour aligner le
   module sur l'identité du portail Groupe Alkan, il suffit de modifier :root. */
:root {
  --fond: #f1f5f9;
  --surface: #ffffff;
  --texte: #0f172a;
  --texte-doux: #64748b;
  --bordure: #e2e8f0;
  --accent: #0f766e;
  --accent-fonce: #115e59;
  --accent-clair: #ccfbf1;
  --entete: #0f172a;
  --entete-texte: #ffffff;

  --depasse: #b91c1c;   --depasse-fond: #fee2e2;
  --jour-j: #c2410c;    --jour-j-fond: #ffedd5;
  --urgent: #b45309;    --urgent-fond: #fef3c7;
  --a-traiter: #1d4ed8; --a-traiter-fond: #dbeafe;
  --succes: #15803d;    --succes-fond: #dcfce7;

  --rayon: 12px;
  --rayon-petit: 8px;
  --ombre: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--police); background: var(--fond); color: var(--texte);
  font-size: 16px; line-height: 1.45;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.doux { color: var(--texte-doux); }
.petit { font-size: .85rem; }
.centre { text-align: center; }
.cache { display: none !important; }

/* En-tête */
.entete {
  position: sticky; top: 0; z-index: 20; background: var(--entete); color: var(--entete-texte);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
.entete a { color: var(--entete-texte); text-decoration: none; }
.entete .retour { font-size: .9rem; opacity: .85; white-space: nowrap; }
.entete .titre { flex: 1; font-weight: 700; font-size: 1.05rem; }
.entete .operateur {
  font-size: .8rem; background: rgba(255,255,255,.14); padding: 4px 10px; border-radius: 999px;
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.contenu { max-width: 720px; margin: 0 auto; padding: 16px; }

/* Navigation basse */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface);
  border-top: 1px solid var(--bordure); display: flex;
  padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: var(--texte-doux); font-size: .72rem; gap: 2px;
}
.nav a .ico { font-size: 1.35rem; line-height: 1; }
.nav a.actif { color: var(--accent); font-weight: 600; }
.nav a.scan .ico {
  background: var(--accent); color: #fff; width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin-top: -18px;
  box-shadow: 0 4px 12px rgba(15, 118, 110, .35);
}

/* Cartes */
.carte {
  background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre);
  border: 1px solid var(--bordure); padding: 16px; margin-bottom: 12px;
}
.carte.compacte { padding: 12px; }

/* Messages */
.message { border-radius: var(--rayon-petit); padding: 12px 14px; margin-bottom: 12px; font-weight: 500; }
.message.succes { background: var(--succes-fond); color: var(--succes); }
.message.erreur { background: var(--depasse-fond); color: var(--depasse); }
.message.info { background: var(--a-traiter-fond); color: var(--a-traiter); }
.message.alerte { background: var(--urgent-fond); color: var(--urgent); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--bordure); background: var(--surface); color: var(--texte);
  border-radius: var(--rayon-petit); padding: 12px 16px; font-size: 1rem; font-weight: 600;
  font-family: inherit; text-decoration: none; cursor: pointer; min-height: 48px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.principal:active { background: var(--accent-fonce); }
.btn.danger { background: var(--depasse); border-color: var(--depasse); color: #fff; }
.btn.lien { border: none; background: none; color: var(--accent); padding: 8px; min-height: 0; font-weight: 500; }
.btn.bloc { display: flex; width: 100%; }
.btn.geant { min-height: 64px; font-size: 1.2rem; letter-spacing: .02em; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.rangee { display: flex; gap: 8px; flex-wrap: wrap; }
.rangee > .btn { flex: 1; }

/* Formulaires */
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=search], input[type=number],
input[type=tel], input[type=url], select {
  width: 100%; font-size: 1.05rem; font-family: inherit; padding: 12px;
  border: 1px solid var(--bordure); border-radius: var(--rayon-petit); background: #fff;
  color: var(--texte); min-height: 48px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.case { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 12px 0; }
.case input { width: 22px; height: 22px; }

/* Compteurs de l'accueil */
.compteurs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 560px) { .compteurs { grid-template-columns: repeat(4, 1fr); } }
.compteur { border-radius: var(--rayon); padding: 12px; text-align: center; }
.compteur .nombre { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.compteur .libelle { font-size: .8rem; font-weight: 600; }
.niv-depasse, .badge.niv-depasse { background: var(--depasse-fond); color: var(--depasse); }
.niv-jour_j, .badge.niv-jour_j { background: var(--jour-j-fond); color: var(--jour-j); }
.niv-urgent, .badge.niv-urgent { background: var(--urgent-fond); color: var(--urgent); }
.niv-a_traiter, .badge.niv-a_traiter { background: var(--a-traiter-fond); color: var(--a-traiter); }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 8px;
  border-radius: 999px; white-space: nowrap; background: var(--fond); color: var(--texte-doux);
}

/* Listes d'alertes */
.groupe-meuble h2 { display: flex; align-items: baseline; gap: 8px; }
.groupe-meuble h2 .num { color: var(--texte-doux); font-weight: 600; font-size: .9rem; }
.ligne {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-top: 1px solid var(--bordure); text-decoration: none; color: inherit;
}
.ligne:first-of-type { border-top: none; }
.ligne .corps { flex: 1; min-width: 0; }
.ligne .nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ligne .detail { font-size: .85rem; color: var(--texte-doux); }
.ligne .fleche { color: var(--texte-doux); font-size: 1.2rem; }
.vide { text-align: center; padding: 28px 12px; color: var(--texte-doux); }

/* Tableaux simples */
.tableau { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tableau th, .tableau td { text-align: left; padding: 10px 6px; border-top: 1px solid var(--bordure); vertical-align: top; }
.tableau th { font-size: .78rem; text-transform: uppercase; color: var(--texte-doux); border-top: none; }

/* ---------- Parcours de scan ---------- */
.barre-meuble {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: 10px 12px; margin-bottom: 12px; box-shadow: var(--ombre);
}
.barre-meuble .corps { flex: 1; min-width: 0; }
.barre-meuble .etiquette { font-size: .75rem; color: var(--texte-doux); text-transform: uppercase; font-weight: 700; }
.barre-meuble .nom { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.zone-camera {
  position: relative; background: #000; border-radius: var(--rayon); overflow: hidden;
  aspect-ratio: 4 / 3; margin-bottom: 12px;
}
.zone-camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.zone-camera .viseur {
  position: absolute; left: 10%; right: 10%; top: 35%; bottom: 35%;
  border: 3px solid rgba(255,255,255,.9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.25);
}
.zone-camera .info-camera {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; text-align: center; padding: 20px; font-weight: 500;
}
.zone-camera.lu .viseur { border-color: #4ade80; }
.zone-camera .info-camera:not(.cache) { background: rgba(15, 23, 42, .85); }
/* Pendant la saisie d'un produit, la navigation basse est masquée pour garder
   les gros boutons visibles au pouce. */
body.parcours-concentre .nav { display: none; }
body.parcours-concentre { padding-bottom: env(safe-area-inset-bottom); }

.saisie-ean { display: flex; gap: 8px; }
.saisie-ean input { flex: 1; font-size: 1.2rem; letter-spacing: .05em; }
.saisie-ean .btn { flex: 0 0 auto; }

.fiche-produit { display: flex; gap: 12px; align-items: center; }
.fiche-produit img { width: 72px; height: 72px; object-fit: contain; border-radius: var(--rayon-petit); background: #fff; border: 1px solid var(--bordure); }
.fiche-produit .nom { font-size: 1.2rem; font-weight: 800; line-height: 1.2; }
.fiche-produit .detail { color: var(--texte-doux); font-size: .92rem; }
.ean { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; color: var(--texte-doux); }

.question { font-size: 1.15rem; font-weight: 700; margin: 16px 0 12px; text-align: center; }

/* Roulettes JOUR / MOIS */
.roulettes {
  position: relative; display: flex; gap: 12px; justify-content: center; height: 220px;
  user-select: none; -webkit-user-select: none; margin: 4px 0 8px;
}
.roulettes::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 48px; transform: translateY(-50%);
  background: var(--accent-clair); border-radius: var(--rayon-petit); pointer-events: none;
}
.roulette {
  position: relative; width: 108px; height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
          mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
.roulette::-webkit-scrollbar { display: none; }
.roulette .marge { height: 86px; }
.roulette .cran {
  height: 48px; display: flex; align-items: center; justify-content: center; scroll-snap-align: center;
  font-size: 1.6rem; font-weight: 700; color: var(--texte-doux); font-variant-numeric: tabular-nums;
}
.roulette .cran.choisi { color: var(--texte); }
.roulette .cran.indispo { opacity: .25; }
.entete-roulettes { display: flex; justify-content: center; gap: 12px; }
.entete-roulettes span { width: 108px; text-align: center; font-size: .75rem; font-weight: 700; color: var(--texte-doux); letter-spacing: .08em; }

.date-geante { text-align: center; font-size: 1.75rem; font-weight: 800; letter-spacing: .02em; margin: 6px 0 4px; text-transform: uppercase; }
.date-etat { text-align: center; min-height: 1.5em; font-weight: 600; margin-bottom: 8px; }
.date-etat.depassee { color: var(--depasse); }
.date-etat.suspecte { color: var(--urgent); }
.date-etat.ok { color: var(--texte-doux); }

.ecran-ok { text-align: center; padding: 36px 16px; }
.ecran-ok .coche {
  width: 84px; height: 84px; border-radius: 50%; background: var(--succes); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 3rem; margin: 0 auto 16px;
}

.choix-quantite { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.choix-quantite .btn { min-height: 52px; font-size: 1.15rem; padding: 8px; }
.choix-quantite .btn.choisi, .choix-action .btn.choisi { background: var(--accent); color: #fff; border-color: var(--accent); }
.choix-action { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choix-action .btn { min-height: 60px; }

.liste-meubles .categorie { font-size: .78rem; font-weight: 700; color: var(--texte-doux); text-transform: uppercase; margin: 16px 0 6px; }
.liste-meubles button {
  display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--rayon-petit); padding: 12px; margin-bottom: 6px; font-size: 1rem; font-family: inherit; color: var(--texte);
}
.liste-meubles button.choisi { border-color: var(--accent); background: var(--accent-clair); font-weight: 700; }

.chaine { list-style: none; padding: 0; margin: 0; }
.chaine li { padding: 8px 0 8px 18px; border-left: 3px solid var(--bordure); margin-left: 6px; position: relative; }
.chaine li::before { content: ""; position: absolute; left: -7px; top: 14px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
