:root {
  /* Couleurs de marque Kevla : vert profond, blanc, jaune */
  --brand: #0d5c3f;
  --brand-dark: #073d2a;
  --brand-deep: #052a1d;
  --brand-soft: #e8f3ee;
  --brand-mid: #14795a;
  --accent: #f5b301;
  --accent-dark: #c98d00;
  --accent-soft: #fff6d9;

  /* Rappel des anciennes variables (alias sur la charte) */
  --blue: var(--brand);
  --blue-dark: var(--brand-dark);
  --blue-soft: var(--brand-soft);

  --ink: #16202f;
  --ink-soft: #5b6675;
  --line: #e3e8ef;
  --bg: #f5f8f6;
  --white: #ffffff;

  /* Etats (semantique, inchange) */
  --green: #12805c;
  --green-soft: #e2f5ee;
  --amber: #b26a00;
  --amber-soft: #fdf1dc;
  --red: #c02626;
  --red-soft: #fdeaea;
  --violet: #6b46c1;
  --violet-soft: #f0eafc;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ------------------------------------------------------------ layout */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 18px; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 40px; width: auto; max-width: 190px; object-fit: contain; display: block; }
.brand .tag { font-size: 11px; color: var(--ink-soft); letter-spacing: .3px; }

.topnav { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Onglets de navigation : vrais boutons "en relief" avec une lisere basse
   qui simule la profondeur (effet 3D). L'onglet actif se remplit de la
   couleur de marque ; le panier reste le seul element plein (voir .cart-btn)
   ce qui cree une hierarchie visuelle claire. */
.topnav > button:not(.cart-btn) {
  background: linear-gradient(180deg, #ffffff 0%, #eef3f0 100%);
  border: 1px solid #d3dae4;
  border-bottom: 3px solid #c2ccd6;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 2px 4px rgba(16, 24, 40, .07);
  transition: background .15s, border-color .15s, color .15s, box-shadow .12s, transform .08s;
}
.topnav .nav-lbl { display: inline; white-space: nowrap; }
.topnav .nav-ico {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; opacity: .78;
}
.topnav button:not(.cart-btn):hover .nav-ico,
.topnav button:not(.cart-btn).on .nav-ico { opacity: 1; }
.topnav > button:not(.cart-btn):hover {
  background: linear-gradient(180deg, #f4faf7 0%, #e5f1ec 100%);
  border-color: var(--brand-mid);
  border-bottom-color: var(--brand-mid);
  color: var(--brand-dark);
}
.topnav > button:not(.cart-btn):active {
  transform: translateY(1px);
  border-bottom-width: 2px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12);
}
.topnav > button:not(.cart-btn).on {
  background: linear-gradient(180deg, var(--brand-mid) 0%, var(--brand) 100%);
  border-color: var(--brand-dark);
  border-bottom-color: var(--brand-dark);
  color: #fff;
  box-shadow: 0 3px 9px rgba(13, 92, 63, .28);
}
.topnav > button:not(.cart-btn).on:active {
  transform: translateY(1px);
  border-bottom-width: 2px;
  box-shadow: 0 1px 4px rgba(13, 92, 63, .3);
}
.topnav > button:not(.cart-btn):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cart-btn {
  position: relative; background: linear-gradient(180deg, var(--brand-mid) 0%, var(--brand) 100%);
  color: #fff; border: 1px solid var(--brand-dark); border-bottom: 3px solid var(--brand-dark);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  box-shadow: 0 3px 9px rgba(13, 92, 63, .28);
  transition: background .15s, box-shadow .12s, transform .08s;
}
.cart-btn:hover { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%); }
.cart-btn:active { transform: translateY(1px); border-bottom-width: 2px; box-shadow: 0 1px 4px rgba(13, 92, 63, .3); }
.cart-icon { display: grid; place-items: center; opacity: .95; }
.cart-count {
  background: var(--white); color: var(--brand-dark); border-radius: 20px;
  min-width: 20px; height: 20px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; padding: 0 5px;
}
/* Montant selectionne, affiche directement dans le bouton Panier */
.cart-total {
  background: var(--accent); color: #1c1c1c; border-radius: 7px;
  padding: 3px 9px; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* Bandeau flottant : recapitulatif apres ajout */
.cart-bar {
  background: var(--brand-dark); color: #fff; padding: 11px 0;
  box-shadow: 0 4px 14px rgba(5, 42, 29, .25); position: relative; z-index: 5;
  animation: slideDown .2s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } }
.cart-bar .wrap {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.cart-bar-txt { font-size: 14.5px; flex: 1; min-width: 190px; }
.cart-bar-txt strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.cart-bar-btn {
  background: var(--accent); color: #1c1c1c; border: 0; cursor: pointer;
  padding: 8px 16px; border-radius: 8px; font-weight: 650; font-size: 13.5px;
  white-space: nowrap;
}
.cart-bar-btn:hover { background: var(--accent-dark); }
/* Soulignement bref du bandeau apres un ajout */
.cart-bar.flash { animation: slideDown .2s ease, flashBar .5s ease .05s; }
@keyframes flashBar {
  0% { background: var(--brand-dark); }
  35% { background: var(--brand-mid); }
  100% { background: var(--brand-dark); }
}

/* Banniere d'edition de commande (mode modification d'une commande existante) */
.edit-banner {
  background: #fff7e6; border: 1px solid #f0d089; color: #8a5a00;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 13.5px;
}

@media (max-width: 620px) {
  .cart-label { display: none; }
  .topbar .wrap { gap: 8px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 12px; }

  /* Barre de navigation mobile : le panier est le premier element visuel et
     reste aligne a droite (margin-left:auto) ; les trois onglets se repartissent
     equitablement sur la largeur. flex-wrap garantit un repli propre : si l'ecran
     est trop etroit, le panier passe seul en haut et les onglets occupent la
     ligne suivante, sans jamais se chevaucher (pas de position:absolute). */
  .topbar { position: sticky; top: 0; z-index: 60; }
  .topbar .wrap {
    flex-wrap: wrap; gap: 7px; padding: 8px 12px; align-items: center;
  }
  .topbar .brand { display: none; }

  /* Onglets mobile = icone + texte, traites de facon identique sur les trois
     boutons (plus d'icone orpheline). Chaque pastille est de largeur egale et
     l'icone + le libelle sont centres ensemble avec un espacement constant ;
     si l'ecran est trop etroit le libelle est tronque proprement (jamais de
     chevauchement). Le tout reste sur une seule ligne grace a flex-wrap. */
  .topnav { width: 100%; margin-left: 0; gap: 6px; order: 2; }
  .topnav > button:not(.cart-btn) {
    flex: 1 1 0; min-width: 0; padding: 9px 6px; border-radius: 10px;
    gap: 7px; justify-content: center;
    box-shadow: 0 2px 4px rgba(16, 24, 40, .07);
    border-bottom-width: 3px;
  }
  .topnav > button:not(.cart-btn).on { box-shadow: 0 3px 9px rgba(13, 92, 63, .28); }
  .topnav .nav-ico { opacity: .82; flex: 0 0 auto; }
  .topnav .nav-ico svg { width: 19px; height: 19px; }
  .topnav .nav-lbl {
    display: inline; font-size: 12.5px; font-weight: 600; line-height: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* Le panier : premier element visuel, aligne a droite sur la ligne du haut. */
  .topnav .cart-btn {
    order: -1; margin-left: auto; flex: 0 0 auto;
    padding: 8px 12px; gap: 7px; border-radius: 10px;
  }
  .topnav .cart-btn .cart-total { padding: 3px 8px; font-size: 12.5px; }

  /* Banniere d'accueil */
  .hero { padding: 12px 0 14px; }
  .hero-banner { border-radius: 10px; }
  .hero .whatsapp-cta { margin-top: 10px; gap: 7px; }
  .btn-wa, .btn-outline-wa { flex: 1 1 auto; justify-content: center; padding: 11px 12px; }

  /* Filtres sur deux lignes */
  .catalogue-bar { flex-wrap: wrap; gap: 8px; }
  .catalogue-bar .input, .catalogue-bar .select { max-width: none !important; flex: 1 1 140px; }

  /* Catalogue : deux colonnes compactes sur mobile, plus de produits visibles
     d'un coup d'oeil. Les cartes sont allongees et serrees. */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .product-info { padding: 9px 10px; gap: 5px; }
  .product-name { font-size: 13px; line-height: 1.25; }
  .product-sku { font-size: 10px; }
  .product-desc { font-size: 11px; -webkit-line-clamp: 2; line-clamp: 2; }
  .product-price { font-size: 15px; }
  /* Boutons de commande places au-dessus du nom du produit */
  .product-actions {
    display: flex; gap: 5px; align-items: center; flex-wrap: wrap;
    margin-bottom: 2px;
  }
  .product-actions .stepper { flex: 0 0 auto; }
  .product-actions .stepper input { height: 42px; width: 44px; font-size: 15px; }
  .product-actions .stepper button { width: 42px; height: 42px; font-size: 22px; }
  .product-actions .btn { flex: 1 1 auto; min-height: 42px; padding: 8px 12px; font-size: 13px; }

  /* Rail promos : cartes un peu plus etroites sur mobile */
  .promo-rail { padding: 10px 9px 12px; }
  .promo-card { flex: 0 0 142px; padding: 10px; }
  .promo-card .promo-now { font-size: 15px; }

  /* Panier */
  .cart-layout { grid-template-columns: 1fr; }
  .btn { font-size: 14px; }
  .input, .select, .textarea { font-size: 16px; }  /* evite le zoom auto iOS */
  .modal-bg { padding: 10px; }
  .modal { padding: 18px 16px; }
  .welcome-body { padding: 16px 15px 20px; }

  /* Panier : le tableau 5 colonnes devient une liste de cartes, sinon le nom
     du produit se casse en une colonne et la page deborde. */
  .cart-table thead { display: none; }
  .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; width: 100%; }
  .cart-table tr {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 11px 12px; margin-bottom: 9px; background: var(--white);
    display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
    align-items: center;
  }
  .cart-table td { padding: 0; border: 0; }
  .cart-cell-name { grid-column: 1 / -1; }
  .cart-cell-name > div:first-child { font-size: 14.5px; line-height: 1.3; }
  .cart-cell-unit { grid-column: 1; text-align: left; font-size: 12.5px; color: var(--ink-soft); }
  .cart-cell-unit::before { content: "Prix unitaire : "; }
  .cart-cell-qty { grid-column: 2; }
  .cart-cell-qty .stepper { margin-left: 0 !important; }
  .cart-cell-total { grid-column: 1; text-align: left; font-size: 14px; }
  .cart-cell-total::before { content: "Total : "; }
  .cart-cell-del { grid-column: 2; }
  .cart-cell-del .btn { padding: 6px 12px; font-size: 12.5px; }
  /* Securite : jamais de largeur minimale sur le panier mobile (sinon
     le wrapper overflow-x:auto cree un debordement horizontal). */
  .cart-table { min-width: 0; }

  /* Detail des articles d'une commande (page Suivi) : meme traitement
     que le panier -> cartes empilees, plus de tableau a 4 colonnes qui
     deborde l'ecran. */
  .detail-items { width: 100%; }
  .detail-items thead { display: none; }
  .detail-items, .detail-items tbody, .detail-items tr, .detail-items td { display: block; width: 100%; }
  .detail-items tr {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 9px; background: var(--white);
  }
  .detail-items td { padding: 3px 0; border: 0; }
  .detail-items td:first-child { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
  .detail-items td.num { text-align: left; font-size: 13px; color: var(--ink-soft); }
  .detail-items td.num::before { color: var(--ink-soft); margin-right: 4px; }
  .detail-items td.num:nth-of-type(1)::before { content: "P.U. : "; }
  .detail-items td.num:nth-of-type(2)::before { content: "Qté : "; }
  .detail-items td.num:nth-of-type(3)::before { content: "Montant : "; }
  .detail-items td.num:nth-of-type(3) { color: var(--ink); font-weight: 700; }
}

@media (max-width: 380px) {
  .product-actions { flex-wrap: wrap; }
  .product-actions .stepper { max-width: 100%; }
  /* Tres petit ecran : on reduit encore le texte des onglets pour eviter le troncage */
  .topnav > button:not(.cart-btn) { padding: 8px 3px; }
  .topnav .nav-lbl { font-size: 11.5px; }
}

/* ------------------------------------------------------------ pieces communes */
.panel {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.panel-head h2 { font-size: 16px; font-weight: 650; }
.panel-body { padding: 20px; }

.btn {
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  padding: 9px 16px; border-radius: 9px; font-size: 14px; font-weight: 550;
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
}
.btn:hover { border-color: #c9d2df; background: #fbfcfe; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* Bouton d'action principal (validation de commande) : jaune de marque */
.btn-success { background: var(--accent); border-color: var(--accent); color: #1c1c1c; }
.btn-success:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #1c1c1c; }
.btn-danger { background: var(--red-soft); border-color: #f4c9c9; color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn-outline { background: var(--white); border-color: var(--line); color: var(--ink); }
.btn-outline:hover { background: var(--bg); border-color: var(--brand-mid); color: var(--brand-dark); }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink); }
.field .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d3dae4;
  border-radius: 9px; background: var(--white); color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(13, 92, 63, .16);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag-a-verifier { background: var(--amber-soft); color: var(--amber); }
.tag-en-preparation { background: var(--violet-soft); color: var(--violet); }
.tag-en-livraison { background: var(--blue-soft); color: var(--blue-dark); }
.tag-livree { background: var(--green-soft); color: var(--green); }
.tag-annulee { background: var(--red-soft); color: var(--red); }
.tag-neutral { background: #eef1f5; color: var(--ink-soft); }
.tag-warn { background: var(--amber-soft); color: var(--amber); }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-soft); font-weight: 700; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: #fafbfd;
}
td { padding: 11px 12px; border-bottom: 1px solid #f0f3f7; font-size: 14px; vertical-align: middle; }
tbody tr:hover { background: #fafcff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-soft); }
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .55; }

/* ------------------------------------------------------------ toast */
#toasts {
  position: fixed; top: 78px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; max-width: 380px;
}
.toast {
  background: var(--ink); color: #fff; padding: 12px 15px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.22); animation: slide .25s ease;
}
.toast.ok { background: #10684b; }
.toast.err { background: #a91f1f; }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } }

/* ------------------------------------------------------------ modale */
.modal-bg {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .48);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 150; padding: 18px; overflow-y: auto;
}
.modal {
  background: var(--white); border-radius: 14px; width: 100%; max-width: 560px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3); animation: pop .2s ease; max-height: 92vh;
  display: flex; flex-direction: column; min-height: 0; margin: auto;
}
.modal.wide { max-width: 780px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 650; }
.modal-body { padding: 20px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 9px; background: #fafbfd;
  border-radius: 0 0 14px 14px;
}
.modal-close {
  border: none; background: transparent; color: var(--ink-soft);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 0 6px;
  border-radius: 8px; align-self: center;
}
.modal-close:hover { background: #eef1f6; color: var(--ink); }
.x-btn { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--ink-soft); padding: 0 4px; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-8px); } }

/* ------------------------------------------------------------ page client */
.hero {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  color: #fff; padding: 22px 0 26px;
}
.hero h1 { font-size: 25px; font-weight: 700; margin-bottom: 5px; }
.hero p { opacity: .92; font-size: 14.5px; }

/* Banniere officielle Kevla (1920x750) */
.hero-banner {
  border-radius: 14px; overflow: hidden; line-height: 0;
  box-shadow: 0 10px 30px rgba(5, 42, 29, .32);
  border: 1px solid rgba(255, 255, 255, .18);
}
.hero-banner img {
  width: 100%; height: auto; display: block;
  /* Sur petit ecran, on ne rogne pas : on laisse la largeur shrinker */
  min-height: 150px; object-fit: cover; object-position: center right;
}

.hero .whatsapp-cta { margin-top: 16px; display: flex; gap: 9px; flex-wrap: wrap; }
.btn-wa {
  background: #25d366; color: #fff; border: 0; padding: 10px 18px;
  border-radius: 9px; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-wa:hover { filter: brightness(1.06); }
.btn-outline-wa {
  background: var(--white); color: var(--brand-dark); border: 1px solid var(--brand-dark);
  padding: 10px 18px; border-radius: 9px; font-weight: 600; font-size: 14px;
}
.btn-outline-wa:hover { background: var(--brand-soft); }

.notice {
  background: var(--amber-soft); border: 1px solid #f0dcb4; color: #7a4a00;
  padding: 12px 15px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px;
}
.notice.info { background: var(--blue-soft); border-color: #c5dbfa; color: var(--blue-dark); }
.notice.err { background: var(--red-soft); border-color: #f4c9c9; color: var(--red); }

.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px;
}

.order-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.order-card:hover { border-color: var(--brand-mid); box-shadow: 0 2px 10px rgba(13,92,63,.10); }
.order-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order-card-sub { font-size: 12.5px; color: #6b7b73; margin-top: 4px; }

/* Recherche par reference : option secondaire repliee sous le bandeau */
.lookup-alt {
  max-width: 560px; margin: 22px auto 0; border-top: 1px dashed var(--line); padding-top: 14px;
}
.lookup-alt summary {
  cursor: pointer; color: var(--brand-dark); font-weight: 600; font-size: 13.5px;
  list-style: none; -webkit-tap-highlight-color: transparent; user-select: none;
}
.lookup-alt summary::-webkit-details-marker { display: none; }
.lookup-alt summary::before { content: "▸ "; }
.lookup-alt[open] summary::before { content: "▾ "; }
.lookup-alt[open] .panel { margin-top: 12px; }
.product-card {
  background: var(--white); border: 1px solid var(--line); border-bottom: 2px solid #d7dee7;
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 3px 8px rgba(16, 24, 40, .05);
  transition: box-shadow .16s, transform .16s, border-color .16s;
}
.product-card:hover { box-shadow: 0 4px 10px rgba(16, 24, 40, .1), 0 10px 22px rgba(16, 24, 40, .1); transform: translateY(-2px); border-color: #cdd6e0; }
/* Le catalogue n'affiche plus de vignette : la piece est identifiee par son
   nom, ce qui evite de charger des images volumineuses sur mobile. */
.product-info { padding: 11px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.product-name { font-weight: 620; font-size: 14px; line-height: 1.3; }
.product-sku { font-size: 11.5px; color: var(--ink-soft); font-family: ui-monospace, Menlo, Consolas, monospace; }
.product-desc {
  font-size: 12.5px; color: var(--ink-soft); display: -webkit-box;
  -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-price { font-size: 18px; font-weight: 700; color: var(--blue-dark); margin-top: auto; }
.product-price .cur { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.product-actions { display: flex; gap: 7px; align-items: center; margin-top: 8px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid #d3dae4; border-radius: 10px; overflow: hidden; background: var(--white); }
.stepper button {
  width: 40px; height: 42px; border: 0; background: #eef4f0;
  font-size: 22px; line-height: 1; font-weight: 700; color: var(--brand-dark);
  cursor: pointer; transition: background .12s, color .12s;
}
.stepper button:hover { background: var(--brand-soft); color: var(--brand); }
.stepper button:active { background: var(--brand); color: #fff; }
.stepper input {
  width: 46px; height: 42px; text-align: center; border: 0;
  border-left: 1px solid #e3e8ef; border-right: 1px solid #e3e8ef;
  font-size: 16px; font-weight: 700; color: var(--ink); background: var(--white);
  -moz-appearance: textfield;
}
.stepper input:focus { outline: none; }
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.catalogue-bar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.catalogue-bar .input { max-width: 280px; }

/* ===================================================== RAIL PROMOTIONS */
.promo-rail {
  background: linear-gradient(100deg, #fff6f0 0%, #fff 60%);
  border: 1px solid #ffd9c2; border-radius: 14px;
  padding: 12px 12px 14px; margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(255, 122, 41, .10);
}
.promo-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.promo-title { font-size: 16px; font-weight: 800; color: #e8550f; letter-spacing: .2px; }
.promo-nav { display: flex; gap: 6px; }
.promo-arrow {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid #ffc9a8;
  background: #fff; color: #e8550f; font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.promo-arrow:hover { background: #ffe9dc; }
.promo-arrow:active { transform: scale(.92); }
.promo-track {
  overflow-x: auto; padding-bottom: 6px;
  scrollbar-width: thin;
}
.promo-track-inner {
  display: flex; gap: 12px; width: max-content;
  animation: promoMarquee 45s linear infinite;
  will-change: transform;
}
/* Pause au survol (desktop) ou au toucher (mobile) pour lire / ajouter. */
.promo-track:hover .promo-track-inner,
.promo-track:active .promo-track-inner { animation-play-state: paused; }
@keyframes promoMarquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.promo-track::-webkit-scrollbar { height: 6px; }
.promo-track::-webkit-scrollbar-thumb { background: #ffc9a8; border-radius: 6px; }
.promo-card {
  flex: 0 0 162px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 12px 11px; display: flex; flex-direction: column; gap: 7px;
  position: relative; min-width: 0; overflow: hidden;
}
.promo-card .promo-badge {
  position: absolute; top: 8px; right: 8px;
  background: #e8550f; color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 7px; border-radius: 999px; z-index: 2;
}
/* Pas de vignette : la carte reste compacte et sans image manquante.
   Le nom occupe l'espace libre pour garder toutes les cartes alignees. */
.promo-card .promo-name {
  font-size: 14px; font-weight: 700; line-height: 1.26; color: var(--ink);
  min-height: 53px; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px;
  overflow-wrap: break-word; word-break: break-word;
}
.promo-card .promo-prices { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.promo-card .promo-old {
  font-size: 13px; color: #9aa6b2; text-decoration: line-through;
}
.promo-card .promo-now {
  font-size: 16px; font-weight: 800; color: #e8550f;
}
.promo-card .promo-now small { font-size: 11px; font-weight: 600; }
.promo-card .promo-add {
  margin-top: 2px; width: 100%; padding: 8px 10px; font-size: 13px;
  background: #e8550f; color: #fff; border: 0; border-radius: 9px; cursor: pointer;
}
.promo-card .promo-add:hover { background: #cf4a0c; }
.promo-card .promo-add:disabled { background: #cfd6dd; cursor: not-allowed; }

/* ===== Bandeau d'actualites / annonces defilantes (sous le rail promo) ===== */
.news-ticker {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 9px 0; padding: 0 12px; height: 42px;
  background: linear-gradient(90deg, #fff7ed, #fff);
  border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden;
}
.news-tag {
  flex: 0 0 auto; font-weight: 800; font-size: 12.5px; color: #c2410c;
  background: #ffedd5; padding: 5px 10px; border-radius: 7px;
  white-space: nowrap; letter-spacing: .2px;
}
.news-viewport { flex: 1 1 auto; overflow: hidden; height: 100%; position: relative; }
.news-track {
  display: inline-flex; align-items: center; height: 100%;
  white-space: nowrap; will-change: transform;
  animation: newsMarquee 32s linear infinite;
}
.news-track:hover { animation-play-state: paused; }
.news-item {
  display: inline-flex; align-items: center;
  font-size: 13.5px; color: var(--ink); padding: 0 28px;
}
.news-item::before {
  content: "\25CF"; color: #f59e0b; font-size: 8px;
  margin-right: 12px; vertical-align: middle;
}
@keyframes newsMarquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (max-width: 520px) {
  .news-ticker { margin: 10px 9px 0; height: 40px; }
  .news-tag { font-size: 11.5px; padding: 4px 8px; }
  .news-item { font-size: 12.5px; padding: 0 20px; }
}

.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.summary-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.summary-row.total {
  border-top: 2px solid var(--line); margin-top: 9px; padding-top: 12px;
  font-size: 18px; font-weight: 700; color: var(--blue-dark);
}
.sticky { position: sticky; top: 86px; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 4px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--blue); border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--blue-soft);
}
.tl-when { font-size: 12px; color: var(--ink-soft); }
.tl-what { font-weight: 600; font-size: 14px; }
.tl-note { font-size: 13px; color: var(--ink-soft); }

.footer {
  background: var(--brand-deep); color: #bcd3c8; padding: 26px 0; margin-top: 34px; font-size: 13.5px;
}
.footer .wrap { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; }
.footer h4 { color: #fff; font-size: 14px; margin-bottom: 7px; }
.footer a { color: #8fb8ff; }
.footer img {
  background: var(--white); padding: 7px 14px; border-radius: 9px;
  height: 38px; width: auto; max-width: 200px; object-fit: contain;
  margin-bottom: 12px;
}

/* ------------------------------------------------------------ fenetre d'accueil */
.welcome-bg {
  position: fixed; inset: 0; z-index: 300;
  background: linear-gradient(160deg, rgba(7,61,42,.96), rgba(5,42,29,.97));
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto;
  animation: fadeIn .22s ease;
}
@keyframes fadeIn { from { opacity: 0; } }

.welcome-card {
  background: var(--white); border-radius: 16px; width: 100%; max-width: 480px;
  box-shadow: 0 30px 80px rgba(5, 42, 29, .45); margin: auto;
  animation: pop .25s ease; overflow: hidden;
  border-top: 5px solid var(--accent);
}

.welcome-head {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff; padding: 24px 26px 20px; text-align: center;
}
.welcome-logo {
  height: 46px; width: auto; max-width: 210px; object-fit: contain;
  margin-bottom: 14px;
}
.welcome-head h1 { font-size: 22px; font-weight: 700; margin-bottom: 5px; }
.welcome-head p { font-size: 14px; opacity: .92; }

.welcome-body { padding: 22px 26px 26px; }

.welcome-guide {
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0; padding: 13px 16px; margin-bottom: 18px;
  font-size: 14px; color: var(--brand-dark); line-height: 1.6; font-weight: 550;
  text-align: center;
}
.welcome-guide p { margin: 0; }

.welcome-btn {
  width: 100%; padding: 12px; font-size: 15px; margin-top: 4px;
  background: var(--accent); border-color: var(--accent); color: #1c1c1c;
}
.welcome-btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #1c1c1c; }

.welcome-alt {
  text-align: center; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft);
}

.welcome-done-box { text-align: center; padding: 10px 0 4px; }
.welcome-done-icon {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--brand); color: var(--accent);
  display: grid; place-items: center; font-size: 26px; font-weight: 700;
}
.welcome-done-box h2 { font-size: 19px; font-weight: 680; margin-bottom: 6px; }
.welcome-done-box p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; }

@media (max-width: 520px) {
  .welcome-body { padding: 18px 18px 22px; }
  .welcome-head { padding: 20px 18px 16px; }
  .welcome-head h1 { font-size: 19px; }
}

/* ------------------------------------------------------------ back-office */
.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(140deg, var(--brand-deep), var(--brand-mid));
}
.login-card {
  background: var(--white); border-radius: 16px; padding: 30px; width: 100%;
  max-width: 390px; box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-card img.logo { height: 46px; width: auto; max-width: 210px; object-fit: contain; margin-bottom: 18px; }

.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--brand-deep); color: #bcd3c8; padding: 16px 12px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 6px 8px 16px; }
.sidebar .brand img {
  background: var(--white); padding: 6px 12px; border-radius: 8px;
  height: 32px; width: auto; max-width: 160px; object-fit: contain;
}
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: #b6c0cf; font-size: 14px; font-weight: 500; margin-bottom: 2px;
  background: none; border: 0; width: 100%; text-align: left;
}
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.on { background: var(--blue); color: #fff; }
.side-link .ico { width: 18px; text-align: center; }
.side-badge {
  margin-left: auto; background: var(--red); color: #fff; border-radius: 20px;
  font-size: 11px; font-weight: 700; padding: 1px 7px;
}
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); }
.side-foot .who { font-size: 13px; color: #fff; font-weight: 600; }
.side-foot .role { font-size: 11.5px; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }

.main { padding: 22px 24px 40px; background: var(--bg); }
.page-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { font-size: 21px; font-weight: 680; }
.page-head .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s;
}
.stat:hover { transform: translateY(-2px); }
.stat .k { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.stat .v { font-size: 27px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.accent-amber .v { color: var(--amber); }
.stat.accent-violet .v { color: var(--violet); }
.stat.accent-blue .v { color: var(--blue); }
.stat.accent-green .v { color: var(--green); }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  padding: 6px 13px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--white); font-size: 13px; color: var(--ink-soft); font-weight: 550;
}
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 148px 1fr; gap: 7px 12px; font-size: 14px; }
.kv dt { color: var(--ink-soft); font-size: 13px; }
.kv dd { font-weight: 550; }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 12px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar { width: 100%; background: linear-gradient(180deg, var(--blue), var(--blue-dark)); border-radius: 5px 5px 0 0; min-height: 3px; }
.bar-lbl { font-size: 11px; color: var(--ink-soft); }
.bar-val { font-size: 11.5px; font-weight: 700; color: var(--blue-dark); }

.img-picker { display: flex; gap: 10px; align-items: center; }
.img-preview {
  width: 62px; height: 62px; border: 1px dashed #c9d2df; border-radius: 10px;
  display: grid; place-items: center; overflow: hidden; background: #fafbfd; flex-shrink: 0;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 1024px) {
  .cart-layout, .detail-grid, .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar .brand, .side-foot { width: 100%; }
  .side-link { width: auto; }
  .side-foot { margin-top: 8px; }
  .sticky { position: static; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Indice de defilement horizontal (affiche uniquement en mobile) */
.scroll-hint {
  display: none; text-align: center; font-size: 12px; color: var(--ink-soft);
  padding: 8px 0 2px; letter-spacing: .3px;
}

/* ===== Back-office — adaptation mobile (≤768px) =====
   Avec la regle 1024px la sidebar devient une rangee qui deborde et coupe
   les libelles ("Produits" rogne a droite) et force un debordement horizontal
   de toute la page. On transforme la sidebar en barre de navigation
   horizontalement SCROLLABLE (plus de rognage) et on empeche tout
   debordement de page. */
@media (max-width: 768px) {
  .admin-shell { display: block; max-width: 100%; }
  .sidebar {
    flex-direction: row; flex-wrap: nowrap; align-items: center;
    gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    position: sticky; top: 0; z-index: 50; height: auto;
    padding: 8px 10px; box-shadow: 0 2px 12px rgba(0,0,0,.20);
  }
  .sidebar .brand { width: auto; padding: 0 8px 0 0; flex: 0 0 auto; }
  .sidebar .brand img { height: 28px; padding: 4px 8px; }
  .sidebar .side-link {
    width: auto; flex: 0 0 auto; white-space: nowrap; margin-bottom: 0;
    font-size: 13px; padding: 7px 12px; border-radius: 20px;
  }
  .sidebar .side-badge { margin-left: 6px; }
  .side-foot { display: none; }
  .main { padding: 14px 12px 36px; min-width: 0; }
  .page-head { gap: 8px; margin-bottom: 14px; }
  .page-head h1 { font-size: 18px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 13px; }
  .stat .v { font-size: 22px; }
  .stat .k { font-size: 11.5px; }
  .detail-grid { grid-template-columns: 1fr; min-width: 0; }
  /* Point critique : sans min-width:0, l'item de grille garde la largeur
     minimale de son contenu (table min-width:560px) et deborde l'ecran au
     lieu de laisser le wrapper interne defiler. On l'autorise a se reduire
     a la largeur du conteneur pour que le scroll horizontal fonctionne. */
  .detail-grid > div { min-width: 0; }
  .panel { min-width: 0; }
  .panel-body { padding: 14px; }
  .kv { grid-template-columns: 104px 1fr; }
  /* Tableaux du back-office : defilement horizontal contenu DANS la carte.
     On retire la contrainte qui coupait le tableau au bord de l'ecran, et on
     force une largeur minimum sur le tableau pour que les colonnes restent
     lisibles et que "glisser" dans la carte fonctionne vraiment. */
  [style*="overflow-x:auto"] { -webkit-overflow-scrolling: touch; max-width: 100%; }
  /* La contrainte min-width:560px ne concerne QUE les tableaux du back-office.
     Le panier (cart-table) est deja mis en cartes sur mobile et ne doit PAS
     etre force a 560px, sinon il deborde et cree un scroll horizontal. */
  [style*="overflow-x:auto"] > table:not(.cart-table) { min-width: 560px; }
  .scroll-hint { display: block; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .main { padding: 12px 10px 32px; }
  .page-head h1 { font-size: 17px; }
}