/* Portail professionnel SMAM Tools & Garden — couleurs relevees dans le
   monogramme « SG » : bleu nuit des lettres, feuilles du vert d'eau au bleu
   ciel. Boutons dans le bleu SG assombri (texte blanc lisible). Le vert
   reste reserve aux succes : disponible, remises, validations. */
:root {
  --marine: #1f305f;          /* bleu nuit de la charte SMAM Garden (LOGO.pdf) */
  --marine-fonce: #141f47;
  --encre: #16223c;
  --sg-vert: #2bb2a8;
  --sg-bleu: #18a0d3;
  --accent: #1283b0;
  --accent-fonce: #0e6a90;
  --vert: #24b24b;
  --vert-fonce: #178a3e;
  --turquoise: #18a0d3;
  --fond: #f5f7fa;
  --surface: #ffffff;
  --texte: #22293a;
  --doux: #6b7689;
  --bord: #dfe4ee;
  --rouge: #c62828;
  --ambre: #b26a00;
  --ombre: 0 1px 2px rgba(22, 34, 60, .06), 0 4px 16px rgba(22, 34, 60, .06);
  --rayon: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--marine); }
a:hover { color: var(--vert-fonce); }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; color: var(--encre); letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; color: var(--encre); }
h3 { font-size: 1rem; margin: 0 0 .5rem; color: var(--encre); }
.doux { color: var(--doux); }
.petit { font-size: .85rem; }
.nombre { font-variant-numeric: tabular-nums; white-space: nowrap; }
.numero { white-space: nowrap; }
.texte-court { display: none; }

/* ---- en-tete ---- */
.entete { background: var(--marine); color: #fff; position: sticky; top: 0; z-index: 20;
          box-shadow: 0 2px 10px rgba(0, 0, 0, .15); border-bottom: 3px solid var(--sg-bleu);
          border-image: linear-gradient(90deg, var(--sg-vert), var(--sg-bleu)) 1; }
.entete-int { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 22px;
              padding: 0 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; flex-shrink: 0; }
/* logo officiel SMAM GARDEN, version pour fond bleu nuit (charte, page 2) */
.logo .logo-image { height: 42px; width: auto; display: block; }
.logo .logo-espace { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8;
                     border-left: 1px solid rgba(255, 255, 255, .3); padding-left: 10px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #dfe6f3; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap;
         font-size: .93rem; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.actif { background: rgba(43, 178, 168, .2); color: #fff; box-shadow: inset 0 -2px 0 var(--sg-vert); }
.utilisateur { display: flex; align-items: center; gap: 12px; flex-shrink: 0; font-size: .88rem; }
.utilisateur form { margin: 0; }
.lien-bouton { background: none; border: 0; color: #dfe6f3; cursor: pointer; font: inherit; padding: 6px 8px;
               border-radius: 6px; }
.lien-bouton:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.pastille-brouillon { display: inline-flex; align-items: center; gap: 8px;
                      background: linear-gradient(90deg, var(--sg-vert), var(--sg-bleu));
                      color: #fff; text-decoration: none; padding: 7px 12px; border-radius: 999px;
                      font-weight: 600; font-size: .88rem; }
.pastille-brouillon:hover { background: var(--accent-fonce); color: #fff; }
.pastille-brouillon b { background: #fff; color: var(--accent-fonce); border-radius: 999px; min-width: 22px;
                        text-align: center; padding: 0 6px; }

/* ---- page ---- */
.page { max-width: 1320px; margin: 0 auto; padding: 26px 20px 60px; }
.titre-page { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
              flex-wrap: wrap; margin-bottom: 20px; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
         box-shadow: var(--ombre); padding: 20px; }
.grille-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.grille-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pile > * + * { margin-top: 16px; }
/* deux colonnes seulement si le tableau de gauche y tient (brouillon a 960 px) */
@media (max-width: 1024px) { .grille-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .grille-2, .grille-3 { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 18px 16px 50px; }
}
/* menu : libelles courts puis menu sur sa propre ligne, avant tout debordement
   (le client a 7 entrees ; un menu qui defile cache les dernieres) */
@media (max-width: 1500px) { .nav a { padding: 8px 10px; } }
@media (max-width: 1100px) {
  .entete-int { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; overflow: visible; }
}

/* ---- boutons & formulaires ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0;
       border-radius: 8px; background: var(--accent); color: #fff; font-family: inherit; font-weight: 600;
       font-size: .93rem; line-height: 1.1;
       padding: 11px 18px; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--accent-fonce); color: #fff; }
.btn:disabled { background: #b9c2d0; cursor: not-allowed; }
.btn-secondaire { background: #fff; color: var(--marine); box-shadow: inset 0 0 0 1.5px var(--marine); }
.btn-secondaire:hover { background: var(--marine); color: #fff; }
.btn-danger { background: #fff; color: var(--rouge); box-shadow: inset 0 0 0 1.5px var(--rouge); }
.btn-danger:hover { background: var(--rouge); color: #fff; }
.btn-marine { background: var(--marine); }
.btn-marine:hover { background: var(--encre); }
.btn-petit { padding: 7px 12px; font-size: .85rem; }
.btn-large { width: 100%; padding: 14px; font-size: 1rem; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--encre); }
.champ { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=search], select, textarea {
  width: 100%; border: 1.5px solid var(--bord); border-radius: 8px; padding: 10px 12px; font: inherit;
  background: #fff; color: var(--texte);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
                                            box-shadow: 0 0 0 3px rgba(18, 131, 176, .2); }
textarea { resize: vertical; }
.aide { font-size: .82rem; color: var(--doux); margin-top: 4px; }
.en-ligne { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.en-ligne > * { margin: 0; }
.case { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.case input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---- messages ---- */
.message { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; font-size: .93rem;
           border: 1px solid; }
.message-ok { background: #eaf8ee; border-color: #bfe7cb; color: #155f2c; }
.message-erreur { background: #fdecec; border-color: #f5c2c2; color: #8e1c1c; }
.message-alerte { background: #fff5e5; border-color: #f5d7a6; color: #7a4a00; }
.message-info { background: #eaf4fb; border-color: #c4dff2; color: #164a73; }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 700;
         padding: 3px 9px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-disponible { background: #e7f7ec; color: var(--vert-fonce); }
.badge-arrivage { background: #fff3e0; color: var(--ambre); }
.badge-rupture { background: #fdecec; color: var(--rouge); }
.rupture-note { display: block; font-size: .78rem; color: var(--rouge); margin-top: 4px; }
.badge-promo { background: #fdecec; color: var(--rouge); }
.badge-promo::before { display: none; }
.badge-gris { background: #eef1f5; color: var(--doux); }
.badge-bleu { background: #e6effa; color: #1f4f8f; }
.badge-vert { background: #e7f7ec; color: var(--vert-fonce); }
.badge-rouge { background: #fdecec; color: var(--rouge); }
/* dans un tableau, une etiquette longue (« En livraison — BL n° 260308 ») passe
   a la ligne au lieu de deborder de sa carte, quelle que soit la largeur */
.tableau td .badge { white-space: normal; line-height: 1.3; }
.tableau td .badge::before { flex-shrink: 0; }

/* ---- catalogue ---- */
.barre-filtres { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.3fr) auto;
                 gap: 12px; align-items: end; }
@media (max-width: 900px) { .barre-filtres { grid-template-columns: minmax(0, 1fr); } }
.recherche { position: relative; }
.recherche input { padding-left: 38px; font-size: 1rem; }
/* loupe calee sur le BAS du bloc (le champ), pas sur son milieu : le bloc
   contient aussi l'intitule « Rechercher » */
.recherche::before { content: ""; position: absolute; left: 13px; bottom: 14px; width: 15px; height: 15px;
                     border: 2px solid var(--doux); border-radius: 50%; }
.recherche::after { content: ""; position: absolute; left: 26px; bottom: 17px; width: 7px; height: 2px;
                    background: var(--doux); transform: rotate(45deg); }
.options-filtres { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.grille-produits { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.produit { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
           display: flex; flex-direction: column; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.produit:hover { box-shadow: var(--ombre); transform: translateY(-1px); }
.produit-image { aspect-ratio: 4 / 3; background: #fff; display: flex; align-items: center; justify-content: center;
                 border-bottom: 1px solid var(--bord); position: relative; overflow: hidden; }
/* hors du flux : une photo en portrait ne peut plus etirer la carte (un
   pourcentage de hauteur ne se resout pas contre `aspect-ratio`) */
.produit-image img { position: absolute; inset: 0; margin: auto; width: 88%; height: 88%; object-fit: contain; }
.produit-image .badge-promo { position: absolute; top: 10px; left: 10px; }
.sans-photo { color: #c3cad6; font-size: .8rem; text-align: center; }
.sans-photo svg { width: 52px; height: 52px; display: block; margin: 0 auto 4px; }
.produit-corps { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.marque { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
          color: var(--accent); }
.designation { font-weight: 600; font-size: .92rem; line-height: 1.35; color: var(--encre);
               display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
               min-height: 2.7em; }
.codes { font-size: .78rem; color: var(--doux); }
.prix-bloc { margin-top: auto; padding-top: 6px; }
.prix-public { font-size: .8rem; color: var(--doux); text-decoration: line-through; }
.prix-net { font-size: 1.25rem; font-weight: 800; color: var(--encre); }
.prix-net small { font-size: .75rem; font-weight: 600; color: var(--doux); }
.prix-ttc { font-size: .78rem; color: var(--doux); }
.remise { font-size: .78rem; font-weight: 700; color: var(--vert-fonce); }
.ajout { display: flex; gap: 8px; margin-top: 10px; }
.quantite { display: flex; align-items: center; border: 1.5px solid var(--bord); border-radius: 8px;
            overflow: hidden; background: #fff; }
.quantite button { border: 0; background: #f1f4f9; width: 32px; height: 38px; font-size: 1.1rem; cursor: pointer;
                   color: var(--marine); }
.quantite button:hover { background: #e3e9f2; }
.quantite input { width: 48px; border: 0; text-align: center; padding: 0; height: 38px; font-weight: 700;
                  -moz-appearance: textfield; box-shadow: none !important; }
.quantite input::-webkit-outer-spin-button, .quantite input::-webkit-inner-spin-button { -webkit-appearance: none; }
.ajout .btn { flex: 1; padding: 10px; }
.deja { font-size: .78rem; color: var(--vert-fonce); font-weight: 600; }
.retour-ajout { font-size: .8rem; margin-top: 6px; }
.retour-ajout.ok { color: var(--vert-fonce); }
.retour-ajout.alerte { color: var(--ambre); }
.retour-ajout.erreur { color: var(--rouge); }
.plus-resultats { text-align: center; margin-top: 22px; }
.compteur { color: var(--doux); font-size: .9rem; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---- tableaux ---- */
.tableau { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tableau th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
              color: var(--doux); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--bord);
              white-space: nowrap; }
.tableau td { padding: 12px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.tableau tr:hover td { background: #fafbfd; }
.tableau .droite, .tableau th.droite { text-align: right; }
.tableau .vignette { width: 48px; height: 48px; object-fit: contain; background: #fff; border: 1px solid var(--bord);
                     border-radius: 6px; }
.tableau .vignette-vide { display: inline-block; vertical-align: middle; box-sizing: border-box; background: #f4f6fa
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c3cad6' stroke-width='1.5'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='M21 16l-5-5-8 8'/%3E%3C/svg%3E")
  center / 24px no-repeat; }
.defile { overflow-x: auto; }
.habituels .h-sep { display: block; font-size: 0; }
.totaux { margin-left: auto; min-width: 280px; }
.totaux div { display: flex; justify-content: space-between; gap: 24px; padding: 6px 0; }
.totaux .total { border-top: 2px solid var(--encre); margin-top: 6px; padding-top: 10px; font-size: 1.15rem;
                 font-weight: 800; color: var(--encre); }

/* ---- filtres communs : marques en un clic ---- */
.visuellement-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden;
                      clip: rect(0 0 0 0); white-space: nowrap; }
.puces-marques { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.puce { position: relative; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 13px;
        border: 1.5px solid var(--bord); border-radius: 999px; background: #fff; color: var(--marine);
        font-weight: 600; font-size: .86rem; cursor: pointer; user-select: none; }
.puce input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.puce:hover { border-color: var(--accent); }
.puce:has(input:checked) { background: var(--marine); border-color: var(--marine); color: #fff; }
.puce:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(18, 131, 176, .3); }
.puce-n { font-size: .72rem; font-weight: 700; opacity: .65; }

/* ---- commander : bon de commande rapide ---- */
.commande-rapide { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.commande-principale { min-width: 0; }
.filtres-commande { margin-bottom: 14px; }
.barre-recherche { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.carte-tableau { padding: 0; }
.tableau-commande { font-size: .9rem; }
.tableau-commande thead th { position: sticky; top: 67px; z-index: 2; background: #f4f6fa; }
.tableau-commande td { padding: 10px; }
.tableau-commande .c-img { width: 62px; }
.tableau-commande .c-art { min-width: 220px; }
.tableau-commande tbody tr:nth-child(even) td { background: #fafbfd; }
.tableau-commande tr.dans-commande td { background: #edf8f3; }
.tableau-commande tr.dans-commande td:first-child { box-shadow: inset 3px 0 0 var(--vert); }
.tableau .centre { text-align: center; }
.designation-ligne { font-weight: 600; color: var(--encre); line-height: 1.3; }
.habituel { font-size: .75rem; font-weight: 600; color: var(--accent); margin-top: 2px; }
.remise-taux { font-weight: 700; color: var(--vert-fonce); white-space: nowrap; }
.c-remise .petit { white-space: nowrap; font-size: .72rem; }
.remise-taux.promo { color: var(--rouge); }
.c-qte { text-align: center; white-space: nowrap; }
.c-qte .quantite { display: inline-flex; }
.plus-lignes td { text-align: center; padding: 16px; }
.resume-commande { position: sticky; top: 87px; }
.resume-chiffres > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: .92rem; }
.resume-chiffres > div > span:first-child { color: var(--doux); }
.resume-chiffres .resume-remise span { color: var(--vert-fonce); font-weight: 700; }
.resume-chiffres .resume-net { border-top: 1px solid var(--bord); margin-top: 4px; padding-top: 10px; font-weight: 700; }
.resume-chiffres .resume-ttc { border-top: 2px solid var(--encre); margin-top: 6px; padding-top: 10px;
                               font-size: 1.15rem; font-weight: 800; color: var(--encre); }
.resume-chiffres .resume-ttc span:first-child { color: var(--encre); }
.resume-commande .btn-large { margin-top: 14px; }
.resume-note { margin: 10px 0 0; }
.totaux .totaux-remise span { color: var(--vert-fonce); font-weight: 700; }
/* Largeurs : au-dessus de 1280 px, tableau + recapitulatif a droite ; en
   dessous, le recapitulatif devient une barre fixe en bas d'ecran (total TTC et
   validation toujours a portee) ; sous 960 px, les lignes s'empilent en fiches. */
@media (max-width: 1280px) {
  .commande-rapide { grid-template-columns: minmax(0, 1fr); padding-bottom: 72px; }
  .resume-commande { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0;
                     border-radius: 0; padding: 10px 20px; display: flex; align-items: center; gap: 16px;
                     box-shadow: 0 -4px 16px rgba(22, 34, 60, .14); }
  .resume-commande.vide { display: none; }
  .resume-commande h2, .resume-commande .resume-note { display: none; }
  .resume-chiffres { flex: 1; display: flex; justify-content: flex-end; gap: 22px; }
  .resume-chiffres > div:not(.resume-ttc):not(.resume-remise):not(.resume-net) { display: none; }
  .resume-chiffres > div { padding: 0; margin: 0; border: 0; gap: 8px; }
  .resume-chiffres .resume-net, .resume-chiffres .resume-ttc { border: 0; margin: 0; padding: 0; }
  .resume-chiffres .resume-ttc { font-size: 1.05rem; }
  .resume-commande .btn-large { width: auto; margin: 0; padding: 12px 18px; }
}
@media (max-width: 960px) {
  .tableau-commande thead { display: none; }
  .tableau-commande, .tableau-commande tbody { display: block; }
  .tableau-commande tr { display: grid; grid-template-columns: 52px repeat(3, minmax(0, 1fr)); gap: 6px 10px;
                         padding: 12px; border-bottom: 1px solid var(--bord); }
  .tableau-commande tr.dans-commande { background: #edf8f3; box-shadow: inset 3px 0 0 var(--vert); }
  .tableau-commande td { display: block; padding: 0; border: 0; text-align: left; }
  .tableau-commande tbody tr td, .tableau-commande tr.dans-commande td { background: none; box-shadow: none; }
  .tableau-commande td[data-label]::before { content: attr(data-label); display: block; font-size: .66rem;
                                             font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
                                             color: var(--doux); }
  .tableau-commande .c-img { grid-column: 1; grid-row: 1 / 3; }
  .tableau-commande .c-art { grid-column: 2 / -1; min-width: 0; }
  .tableau-commande .c-dispo { grid-column: 2 / -1; }
  .tableau-commande .c-prix { grid-column: 1 / 3; }
  .tableau-commande .c-remise { grid-column: 3; }
  .tableau-commande .c-net { grid-column: 4; text-align: right; }
  .tableau-commande .c-qte { grid-column: 1 / 4; text-align: left; }
  .tableau-commande .c-total { grid-column: 4; text-align: right; align-self: end; }
  .tableau-commande .plus-lignes { display: block; }
}
@media (max-width: 700px) {
  .barre-recherche { grid-template-columns: minmax(0, 1fr); }
  .resume-chiffres > div:not(.resume-ttc) { display: none; }
  .resume-commande { padding: 10px 16px; gap: 12px; }
  .resume-commande .btn-large { padding: 12px 14px; }
  /* « Mes commandes » en fiches */
  .liste-commandes thead { display: none; }
  .liste-commandes, .liste-commandes tbody { display: block; }
  .liste-commandes tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 0;
                        border-bottom: 1px solid var(--bord); }
  .liste-commandes td { display: block; padding: 0; border: 0; }
  .liste-commandes .lc-numero { grid-column: 1; }
  .liste-commandes .lc-total { grid-column: 2; grid-row: 1; }
  .liste-commandes .lc-date { grid-column: 1; font-size: .85rem; color: var(--doux); }
  .liste-commandes .lc-etat { grid-column: 1 / -1; }
  .liste-commandes .lc-action { grid-column: 1 / -1; text-align: left; }
}

/* ---- conditions par categorie (fiche client) ---- */
.conditions .cat-principale td { background: #f4f6fa; border-top: 2px solid var(--bord); }
.conditions .cat-sous td:first-child { padding-left: 32px; }
.conditions .champ-remise { width: 76px; text-align: right; padding: 7px 9px; }
.conditions .case { margin: 0; }
/* ligne masquee : grisee des qu'on decoche, sans attendre l'enregistrement */
.conditions tr:has(.visible-cat:not(:checked)) td { opacity: .5; }
.conditions tr:has(.visible-cat:not(:checked)) td:nth-child(3) { opacity: 1; }
.barre-classement { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px;
                    margin-bottom: 16px; }
.barre-classement select { padding: 7px 10px; }
.conditions-client { margin-top: 6px; font-size: .9rem; }
/* sous-categorie dont la categorie principale est masquee : masquee de fait */
.conditions tr.parent-masque td { opacity: .45; }
.conditions .note-parent { display: none; font-size: .75rem; color: var(--rouge); }
.conditions tr.parent-masque .note-parent { display: inline; }
.proposition { margin-top: 6px; font-size: .8rem; font-weight: 500; }
.proposition input { width: 16px; height: 16px; }

/* ---- tableau de bord ---- */
.tuile { display: block; text-decoration: none; color: inherit; }
.tuile .chiffre { font-size: 2rem; font-weight: 800; color: var(--encre); line-height: 1.1; }
.tuile:hover { border-color: var(--accent); }
.bienvenue { background: linear-gradient(120deg, var(--marine-fonce), var(--marine) 55%, var(--accent));
             color: #fff; border: 0; }
.bienvenue h1 { color: #fff; }
.bienvenue .doux { color: #cdd7e8; }
.actions-rapides { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.actions-rapides .btn-secondaire { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.6); }
.actions-rapides .btn-secondaire:hover { background: #fff; color: var(--marine); }

/* ---- connexion ---- */
.ecran-connexion { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.connexion-marque { background: linear-gradient(150deg, var(--marine-fonce), var(--marine) 55%, var(--accent));
                    color: #fff; display: flex; flex-direction: column; justify-content: center;
                    padding: 60px; gap: 22px; }
.connexion-marque .logo-connexion { width: 260px; max-width: 80%; height: auto; }
.connexion-marque h1 { color: #fff; font-size: 2rem; }
.connexion-marque p { color: #d5deed; max-width: 440px; font-size: 1.02rem; }
.connexion-marques { display: flex; gap: 10px; flex-wrap: wrap; font-size: .8rem; letter-spacing: .06em;
                     text-transform: uppercase; color: #aebcd6; }
.connexion-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.connexion-form .carte { width: 100%; max-width: 400px; padding: 32px; }
@media (max-width: 800px) {
  .ecran-connexion { grid-template-columns: 1fr; }
  .connexion-marque { padding: 36px 24px; }
}

/* ---- identifiants a transmettre ---- */
.identifiants { background: #f5fafc; border: 1.5px dashed var(--accent); border-radius: var(--rayon);
                padding: 18px; font-size: 1rem; white-space: pre-wrap; }
.identifiants code { font: 700 1.15rem/1.4 Consolas, "Courier New", monospace; color: var(--encre);
                     background: #fff; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--bord); }
.pied { text-align: center; color: var(--doux); font-size: .82rem; padding: 30px 20px; }

/* ---- telephone ---- */
@media (max-width: 600px) {
  /* en-tete compact : il ne colle plus en haut (il prendrait un quart de
     l'ecran) ; libelles courts ; le nom du client est deja dans la page */
  .entete { position: static; }
  .logo .logo-espace, .utilisateur .nom-compte, .texte-long { display: none; }
  .logo .logo-image { height: 34px; }
  .texte-court { display: inline; }
  .utilisateur { margin-left: auto; gap: 6px; }
  .pastille-brouillon { padding: 6px 10px; gap: 6px; }
  .nav { flex-wrap: wrap; overflow: visible; }
  .nav a { padding: 7px 10px; font-size: .9rem; }
  .titre-page { align-items: flex-start; }
  .carte { padding: 16px; }
}

/* lignes de commande et articles habituels : une carte par ligne, sans
   defilement horizontal (quantite et total restent a portee de pouce) */
@media (max-width: 700px) {
  .lignes thead, .habituels thead { display: none; }
  .lignes, .lignes tbody, .habituels, .habituels tbody { display: block; }
  .lignes td, .habituels td { display: block; padding: 0; border: 0; text-align: left; }
  .lignes tr:hover td, .habituels tr:hover td { background: none; }
  .lignes td[data-label]::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: 700;
                                   text-transform: uppercase; letter-spacing: .05em; color: var(--doux);
                                   margin-bottom: 2px; }

  .lignes tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px 12px;
               padding: 14px 0; border-bottom: 1px solid var(--bord); }
  .lignes .l-article { grid-column: 1 / -1; }
  .lignes.modifiable .l-article { grid-column: 1 / 4; }
  .lignes .l-suppr { grid-column: 4; grid-row: 1; align-self: start; }
  .lignes .l-prix { grid-column: 1; text-align: left; }
  .lignes .l-remise { grid-column: 2; text-align: left; }
  .lignes .l-qte { text-align: left; }
  .lignes .l-net { grid-column: 3 / -1; }
  .lignes .l-sans-prix { grid-column: 1 / -1; }
  .lignes .l-qte { grid-column: 1 / 3; }
  .lignes .l-total { grid-column: 3 / -1; text-align: right; align-self: end; font-size: 1rem; }

  .habituels tr { display: grid; grid-template-columns: 22px 50px minmax(0, 1fr) auto; gap: 8px 10px;
                  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--bord); }
  .habituels .h-choix { grid-column: 1; grid-row: 1; }
  .habituels .h-image { grid-column: 2; grid-row: 1; }
  .habituels .h-article { grid-column: 3 / -1; grid-row: 1; }
  .habituels .h-achats { grid-column: 1 / -1; }
  .habituels .h-sep { display: inline; font-size: inherit; }
  .habituels .h-net { grid-column: 1 / 4; }
  .habituels .h-net::before { content: "Net HT  "; color: var(--doux); font-size: .78rem; font-weight: 600; }
  .habituels .h-qte { grid-column: 4; }
}

@media print {
  .entete, .pied, .ne-pas-imprimer { display: none !important; }
  body { background: #fff; }
  .carte { box-shadow: none; border: 0; padding: 0; }
  .page { padding: 0; }
}

/* ---- cases a cocher en grille (marques, familles) ---- */
.grille-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.grille-cases .case { margin: 0; }
.grille-cases .case:has(input[type=checkbox]:not(:checked)) { opacity: .5; text-decoration: line-through; }
.masquages-globaux summary { cursor: pointer; }


/* ---- documents et chiffre d'affaires ---- */
.onglets { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.onglet { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--bord, #dfe4ee);
  color: var(--marine); text-decoration: none; font-weight: 600; font-size: .92rem; }
.onglet.actif { background: var(--marine); border-color: var(--marine); color: #fff; }
.onglet .compte { opacity: .7; font-weight: 400; margin-left: 4px; }
.onglets-petits { margin: 0; }
.onglets-petits .onglet { padding: 5px 11px; font-size: .82rem; }
.filtre-annee { margin-bottom: 12px; gap: 8px; }
.liste-documents tfoot td { border-top: 2px solid var(--bord, #dfe4ee); }
.grille-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
  margin-bottom: 16px; }
.grille-chiffres .carte { margin-bottom: 0; }
.chiffre-valeur { font-size: 1.7rem; font-weight: 700; color: var(--marine); margin: 4px 0; }
.chiffre-valeur small { font-size: .9rem; font-weight: 400; color: var(--doux); }
.hausse { color: var(--vert-fonce); font-weight: 600; }
.baisse { color: var(--rouge); font-weight: 600; }
.courbe-bloc { width: 100%; }
.courbe { width: 100%; height: auto; display: block; }
.courbe .grille { stroke: #e6eaf1; stroke-width: 1; }
.courbe .grille.zero { stroke: #b9c4d6; }
.courbe .axe { font-size: 12px; fill: #6b7689; font-family: inherit; }
.legende { display: flex; gap: 18px; justify-content: center; margin-top: 6px; font-size: .9rem; }
.legende-annee { display: inline-flex; align-items: center; gap: 6px; }
.legende-annee i { width: 22px; height: 4px; border-radius: 2px; display: inline-block; }
.tableau-mois td, .tableau-mois th { padding: 6px 10px; }
@media (max-width: 700px) {
  .chiffre-valeur { font-size: 1.4rem; }
  /* la courbe est reduite ~2x : libelles agrandis, un mois sur deux */
  .courbe .axe-y { font-size: 24px; }
  .courbe .mois { font-size: 24px; }
  .courbe .mois-impair { display: none; }
  .m-cacher { display: none; }
  /* meilleurs achats : une fiche par article (designation pleine largeur) */
  .meilleurs thead { display: none; }
  .meilleurs tr { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 12px;
    padding: 12px 0; border-bottom: 1px solid #e6eaf1; }
  .meilleurs td { padding: 0; border: 0; text-align: left; }
  .meilleurs .m-art { grid-column: 1 / -1; }
  .meilleurs .m-qte::after { content: " ×"; color: var(--doux); }
}

/* ---- suivi d'une commande (client) ---- */
.etapes { list-style: none; display: flex; gap: 0; margin: 0 0 18px; padding: 0; counter-reset: etape; }
.etapes li { flex: 1; position: relative; padding: 12px 12px 12px 44px; background: #fff; border: 1px solid #dfe4ee;
  color: var(--doux); font-weight: 600; font-size: .92rem; }
.etapes li + li { border-left: 0; }
.etapes li:first-child { border-radius: 10px 0 0 10px; }
.etapes li:last-child { border-radius: 0 10px 10px 0; }
.etapes li::before { counter-increment: etape; content: counter(etape); position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: #e6eaf1; color: var(--doux);
  display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.etapes li span { display: block; font-weight: 400; font-size: .8rem; }
.etapes li.fait { color: var(--vert-fonce); }
.etapes li.fait::before { content: "✓"; background: var(--vert-fonce); color: #fff; }
.etapes li.en-cours { color: var(--marine); background: #eef4fb; }
.etapes li.en-cours::before { background: var(--accent); color: #fff; }
@media (max-width: 600px) {
  .etapes { flex-direction: column; }
  .etapes li + li { border-left: 1px solid #dfe4ee; border-top: 0; }
  .etapes li:first-child { border-radius: 10px 10px 0 0; }
  .etapes li:last-child { border-radius: 0 0 10px 10px; }
}
