/* Mass Concept Stock — styles (couleurs et typographie de la maquette validée) */
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 600; font-display: swap; src: url('/polices/bricolage-grotesque-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700; font-display: swap; src: url('/polices/bricolage-grotesque-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('/polices/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url('/polices/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url('/polices/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }

:root {
  --fond: #F5F3EE; --carte: #FFFFFF; --encre: #1B1A17; --gris: #5E5A52; --gris-clair: #8A857A;
  --trait: #E3DFD6; --trait-leger: #EFECE5; --champ-bord: #CFCABF; --champ-fond: #F9F8F5; --entete-table: #F1EEE8;
  --accent: #1F5E5B; --accent-fonce: #16423F; --accent-clair: #E3EEEC;
  --rouge: #8F1A10; --rouge-clair: #FDECEA; --orange: #8A4104; --orange-clair: #FDF1E3;
  --nuit: #1B1A17; --nuit-2: #2F2D28; --nuit-texte: #D6D1C6; --nuit-doux: #A8A396;
  --titre: 'Bricolage Grotesque', system-ui, sans-serif;
  --texte: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --rayon: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--encre); font-family: var(--texte); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-fonce); }
h1, h2, h3 { font-family: var(--titre); margin: 0; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; font-family: var(--texte); }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .chiffre { font-family: var(--titre); font-variant-numeric: tabular-nums; }
.muet { color: var(--gris); }
.petit { font-size: 13px; }
.cache-visuel { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
:focus-visible { outline: 3px solid #3F9A94; outline-offset: 2px; }

/* ---------- mise en page ---------- */
.app { min-height: 100vh; display: flex; }
.menu { overflow-y: auto; width: 232px; flex-shrink: 0; background: var(--nuit); color: var(--fond); padding: 24px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.menu .marque { padding: 0 10px 22px; font-family: var(--titre); font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.menu a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--nuit-texte); font-size: 15px; }
.menu a:hover { background: var(--nuit-2); color: #fff; }
.menu a.actif { background: var(--nuit-2); color: #fff; font-weight: 600; }
.menu .espace { flex-grow: 1; }
.menu .qui { padding: 12px 10px 0; font-size: 13px; color: var(--nuit-doux); }
.menu .qui button { background: none; border: 0; color: var(--nuit-texte); text-decoration: underline; cursor: pointer; padding: 4px 0; font-size: 13px; }
.principal { flex-grow: 1; min-width: 0; padding: 28px 36px 40px; display: flex; flex-direction: column; gap: 18px; }
.entete { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.entete .sous { font-size: 15px; color: var(--gris); margin-top: 4px; }
.barre-haut, .nav-bas { display: none; }

/* ---------- blocs ---------- */
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; }
.carte.pad { padding: 16px 18px; }
.carte > h2 { padding: 16px 18px 10px; }
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grille-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grille-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 16px 20px; border-radius: 14px; background: var(--carte); border: 1px solid var(--trait); display: flex; flex-direction: column; gap: 4px; }
.kpi span:first-child { font-size: 14px; color: var(--gris); }
.kpi .valeur { font-family: var(--titre); font-size: 30px; font-weight: 700; }
.kpi .valeur small { font-size: 15px; font-weight: 600; color: var(--gris); }
.kpi.alerte { background: var(--orange-clair); border-color: transparent; color: var(--orange); }
.kpi.alerte span:first-child { color: var(--orange); }
.tuile { display: flex; flex-direction: column; gap: 2px; padding: 12px; min-height: 44px; border-radius: 12px; background: var(--carte); border: 1px solid var(--trait); color: var(--encre); }
.tuile .valeur { font-family: var(--titre); font-size: 28px; font-weight: 700; }
.tuile span:last-child { font-size: 12px; line-height: 1.3; }
.tuile.rouge { background: var(--rouge-clair); border-color: transparent; color: var(--rouge); }
.tuile.orange { background: var(--orange-clair); border-color: transparent; color: var(--orange); }
.action { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; background: var(--carte); border: 1px solid var(--trait); color: var(--encre); min-height: 96px; font-size: 16px; font-weight: 600; }
.action.principale { background: var(--accent); border-color: var(--accent); color: #fff; }
.action:hover { border-color: var(--accent); }
.action.principale:hover { color: #fff; background: var(--accent-fonce); }
.titre-section { font-size: 13px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .6px; }
.liste { display: flex; flex-direction: column; background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; overflow: hidden; }
.liste > * + * { border-top: 1px solid var(--trait-leger); }
.ligne-liste { display: flex; gap: 12px; align-items: center; padding: 12px 14px; min-height: 44px; color: var(--encre); background: none; border: 0; text-align: left; width: 100%; cursor: pointer; }
.ligne-liste:hover { background: #FBFAF7; color: var(--encre); }
.ligne-liste .n { font-family: var(--titre); font-weight: 700; font-size: 16px; min-width: 44px; color: var(--accent); }
.ligne-liste .corps { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ligne-liste .corps b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne-liste .corps span { font-size: 13px; color: var(--gris); }
.barre { display: flex; align-items: center; gap: 12px; }
.barre .nom { width: 170px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre .fond { flex-grow: 1; height: 14px; background: var(--trait-leger); border-radius: 7px; overflow: hidden; }
.barre .plein { height: 100%; background: var(--accent); border-radius: 7px; }
.barre .v { width: 40px; text-align: right; font-weight: 600; }

/* ---------- pastilles ---------- */
.pastille { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.pastille.cours { color: var(--orange); background: var(--orange-clair); }
.pastille.fini { color: var(--accent-fonce); background: var(--accent-clair); }
.pastille.neutre { color: var(--gris); background: var(--trait-leger); }
.pastille.rouge { color: var(--rouge); background: var(--rouge-clair); }
.qte { font-family: var(--titre); font-size: 17px; font-weight: 700; padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.qte.negatif { color: var(--rouge); background: var(--rouge-clair); }
.qte.zero, .qte.seuil { color: var(--orange); background: var(--orange-clair); }

/* ---------- formulaires ---------- */
.champ { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.champ > label, .champ > .etiquette { font-size: 14px; font-weight: 600; }
.champ .aide { font-size: 13px; color: var(--gris); }
input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], input:not([type]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--champ-bord); background: #fff; font-size: 16px; }
textarea { min-height: 70px; resize: vertical; }
input.gros { font-family: var(--titre); font-size: 18px; font-weight: 700; }
input[readonly], .fige { background: #EDEAE3; color: var(--gris); }
.fige { min-height: 46px; padding: 12px 14px; border-radius: 12px; font-size: 15px; }
.filtres { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filtres .champ { min-width: 150px; }
.filtres .champ.large { flex-grow: 1; min-width: 220px; }
.filtres input, .filtres select { min-height: 42px; padding: 8px 12px; font-size: 15px; border-radius: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--encre); background: #fff; color: var(--encre); font-size: 15px; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { background: #F6F4EF; color: var(--encre); }
.btn.plein { background: var(--encre); color: #fff; }
.btn.plein:hover { background: #000; color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-fonce); color: #fff; }
.btn.danger { border-color: var(--rouge); color: var(--rouge); }
.btn.lien { border: 0; background: none; color: var(--accent); padding: 0 6px; min-height: 36px; }
.btn.petit { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.large { width: 100%; }
.puces { display: flex; gap: 8px; flex-wrap: wrap; }
.puce { min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid #D8D3C8; background: #fff; font-size: 14px; cursor: pointer; }
.puce.choisie { background: var(--encre); border-color: var(--encre); color: #fff; font-weight: 600; }
.bascule { display: flex; gap: 8px; }
.bascule button { flex-grow: 1; min-height: 46px; border-radius: 12px; border: 1px solid #D8D3C8; background: #fff; font-size: 15px; cursor: pointer; }
.bascule button.choisi { border: 2px solid var(--accent); background: var(--accent-clair); color: var(--accent-fonce); font-weight: 600; }
.qte-pas { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px auto; gap: 8px; align-items: center; }
.qte-pas button { height: 48px; border-radius: 12px; border: 1px solid var(--champ-bord); background: #fff; font-size: 22px; cursor: pointer; }
.qte-pas input { text-align: center; }

/* recherche d'article */
.recherche { position: relative; }
.propositions { margin-top: 6px; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--trait); border-radius: 12px; overflow: hidden; }
.propositions.flottant { position: absolute; left: 0; right: 0; z-index: 20; box-shadow: 0 8px 24px rgba(27, 26, 23, .12); max-height: 320px; overflow-y: auto; }
.propositions button { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; border: 0; background: none; text-align: left; cursor: pointer; font-size: 15px; min-height: 44px; }
.propositions button + button { border-top: 1px solid var(--trait-leger); }
.propositions button.survol, .propositions button:hover { background: var(--accent-clair); }
.propositions .stock { color: var(--gris); font-size: 13px; white-space: nowrap; }
.propositions .vide { padding: 11px 14px; color: var(--gris); font-size: 14px; }

/* ---------- tableaux ---------- */
.table-cadre { overflow: auto; background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { position: sticky; top: 0; background: var(--entete-table); text-align: left; font-weight: 600; padding: 9px 12px; white-space: nowrap; z-index: 1; }
td { padding: 8px 12px; border-top: 1px solid var(--trait-leger); vertical-align: top; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background: #FBFAF7; }
tr.annule td { color: var(--gris-clair); text-decoration: line-through; }
td.n, th.n { text-align: right; white-space: nowrap; }
td .bon { color: var(--accent); font-weight: 600; }

/* ---------- messages ---------- */
.message { padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.message.ok { background: var(--accent-clair); color: var(--accent-fonce); }
.message.erreur { background: var(--rouge-clair); color: var(--rouge); }
.message.attention { background: var(--orange-clair); color: var(--orange); }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toasts .message { box-shadow: 0 8px 24px rgba(27, 26, 23, .18); }
.chargement { padding: 24px; color: var(--gris); }

/* ---------- fenêtre ---------- */
.voile { position: fixed; inset: 0; background: rgba(27, 26, 23, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.fenetre { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.fenetre .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- saisie rapide (PC) ---------- */
.avec-cote { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.cote { position: sticky; top: 16px; background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.info-bon { padding: 10px 12px; border-radius: 10px; background: var(--accent-clair); color: var(--accent-fonce); font-size: 14px; }
.info-bon b { display: block; font-size: 15px; }

/* ---------- connexion ---------- */
.connexion { min-height: 100vh; background: var(--nuit); color: var(--fond); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.connexion form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
.connexion .logo { font-family: var(--titre); font-size: 38px; font-weight: 700; letter-spacing: 1px; line-height: 1; }
.connexion input { background: #2A2925; border-color: #4A4740; color: var(--fond); }
.connexion .btn.plein { background: var(--fond); color: var(--encre); border-color: var(--fond); min-height: 54px; font-size: 17px; }
.connexion label.coche { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; color: #CFCABF; font-weight: 400; }
.connexion label.coche input { width: 22px; height: 22px; min-height: 0; accent-color: #3F9A94; }

.seulement-tel { display: none; }
.pile { display: flex; flex-direction: column; gap: 18px; }

/* ---------- téléphone ---------- */
@media (max-width: 900px) {
  body { font-size: 15px; }
  .app { display: block; padding-bottom: 76px; }
  .menu { display: none; }
  .barre-haut { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; background: var(--nuit); color: var(--fond); position: sticky; top: 0; z-index: 30; }
  .barre-haut .marque { font-family: var(--titre); font-weight: 700; font-size: 18px; letter-spacing: .5px; }
  .barre-haut .qui { font-size: 13px; color: #CFCABF; }
  .barre-haut a { color: #CFCABF; }
  .nav-bas { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--trait); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); z-index: 30; }
  .nav-bas a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; min-height: 44px; color: var(--gris); font-size: 12px; }
  .nav-bas a.actif { color: var(--accent); font-weight: 600; }
  .principal { padding: 16px 16px 24px; gap: 16px; }
  h1 { font-size: 22px; }
  .grille-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grille-2 { grid-template-columns: minmax(0, 1fr); }
  .avec-cote { grid-template-columns: minmax(0, 1fr); }
  .cote { position: static; }
  .kpi .valeur { font-size: 24px; }
  .seulement-pc { display: none !important; }
  .seulement-tel { display: block; }
  .filtres .champ { min-width: 0; flex: 1 1 140px; }
  .barre .nom { width: 120px; }
  .table-cadre.cartes-tel table, .table-cadre.cartes-tel thead { display: none; }
}
