/* Négoce — feuille de style unique.
   Pensée d'abord pour le téléphone du patron, puis élargie au poste de
   comptoir : c'est l'écran le plus contraint qui commande la mise en page. */

:root {
  --encre: #0f172a;
  --encre-douce: #64748b;
  --fond: #f1f5f9;
  --carte: #ffffff;
  --trait: #e2e8f0;
  --accent: #0ea5e9;
  --accent-fonce: #0284c7;
  --vert: #16a34a;
  --rouge: #dc2626;
  --ambre: #d97706;
  --rayon: 12px;
  --ombre: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--encre);
  background: var(--fond);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0 0 12px; font-weight: 650; letter-spacing: -.01em; }
[hidden] { display: none !important; }

/* ── Connexion ───────────────────────────────────────────────────────────── */
.connexion {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, #0f172a, #1e3a5f);
}
.carte-connexion {
  width: 100%; max-width: 380px; background: var(--carte);
  border-radius: 18px; padding: 32px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.logo {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 14px;
  background: linear-gradient(140deg, var(--accent), var(--accent-fonce));
  color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700;
}
.carte-connexion h1 { text-align: center; margin-bottom: 2px; }
.sous-titre { text-align: center; color: var(--encre-douce); margin: 0 0 20px; font-size: 13.5px; }
.onglets { display: flex; gap: 6px; background: var(--fond); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.onglet {
  flex: 1; padding: 8px; border: 0; background: none; border-radius: 7px;
  font: inherit; font-size: 13.5px; color: var(--encre-douce); cursor: pointer;
}
.onglet.actif { background: var(--carte); color: var(--encre); font-weight: 600; box-shadow: var(--ombre); }

label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--encre-douce); font-weight: 500; }
input, select, textarea {
  width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit; color: var(--encre);
  border: 1px solid var(--trait); border-radius: 9px; background: var(--carte);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
#ci-pin { text-align: center; letter-spacing: 10px; font-size: 22px; }

/* ── Boutons ─────────────────────────────────────────────────────────────── */
.bouton {
  padding: 9px 16px; border: 1px solid var(--trait); border-radius: 9px;
  background: var(--carte); font: inherit; font-size: 14px; cursor: pointer;
  transition: .12s; white-space: nowrap;
}
.bouton:hover { border-color: var(--encre-douce); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 550; }
.bouton.principal:hover { background: var(--accent-fonce); }
.bouton.danger { color: var(--rouge); border-color: #fecaca; }
.bouton.discret { border: 0; background: none; color: var(--encre-douce); }
.bouton.large { width: 100%; padding: 12px; margin-top: 6px; }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.icone { border: 0; background: none; font-size: 20px; cursor: pointer; padding: 4px 8px; }

/* ── Ossature ────────────────────────────────────────────────────────────── */
.barre {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--encre); color: #fff; position: sticky; top: 0; z-index: 20;
}
.marque { font-weight: 650; letter-spacing: -.01em; }
.espace { flex: 1; }
.qui { font-size: 13px; opacity: .75; }
.etat { font-size: 11.5px; color: #4ade80; }
.etat.hors-ligne { color: #fbbf24; }
.barre .bouton.discret { color: #cbd5e1; }

.corps { display: flex; min-height: calc(100vh - 48px); }
nav {
  width: 210px; background: var(--carte); border-right: 1px solid var(--trait);
  padding: 14px 10px; flex-shrink: 0;
}
.lien {
  display: block; width: 100%; text-align: left; padding: 10px 13px; margin-bottom: 3px;
  border: 0; border-radius: 9px; background: none; font: inherit; font-size: 14px;
  color: var(--encre-douce); cursor: pointer;
}
.lien:hover { background: var(--fond); }
.lien.actif { background: var(--accent); color: #fff; font-weight: 550; }
main { flex: 1; padding: 22px; max-width: 100%; overflow-x: auto; }

/* ── Éléments de contenu ─────────────────────────────────────────────────── */
.carte { background: var(--carte); border-radius: var(--rayon); padding: 18px; box-shadow: var(--ombre); margin-bottom: 16px; }
.grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.chiffre { background: var(--carte); border-radius: var(--rayon); padding: 16px 18px; box-shadow: var(--ombre); }
.chiffre .libelle { font-size: 12.5px; color: var(--encre-douce); }
.chiffre .valeur { font-size: 27px; font-weight: 680; letter-spacing: -.02em; margin-top: 3px; }
.chiffre .detail { font-size: 12px; color: var(--encre-douce); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 9px 12px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--encre-douce); border-bottom: 1px solid var(--trait); font-weight: 600;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--trait); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--fond); }
.nombre { text-align: right; font-variant-numeric: tabular-nums; }

.etiquette { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.etiquette.vert { background: #dcfce7; color: #15803d; }
.etiquette.rouge { background: #fee2e2; color: #b91c1c; }
.etiquette.ambre { background: #fef3c7; color: #b45309; }
.etiquette.gris { background: var(--fond); color: var(--encre-douce); }

.barre-outils { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.barre-outils input, .barre-outils select { margin-top: 0; width: auto; min-width: 180px; }
.muet { color: var(--encre-douce); font-size: 13px; }
.erreur { color: var(--rouge); font-size: 13px; margin-top: 10px; }
.vide { text-align: center; padding: 40px 20px; color: var(--encre-douce); }

/* Grille de saisie des tailles : c'est l'écran le plus utilisé au dépôt. */
.matrice { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); margin-top: 10px; }
.case-taille { border: 1px solid var(--trait); border-radius: 10px; padding: 8px; text-align: center; background: var(--carte); }
.case-taille .t { font-size: 12px; color: var(--encre-douce); margin-bottom: 4px; }
.case-taille input { margin: 0; text-align: center; padding: 6px; font-weight: 600; }

/* ── Fenêtre modale et messages ──────────────────────────────────────────── */
.fenetre { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.fenetre-boite { background: var(--carte); border-radius: 16px; padding: 22px; width: 100%; max-width: 620px; max-height: 88vh; overflow: auto; }
.message {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--encre); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.message.vert { background: var(--vert); }
.message.rouge { background: var(--rouge); }

/* ── Téléphone ───────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .corps { display: block; }
  nav {
    width: 100%; display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px;
    border-right: 0; border-bottom: 1px solid var(--trait); position: sticky; top: 48px; z-index: 15;
  }
  .lien { width: auto; white-space: nowrap; padding: 8px 14px; }
  main { padding: 14px; }
  #menu-mobile { display: none; }
  table { font-size: 13px; }
  th, td { padding: 8px; }
}
