/* ===== Base UI ===== */
:root{
  --bg: #f7f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
}
*{ box-sizing:border-box; }
body{ margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a{ color: inherit; text-decoration:none; }
a:hover{ text-decoration:underline; }
.container{ max-width: 1200px; margin: 0 auto; padding: 16px; }
.card{ background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.muted{ color: var(--muted); }
.btn{ display:inline-flex; align-items:center; gap:6px; padding:8px 12px; border-radius: 10px; border:1px solid var(--border); background:#fff; cursor:pointer; }
.btn:hover{ filter: brightness(0.98); }
.btn-primary{ background:#111827; color:#fff; border-color:#111827; }
.btn-danger{ background:#ef4444; color:#fff; border-color:#ef4444; }
.btn-success{ background:#16a34a; color:#fff; border-color:#16a34a; }
.btn-secondary{ background:#334155; color:#fff; border-color:#334155; }
.table-wrap{ width:100%; overflow:auto; border:1px solid var(--border); border-radius: var(--radius); background:#fff; }
table{ width:100%; border-collapse:collapse; }
th,td{ padding:10px 12px; border-bottom:1px solid var(--border); text-align:left; white-space:nowrap; }
thead th{ background:#f3f4f6; font-weight:600; }
tr:hover td{ background:#fafafa; }
input,select,textarea{ width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:10px; outline:none; background:#fff; }
input:focus,select:focus,textarea:focus{ border-color:#94a3b8; box-shadow:0 0 0 3px rgba(148,163,184,.25); }
.input-group{ display:flex; gap:8px; align-items:stretch; }
.input-group > input{ flex:1; }
.input-group > .btn{ width:auto; white-space:nowrap; }
.input-sm{ padding:8px 10px; border-radius:10px; font-size:13px; }
.table-tools{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin: 0 0 10px 0; }
.table-tools-left, .table-tools-right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.table-tools .btn{ padding:8px 10px; }
.table-tools .muted{ font-size:12px; }
.form-row{ display:grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.col-12{ grid-column: span 12; } .col-6{ grid-column: span 6; } .col-4{ grid-column: span 4; } .col-3{ grid-column: span 3; }
@media (max-width: 820px){
  .col-6,.col-4,.col-3{ grid-column: span 12; }
}
/* Topbar */
.topbar{ position: sticky; top:0; z-index: 50; display:flex; align-items:center; gap: 12px; padding: 10px 14px; border-bottom:1px solid var(--border); background: rgba(255,255,255,.92); backdrop-filter: blur(8px); }
.brand-link{ display:flex; align-items:center; gap:10px; }
.brand-logo{ width:34px; height:34px; border-radius: 10px; object-fit:cover; border:1px solid var(--border); }
.brand-mark{ width:34px; height:34px; border-radius: 10px; display:grid; place-items:center; background:#111827; color:#fff; font-weight:700; }
.brand-text{ font-weight:700; }
.nav{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.nav a{ padding:8px 10px; border-radius: 10px; }
.nav a:hover{ background:#f3f4f6; text-decoration:none; }
.userchip{ margin-left:auto; text-align:right; padding:6px 10px; border:1px solid var(--border); border-radius: 12px; background:#fff; }
.userchip-title{ font-weight:600; font-size: 13px; }
.userchip-sub{ font-size: 12px; color: var(--muted); }
.nav-toggle{ margin-left:auto; display:none; border:1px solid var(--border); background:#fff; border-radius: 12px; padding:8px 10px; }
@media (max-width: 980px){
  /* Option A: garder la navigation EN HAUT et HORIZONTALE (pas de sidebar, pas de menu vertical) */
  .nav-toggle{ display:none !important; }

  .topbar{ flex-wrap: wrap; }
  .nav{
    display:flex !important;
    position: static !important;
    left:auto; right:auto; top:auto;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .nav a{
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .userchip{ width: 100%; margin-left: 0; display:block; }
}
/* ===== Produits (Admin + Caisse): miniatures + zoom ===== */
.page-products .product-img{
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  cursor: zoom-in;
  transition: transform 0.15s ease;
  display:block;
  image-rendering:auto;
}

.page-products .product-img:hover{ transform: scale(1.05); }

.page-products .product-img.no-zoom{
  cursor: default;
}

@media (max-width: 768px){
  .page-products .product-img{
    width: 52px;
    height: 52px;
  }
}

/* ===== Produits (Admin + Caisse): typographie ===== */
.page-products .rowprod{
  display:flex;
  gap:12px;
  align-items:center;
}
.page-products .rowprod .strong{
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
  margin-bottom: 2px;
  /* Empêche les noms très longs d'étirer la ligne */
  max-width: 520px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 1100px){
  .page-products .rowprod .strong{ max-width: 420px; }
}

@media (max-width: 768px){
  .page-products .rowprod .strong{ max-width: 240px; }
}
.page-products .rowprod .muted{
  font-size: 12px;
  line-height: 1.2;
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.page-products .hint{
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.2;
  color: #6b7280;
}
.page-products .table td{ vertical-align: top; }

/* ===== Inventaire: liste produits (photo + meta) ===== */
.page-inventory .inv-table .inv-prod{
  display:flex;
  gap:10px;
  align-items:center;
}
.page-inventory .inv-thumb{
  width:40px;
  height:40px;
  object-fit:cover;
  border-radius:10px;
  border:1px solid #e5e5e5;
  background:#f3f4f6;
}
.page-inventory .inv-title{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.page-inventory .inv-name{
  font-weight:800;
  line-height:1.2;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.page-inventory .inv-meta{
  margin-top:4px;
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  font-size:12px;
  line-height:1.2;
  color:#6b7280;
}
.page-inventory .pill.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
@media (max-width: 768px){
  .page-inventory .inv-thumb{ width:34px; height:34px; border-radius:9px; }
}

/* ===== Mini chat (boutique en ligne) ===== */

body.shop-chat-open{ overflow:hidden; }


.shop-chat-fab{
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0,0,0,.22);
}

.shop-wa-fab{
  position: fixed;
  right: 86px; /* à gauche du bouton chat */
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 9998;
  /* WhatsApp floating button (smaller) */
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #16a34a;
  color: #fff;
  font-weight: 900;
  letter-spacing: .5px;
  box-shadow: 0 14px 30px rgba(0,0,0,.20);
}
.shop-wa-fab:focus{ outline: 3px solid rgba(59,130,246,.35); outline-offset: 2px; }
.shop-wa-ic{ font-size: 12px; line-height: 1; }
.shop-chat-badge{
  position:absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border: 2px solid #fff;
}
.shop-chat-panel{
  position: fixed;
  right: 18px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 9998;
  width: 340px;
  max-width: calc(100vw - 36px);
  height: min(480px, 70vh);
  max-height: calc(100dvh - 120px);
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.98);
  box-shadow: 0 22px 60px rgba(0,0,0,.25);
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.shop-chat-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0,0,0,.03);
  border-bottom: 1px solid rgba(0,0,0,.10);
}
.shop-chat-title{ font-weight: 900; }
.shop-chat-sub{ font-size: 12px; color: rgba(0,0,0,.62); }
.shop-chat-close{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  cursor: pointer;
}
.shop-chat-body{
  flex:1;
  overflow:auto;
  padding: 12px;
  background: rgba(0,0,0,.02);
}
.shop-chat-form{
  display:flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(0,0,0,.10);
}
.shop-chat-input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12);
  outline: none;
}
.shop-chat-start{
  padding: 10px 12px;
  border-top: 1px dashed rgba(0,0,0,.12);
}
.shop-chat-msg{ display:flex; flex-direction:column; align-items:flex-start; margin: 8px 0; }
.shop-chat-msg.mine{ align-items:flex-end; }
.shop-chat-msg .bubble{ max-width: 78%; padding: 9px 11px; border-radius: 14px; background: #fff; border: 1px solid rgba(0,0,0,.10); box-shadow: 0 6px 16px rgba(0,0,0,.05); }
.shop-chat-msg.mine .bubble{ background: rgba(17,24,39,.10); }
.shop-chat-msg .meta{ font-size: 11px; color: rgba(0,0,0,.55); margin-top: 3px; }

@media (max-width: 520px){
  .shop-chat-panel{ right: 10px; bottom: calc(78px + env(safe-area-inset-bottom)); width: calc(100vw - 20px); height: 70dvh; max-height: calc(100dvh - 120px); }
  .shop-chat-fab{ right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .shop-wa-fab{ right: 80px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .shop-wa-fab{ width: 42px; height: 42px; }
  .shop-wa-ic{ font-size: 11px; }
}

/* Overlay zoom */
.img-zoom-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.img-zoom-overlay img{
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  cursor: zoom-out;
}

:root{--bg:#f6f7fb;--card:#fff;--text:#111;--muted:#6b7280;--primary:#111827;--border:#e5e7eb;--accent:#2563eb;}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--text)}
.theme-dark{--bg:#0b1220;--card:#0f172a;--text:#e5e7eb;--muted:#9ca3af;--primary:#e5e7eb;--border:#1f2937;--accent:#60a5fa;}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;border-bottom:1px solid var(--border);background:var(--card);position:sticky;top:0;z-index:10}
.brand-link{text-decoration:none;color:var(--text);display:flex;align-items:center;gap:10px}
.brand-logo{height:32px;width:32px;object-fit:contain;border-radius:8px;border:1px solid var(--border);background:#fff}
.brand-mark{height:32px;width:32px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:var(--accent);color:white;font-weight:700}
.nav{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.nav a{text-decoration:none;color:var(--text);padding:6px 8px;border-radius:10px}
.nav a:hover{background:rgba(0,0,0,.05)}
.theme-dark .nav a:hover{background:rgba(255,255,255,.07)}
.nav a.muted{color:var(--muted)}
.userchip{min-width:180px;text-align:right}
.userchip-title{font-weight:700;font-size:14px}
.userchip-sub{font-size:12px;color:var(--muted)}
.container{max-width:1150px;margin:16px auto;padding:0 12px}
.card{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:14px;box-shadow:0 1px 2px rgba(0,0,0,.04)}
.grid{display:grid;gap:12px}
.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:900px){.grid.two,.grid.three{grid-template-columns:1fr}.userchip{display:none}}
.h1{font-size:20px;margin:0 0 10px 0}
.muted{color:var(--muted)}
.logbox{max-height:60vh;overflow:auto;background:#0b0b0b;color:#eaeaea;padding:12px;border-radius:12px;font-size:12px;white-space:pre-wrap}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
input,select,textarea{width:100%;padding:10px;border-radius:12px;border:1px solid var(--border);background:transparent;color:var(--text)}
label{font-size:12px;color:var(--muted)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid var(--border);padding:10px 12px;border-radius:12px;background:var(--primary);color:white;text-decoration:none;cursor:pointer}
.btn.secondary{background:transparent;color:var(--text)}
.btn.small{padding:6px 10px;border-radius:10px;font-size:12px}
.table{width:100%;border-collapse:separate;border-spacing:0 8px}
.table th{font-size:12px;color:var(--muted);text-align:left;padding:0 8px}
.table td{background:var(--card);border:1px solid var(--border);padding:10px 8px}
.table tr td:first-child{border-radius:12px 0 0 12px}
.table tr td:last-child{border-radius:0 12px 12px 0}
.badge{padding:4px 8px;border:1px solid var(--border);border-radius:999px;font-size:12px}
.footer{padding:18px 12px;color:var(--muted);text-align:center}

/* Universal pagination for tables (client-side) */
.u-pager-wrap{width:100%}
.u-pager-controls{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:10px 4px 0}
.u-pager-left,.u-pager-mid{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.u-pager-label{opacity:.8;font-size:13px}
.u-pager-select{padding:8px 10px;border-radius:10px;border:1px solid var(--line);background:var(--card)}
.u-pager-btn{padding:8px 10px;border-radius:10px;border:1px solid var(--line);background:var(--card);cursor:pointer;min-width:40px}
.u-pager-btn:disabled{opacity:.5;cursor:not-allowed}
.u-pager-page{width:80px;padding:8px 10px;border-radius:10px;border:1px solid var(--line);background:var(--card)}
.u-pager-info{opacity:.85;font-size:13px}
@media (max-width:768px){.u-pager-controls{justify-content:center}.u-pager-info{width:100%;text-align:center}}
.notice{padding:10px 12px;border-radius:12px;border:1px solid var(--border);background:rgba(37,99,235,.08)}
.err{padding:10px 12px;border-radius:12px;border:1px solid #ef4444;background:rgba(239,68,68,.08)}
.print{background:white;color:#111}
.print .watermark{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;opacity:.07;transform:rotate(-25deg);font-size:72px;font-weight:800;letter-spacing:6px}
.print .binary{position:fixed;inset:0;pointer-events:none;opacity:.05;font-family:ui-monospace,Menlo,monospace;font-size:10px;line-height:14px;white-space:pre-wrap;overflow:hidden;padding:16px}
@media print{.no-print{display:none!important}.print .watermark,.print .binary{position:fixed}}


/* ===== Utilities used across pages (v45+) ===== */
.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin:0 0 12px 0;flex-wrap:wrap}
.page-head h2{margin:0;font-size:20px}
.page-head .actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center}

/* Helpers (used by multiple pages) */
.between{justify-content:space-between}
.row-between{display:flex;gap:10px;flex-wrap:wrap;align-items:center;justify-content:space-between}
.mt-1{margin-top:8px}

.p-2{padding:14px}
.mb-2{margin-bottom:12px}
.small{font-size:12px}
.h3{font-size:24px;font-weight:900;margin-top:6px}
.strong{font-weight:800}

.grid{display:grid;gap:12px}
/* Allow using grid-* classes without having to add the .grid class (fixes stacked fields on some pages) */
.grid-2,.grid-3,.grid-4,.grid-5,.grid-6{display:grid;gap:12px}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.grid-5{grid-template-columns:repeat(5,minmax(0,1fr))}
.grid-6{grid-template-columns:repeat(6,minmax(0,1fr))}
.grid-span-2{grid-column:1 / -1}
@media (max-width: 980px){
  .grid-2,.grid-3,.grid-4,.grid-5,.grid-6{grid-template-columns:1fr}
}

.filters{margin:0 0 12px 0}
.chk{display:flex;gap:8px;align-items:center;font-size:12px;color:var(--muted)}
.chk input{width:auto}

.table-responsive,.table-wrap{width:100%;overflow:auto}
.right,.text-right{text-align:right}

.btn-sm,.btn.small{padding:6px 10px;border-radius:10px;font-size:12px}

/* Flex helpers (some pages use .flex / .flex-right) */
.flex{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.flex-right{margin-left:auto;display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.num{text-align:right}

.badge-success{border-color:#16a34a;background:rgba(22,163,74,.10)}
.badge-warning{border-color:#f59e0b;background:rgba(245,158,11,.12)}
.badge-danger,.badge.danger{border-color:#ef4444;background:rgba(239,68,68,.12)}
.badge.success{border-color:#16a34a;background:rgba(22,163,74,.10)}

.notice{border-left:4px solid var(--accent)}


.pagination{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin:12px 0}
.pagination .pg{padding:6px 10px;border:1px solid #ddd;border-radius:8px;text-decoration:none;color:inherit}
.pagination .pg.active{background:#111;color:#fff;border-color:#111}


/* Admin tiles */
.tile{display:block;color:inherit;text-decoration:none}
.tile:hover{transform:translateY(-1px);box-shadow:0 6px 14px rgba(0,0,0,.06)}
.tile-num{font-size:32px;font-weight:900;margin:6px 0}
.table-wrap{overflow:auto}
.alert{padding:10px 12px;border-radius:12px;margin:8px 0;border:1px solid var(--border)}
.alert.danger{border-color:#ef4444;background:rgba(239,68,68,.08)}

/* Autocomplete */
.ac-suggestions{position:absolute;top:100%;left:0;right:0;z-index:50;background:#fff;border:1px solid rgba(0,0,0,.12);border-radius:10px;box-shadow:0 10px 24px rgba(0,0,0,.08);max-height:220px;overflow:auto;display:none}
.ac-item{padding:10px 12px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ac-item:hover,.ac-item.active{background:rgba(0,0,0,.06)}


/* ===== Expert++++ Shell (Sidebar/Topbar) ===== */
.app-shell{ min-height:100vh; display:grid; grid-template-columns: 1fr; grid-template-rows: 56px 1fr; grid-template-areas:
  "topbar"
  "content";
}
.topbar{ grid-area:topbar; position:sticky; top:0; z-index:50; display:flex; align-items:center; gap:10px; padding:0 12px; background:var(--card); border-bottom:1px solid rgba(0,0,0,.08); }
.topbar .brand{ display:flex; align-items:center; gap:8px; }
.topbar .brand-link{ text-decoration:none; color:inherit; font-weight:800; }
.topbar .badge{ font-size:12px; padding:2px 8px; border-radius:999px; background:rgba(0,0,0,.06); }
.topbar-spacer{ flex:1; }
.icon-btn{ border:1px solid rgba(0,0,0,.12); background:transparent; padding:6px 10px; border-radius:10px; cursor:pointer; }
.icon-btn:hover{ background:rgba(0,0,0,.05); }
.userchip{ display:flex; flex-direction:column; line-height:1.1; padding:6px 10px; border:1px solid rgba(0,0,0,.10); border-radius:12px; background:rgba(0,0,0,.02); }
.userchip-name{ font-weight:700; font-size:13px; }
.userchip-role{ font-size:11px; opacity:.7; text-transform:uppercase; letter-spacing:.04em; }

.sidebar{ grid-area:sidebar; position:sticky; top:56px; height:calc(100vh - 56px); overflow:auto; background:var(--card); border-right:1px solid rgba(0,0,0,.08); padding:10px; }
.nav{ display:flex; flex-direction:column; gap:6px; }
.nav-item{ display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:12px; text-decoration:none; color:inherit; border:1px solid transparent; }
.nav-item:hover{ background:rgba(0,0,0,.04); }
.nav-item.active{ background:rgba(0,0,0,.06); border-color:rgba(0,0,0,.10); font-weight:700; }
.nav-sep{ height:1px; background:rgba(0,0,0,.08); margin:8px 6px; }

.content{ grid-area:content; padding:14px; }
@media (max-width: 980px){
  .app-shell{ grid-template-columns: 1fr; grid-template-areas: "topbar" "content"; }
  .sidebar{ position:fixed; left:0; top:56px; transform:translateX(-110%); transition:transform .2s ease; width:280px; z-index:60; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
  .sidebar.open{ transform:translateX(0); }
}

/* ===== Modal ===== */
.modal-backdrop{ position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:90; }
.modal{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; z-index:100; padding:14px; }
.modal-card{ width:min(560px, 100%); background:var(--card); border:1px solid rgba(0,0,0,.10); border-radius:16px; box-shadow:0 30px 90px rgba(0,0,0,.25); overflow:hidden; }
.modal-head{ display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid rgba(0,0,0,.08); }
.modal-title{ font-weight:800; }
.modal-body{ padding:14px; display:flex; flex-direction:column; gap:10px; }
.modal-foot{ padding:12px 14px; border-top:1px solid rgba(0,0,0,.08); display:flex; justify-content:flex-end; gap:10px; }

/* ===== DataTable lightweight ===== */
.data-table-wrap{ border:1px solid rgba(0,0,0,.10); border-radius:14px; overflow:hidden; background:var(--card); }
.data-table-toolbar{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; justify-content:space-between; padding:10px 12px; border-bottom:1px solid rgba(0,0,0,.08); }
.data-table-toolbar input{ width:min(320px, 100%); }
.data-table-pager{ display:flex; gap:6px; align-items:center; }
.data-table-pager button{ padding:6px 10px; border-radius:10px; border:1px solid rgba(0,0,0,.12); background:transparent; cursor:pointer; }
.data-table-pager button:disabled{ opacity:.5; cursor:not-allowed; }
.data-table-sort{ cursor:pointer; user-select:none; }
.data-table-sort::after{ content:" ↕"; opacity:.35; font-weight:400; }
.data-table-sort.asc::after{ content:" ↑"; opacity:.7; }
.data-table-sort.desc::after{ content:" ↓"; opacity:.7; }

/* ===== Dark theme polish ===== */
body.theme-dark .topbar, body.theme-dark .sidebar, body.theme-dark .modal-card{ border-color: rgba(255,255,255,.10); }

/*
  IMPORTANT (BUGFIX):
  Le projet utilise l'attribut HTML "hidden" pour masquer le modal.
  Or, .modal a un display:flex qui peut écraser [hidden] selon l'ordre CSS.
  On force donc l'attribut hidden à gagner (sinon le modal "Action" bloque les pages).
*/
[hidden]{ display:none !important; }
.modal[hidden], .modal-backdrop[hidden]{ display:none !important; }
body.theme-dark .nav-item:hover{ background: rgba(255,255,255,.06); }
body.theme-dark .nav-item.active{ background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.12); }


/* ==== FIX DEFINITIF: empêche la superposition de l'entête ==== */
:root{ --topbar-h: 64px; }
/* Force la topbar en fixed + réserve l'espace en haut */
.topbar{
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
}
/* Réserve l'espace sous l'entête pour tout le contenu */
main.container{
  padding-top: calc(var(--topbar-h) + 12px) !important;
}
/* Si certaines pages utilisent .sidebar sticky top:56, on aligne */
.sidebar{ top: var(--topbar-h) !important; }



/* ==== OVERRIDE EXPERT: menu toujours horizontal + pas de superposition ==== */
:root{ --topbar-h: 56px !important; }

.topbar{
  position: fixed !important;
  top: 0 !important; left:0 !important; right:0 !important;
  height: var(--topbar-h) !important;
  min-height: var(--topbar-h) !important;
  z-index: 9999 !important;
}

/* Réserve toujours l’espace sous l’entête */
main.container{
  padding-top: calc(var(--topbar-h) + 12px) !important;
}

/* Menu horizontal (desktop + mobile) */
.nav{
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  white-space: nowrap !important;
  position: static !important;
  background: transparent !important;
  box-shadow: none !important;
  max-height: none !important;
}

/* Liens */
.nav a{
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
}

/* Désactive le dropdown mobile (qui forçait la verticale) */
.nav-toggle{ display:none !important; }
.nav.open{
  display:flex !important;
  flex-direction: row !important;
  align-items: center !important;
}

/* Optionnel: cacher le nom sur petits écrans pour garder propre */
@media (max-width: 720px){
  .nav a .label{ display:none !important; }
}


/* ===== TOP NAV (Option A) ===== */
.topnav{
  display:flex;
  align-items:center;
  gap:10px;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  padding: 0 6px;
}
.topnav::-webkit-scrollbar{ height:6px; }
.topnav-item{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 10px;
  border-radius: 10px;
  text-decoration:none;
  color: inherit;
  border: 1px solid transparent;
}
.topnav-item:hover{ background: rgba(0,0,0,.04); }
.topnav-item.active{ background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.10); font-weight:700; }
.topnav-item.denied{ opacity:.45; }
.topnav-item.denied:hover{ background: rgba(0,0,0,.04); }
.topnav-item.denied .lock{ margin-left:4px; font-size:12px; }

.topnav-sep{ width:1px; height:20px; background: rgba(0,0,0,.18); display:inline-block; }

/* Hide legacy sidebar completely */
.sidebar{ display:none !important; }

/* Mobile: ensure content never hides under header */
@media (max-width: 768px){
  .topbar{ position: sticky; }
  .content{ padding-top: 12px; }
}


/* ===== V9 FIX: Top menu ALWAYS horizontal + no overlap (PC & Mobile) ===== */
@media (min-width: 769px){
:root{ --topbar-h: 64px; }

.topbar{
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: var(--topbar-h) !important;
  z-index: 99999 !important;
  flex-wrap: nowrap !important; /* prevent header becoming multi-line */
  overflow: hidden;
}

body{ padding-top: var(--topbar-h) !important; }

.topnav{
  display:flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 10px;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  -webkit-overflow-scrolling: touch;
}

.topnav-item{ white-space: nowrap !important; }

@media (max-width: 768px){
  /* Sur mobile on garde un menu utilisateur compact (au lieu de tout cacher) */
  .brand-text{ display:none !important; }
}
}

/* ===== V11: Top header horizontal (Option A) ===== */
.top-header{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
body{ padding-top: 76px; }
.brand-link{ display:flex; align-items:center; gap:10px; }
.brand-logo{ width:36px; height:36px; border-radius:10px; object-fit:cover; border:1px solid var(--border); background:#fff; }
.brand-text{ font-weight:700; }
.topnav{
  flex: 1;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}
.topnav::-webkit-scrollbar{ height: 6px; }
.topnav-item{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}
.topnav-item:hover{ background:#f3f4f6; text-decoration:none; }
.topnav-item.active{ background:#111827; color:#fff; }
.topnav-item.locked{ opacity:.6; cursor:not-allowed; }
.topnav-item.locked:hover{ background: transparent; }

/* Déconnexion : affichée dans le tiroir mobile (sinon elle peut sortir de l'écran) */
.topnav .mobile-logout{ display:none; }

/* Chat unread badge in topnav */
.nav-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  background:#dc3545;
  color:#fff;
  font-size:12px;
  line-height:18px;
  margin-left:8px;
}
.topnav-sep{ width:1px; height:22px; background: var(--border); margin:0 4px; flex: 0 0 auto; }

.header-actions{ display:flex; align-items:center; gap:10px; flex:0 0 auto; }
.icon-btn{ border:1px solid var(--border); background:#fff; border-radius:12px; padding:8px 10px; cursor:pointer; }
.mobile-only{ display:none; }
.userchip{ display:flex; flex-direction:column; line-height:1.1; }
.userchip-name{ font-weight:600; }
.userchip-sub{ font-size:12px; color:var(--muted); }

/* Menu utilisateur (profil) */
.user-menu{ position: relative; }
.user-menu > summary{ list-style: none; cursor: pointer; display:flex; align-items:flex-end; gap:8px; padding:8px 10px; border:1px solid var(--border); border-radius:12px; background:#fff; }
.user-menu > summary::-webkit-details-marker{ display:none; }
.user-menu .userchip{ border:0; padding:0; background:transparent; }
.userchip-caret{ font-size:12px; color: var(--muted); align-self: center; }
.user-menu-panel{
  position:absolute; right:0; top: calc(100% + 8px);
  min-width: 210px;
  background:#fff;
  border:1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.12);
  padding: 8px;
  z-index: 12000;
}
.user-menu[open] .user-menu-panel{ animation: fadeIn .12s ease-out; }
.user-menu-item{ display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius: 12px; text-decoration:none; color: inherit; }
.user-menu-item:hover{ background:#f3f4f6; text-decoration:none; }
.user-menu-item.danger{ color:#b42318; }

/* Empêche le nom utilisateur de pousser les boutons hors écran */
.userchip-name, .userchip-sub, .userchip-role{ max-width: 180px; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn{ flex: 0 0 auto; }

.content{ min-height: calc(100vh - 76px); }
/*
  IMPORTANT (mobile iOS/Android):
  Some environments (older iOS Safari, in-app browsers, missing/ignored viewport) can render pages
  with a layout width around ~980px even on phones.
  If we keep the breakpoint at 768px, the header stays in desktop mode and items (including
  "Déconnexion") become unreachable off-screen.

  => Use a wider breakpoint for the header navigation so phones ALWAYS get the mobile drawer.
*/
@media (max-width: 1024px){
  .brand-text{ display:none; }
  /* Mobile: réduire l'entête (évite qu'il prenne trop de place) */
  .top-header{ height: 56px; padding: 0 10px; gap: 10px; }
  body{ padding-top: 66px; }
  .brand-logo{ width:32px; height:32px; border-radius:10px; }
  .icon-btn{ padding:6px 8px; border-radius:12px; }
  .topnav-item{ padding: 7px 9px; font-size: 13px; }

  /* Mobile/compact nav: masquer la liste (évite un header gigantesque) et l'ouvrir en tiroir */
  .mobile-only{ display:inline-flex; }
  .topnav{ display:none !important; }
  .topnav.open{
    display:flex !important;
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 0;
    background: #fff;
    padding: 12px;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px;
    overflow-y: auto;
    z-index: 9999;
  }
  .topnav.open .topnav-item{
    width: 100%;
    justify-content: flex-start;
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  /* Dropdowns inside the mobile drawer behave like accordions (no portal / no absolute positioning) */
  .topnav.open [data-dd]{
    width: 100%;
  }
  .topnav.open .nav-dd-btn{
    width: 100%;
    justify-content: space-between;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
  }
  .topnav.open .nav-dd-menu{
    position: static !important;
    display: none;
    width: 100%;
    margin: 6px 0 2px;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: none;
    overflow: hidden;
  }
  .topnav.open .nav-dd-menu.is-open{
    display: block;
  }
  .topnav.open .nav-dd-menu a{
    display: block;
    padding: 10px 12px;
  }
  .topnav.open .nav-dd-menu a + a{
    border-top: 1px solid rgba(0,0,0,.06);
  }
  .topnav.open .mobile-logout{ display:inline-flex; }
  .topnav-sep{ display:none; }
  .mobile-nav-overlay{
    position: fixed;
    top: 56px; left:0; right:0; bottom:0;
    background: rgba(0,0,0,.35);
    z-index: 9998;
  }
  /* Menu utilisateur compact sur mobile */
  .userchip-name, .userchip-sub, .userchip-role{ max-width: 120px; }
  .userchip-sub{ display:none; }
  .user-menu-panel{ position: fixed; right: 10px; top: 60px; }

  /*
    IMPORTANT: Certains téléphones (ou navigateurs intégrés) cachent/rognent le bouton texte.
    Pour garantir une déconnexion toujours accessible, on garde aussi l'icône visible.
  */
  .logout-btn{ display:inline-flex !important; }
}


/* ===== Public shop (boutique en ligne) ===== */
.shop-header{
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.shop-header-inner{
  display:flex; gap:12px; align-items:center; justify-content:space-between;
  padding: 10px 14px;
  max-width: 1200px;
  margin: 0 auto;
}
.shop-brand{display:flex; align-items:center; gap:10px; text-decoration:none; color:inherit;}
.shop-brand-logo{height:34px; width:34px; object-fit:cover; border-radius:10px; box-shadow: var(--shadow);}
.shop-brand-dot{height:12px; width:12px; border-radius:50%; background: var(--primary);}
.shop-brand-name{font-weight:800; letter-spacing:.2px;}
.shop-search{flex: 1; display:flex; gap:8px; align-items:center; max-width: 560px;}
.shop-search input[type="search"]{
  flex:1; height:38px; border-radius: 12px;
  border: 1px solid rgba(0,0,0,.10);
  padding: 0 12px; outline: none; background: rgba(255,255,255,.85);
}
.shop-actions{display:flex; gap:8px; align-items:center;}
.shop-mobile-toggle{display:none;}

/* FAB Panier (mobile) - stable sur iOS/Android */
.shop-cart-fab{
  display:none;
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 11000;
  height: 48px;
  min-width: 48px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(15,23,42,.96);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 18px 45px rgba(2,6,23,.35);
  align-items: center;
  justify-content: center;
  gap: 10px;
}

@keyframes fadeIn{ from{ opacity:0; transform: translateY(-4px);} to{ opacity:1; transform: translateY(0);} }
.shop-cart-fab .badge{ background: rgba(255,255,255,.18); color:#fff; border: 1px solid rgba(255,255,255,.18); }

/* Menu actions shop (mobile) */
@media (max-width: 768px){
  .shop-mobile-toggle{display:inline-flex;}
  /* Sur mobile, le menu ne doit PAS pousser la grille produits : on le met en overlay */
  .shop-actions{
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(56px + env(safe-area-inset-top));
    z-index: 1000;
    width: auto;
    max-height: calc(100dvh - 90px);
    overflow: auto;
    border: 1px solid rgba(0,0,0,.10);
    border-radius: 16px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 18px 60px rgba(0,0,0,.16);
    padding: 10px;
  }
  body:not(.shop-nav-open) .shop-actions{display:none;}
  body.shop-nav-open::before{
    content:"";
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,.28);
    backdrop-filter: blur(1px);
  }
  .shop-cart-fab{ display:inline-flex; }
}

/* Mobile shop: compacter fortement l'entête (le banner peut prendre la moitié d'écran) */
@media (max-width: 768px){
  .shop-header-inner{ flex-wrap:wrap; gap:10px; padding: 8px 12px; }
  .shop-brand-name{ font-size: 15px; }
  .shop-brand-logo{ height:30px; width:30px; border-radius:10px; }
  .shop-search{ order: 3; width:100%; max-width:none; }
  .shop-search input[type="search"]{ height:36px; border-radius:12px; }
  .shop-search .btn{ padding: 8px 10px; }
  /* Le bouton panier doit rester compact sur mobile */
  .shop-cart-link{ padding: 8px 10px; }
  /* Cache le grand bandeau sur mobile pour éviter un header trop haut */
  .shop-banner{ display:none; }
}
.badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0,0,0,.08);
  font-size: 12px;
}

.shop-banner{
  border-top: 1px solid rgba(0,0,0,.06);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.shop-banner-inner{
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 14px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
}
.shop-banner:before{
  content: '';
  display:block;
  height: 1px;
}
.shop-banner-inner{ position: relative; }
.shop-banner .shop-tagline{
  font-weight: 800;
  opacity: .9;
}
.shop-banner .shop-header-text{
  margin-top: 6px;
  color: rgba(0,0,0,.75);
  font-size: 13px;
  max-width: 640px;
}
.shop-contacts{
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(0,0,0,.8);
  box-shadow: var(--shadow);
}

/* Mise en page plus propre (infos + QR) */
.shop-contacts .shop-contact-grid{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}
.shop-contacts .shop-contact-qr{
  display:flex;
  justify-content:flex-end;
}

/* Modal (suivi livraison) */
.shop-modal{ position: fixed; inset:0; z-index: 80; display:none; }
.shop-modal[aria-hidden="false"]{ display:block; }
.shop-modal-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.shop-modal-card{
  position: relative;
  max-width: 560px;
  width: calc(100vw - 24px);
  margin: 12vh auto 0 auto;
  background:#fff;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.12);
  box-shadow: 0 24px 80px rgba(0,0,0,.22);
  padding: 14px;
}
@media (max-width: 768px){
  .shop-modal-card{ margin-top: 10vh; }
}

.shop-qr-block{ margin-top: 6px; }
.shop-qr-img{
  display:block;
  width: 90px;
  height: 90px;
  object-fit: contain;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 8px;
}

/* Garde l'ancien style pour les pages d'impression qui utilisent encore des codes-barres */
.shop-barcode-block{ margin-top: 6px; }
.shop-barcode-img{
  display:block;
  width: 100%;
  max-width: 240px;
  height: auto;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  padding: 6px;
}

/* Watermark */
.shop-watermark{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}
.shop-watermark:before{
  content: attr(data-text);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) rotate(-18deg);
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 2px;
  color: rgba(0,0,0,.18);
  opacity: var(--shop-wm-opacity, 0.08);
  text-transform: uppercase;
  white-space: nowrap;
}
.shop-watermark:after{
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--shop-wm-image);
  background-repeat: repeat;
  background-position: center;
  background-size: 240px auto;
  opacity: var(--shop-wm-opacity, 0.08);
}

/* Shop footer */
.shop-footer{ margin-top: 22px; border-top: 1px solid rgba(0,0,0,.06); background: rgba(255,255,255,.92); backdrop-filter: blur(8px); }
.shop-footer-banner{ height: 140px; background-size: cover; background-position: center; border-bottom: 1px solid rgba(0,0,0,.06); }
.shop-footer-inner{ max-width: 1200px; margin:0 auto; padding: 16px 14px; display:grid; grid-template-columns: 2fr 1fr 1fr; gap:14px; }
.shop-footer-title{ font-weight: 900; font-size: 16px; }
.shop-footer-tagline{ color: rgba(0,0,0,.65); margin-top: 2px; }
.shop-footer-text{ margin-top: 8px; color: rgba(0,0,0,.7); font-size: 13px; }
.shop-footer-col{ font-size: 12px; color: rgba(0,0,0,.75); }
.shop-footer-col-title{ font-weight: 800; margin-bottom: 8px; }
.shop-footer-bottom{ max-width: 1200px; margin:0 auto; padding: 10px 14px; font-size: 12px; color: rgba(0,0,0,.6); border-top: 1px solid rgba(0,0,0,.06); }

@media (max-width: 900px){
  .shop-banner-inner{ flex-direction: column; }
  .shop-contacts .shop-contact-grid{ grid-template-columns: 1fr; }
  .shop-contacts .shop-contact-qr{ justify-content:flex-start; }
  .shop-footer-inner{ grid-template-columns: 1fr; }
}

/* Force a consistent product grid (avoid legacy duplicate rules) */
.shop-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px){ .shop-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px){ .shop-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px){ .shop-grid{ grid-template-columns: 1fr; } }

/* Shop layout */
.shop-wrap{max-width:1200px;margin:0 auto;padding:14px;}
.shop-hero{
  background: linear-gradient(135deg, rgba(0,0,0,.02), rgba(0,0,0,.06));
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 18px;
  padding: 16px;
  display:flex; gap:14px; align-items:flex-start; justify-content:space-between;
}
.shop-hero h1{margin:0;font-size: 22px;}
.shop-hero p{margin:6px 0 0 0; color: rgba(0,0,0,.6);}

.shop-welcome{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(3px);
  max-width: 680px;
}
.shop-welcome-title{ font-weight: 900; font-size: 13px; margin:0 0 4px 0; }
.shop-welcome-text{ font-size: 13px; line-height: 1.35; color: rgba(0,0,0,.74); }
.shop-welcome-text b{ color: rgba(0,0,0,.86); }

.shop-badges{ display:flex; gap:8px; flex-wrap:wrap; margin-top: 10px; }
.shop-chip{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.70);
}
.shop-card .desc{ color: var(--muted); font-size: 11px; line-height:1.35; margin-top: -4px; }
.shop-shell{display:grid; grid-template-columns: 260px 1fr; gap:14px; margin-top:14px;}
.shop-filters{background: var(--card); border:1px solid rgba(0,0,0,.06); border-radius: 18px; padding:12px; box-shadow: var(--shadow);}
.shop-filters .filter-title{font-weight:800; margin-bottom:10px;}
.shop-filters a{display:block; padding:10px 10px; border-radius: 12px; text-decoration:none; color:inherit;}
.shop-filters a:hover{background: rgba(0,0,0,.04);}
.shop-filters a.active{background: rgba(0,0,0,.06); font-weight:700;}
.shop-grid{display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:12px;}
.shop-card{
  background: var(--card);
  border:1px solid rgba(0,0,0,.06);
  border-radius: 18px;
  overflow:hidden;
  box-shadow: var(--shadow);
  display:flex; flex-direction:column;
}
.shop-card .thumb{height:120px; background: rgba(0,0,0,.03); display:flex; align-items:center; justify-content:center;}
.shop-card .thumb img{width:100%; height:100%; object-fit:contain;}
.shop-card .body{padding:12px; display:flex; flex-direction:column; gap:8px; flex:1;}
.shop-card .title{font-weight:800; margin:0; font-size: 13px; line-height:1.2;}
.shop-card .meta{display:flex; gap:10px; flex-wrap:wrap; color: rgba(0,0,0,.6); font-size: 11px;}
.shop-card .price{font-weight:900; font-size: 14px;}
.shop-card .actions{display:flex; gap:8px; margin-top:auto;}
.shop-card .actions .btn{flex:1;}

@media (max-width: 1100px){
  .shop-grid{grid-template-columns: repeat(3, minmax(0, 1fr));}
}
@media (max-width: 900px){
  .shop-shell{grid-template-columns: 1fr;}
  .shop-grid{grid-template-columns: repeat(2, minmax(0, 1fr));}
  .shop-header-inner{ flex-wrap:wrap; }
  .shop-search{ display:flex; width:100%; max-width:none; }
  .shop-actions{ width:100%; justify-content:space-between; }
}
@media (max-width: 520px){
  .shop-grid{grid-template-columns: 1fr;}
}



/* ===== Public shop improvements (compact + catégories) ===== */
.shop-filters{ position: sticky; top: 76px; }

.shop-toolbar{ display:flex; gap:10px; align-items:flex-end; justify-content:space-between; margin:0 2px 12px; }
.shop-toolbar .left{ display:flex; flex-direction:column; gap:2px; }
.shop-toolbar .small{ font-size:12px; color: var(--muted); }

/* Plus de colonnes + vignettes plus petites */
.shop-grid{ grid-template-columns: repeat(5, minmax(0, 1fr)); }
.shop-card:hover{ transform: translateY(-1px); }
.shop-card .thumb{
  height:120px;
  padding:10px;
  background: rgba(0,0,0,.02);
}
.shop-card .thumb img{
  width:100%; height:100%;
  object-fit: contain;
  border-radius: 14px;
}
.shop-card .body{ padding: 12px; gap: 7px; }
.shop-card .meta{ gap:8px; }

.shop-section{ margin-bottom: calc(18px + env(safe-area-inset-bottom)); }
.shop-section-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:10px; margin: 6px 2px 10px; }
.shop-section-head h3{ margin:0; font-size:18px; }
.shop-section-head .muted{ font-size:12px; color: var(--muted); }
.shop-section-head a{
  text-decoration:none;
  font-size:13px;
  opacity:.75;
}
.shop-section-head a:hover{ opacity:1; text-decoration: underline; }

@media (max-width: 1200px){
  .shop-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px){
  .shop-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px){
  .shop-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-filters{ position: relative; top:auto; }
}
@media (max-width: 520px){
  .shop-grid{ grid-template-columns: 1fr; }
}

/* ===== Shop responsive tweaks ===== */
@media (max-width: 768px){
  .shop-header-inner{ flex-wrap: wrap; justify-content:flex-start; }
  .shop-search{ order: 3; flex: 1 1 100%; max-width: 100%; }
  .shop-actions{ order: 2; margin-left:auto; }
  .shop-brand-name{ font-size: 15px; }
  .shop-banner-inner{ flex-direction: column; }
  .shop-contacts .shop-contact-grid{ grid-template-columns: 1fr; }
  .shop-contacts .shop-contact-qr{ justify-content:flex-start; }
}

/* ===== Shop UI polish (2026-02) ===== */
.shop-card{ transition: transform .12s ease, box-shadow .12s ease; }
.shop-card:hover{ transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.10); }
.shop-card .thumb{ position: relative; }
.shop-card .thumb-link{ display:block; width:100%; height:100%; text-decoration:none; }
.shop-card .thumb-link:focus{ outline: 2px solid rgba(59,130,246,.55); outline-offset: 2px; border-radius: 16px; }
.shop-card .title{ text-decoration:none; color: inherit; }
.shop-card .title:hover{ text-decoration: underline; }
.shop-card .title:focus{ outline: 2px solid rgba(59,130,246,.55); outline-offset: 2px; border-radius: 8px; }

/* Mobile: keep cart button visible */
@media (max-width: 760px){
  #shopCartBtn{ position: sticky; top: 8px; z-index: 20; }
}

/* ===== Tontines page (improved) ===== */
.page-tontines .tontine-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap}
.page-tontines .tontine-filters{display:flex;gap:8px;flex-wrap:wrap}
.page-tontines .tontine-stats{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0}
.page-tontines .tontine-stats .stat{flex:1;min-width:180px;border:1px solid var(--border);border-radius:14px;padding:10px 12px;background:var(--card)}
.page-tontines .tontine-stats .stat .value{font-size:18px;font-weight:900;margin-top:2px}
.page-tontines .tontine-title{font-weight:900;font-size:15px;line-height:1.2}
.page-tontines .tontine-meta{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:6px}
.page-tontines .tontine-pay summary{cursor:pointer;list-style:none}
.page-tontines .tontine-pay summary::-webkit-details-marker{display:none}
.page-tontines .tontine-pay .pay-form{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:8px}
.page-tontines .tontine-pay input{max-width:180px}
.page-tontines tr.tontine-due td{border-color:rgba(245,158,11,.35)}

@media (max-width: 768px){
  .page-tontines .tontine-stats .stat{min-width:140px}
  .page-tontines .tontine-pay input{max-width:140px}
  .page-tontines .tontine-table th:nth-child(6),
  .page-tontines .tontine-table td:nth-child(6){display:none}
}

/* ===== Shop formatting + product images (v5) ===== */

/* Topbar: count + pills + category chips */
.shop-topbar{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-top: 10px; }
.shop-topbar-left{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-width:0; }
.shop-count{ display:inline-flex; align-items:baseline; gap:6px; }
.shop-count-num{ font-weight: 900; font-size: 16px; }
.shop-count-label{ font-size: 12px; opacity: .7; }

/* Generic pill style used in shop.php */
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.70);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-chips{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; min-width:0; max-width: 100%; }
.chip{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-decoration:none;
  color: inherit;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.70);
  white-space: nowrap;
}
.chip:hover{ background: rgba(255,255,255,.92); }
.chip.active{ background: rgba(0,0,0,.06); font-weight: 800; }

/* Mobile: chips scroll horizontally instead of breaking the layout */
@media (max-width: 760px){
  .shop-chips{ flex-wrap:nowrap; overflow-x:auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .shop-chips::-webkit-scrollbar{ height: 4px; }
}

/* Product images: consistent ratio + cover for nicer cards */
.shop-card .thumb{
  height: auto !important;
  aspect-ratio: 4 / 3;
  padding: 10px !important;
  background: rgba(255,255,255,.92) !important;
  overflow: hidden;
}
.shop-card .thumb img{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 16px !important;
  display:block;
  transition: transform .18s ease;
}
.shop-card:hover .thumb img{ transform: scale(1.03); }

/* Wishlist button + badges (missing base styles) */
.shop-card .wish{
  position:absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.86);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.shop-card .wish.active{ border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.10); }

.thumb-badges{ position:absolute; left: 10px; bottom: 10px; display:flex; gap:6px; flex-wrap:wrap; }
.badge{
  display:inline-flex;
  align-items:center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.88);
}
.badge.pill-badge{ max-width: 180px; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.danger{ background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.25); }
.badge.warning{ background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.25); }


/* === Improvements: shop cards clickable + text clamp === */
.shop-card{ cursor: pointer; }
.shop-card a, .shop-card button, .shop-card label{ cursor: pointer; }
.shop-card .title{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: calc(1.2em * 2);
}
.shop-card .desc{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: calc(1.35em * 2);
}
.shop-card:focus-within{ outline: 3px solid rgba(59,130,246,.25); outline-offset: 2px; }

/* ===== Shop mobile filters drawer (2026-02) ===== */
.shop-filters-toggle{ display:none; }
.shop-filters-mobile-head{ display:none; }
.shop-filters-backdrop{ display:none; }

@media (max-width: 900px){
  .shop-filters-toggle{ display:inline-flex; }

  /* Empêche le scroll de la page derrière le tiroir */
  body.shop-filters-open{ overflow:hidden; }

  /* Drawer */
  .shop-filters{ position: fixed; inset: 0 auto 0 0; width: min(92vw, 360px); max-width: 360px;
    padding: 14px; border-radius: 0 18px 18px 0; overflow:auto;
    transform: translateX(-110%); transition: transform .18s ease;
    z-index: 1000; box-shadow: 0 18px 60px rgba(0,0,0,.25);
  }
  body.shop-filters-open .shop-filters{ transform: translateX(0); }

  .shop-filters-mobile-head{ display:flex; align-items:center; justify-content:space-between; gap:10px;
    padding: 2px 0 10px; border-bottom: 1px solid rgba(0,0,0,.06); margin-bottom: 10px;
  }

  .shop-filters-backdrop{ display:none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 999; }
  body.shop-filters-open .shop-filters-backdrop{ display:block; }

  /* Avoid sticky on mobile drawer */
  .shop-filters{ top:0; }
}


/* === Shop UI refresh v4 (auto) === */
.page-shop .shop-wrap{ max-width: 1240px; margin: 0 auto; padding: 16px; }
.page-shop .shop-hero{
  background: linear-gradient(135deg, rgba(17,24,39,.06), rgba(17,24,39,.02));
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 22px;
  padding: 18px;
  gap: 14px;
}
.page-shop .shop-hero h1{
  margin:0;
  font-size: 22px;
  line-height: 1.15;
  word-break: break-word;
  overflow-wrap: anywhere;
}
@media (max-width: 520px){
  .page-shop .shop-hero h1{ font-size: 19px; }
}

.page-shop .shop-welcome{
  border-radius: 18px;
  background: rgba(255,255,255,.82);
}

.page-shop .shop-shell{ gap: 16px; }
.page-shop .shop-filters{
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(0,0,0,.08);
}

.page-shop .shop-grid{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1250px){ .page-shop .shop-grid{ grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (max-width: 1050px){ .page-shop .shop-grid{ grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 760px){ .page-shop .shop-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 520px){ .page-shop .shop-grid{ grid-template-columns: 1fr; } }

.page-shop .shop-card{
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 14px 34px rgba(0,0,0,.10);
  transition: transform .14s ease, box-shadow .14s ease;
}
.page-shop .shop-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(0,0,0,.16);
}
.page-shop .shop-card .thumb{
  height: 170px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,.01));
}
.page-shop .shop-card .thumb img{
  border-radius: 16px;
}
@media (max-width: 760px){
  .page-shop .shop-card .thumb{ height: 155px; }
}

.page-shop .shop-card .title{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 2.6em;
}
.page-shop .shop-card .desc{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: -2px;
}

.page-shop .shop-toolbar{
  align-items: center;
  margin: 0 2px 14px;
}
.page-shop .shop-toolbar .small{ opacity: .85; }

/* Chat always above headers/alerts */
.shop-chat-panel, .shop-chat-fab, .shop-wa-fab{ z-index: 10050; }
.shop-chat-panel{ background: #fff; }
.shop-chat-head{ background: #fff; }

/* ===== Boutique en ligne: UI + images produits (uniformes) ===== */
.page-shop .shop-grid{ gap: 14px; }

/* vignette: ratio fixe + cover (évite images écrasées) */
.page-shop .shop-card .thumb{
  height: auto !important;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,.06));
}
.page-shop .shop-card .thumb img{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  transition: transform .18s ease;
}
.page-shop .shop-card:hover .thumb img{ transform: scale(1.04); }

/* actions: évite que "Détails" disparaisse sur mobile */
.page-shop .shop-card .actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.page-shop .shop-card .actions .btn{
  flex: 1 1 calc(50% - 8px);
  min-width: 120px;
}
@media (max-width: 480px){
  .page-shop .shop-card .actions .btn{ flex: 1 1 100%; min-width: 0; }
}

/* Shop cards: keep action buttons visible on all screen sizes */
.page-shop .shop-card .actions{
  flex-wrap: wrap;
}
.page-shop .shop-card .actions .btn,
.page-shop .shop-card .actions .btn.wa,
.page-shop .shop-card .actions .btn.secondary{
  flex: 1 1 92px;
  min-width: 92px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.1;
}
@media (max-width: 760px){
  .page-shop .shop-card .actions .btn,
  .page-shop .shop-card .actions .btn.wa,
  .page-shop .shop-card .actions .btn.secondary{
    flex-basis: 46%;
    min-width: 0;
  }
}

/* Disabled WhatsApp when no number configured */
.page-shop .shop-card .actions .btn.wa.disabled{
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}


/* --- Shop categories (chips) collapsible --- */
/* Shop categories scroll buttons (desktop) */
.shop-chips-wrap{display:flex; align-items:center; gap:8px; overflow:hidden}
.shop-chips{flex:1 1 auto; min-width:0}
.shop-chips-scroll-btn{
  flex:0 0 auto;
  width:32px; height:32px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  color: inherit;
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.shop-chips-scroll-btn:active{ transform: scale(.98); }

/* Mobile: hide scroll buttons and enable swipe */
@media (max-width: 760px){
  .shop-chips-wrap{overflow:visible}
  .shop-chips-scroll-btn{display:none !important}
  .shop-chips{flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling: touch; scroll-snap-type:x proximity;}
  .shop-chips .chip{scroll-snap-align:start}
}


.shop-chips-wrap{position:relative;margin-top:10px}
.shop-chips-wrap.is-collapsed #shopCats{max-height:92px;overflow:hidden}
.shop-chips-wrap.is-collapsed::after{
  content:"";
  position:absolute;left:0;right:0;bottom:38px;height:40px;
  pointer-events:none;
  background:linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
}
.shop-chips-toggle{
  margin-top:8px;
  border:1px solid var(--line);
  background:var(--card);
  padding:8px 12px;
  border-radius:999px;
  font-weight:800;
  cursor:pointer;
}
@media (max-width: 720px){
  .shop-chips-wrap.is-collapsed #shopCats{max-height:none;overflow:auto}
  .shop-chips-wrap::after{display:none}
}


/* Quick add to cart on product photo */
.shop-card .thumb-add{
  position:absolute;
  right:10px;
  bottom:10px;
  width:40px;
  height:40px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  text-decoration:none;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(17,24,39,.85);
  color:#fff;
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.shop-card .thumb-add:hover{ transform: scale(1.05); }
.shop-card .thumb-add:focus{ outline: 3px solid rgba(59,130,246,.35); outline-offset: 2px; }
/* Sur PC, on garde le bouton visible (mais discret) pour que l'utilisateur le trouve facilement */
@media (hover:hover){
  .shop-card .thumb-add{ opacity:.92; transform: none; transition: opacity .15s ease, transform .15s ease; }
  .shop-card:hover .thumb-add{ opacity:1; transform: scale(1.05); }
}


/* === Shop UI enhancements (cards, chips, sticky) === */
.shop-cats{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.shop-cats .chip{ padding:8px 12px; border-radius:999px; border:1px solid #e5e7eb; background:#fff; font-weight:700; font-size:13px; white-space:nowrap; }
.shop-cats .chip.active{ background:#111827; color:#fff; border-color:#111827; }
.shop-grid{ display:grid; gap:14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.shop-card{ border:1px solid #eef2f7; border-radius:18px; background:#fff; overflow:hidden; box-shadow:0 8px 22px rgba(0,0,0,.06); transition:transform .15s ease, box-shadow .15s ease; }
.shop-card:hover{ transform: translateY(-2px); box-shadow:0 16px 36px rgba(0,0,0,.10); }
.shop-card .thumb{ position:relative; aspect-ratio: 4/3; background:#f8fafc; }
.shop-card .thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.shop-card .thumb-add{ position:absolute; right:10px; bottom:10px; width:42px; height:42px; border-radius:999px; display:flex; align-items:center; justify-content:center; background:#111827; color:#fff; text-decoration:none; box-shadow:0 10px 22px rgba(0,0,0,.18); }
.shop-card .wish{ position:absolute; left:10px; bottom:10px; width:42px; height:42px; border-radius:999px; border:0; background:rgba(255,255,255,.95); box-shadow:0 10px 22px rgba(0,0,0,.12); }
.shop-card .body{ padding:12px 12px 14px; }
.shop-card .title{ font-weight:800; line-height:1.25; font-size:14px; min-height:36px; }
.shop-card .meta{ margin-top:6px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.shop-card .price{ font-weight:900; font-size:15px; }
.shop-card .muted{ color:#6b7280; font-size:12px; }
@media (max-width: 520px){
  .shop-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap:10px; }
  .shop-card{ border-radius:16px; }
}

/* ===== Admin/Listings (expert) ===== */
.table-toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between;margin:10px 0 12px;}
.table-toolbar .left{display:flex;flex-wrap:wrap;gap:10px;align-items:center;}
.table-toolbar .right{display:flex;flex-wrap:wrap;gap:10px;align-items:center;}
.table-toolbar input[type="search"],
.table-toolbar input[type="text"],
.table-toolbar input[type="date"],
.table-toolbar select{height:38px;border-radius:12px;border:1px solid var(--border);background:var(--card);padding:0 12px;min-width:180px;}
.table-toolbar .btn{height:38px;border-radius:12px;}

.table-wrap{overflow:auto;border:1px solid var(--border);border-radius:14px;background:var(--card);}
.table{width:100%;border-collapse:separate;border-spacing:0;min-width:760px;}
.table th{position:sticky;top:0;background:var(--card);z-index:1;font-weight:800;border-bottom:1px solid var(--border);}
.table th,.table td{padding:10px 12px;border-bottom:1px solid var(--border);vertical-align:middle;}
.table tr:hover td{background:rgba(125,125,125,.06);}
.table .num{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums;}
.table .nowrap{white-space:nowrap;}

.badge{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-weight:800;font-size:12px;border:1px solid var(--border);}
.badge.ok{background:rgba(16,185,129,.12);border-color:rgba(16,185,129,.25);}
.badge.warn{background:rgba(245,158,11,.12);border-color:rgba(245,158,11,.25);}
.badge.err{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.25);}
.badge.info{background:rgba(59,130,246,.10);border-color:rgba(59,130,246,.22);}

.pagination{display:flex;gap:8px;align-items:center;justify-content:center;margin:14px 0 6px;flex-wrap:wrap;}
.pagination .page{padding:8px 11px;border-radius:12px;border:1px solid var(--border);text-decoration:none;background:var(--card);font-weight:800;}
.pagination .page.active{background:#111827;color:#fff;border-color:#111827;}
.pagination .page.disabled{opacity:.4;pointer-events:none;}
.pagination .dots{opacity:.6;padding:0 4px;}

@media (max-width: 720px){
  .table{min-width:660px;}
  .table-toolbar input[type="search"],
  .table-toolbar input[type="text"],
  .table-toolbar input[type="date"],
  .table-toolbar select{min-width:140px;}
}

/* ---- Livreur KPIs ---- */
.livreur-kpis{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.livreur-kpi{border:1px solid rgba(0,0,0,.08);border-radius:16px;padding:10px 12px;background:#fff}
.livreur-kpi .kpi{font-size:20px;font-weight:900;margin-top:2px}
@media(max-width:720px){.livreur-kpis{grid-template-columns:1fr}}

/* ---- Shop floating actions (mobile) ---- */
.shop-fab{display:none;position:fixed;right:12px;bottom:12px;gap:10px;z-index:55}
.shop-fab-btn{width:46px;height:46px;border-radius:999px;display:flex;align-items:center;justify-content:center;border:1px solid var(--border);background:var(--card);box-shadow:0 10px 30px rgba(0,0,0,.12);text-decoration:none;font-weight:900}
.shop-fab-badge{position:absolute;margin-left:18px;margin-top:-18px;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:#111827;color:#fff;font-size:11px;display:inline-flex;align-items:center;justify-content:center}
.shop-fab-btn{position:relative}
@media(max-width:768px){.shop-fab{display:flex;flex-direction:column}}


/* ===== Premium UX Add-ons (2026-02-09) ===== */
.page-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin: 0 0 12px 0; }
.page-title{ font-size: 20px; font-weight: 900; letter-spacing: -0.02em; }
.page-subtitle{ margin-top:4px; color: var(--muted); font-size: 13px; }
.page-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

.badge{ display:inline-flex; align-items:center; justify-content:center; padding:2px 8px; border-radius:999px; font-size:12px; border:1px solid var(--border); background:#fff; }
.badge.success{ border-color: rgba(22,163,74,.35); background: rgba(22,163,74,.08); }
.badge.danger{ border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.08); }
.badge.warn{ border-color: rgba(234,179,8,.35); background: rgba(234,179,8,.10); }

.tabs{ display:flex; gap:8px; flex-wrap:wrap; margin: 0 0 12px 0; }
.tab{ padding:8px 10px; border:1px solid var(--border); border-radius: 999px; background:#fff; font-size:13px; }
.tab.active{ background:#111827; border-color:#111827; color:#fff; }

/* Tables: actions */
.td-actions{ white-space:nowrap; }
.btn-ghost{ background:#fff; border-color: var(--border); }
.btn-ghost:hover{ background:#f3f4f6; }

/* Toast */
#appToasts{ position: fixed; right: 14px; bottom: 14px; z-index: 9999; display:flex; flex-direction:column; gap:10px; }
.toast{ background:#111827; color:#fff; padding:10px 12px; border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.22); max-width: 360px; font-size: 13px; }
.toast.success{ background:#16a34a; }
.toast.danger{ background:#ef4444; }
.toast.warn{ background:#ca8a04; }
.toast.hide{ opacity:0; transform: translateY(6px); transition: all .25s ease; }

/* Forms */
.help{ color: var(--muted); font-size: 12px; margin-top:6px; }

/* Mobile polish */
@media (max-width: 640px){
  .page-head{ align-items:flex-start; }
  .page-actions{ width:100%; }
}


/* ===== Dropdown nav (header groups) =====
   Robust mode: CSS handles display/positioning; JS only toggles .open/.is-open.
   This avoids "invisible dropdown" caused by overflow/scroll containers.
*/
@media (min-width: 769px){
  .topbar{ overflow: visible !important; }
  .topnav{ overflow-y: visible !important; }
}

.nav-dd{ position:relative; display:inline-flex; }
.nav-dd-btn{ background: transparent; border: 1px solid transparent; cursor:pointer; }
.nav-dd-btn:focus{ outline:2px solid rgba(17,24,39,.25); outline-offset:2px; }
.nav-dd-caret{ font-size: 12px; opacity:.75; }

.nav-dd-menu{
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 16px));
  max-height: min(70vh, calc(100vh - 120px));
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.14);
  padding: 8px;
  display: none;
  transform: translateY(-4px);
  opacity: 0;
  transition: transform .12s ease, opacity .12s ease;
  z-index: 999999;
}

/* Show: JS toggle + pure CSS fallback (hover/focus) */
.nav-dd.open .nav-dd-menu,
.nav-dd:focus-within .nav-dd-menu,
.nav-dd:hover .nav-dd-menu{
  display: block;
  transform: translateY(0);
  opacity: 1;
}

.nav-dd-menu a{
  display:block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration:none;
  white-space: nowrap;
}
.nav-dd-menu a:hover{ background: rgba(0,0,0,.06); }

@media (max-width: 720px){
  .nav-dd-menu{ min-width: 200px; }
}

/* Desktop hover support */
/* Mobile: make dropdown menu fit within screen */
@media (max-width: 720px){
  .nav-dd-menu{ min-width: 200px; }
}


/* ===== NAV DROPDOWN (Desktop stable) ===== */
[data-dd]{ position: relative; display:inline-flex; }
.nav-dd-btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  cursor:pointer;
}
.nav-dd-caret{ font-size: .9em; opacity:.75; }

/* Menu hidden by default */
.nav-dd-menu{
  display:none;
  position:absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-width: 320px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  z-index: 99999;
  white-space: normal;
}
.nav-dd-menu a{
  display:flex;
  padding:10px 10px;
  border-radius:10px;
  text-decoration:none;
  color:inherit;
}
.nav-dd-menu a:hover{ background: rgba(0,0,0,.05); }

/* Open triggers: class + hover + focus-within (keyboard) */
[data-dd].open .nav-dd-menu,
[data-dd]:hover .nav-dd-menu,
[data-dd]:focus-within .nav-dd-menu,
.nav-dd-menu.is-open{ display:block; }

/* Make sure the top header doesn't clip dropdowns */
.topbar, .topnav, .topnav-wrap{ overflow: visible !important; }

/* Allow wrapping on desktop so we don't need horizontal scroll (prevents clipping issues) */
@media (min-width: 900px){
  .topnav{
    flex-wrap: wrap;
    white-space: normal;
    overflow: visible !important;
  }
}
@media (max-width: 899px){
  /* keep mobile horizontal scroll */
  .topnav{
    overflow-x: auto;
    overflow-y: visible;
    white-space: nowrap;
  }
}



/* ===== Shop mobile menu (ultra fiable) ===== */
@media (max-width: 900px){
  /* sur mobile, on transforme les actions boutique en panneau plein écran */
  body.shop-nav-open .shop-actions{
    display:block !important;
    position: fixed;
    top: 56px;
    left: 0; right: 0; bottom: 0;
    padding: 12px;
    background: #fff;
    overflow-y: auto;
    z-index: 10000;
    border-top: 1px solid var(--border);
  }
  /* cacher la version desktop dans le panneau */
  body.shop-nav-open .shop-actions .shop-actions-desktop{ display:none !important; }
  body.shop-nav-open .shop-actions .shop-actions-mobile{ display:block !important; }

  /* quand le menu est fermé : on cache tout */
  body:not(.shop-nav-open) .shop-actions{ display:none !important; }

  .shop-actions-mobile{
    display:none;
  }
  .shop-menu-item{
    display:flex;
    align-items:center;
    justify-content: space-between;
    padding: 12px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 8px 0;
    text-decoration:none;
    color: inherit;
    background: #fff;
  }
  .shop-menu-item:active{ transform: scale(0.99); }
  .shop-menu-item.danger{ color:#b42318; border-color: rgba(180,35,24,0.35); }
  .shop-actions .badge{ margin-left: 8px; }
}
@media (min-width: 901px){
  .shop-actions-desktop{ display:flex; gap:8px; align-items:center; }
  .shop-actions-mobile{ display:none !important; }
}

/* ===== FIX MOBILE (2026-02-16) : Dropdown header reliable on smartphones =====
   On some phones, the "drawer" mode (topnav.open) + overflow containers prevents dropdowns from opening.
   We keep the nav visible (horizontal scroll) and let JS position menus as fixed overlays.
*/
@media (max-width: 768px){
  /* keep nav visible */
  .topnav{ 
    display:flex !important;
    position: relative;
    top:auto; left:auto; right:auto; bottom:auto;
    padding: 0;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px;
    background: transparent;
    border: 0;
    overflow-x: auto;
    overflow-y: visible !important;
    white-space: nowrap;
    z-index: 50;
  }
  /* disable drawer overrides */
  .topnav.open{
    position: relative !important;
    inset: auto !important;
    padding: 0 !important;
    background: transparent !important;
    flex-direction: row !important;
    align-items: center !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
  }
  .mobile-nav-overlay{ display:none !important; }
  /* keep hamburger optional */
  .mobile-only{ display:inline-flex; }
}

/* ===== SHOP DESIGN MOBILE POLISH (2026-02-16) ===== */
@media (max-width: 600px){
  /* keep 2 columns on most phones */
  .shop-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap:10px !important; }
  .shop-card{ border-radius: 16px; }
  .shop-card .thumb{ aspect-ratio: 4/3; }
  .shop-card .title{ font-size: 13px; min-height: 34px; }
  .shop-card .price{ font-size: 14px; }
  .page-shop .shop-toolbar{ flex-direction: column; align-items: stretch; gap:8px; }
  .page-shop .shop-toolbar .right{ width:100%; }
  .page-shop .shop-toolbar select,
  .page-shop .shop-toolbar input{ width:100%; }
}
@media (max-width: 420px){
  .shop-grid{ grid-template-columns: 1fr !important; }
}


/* ===== v120: FIX SHOP MOBILE MENU + PANIER BUTTON SIZE ===== */
@media (max-width: 768px){
  /* Make the shop actions panel float over content (no layout break / no huge height buttons) */
  body.shop-nav-open .shop-actions{
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: 56px !important; /* under the sticky header */
    z-index: 9999 !important;

    display: block !important;
    width: auto !important;
    max-height: 70vh !important;
    overflow: auto !important;

    background: #fff !important;
    border: 1px solid rgba(0,0,0,.08) !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 50px rgba(0,0,0,.18) !important;
    padding: 10px !important;
  }

  /* Keep internal groups stacked */
  .shop-actions-desktop{ display:none !important; }
  .shop-actions-mobile{ display:block !important; }

  /* Ensure links never stretch to full header height */
  .shop-actions a,
  a[href*="page=shop_cart"],
  a[href*="page=shop_cart&"],
  a[href*="page=shop_cart?"]{
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;

    line-height: 1.1 !important;
  }

  /* Make "Panier" compact and consistent */
  .shop-actions a[href*="page=shop_cart"]{
    padding: 12px 12px !important;
    border-radius: 12px !important;
  }

  /* Badge keeps its size */
  .shop-actions .badge{
    flex: 0 0 auto !important;
    min-width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
    text-align: center !important;
    border-radius: 999px !important;
    padding: 0 6px !important;
  }

  /* Optional: dim background while open (prevents accidental taps) */
  body.shop-nav-open:before{
    content:"";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.22);
    z-index: 9998;
  }

  /* The header must stay above the dim layer */
  .shop-header{ z-index: 10000 !important; }
}



/* ===== v121: MOBILE TABLES + ACTION BUTTONS POLISH ===== */
@media (max-width: 768px){
  .table-wrap{ overflow-x:auto !important; -webkit-overflow-scrolling:touch; }
  .table{ min-width: 720px; }
  .table th, .table td{ padding: 10px 10px; }
  .btn, .btn.sm, .btn.btn-sm{ padding: 8px 10px; border-radius: 10px; }
  .actions{ display:flex; flex-wrap:wrap; gap:8px; }
  .data-table-toolbar{ flex-direction:column; align-items:stretch; gap:8px; }
  .data-table-toolbar .data-table-pager{ justify-content:space-between; }
}

/* Ensure pay modal inputs fit small screens */
@media (max-width: 480px){
  .modal .input, .modal input, .modal select{ width:100% !important; }
}


/* Inline form for action buttons (Encaisser etc.) */
.inline-form{display:inline;}
.inline-form button{cursor:pointer;}



/* ===== V129 UI fixes (Sales / Customers / Debtors PRO) ===== */
.table-wrap{overflow:auto;-webkit-overflow-scrolling:touch}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:.6rem .6rem;vertical-align:top;white-space:nowrap}
.table td .muted{white-space:normal}
.badge{display:inline-block;padding:.15rem .5rem;border-radius:999px;font-size:.75rem;line-height:1.2}
.badge-success{background:rgba(0,128,0,.12)}
.badge-warning{background:rgba(255,165,0,.14)}
.badge-danger{background:rgba(255,0,0,.10)}
.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.6rem}
.kpi{background:var(--card-bg, #fff);border:1px solid rgba(0,0,0,.06);border-radius:12px;padding:.7rem}
.kpi-label{font-size:.8rem;opacity:.75}
.kpi-val{font-size:1.15rem;font-weight:700;margin-top:.2rem}

.filters-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:.6rem;align-items:end}
.filters-actions{display:flex;gap:.5rem;flex-wrap:wrap}
.pay-form{min-width:240px}
.pay-form-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:.4rem;align-items:center}
.mt-1{margin-top:.4rem}
.mb-2{margin-bottom:.8rem}
.p-2{padding:.8rem}

@media (max-width: 900px){
  .filters-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .table th,.table td{padding:.55rem .5rem}
}
@media (max-width: 480px){
  .filters-grid{grid-template-columns:1fr}
  .pay-form-grid{grid-template-columns:1fr 1fr}
  .pay-form-grid .btn{grid-column:1 / -1}
}



/* === Shop categories collapsible (mobile) === */

.shop-chips-wrap{ position:relative; display:flex; align-items:flex-start; gap:8px; flex-wrap:wrap; }
.shop-chips{ display:flex; flex-wrap:wrap; gap:8px; overflow:hidden; max-width:100%; }
.shop-chips.is-collapsed{ max-height:84px; } /* ~2 lignes de chips */
.shop-chips.is-expanded{ max-height:1000px; }
.shop-chips-toggle{
  border:1px solid #e5e7eb; background:#fff; border-radius:999px;
  padding:8px 12px; font-weight:800; font-size:13px; white-space:nowrap;
}
.shop-chips-scroll-btn{ border:1px solid #e5e7eb; background:#fff; border-radius:999px; padding:6px 10px; font-weight:900; }
@media (max-width: 768px){
  .shop-chips-scroll-btn{ display:none !important; } /* mobile: swipe/wrap */
  .shop-chips-wrap{ align-items:stretch; }
  .shop-chips-toggle{ display:inline-flex !important; }
}



/* === FIX: shop categories should NOT be fixed/sticky on mobile === */
@media (max-width: 768px){
  /* Keep the main header sticky; only unstick the shop toolbar (categories/count) */
  .page-shop .shop-topbar{
    position: relative !important;
    top: auto !important;
  }
  .page-shop .shop-chips-wrap,
  .page-shop .shop-chips{
    position: static !important;
  }
}



/* === MOBILE FIX PACK v138 (auto) === */

/* Shop (boutique en ligne) : éviter les débordements + pagination masquée par le FAB */
.page-shop .shop-pagination-wrap{ padding-bottom: 84px; } /* espace pour le bouton flottant */
.page-shop .shop-fab{ z-index: 80; }
.page-shop .shop-grid{ min-width: 0; }

/* Catégories : sur mobile, scroll horizontal fiable (pas de wrap qui casse le layout) */
@media (max-width: 900px){
  .page-shop .shop-chips-wrap{ overflow: visible !important; }
  .page-shop .shop-chips{
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100% !important;
    padding-bottom: 6px;
  }
  .page-shop .shop-chips .chip{ white-space: nowrap; }
}

/* Tables : wrapper robuste */
.table-wrap{ overflow:auto; max-width:100%; }




/* iOS Install Banner (Premium) */
.ios-install-banner{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: #111;
  color: #fff;
  padding: 14px 14px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.30);
  z-index: 9999;
  font-size: 14px;
  transform: translateY(120%);
  opacity: 0;
  transition: transform .35s ease, opacity .35s ease;
}

.ios-install-banner.show{
  transform: translateY(0);
  opacity: 1;
}

.ios-install-left{
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.10);
}

.ios-install-logo{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ios-install-content{ 
  flex: 1 1 auto; 
  min-width: 0;
}

.ios-install-title{
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.ios-install-text{
  opacity: .92;
  line-height: 1.25;
}

.ios-chip{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
  font-weight: 700;
}

.ios-install-close{
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  padding: 8px 8px;
  cursor: pointer;
  border-radius: 10px;
  opacity: .9;
}
.ios-install-close:active{ transform: scale(0.98); }

@media (min-width: 900px){
  .ios-install-banner{
    left: auto;
    right: 16px;
    bottom: 16px;
    max-width: 420px;
  }
}


/* ===== Améliorations globales v173 : responsive, accessibilité, confort ===== */
*{box-sizing:border-box}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
img,svg,video,canvas{max-width:100%;height:auto}
button,input,select,textarea{font:inherit}
button,a,input,select,textarea{ -webkit-tap-highlight-color:transparent }
:focus-visible{outline:3px solid rgba(37,99,235,.45);outline-offset:2px}
@media (max-width:768px){
  .container,.page,.content,.main-content{max-width:100%;}
  .table-responsive{overflow-x:auto;-webkit-overflow-scrolling:touch}
  table{max-width:100%}
  .actions,.toolbar,.page-actions,.filters{flex-wrap:wrap;gap:8px}
  .actions>a,.actions>button,.toolbar>a,.toolbar>button{min-height:42px}
  input,select,textarea{max-width:100%}
}
@media (max-width:480px){
  body{overflow-x:hidden}
  .card,.panel,.modal-content{border-radius:12px}
  .shop-chat-fab{right:14px;bottom:calc(14px + env(safe-area-inset-bottom));}
  .shop-wa-fab{right:78px;bottom:calc(14px + env(safe-area-inset-bottom));}
}
@media print{
  .no-print,.sidebar,.topbar,.navbar,.shop-chat-fab,.shop-wa-fab{display:none!important}
  body{background:#fff!important;color:#000!important}
  a{text-decoration:none!important;color:#000!important}
}

/* ===== MOBILE HEADER FINAL FIX 2026-08-26 =====
   Sur téléphone, le menu complet ne doit jamais être coupé horizontalement.
   On force le bouton ☰ et le tiroir, même si une ancienne règle CSS surcharge l'entête. */
@media (max-width: 1100px){
  .top-header{
    height: 56px !important;
    min-height: 56px !important;
    padding: 0 10px !important;
    gap: 8px !important;
    overflow: visible !important;
  }
  body{ padding-top: 66px !important; }
  .top-header .brand-text{ display:none !important; }
  .top-header .brand-logo{ width:32px !important; height:32px !important; }
  .top-header .mobile-only{ display:inline-flex !important; }
  .top-header [data-nav]{ display:none !important; }
  .top-header [data-nav].open{
    display:flex !important;
    position:fixed !important;
    top:56px !important;
    left:0 !important;
    right:0 !important;
    bottom:0 !important;
    width:100vw !important;
    max-width:none !important;
    flex:1 1 auto !important;
    flex-direction:column !important;
    align-items:stretch !important;
    gap:8px !important;
    padding:12px !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    white-space:normal !important;
    background:#fff !important;
    z-index:10000 !important;
    box-sizing:border-box !important;
  }
  .top-header [data-nav].open > a,
  .top-header [data-nav].open .nav-dd-btn{
    width:100% !important;
    min-height:44px !important;
    justify-content:flex-start !important;
    box-sizing:border-box !important;
  }
  .top-header [data-nav].open [data-dd]{ width:100% !important; }
  .top-header [data-nav].open .nav-dd-btn{ justify-content:space-between !important; }
  .top-header [data-nav].open .nav-dd-menu{
    position:static !important;
    width:100% !important;
    max-width:none !important;
  }
  .top-header .header-actions{ margin-left:auto !important; gap:6px !important; }
  .top-header .userchip-name{ max-width:70px !important; }
  .top-header .userchip-sub,.top-header .userchip-role{ display:none !important; }
}


/* ===== PAGINATION SIMPLE ET ISOLÉE =====
   Ces règles concernent uniquement les contrôles de pagination.
   Elles ne modifient jamais .container, .content, .sidebar ou la mise en page globale. */
.u-pager-controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  width:100%;
  box-sizing:border-box;
  margin:12px 0 20px;
  padding:10px 0;
}
.u-pager-left,.u-pager-mid{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.u-pager-info{
  font-size:13px;
  color:var(--muted,#667085);
}
.u-pager-select,.u-pager-page,.u-pager-btn{
  min-height:34px;
  box-sizing:border-box;
}
.u-pager-select,.u-pager-page{
  border:1px solid var(--border,#d0d5dd);
  border-radius:8px;
  padding:5px 8px;
  background:var(--card,#fff);
  color:inherit;
}
.u-pager-page{width:58px;text-align:center;}
.u-pager-btn{
  border:1px solid var(--border,#d0d5dd);
  border-radius:8px;
  background:var(--card,#fff);
  color:inherit;
  padding:5px 10px;
  cursor:pointer;
}
.u-pager-btn:disabled{opacity:.45;cursor:not-allowed;}
@media(max-width:700px){
  .u-pager-controls{justify-content:center;}
  .u-pager-left,.u-pager-mid{justify-content:center;}
  .u-pager-info{width:100%;text-align:center;}
}

/* Gestion utilisateurs / traçabilité produits */
.user-menu-profile{padding:12px 14px;border-bottom:1px solid var(--border);font-size:12px;line-height:1.65;background:var(--card,#fff)}
.user-menu-profile-title{font-weight:800;font-size:13px;margin-bottom:4px}
.user-menu-panel{min-width:280px}
@media(max-width:900px){.user-menu-panel{min-width:260px}.product-actions{white-space:normal}.page-products .tablewrap{overflow-x:auto}}

/* ===== V12 : En-tête professionnel compact et responsive ===== */
.top-header{
  height:60px;
  padding:0 14px;
  gap:10px;
  background:rgba(255,255,255,.96);
  backdrop-filter:blur(14px) saturate(140%);
  -webkit-backdrop-filter:blur(14px) saturate(140%);
  border-bottom:1px solid rgba(15,23,42,.09);
  box-shadow:0 4px 18px rgba(15,23,42,.06);
}
body{ padding-top:72px; }
.brand{ flex:0 0 auto; min-width:0; }
.brand-link{ gap:9px; min-width:0; }
.brand-logo{ width:38px; height:38px; border-radius:11px; box-shadow:0 3px 10px rgba(15,23,42,.10); }
.brand-text{ font-size:15px; font-weight:800; letter-spacing:.15px; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.topnav{ gap:5px; scrollbar-width:none; }
.topnav::-webkit-scrollbar{ display:none; }
.topnav-item{ padding:8px 10px; font-size:13px; font-weight:600; border-radius:10px; }
.topnav-item:hover{ background:rgba(15,23,42,.055); }
.topnav-item.active{ background:#111827; box-shadow:0 2px 7px rgba(15,23,42,.14); }
.nav-dd{ position:relative; flex:0 0 auto; }
.nav-dd-btn{ cursor:pointer; font:inherit; color:inherit; }
.nav-dd.active > .nav-dd-btn{ background:rgba(17,24,39,.07); }
.nav-dd-btn.active{ background:#111827; color:#fff; }
.nav-dd-caret{ font-size:10px; opacity:.7; }
.header-actions{ gap:7px; }
.header-actions .icon-btn{ width:38px; height:38px; padding:0; display:inline-flex; align-items:center; justify-content:center; border-radius:11px; background:rgba(255,255,255,.9); transition:transform .15s ease, background .15s ease, box-shadow .15s ease; }
.header-actions .icon-btn:hover{ transform:translateY(-1px); background:#f8fafc; box-shadow:0 3px 10px rgba(15,23,42,.08); }
.header-actions .btn{ min-height:38px; padding:8px 11px; }
.notify-wrap{ position:relative; }
.notify-panel{ position:absolute; z-index:1200; top:calc(100% + 9px); right:0; width:min(390px,calc(100vw - 20px)); max-width:calc(100vw - 20px); background:#fff; border:1px solid rgba(15,23,42,.10); border-radius:15px; box-shadow:0 18px 50px rgba(15,23,42,.16); overflow:hidden; }
.notify-panel-head{ padding:11px 13px; background:#f8fafc; border-bottom:1px solid rgba(15,23,42,.07); }
.notify-panel-body{ max-height:min(420px,70vh); overflow:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.notify-item{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 13px; text-decoration:none; color:inherit; border-bottom:1px solid rgba(15,23,42,.06); min-height:52px; }
.notify-item:last-child{ border-bottom:0; }
.notify-item:hover{ background:rgba(15,23,42,.035); }
.notify-item-title{ font-weight:750; font-size:13px; }
.notify-item-sub{ margin-top:3px; font-size:11px; opacity:.68; }
.notify-item-badge{ flex:0 0 auto; min-width:24px; height:24px; padding:0 7px; border-radius:999px; display:inline-flex; align-items:center; justify-content:center; font-size:11px; font-weight:800; background:#111827; color:#fff; }
.user-menu > summary{ min-height:38px; padding:6px 9px; border-radius:11px; }
.userchip-name{ font-size:13px; }
.userchip-sub{ font-size:11px; }
.logout-btn{ width:38px; height:38px; padding:0; align-items:center; justify-content:center; }

body.theme-dark .top-header{ background:rgba(17,24,39,.96); border-bottom-color:rgba(255,255,255,.10); box-shadow:0 4px 18px rgba(0,0,0,.20); }
body.theme-dark .header-actions .icon-btn,
body.theme-dark .user-menu > summary{ background:rgba(255,255,255,.05); }
body.theme-dark .topnav-item:hover{ background:rgba(255,255,255,.07); }
body.theme-dark .nav-dd.active > .nav-dd-btn{ background:rgba(255,255,255,.08); }
body.theme-dark .notify-panel-head{ background:#111827; }

@media (max-width:1200px){
  .brand-text{ max-width:110px; }
  .topnav-item{ padding-left:8px; padding-right:8px; }
}
@media (max-width:1024px){
  .top-header{ height:56px; padding:0 9px; gap:7px; }
  body{ padding-top:66px; }
  .brand-logo{ width:34px; height:34px; }
  .brand-text{ display:none !important; }
  .header-actions{ margin-left:auto; }
  .header-actions .btn.mobile-only{ display:inline-flex; }
  .user-menu{ display:none; }
  .logout-btn{ display:inline-flex !important; }
  .notify-panel{ position:fixed; top:64px; right:9px; left:auto; }
}
@media (max-width:520px){
  .top-header{ padding:0 7px; }
  .header-actions{ gap:5px; }
  .header-actions .icon-btn,.logout-btn{ width:36px; height:36px; }
  .header-actions .btn.mobile-only{ font-size:12px; padding:7px 8px; }
  .notify-panel{ position:fixed; top:61px; right:7px; left:7px; width:auto; max-width:none; max-height:calc(100dvh - 72px); border-radius:14px; }
  .notify-panel-body{ max-height:calc(100dvh - 125px); }
}


/* ===== FIX FINAL DROPDOWN HEADER : toujours au-dessus du fond ===== */
@media (max-width: 1024px){
  .topbar{
    position: fixed !important;
    z-index: 50000 !important;
    isolation: isolate;
  }
  .mobile-nav-overlay{
    z-index: 40000 !important;
  }
  .topnav.open{
    position: fixed !important;
    z-index: 50001 !important;
    isolation: isolate;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: var(--card, #fff) !important;
  }
  .topnav.open [data-dd]{
    position: relative !important;
    z-index: 1 !important;
  }
  .topnav.open .nav-dd-menu,
  .topnav.open .nav-dd-menu.is-open{
    position: static !important;
    z-index: auto !important;
    display: block;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: hidden !important;
    background: var(--card, #fff) !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }
  .topnav.open .nav-dd-menu:not(.is-open){
    display: none !important;
  }
  .topnav.open .nav-dd-item{
    position: relative !important;
    z-index: 1 !important;
    background: var(--card, #fff) !important;
    color: inherit;
  }
}


/* ===== CORRECTION MOBILE DEFINITIVE V13 =====
   Cible la vraie classe .topbar (et non .top-header) utilisée par views_header.php.
   Le menu hamburger est un vrai tiroir au-dessus du contenu, et les sous-menus sont des accordéons. */
@media (max-width: 1024px){
  body{ overflow-x:hidden; }
  .topbar{
    position:fixed !important;
    top:0 !important; left:0 !important; right:0 !important;
    width:100% !important;
    height:56px !important;
    min-height:56px !important;
    padding:0 8px !important;
    display:flex !important;
    flex-wrap:nowrap !important;
    align-items:center !important;
    gap:6px !important;
    z-index:2147483003 !important;
    isolation:isolate !important;
    overflow:visible !important;
    transform:none !important;
  }
  body{ padding-top:66px !important; }
  .topbar-spacer{ flex:1 1 auto !important; min-width:0 !important; }
  .topbar > .brand{ flex:0 0 auto !important; min-width:0 !important; }
  .topbar > .mobile-only[data-nav-toggle]{
    display:inline-flex !important;
    flex:0 0 40px !important;
    width:40px !important; height:40px !important;
    align-items:center !important; justify-content:center !important;
    position:relative !important;
    z-index:2147483003 !important;
  }
  .topbar > .topnav{
    display:none !important;
  }
  .topbar > .topnav.open{
    display:flex !important;
    position:fixed !important;
    top:56px !important; left:0 !important; right:0 !important; bottom:0 !important;
    width:100vw !important;
    height:calc(100dvh - 56px) !important;
    max-height:calc(100dvh - 56px) !important;
    margin:0 !important;
    padding:12px !important;
    box-sizing:border-box !important;
    flex-direction:column !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
    gap:8px !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
    white-space:normal !important;
    background:var(--card,#fff) !important;
    color:var(--text,#111827) !important;
    border:0 !important;
    border-top:1px solid var(--border) !important;
    box-shadow:0 16px 40px rgba(0,0,0,.20) !important;
    z-index:2147483004 !important;
    isolation:isolate !important;
  }
  .topbar > .topnav.open > .topnav-item,
  .topbar > .topnav.open > [data-dd] > .nav-dd-btn{
    display:flex !important;
    flex:0 0 auto !important;
    width:100% !important;
    min-height:44px !important;
    padding:11px 13px !important;
    box-sizing:border-box !important;
    align-items:center !important;
    justify-content:space-between !important;
    border:1px solid var(--border) !important;
    border-radius:12px !important;
    background:var(--card,#fff) !important;
    color:var(--text,#111827) !important;
    white-space:normal !important;
  }
  .topbar > .topnav.open > [data-dd]{
    display:block !important;
    width:100% !important;
    flex:0 0 auto !important;
    position:relative !important;
    z-index:1 !important;
  }
  .topbar > .topnav.open .nav-dd-menu,
  .topbar > .topnav.open .nav-dd-menu.is-open{
    position:static !important;
    inset:auto !important;
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    max-height:none !important;
    margin:6px 0 0 !important;
    padding:5px !important;
    box-sizing:border-box !important;
    overflow:visible !important;
    background:var(--card,#fff) !important;
    border:1px solid var(--border) !important;
    border-radius:12px !important;
    box-shadow:none !important;
    opacity:1 !important;
    visibility:visible !important;
    transform:none !important;
    z-index:2 !important;
  }
  .topbar > .topnav.open .nav-dd-menu:not(.is-open){ display:none !important; }
  .topbar > .topnav.open .nav-dd-item{
    display:flex !important;
    width:100% !important;
    min-height:42px !important;
    align-items:center !important;
    padding:10px 12px !important;
    box-sizing:border-box !important;
    border-radius:9px !important;
    background:transparent !important;
    color:inherit !important;
    white-space:normal !important;
  }
  .topbar > .topnav.open .nav-dd-item + .nav-dd-item{ border-top:1px solid rgba(0,0,0,.06); }
  .topbar > .topnav.open .nav-dd-sep{ display:block !important; height:1px !important; margin:4px 2px !important; background:var(--border) !important; }
  .mobile-nav-overlay{
    position:fixed !important;
    top:56px !important; left:0 !important; right:0 !important; bottom:0 !important;
    width:100vw !important; height:calc(100dvh - 56px) !important;
    background:rgba(0,0,0,.42) !important;
    z-index:2147483002 !important;
    pointer-events:auto !important;
  }
  .mobile-nav-overlay[hidden]{ display:none !important; }
  /* Le tiroir est au-dessus de l'overlay. */
  .topbar > .topnav.open{ pointer-events:auto !important; }
  /* Cacher les doublons de déconnexion sur très petits écrans. */
  .topbar > .btn.mobile-only{ display:none !important; }
  .topbar > .logout-btn{ display:inline-flex !important; flex:0 0 36px !important; }
}
@media (max-width:420px){
  .topbar{ padding-left:6px !important; padding-right:6px !important; }
  .topbar > .mobile-only[data-nav-toggle]{ width:38px !important; flex-basis:38px !important; }
  .topbar > .icon-btn:not([data-nav-toggle]), .topbar > .logout-btn{ width:34px !important; height:34px !important; }
}


/* ===== MOBILE HEADER DRAWER - VERSION 15 =====
   Menu mobile type "panneau latéral" : le contenu de la page reste visible et assombri,
   tandis que le panneau de navigation est toujours au-dessus du fond/overlay. */
.nav-icon{display:inline-flex;align-items:center;justify-content:center;width:28px;min-width:28px;font-size:20px;line-height:1;font-weight:800;}
@media (max-width:1024px){
  html,body{max-width:100%;overflow-x:hidden;}
  .topbar{position:fixed !important;top:0 !important;left:0 !important;right:0 !important;width:100% !important;z-index:2147483645 !important;isolation:isolate !important;overflow:visible !important;transform:none !important;}
  .topbar > .topnav{display:none !important;}
  .topbar > .topnav.open{
    display:flex !important;
    position:fixed !important;
    top:56px !important;
    right:0 !important;
    left:auto !important;
    bottom:0 !important;
    width:min(86vw,560px) !important;
    height:calc(100dvh - 56px) !important;
    max-height:calc(100dvh - 56px) !important;
    margin:0 !important;
    padding:10px 12px calc(18px + env(safe-area-inset-bottom)) !important;
    box-sizing:border-box !important;
    flex-direction:column !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
    gap:7px !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior:contain !important;
    white-space:normal !important;
    background:var(--card,#fff) !important;
    color:var(--text,#111827) !important;
    border:1px solid var(--border) !important;
    border-right:0 !important;
    border-top-left-radius:20px !important;
    border-bottom-left-radius:20px !important;
    box-shadow:-18px 0 55px rgba(0,0,0,.22) !important;
    z-index:2147483646 !important;
    isolation:isolate !important;
  }
  .topbar > .topnav.open > .topnav-item,
  .topbar > .topnav.open > [data-dd] > .nav-dd-btn{
    display:flex !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:12px !important;
    width:100% !important;
    min-height:50px !important;
    flex:0 0 auto !important;
    padding:10px 14px !important;
    box-sizing:border-box !important;
    border:0 !important;
    border-radius:12px !important;
    background:transparent !important;
    color:var(--text,#111827) !important;
    font-size:16px !important;
    font-weight:650 !important;
    white-space:normal !important;
    text-align:left !important;
  }
  .topbar > .topnav.open > .topnav-item.active,
  .topbar > .topnav.open > [data-dd].active > .nav-dd-btn,
  .topbar > .topnav.open > [data-dd].open > .nav-dd-btn{
    background:#1677f2 !important;
    color:#fff !important;
    box-shadow:0 4px 12px rgba(22,119,242,.20) !important;
  }
  .topbar > .topnav.open .nav-icon{color:currentColor;}
  .topbar > .topnav.open .nav-dd-caret{margin-left:auto !important;font-size:18px !important;opacity:.65;}
  .topbar > .topnav.open [data-dd]{display:block !important;width:100% !important;flex:0 0 auto !important;position:relative !important;}
  .topbar > .topnav.open .nav-dd-menu,
  .topbar > .topnav.open .nav-dd-menu.is-open{
    position:static !important;
    display:block !important;
    width:calc(100% - 10px) !important;
    min-width:0 !important;
    max-width:none !important;
    max-height:none !important;
    margin:2px 5px 5px !important;
    padding:4px !important;
    overflow:visible !important;
    background:var(--card,#fff) !important;
    border:1px solid var(--border) !important;
    border-radius:12px !important;
    box-shadow:none !important;
    opacity:1 !important;
    visibility:visible !important;
    transform:none !important;
    z-index:3 !important;
  }
  .topbar > .topnav.open .nav-dd-menu:not(.is-open){display:none !important;}
  .topbar > .topnav.open .nav-dd-item{
    display:flex !important;align-items:center !important;width:100% !important;min-height:42px !important;
    padding:9px 12px !important;box-sizing:border-box !important;border-radius:9px !important;
    color:inherit !important;background:transparent !important;white-space:normal !important;
  }
  .topbar > .topnav.open .nav-dd-item + .nav-dd-item{border-top:1px solid rgba(0,0,0,.06) !important;}
  .topbar > .topnav.open .nav-dd-sep{display:block !important;height:1px !important;margin:4px 2px !important;background:var(--border) !important;}
  .topbar > .topnav.open .mobile-only{display:flex !important;}
  .mobile-nav-overlay{
    position:fixed !important;top:56px !important;left:0 !important;right:0 !important;bottom:0 !important;
    width:100vw !important;height:calc(100dvh - 56px) !important;
    background:rgba(15,23,42,.50) !important;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);
    z-index:2147483644 !important;pointer-events:auto !important;
  }
  .mobile-nav-overlay[hidden]{display:none !important;}
  .topbar > .mobile-only[data-nav-toggle]{position:relative !important;z-index:2147483647 !important;}
  body.mobile-menu-open{overflow:hidden !important;}
  body.mobile-menu-open .content{pointer-events:none;}
}
@media (max-width:420px){
  .topbar > .topnav.open{width:88vw !important;border-top-left-radius:18px !important;border-bottom-left-radius:18px !important;padding-left:10px !important;padding-right:10px !important;}
  .topbar > .topnav.open > .topnav-item,.topbar > .topnav.open > [data-dd] > .nav-dd-btn{min-height:47px !important;font-size:15px !important;padding-left:12px !important;padding-right:12px !important;}
}

/* ===== MOBILE HEADER FINAL OVERRIDE — 2026-09-04 =====
   This block intentionally comes LAST so older mobile/header rules cannot override it.
   Target: iPhone/Android — drawer navigation over dimmed page. */
@media (max-width: 768px){
  html, body { max-width:100%; overflow-x:hidden !important; }
  body { padding-top:68px !important; }

  .topbar{
    position:fixed !important;
    top:0 !important; left:0 !important; right:0 !important;
    width:100% !important;
    height:56px !important; min-height:56px !important;
    display:flex !important; flex-wrap:nowrap !important;
    align-items:center !important;
    padding:0 10px !important;
    gap:8px !important;
    overflow:visible !important;
    z-index:2147483647 !important;
    isolation:isolate !important;
    transform:none !important;
  }

  .topbar > .brand { flex:0 0 auto !important; min-width:0 !important; }
  .topbar > .brand .badge { display:none !important; }
  .topbar > .topbar-spacer { flex:1 1 auto !important; min-width:0 !important; }

  .topbar > [data-nav-toggle]{
    display:inline-flex !important;
    flex:0 0 42px !important;
    width:42px !important; height:42px !important;
    align-items:center !important; justify-content:center !important;
    order:2 !important;
    position:relative !important;
    z-index:2147483647 !important;
  }

  /* Hide the navigation completely until the hamburger is pressed. */
  .topbar > .topnav:not(.open){
    display:none !important;
  }

  /* Real right-side drawer. */
  .topbar > .topnav.open{
    display:flex !important;
    position:fixed !important;
    top:56px !important;
    right:0 !important; left:auto !important; bottom:0 !important;
    width:min(88vw,420px) !important;
    height:calc(100dvh - 56px) !important;
    max-height:calc(100dvh - 56px) !important;
    margin:0 !important;
    padding:12px 12px calc(20px + env(safe-area-inset-bottom)) !important;
    box-sizing:border-box !important;
    flex-direction:column !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
    gap:7px !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior:contain !important;
    white-space:normal !important;
    background:var(--card,#fff) !important;
    color:var(--text,#111827) !important;
    border:1px solid var(--border,#e5e7eb) !important;
    border-right:0 !important;
    border-top-left-radius:20px !important;
    border-bottom-left-radius:20px !important;
    box-shadow:-18px 0 55px rgba(0,0,0,.24) !important;
    z-index:2147483647 !important;
    isolation:isolate !important;
  }

  /* Keep all drawer content above its own background. */
  .topbar > .topnav.open > *,
  .topbar > .topnav.open [data-dd]{ position:relative !important; z-index:1 !important; }

  .topbar > .topnav.open > .topnav-item,
  .topbar > .topnav.open > [data-dd] > .nav-dd-btn{
    display:flex !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:12px !important;
    width:100% !important;
    min-height:50px !important;
    flex:0 0 auto !important;
    padding:10px 14px !important;
    box-sizing:border-box !important;
    border:0 !important;
    border-radius:12px !important;
    background:transparent !important;
    color:var(--text,#111827) !important;
    font-size:16px !important;
    font-weight:650 !important;
    text-align:left !important;
    white-space:normal !important;
  }

  .topbar > .topnav.open > .topnav-item.active,
  .topbar > .topnav.open > [data-dd].active > .nav-dd-btn,
  .topbar > .topnav.open > [data-dd].open > .nav-dd-btn{
    background:#1677f2 !important;
    color:#fff !important;
    box-shadow:0 4px 12px rgba(22,119,242,.20) !important;
  }

  .topbar > .topnav.open > [data-dd]{
    display:block !important;
    width:100% !important;
    flex:0 0 auto !important;
  }

  .topbar > .topnav.open .nav-dd-menu,
  .topbar > .topnav.open .nav-dd-menu.is-open{
    position:static !important;
    display:block !important;
    width:calc(100% - 10px) !important;
    min-width:0 !important; max-width:none !important;
    max-height:none !important;
    margin:2px 5px 5px !important;
    padding:4px !important;
    overflow:visible !important;
    box-sizing:border-box !important;
    background:var(--card,#fff) !important;
    color:var(--text,#111827) !important;
    border:1px solid var(--border,#e5e7eb) !important;
    border-radius:12px !important;
    box-shadow:none !important;
    opacity:1 !important; visibility:visible !important;
    transform:none !important;
    z-index:2 !important;
  }
  .topbar > .topnav.open .nav-dd-menu:not(.is-open){ display:none !important; }

  .topbar > .topnav.open .nav-dd-item{
    display:flex !important;
    align-items:center !important;
    width:100% !important; min-height:42px !important;
    padding:9px 12px !important;
    box-sizing:border-box !important;
    border-radius:9px !important;
    background:transparent !important;
    color:inherit !important;
    white-space:normal !important;
  }
  .topbar > .topnav.open .nav-dd-item + .nav-dd-item{
    border-top:1px solid rgba(0,0,0,.06) !important;
  }
  .topbar > .topnav.open .nav-dd-sep{
    display:block !important; height:1px !important;
    margin:4px 2px !important; background:var(--border,#e5e7eb) !important;
  }

  .mobile-nav-overlay{
    display:block !important;
    position:fixed !important;
    top:56px !important; left:0 !important; right:0 !important; bottom:0 !important;
    width:100vw !important; height:calc(100dvh - 56px) !important;
    background:rgba(15,23,42,.52) !important;
    backdrop-filter:blur(2px) !important;
    -webkit-backdrop-filter:blur(2px) !important;
    z-index:2147483646 !important;
    pointer-events:auto !important;
  }
  .mobile-nav-overlay[hidden]{ display:none !important; }

  body.mobile-menu-open{ overflow:hidden !important; }
  body.mobile-menu-open .content{ pointer-events:none !important; }

  /* Header actions stay compact like the supplied screenshot. */
  .topbar > .icon-btn:not([data-nav-toggle]),
  .topbar > .logout-btn{
    flex:0 0 42px !important;
    width:42px !important; height:42px !important;
  }
  .topbar > .btn.mobile-only{ display:none !important; }
}

@media (max-width:420px){
  .topbar{ padding-left:8px !important; padding-right:8px !important; gap:6px !important; }
  .topbar > [data-nav-toggle]{ width:40px !important; height:40px !important; flex-basis:40px !important; }
  .topbar > .icon-btn:not([data-nav-toggle]), .topbar > .logout-btn{ width:40px !important; height:40px !important; flex-basis:40px !important; }
  .topbar > .topnav.open{ width:90vw !important; }
}

/* ===== MOBILE DRAWER ROBUST PATCH V17 =====
   Le tiroir est positionné absolument par rapport à l'entête fixe.
   Cela évite les problèmes iOS de stacking/containing-block des éléments fixed imbriqués. */
@media (max-width:768px){
  .topbar{
    position:fixed !important;
    overflow:visible !important;
    isolation:isolate !important;
    z-index:2147483647 !important;
  }
  .topbar > .topnav:not(.open){ display:none !important; }
  .topbar > .topnav.open{
    display:flex !important;
    position:absolute !important;
    top:56px !important;
    right:0 !important;
    left:auto !important;
    bottom:auto !important;
    width:min(90vw,420px) !important;
    height:calc(100dvh - 56px) !important;
    max-height:calc(100dvh - 56px) !important;
    margin:0 !important;
    padding:14px 12px calc(24px + env(safe-area-inset-bottom)) !important;
    flex-direction:column !important;
    align-items:stretch !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    background:var(--card,#fff) !important;
    color:var(--text,#111827) !important;
    border:1px solid var(--border,#e5e7eb) !important;
    border-right:0 !important;
    border-top-left-radius:20px !important;
    border-bottom-left-radius:20px !important;
    box-shadow:-18px 0 55px rgba(0,0,0,.28) !important;
    z-index:2147483647 !important;
    transform:none !important;
    opacity:1 !important;
    visibility:visible !important;
  }
  .topbar > .topnav.open > *,
  .topbar > .topnav.open [data-dd]{
    position:relative !important;
    z-index:1 !important;
  }
  .mobile-nav-overlay{
    position:fixed !important;
    top:56px !important; left:0 !important; right:0 !important; bottom:0 !important;
    width:100vw !important; height:calc(100dvh - 56px) !important;
    background:rgba(15,23,42,.52) !important;
    backdrop-filter:blur(3px) !important;
    -webkit-backdrop-filter:blur(3px) !important;
    z-index:2147483000 !important;
    pointer-events:auto !important;
  }
  .mobile-nav-overlay[hidden]{display:none !important;}
  body.mobile-menu-open{overflow:hidden !important;}
}
@media (max-width:420px){
  .topbar > .topnav.open{width:90vw !important;}
}

/* ===== MOBILE DRAWER PORTAL — FINAL iOS FIX =====
/* The drawer is temporarily moved to <body> by JS while open. This removes
   it from the header stacking context and guarantees it sits above the overlay. */
@media (max-width:768px){
  body > .topnav.mobile-nav-portal.open{
    display:flex !important;
    position:fixed !important;
    top:56px !important;
    right:0 !important;
    left:auto !important;
    bottom:0 !important;
    width:min(90vw,420px) !important;
    height:calc(100dvh - 56px) !important;
    max-height:calc(100dvh - 56px) !important;
    margin:0 !important;
    padding:14px 12px calc(24px + env(safe-area-inset-bottom)) !important;
    box-sizing:border-box !important;
    flex-direction:column !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
    gap:7px !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior:contain !important;
    background:var(--card,#fff) !important;
    color:var(--text,#111827) !important;
    border:1px solid var(--border,#e5e7eb) !important;
    border-right:0 !important;
    border-top-left-radius:20px !important;
    border-bottom-left-radius:20px !important;
    box-shadow:-18px 0 55px rgba(0,0,0,.30) !important;
    z-index:2147483647 !important;
    isolation:isolate !important;
    transform:translateZ(0) !important;
    opacity:1 !important;
    visibility:visible !important;
  }
  body > .topnav.mobile-nav-portal.open > *,
  body > .topnav.mobile-nav-portal.open [data-dd]{
    position:relative !important;
    z-index:1 !important;
  }
  body > .topnav.mobile-nav-portal.open > .topnav-item,
  body > .topnav.mobile-nav-portal.open > [data-dd] > .nav-dd-btn{
    display:flex !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:12px !important;
    width:100% !important;
    min-height:50px !important;
    flex:0 0 auto !important;
    padding:10px 14px !important;
    box-sizing:border-box !important;
    border:0 !important;
    border-radius:12px !important;
    background:transparent !important;
    color:var(--text,#111827) !important;
    font-size:16px !important;
    font-weight:650 !important;
    text-align:left !important;
    white-space:normal !important;
  }
  body > .topnav.mobile-nav-portal.open > .topnav-item.active,
  body > .topnav.mobile-nav-portal.open > [data-dd].active > .nav-dd-btn,
  body > .topnav.mobile-nav-portal.open > [data-dd].open > .nav-dd-btn{
    background:#1677f2 !important;
    color:#fff !important;
  }
  body > .topnav.mobile-nav-portal.open > [data-dd]{
    display:block !important;
    width:100% !important;
    flex:0 0 auto !important;
  }
  body > .topnav.mobile-nav-portal.open .nav-dd-menu,
  body > .topnav.mobile-nav-portal.open .nav-dd-menu.is-open{
    position:static !important;
    display:block !important;
    width:calc(100% - 10px) !important;
    min-width:0 !important;
    max-width:none !important;
    margin:2px 5px 5px !important;
    padding:4px !important;
    box-sizing:border-box !important;
    overflow:visible !important;
    background:var(--card,#fff) !important;
    border:1px solid var(--border,#e5e7eb) !important;
    border-radius:12px !important;
    box-shadow:none !important;
    opacity:1 !important;
    visibility:visible !important;
    transform:none !important;
    z-index:2 !important;
  }
  body > .topnav.mobile-nav-portal.open .nav-dd-menu:not(.is-open){display:none !important;}
  body > .topnav.mobile-nav-portal.open .nav-dd-item{
    display:flex !important;
    align-items:center !important;
    width:100% !important;
    min-height:42px !important;
    padding:9px 12px !important;
    box-sizing:border-box !important;
    border-radius:9px !important;
    background:transparent !important;
    color:inherit !important;
    white-space:normal !important;
  }
  @media (max-width:420px){
    body > .topnav.mobile-nav-portal.open{width:90vw !important;}
  }
}

/* ===== FIX MOBILE : défilement horizontal des tableaux ===== */
.table-wrap,
.table-responsive,
.data-table-wrap,
.table-container,
.responsive-table,
.overflow-auto {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

.table-wrap table,
.table-responsive table,
.data-table-wrap table,
.table-container table,
.responsive-table table {
  min-width: max-content;
  width: max-content;
}

@media (max-width: 768px) {
  .table-wrap,
  .table-responsive,
  .data-table-wrap,
  .table-container,
  .responsive-table {
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap::-webkit-scrollbar,
  .table-responsive::-webkit-scrollbar,
  .data-table-wrap::-webkit-scrollbar,
  .table-container::-webkit-scrollbar,
  .responsive-table::-webkit-scrollbar {
    height: 7px;
  }
}

/* ===== MAHAKALI TIC – Boutique responsive v2 ===== */
.page-shop .shop-wrap{max-width:1440px;margin-inline:auto;padding-inline:clamp(10px,2vw,24px)}
.page-shop .shop-grid{
  display:grid !important;
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  gap:16px !important;
  align-items:stretch;
}
.page-shop .shop-card{min-width:0;border-radius:16px;box-shadow:0 4px 16px rgba(15,23,42,.055)}
.page-shop .shop-card .thumb{
  height:178px !important; min-height:0 !important; max-height:178px !important;
  aspect-ratio:auto !important; overflow:hidden; background:#f8fafc;
}
.page-shop .shop-card .thumb-link{display:flex;width:100%;height:100%;align-items:center;justify-content:center;padding:9px;box-sizing:border-box}
.page-shop .shop-card .thumb img{
  display:block;width:100% !important;height:100% !important;max-width:100%;max-height:100%;
  object-fit:contain !important;object-position:center;background:transparent;
}
.page-shop .shop-card .body{padding:11px 12px 13px}
.page-shop .shop-card .title{font-size:14px;line-height:1.35;min-height:2.7em}
.page-shop .shop-card .price{font-size:15px}
@media(max-width:1100px){
  .page-shop .shop-grid{grid-template-columns:repeat(3,minmax(0,1fr)) !important;gap:13px !important}
  .page-shop .shop-card .thumb{height:160px !important;max-height:160px !important}
}
@media(max-width:700px){
  .page-shop .shop-grid{grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:10px !important}
  .page-shop .shop-card .thumb{height:132px !important;max-height:132px !important}
  .page-shop .shop-card .thumb-link{padding:7px}
  .page-shop .shop-card .body{padding:9px 9px 11px}
  .page-shop .shop-card .title{font-size:12.5px;min-height:2.7em}
  .page-shop .shop-card .price{font-size:13.5px}
  .page-shop .shop-card .thumb-add,.page-shop .shop-card .wish{width:34px;height:34px;right:7px;left:7px;bottom:7px}
}
@media(max-width:360px){
  .page-shop .shop-grid{gap:8px !important}
  .page-shop .shop-card .thumb{height:112px !important;max-height:112px !important}
  .page-shop .shop-card .title{font-size:12px}
}
@media(prefers-reduced-motion:reduce){.page-shop .shop-card,.page-shop .shop-card .thumb img{transition:none !important}}
.page-shop .shop-grid.compact .shop-card .thumb{height:132px !important;max-height:132px !important;aspect-ratio:auto !important}
@media(max-width:1100px){.page-shop .shop-grid.compact .shop-card .thumb{height:124px !important;max-height:124px !important}}
@media(max-width:700px){.page-shop .shop-grid.compact .shop-card .thumb{height:112px !important;max-height:112px !important}}


/* MAHAKALI TIC — correctif boutique compact inspiré Amazon (v3) */
body.page-shop .shop-wrap{max-width:1600px!important;padding:8px clamp(8px,1.2vw,18px)!important;margin:0 auto!important}
body.page-shop .shop-hero{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:12px!important;min-height:0!important;padding:12px 16px!important;margin:0 0 10px!important;border-radius:12px!important;background:#172b43!important;color:#fff!important;box-shadow:0 3px 12px rgba(15,23,42,.12)!important}
body.page-shop .shop-hero h1{font-size:clamp(17px,1.8vw,25px)!important;line-height:1.15!important;margin:0 0 3px!important;color:#fff!important}
body.page-shop .shop-hero p{font-size:12px!important;margin:0!important;color:rgba(255,255,255,.82)!important}
body.page-shop .shop-hero-eyebrow{font-size:10px!important;margin:0 0 3px!important}
body.page-shop .shop-hero-actions{display:flex!important;align-items:center!important;gap:10px!important;margin:0!important}
body.page-shop .shop-hero-actions .btn{padding:8px 12px!important;font-size:12px!important;border-radius:8px!important}
body.page-shop .shop-welcome{display:none!important}
body.page-shop .shop-grid{display:grid!important;grid-template-columns:repeat(8,minmax(0,1fr))!important;gap:10px!important;align-items:stretch!important}
body.page-shop .shop-card{min-width:0!important;border:1px solid #e5e7eb!important;border-radius:10px!important;overflow:hidden!important;box-shadow:0 2px 8px rgba(15,23,42,.05)!important}
body.page-shop .shop-card .thumb{height:108px!important;min-height:108px!important;max-height:108px!important;padding:5px!important;background:#fff!important}
body.page-shop .shop-card .thumb-link{padding:4px!important}
body.page-shop .shop-card .thumb img{width:100%!important;height:100%!important;object-fit:contain!important}
body.page-shop .shop-card .body{padding:7px!important}
body.page-shop .shop-card .title{font-size:11px!important;line-height:1.25!important;min-height:2.5em!important;max-height:2.5em!important;overflow:hidden!important}
body.page-shop .shop-card .price{font-size:12px!important;margin-top:4px!important}
body.page-shop .shop-card .desc{display:none!important}
body.page-shop .shop-card .actions{display:flex!important;gap:4px!important;flex-wrap:wrap!important;margin-top:6px!important}
body.page-shop .shop-card .actions .btn{font-size:10px!important;padding:6px 5px!important;min-height:28px!important;border-radius:6px!important}
body.page-shop .shop-grid.compact .shop-card .thumb{height:108px!important;max-height:108px!important}
@media(min-width:701px) and (max-width:1199px){
 body.page-shop .shop-grid{grid-template-columns:repeat(6,minmax(0,1fr))!important;gap:9px!important}
 body.page-shop .shop-card .thumb,body.page-shop .shop-grid.compact .shop-card .thumb{height:100px!important;min-height:100px!important;max-height:100px!important}
}
@media(max-width:700px){
 body.page-shop .shop-wrap{padding:5px!important}
 body.page-shop .shop-hero{padding:9px 10px!important;margin-bottom:7px!important;border-radius:9px!important;display:flex!important;flex-wrap:wrap!important}
 body.page-shop .shop-hero h1{font-size:16px!important}
 body.page-shop .shop-hero-actions{gap:6px!important}
 body.page-shop .shop-hero-actions .btn{padding:6px 8px!important;font-size:10px!important}
 body.page-shop .shop-grid{grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:5px!important}
 body.page-shop .shop-card{border-radius:7px!important}
 body.page-shop .shop-card .thumb,body.page-shop .shop-grid.compact .shop-card .thumb{height:68px!important;min-height:68px!important;max-height:68px!important;padding:2px!important}
 body.page-shop .shop-card .thumb-link{padding:2px!important}
 body.page-shop .shop-card .body{padding:4px!important}
 body.page-shop .shop-card .title{font-size:9px!important;line-height:1.15!important;min-height:2.3em!important;max-height:2.3em!important}
 body.page-shop .shop-card .price{font-size:9px!important;margin-top:3px!important}
 body.page-shop .shop-card .actions{gap:2px!important;margin-top:4px!important}
 body.page-shop .shop-card .actions .btn{font-size:8px!important;padding:4px 2px!important;min-height:22px!important}
}


/* MAHAKALI TIC — intégration maquette compacte bleu/cyan/violet */
body:has(.shop-header) .shop-header{
  background:linear-gradient(105deg,rgba(3,16,54,.98),rgba(5,54,135,.97) 58%,rgba(28,15,92,.98));
  color:#fff;border-bottom:1px solid rgba(74,190,255,.55);
  box-shadow:0 5px 22px rgba(0,35,110,.22)
}
body:has(.shop-header) .shop-header-inner{
  max-width:1500px;padding:5px 14px;gap:10px;min-height:58px
}
body:has(.shop-header) .shop-brand{gap:8px;color:#fff}
body:has(.shop-header) .shop-brand-logo{height:30px;width:30px;border-radius:8px}
body:has(.shop-header) .shop-brand-name{font-size:clamp(16px,1.5vw,22px);letter-spacing:-.35px}
body:has(.shop-header) .shop-search{max-width:600px;gap:6px}
body:has(.shop-header) .shop-search input[type="search"]{
 height:34px;border-radius:999px;border:1px solid rgba(125,190,255,.55);
 background:#fff;padding:0 14px;font-size:13px
}
body:has(.shop-header) .shop-search .btn{
 min-height:34px;padding:6px 12px;border-radius:999px;
 background:linear-gradient(135deg,#08b9ff,#1747ed 65%,#873bff);
 border:0;color:#fff;font-weight:800
}
body:has(.shop-header) .shop-actions{gap:6px}
body:has(.shop-header) .shop-actions .btn{
 min-height:32px;padding:6px 10px;border-radius:999px;font-size:12px;
 white-space:nowrap
}
body:has(.shop-header) .shop-actions .btn.secondary{
 background:rgba(255,255,255,.96);color:#10234e;border:1px solid rgba(255,255,255,.7)
}
body:has(.shop-header) .shop-actions .btn:not(.secondary){
 background:linear-gradient(135deg,#087bff,#253bd7);color:#fff;border:1px solid rgba(255,255,255,.35)
}
@media(max-width:900px){
 body:has(.shop-header) .shop-header-inner{min-height:52px;padding:5px 10px;gap:7px}
 body:has(.shop-header) .shop-search{max-width:none}
}
@media(max-width:720px){
 body:has(.shop-header) .shop-header-inner{min-height:48px}
 body:has(.shop-header) .shop-brand-logo{height:27px;width:27px}
 body:has(.shop-header) .shop-brand-name{font-size:15px}
}
