/* Vival PWA — Layout + components */

/* ===== App shell (responsive) ===== */
.app {
  display: grid;
  min-height: 100vh;
  background: var(--surface-1);
}

/* Mobile portrait: stacked with bottom nav */
@media (max-width: 767px) {
  .app { grid-template-rows: auto 1fr auto; }
  .app-sidebar { display: none; }
  .app-topbar { display: flex; }
  .app-main { padding: 0; padding-bottom: 72px; }
  .app-bottomnav { display: flex; }
}

/* Tablet / desktop: sidebar + main */
@media (min-width: 768px) {
  .app { grid-template-columns: 88px 1fr; }
  .app-sidebar { display: flex; }
  .app-topbar { display: none; }
  .app-bottomnav { display: none; }
  .app-main { padding: 0; }
}

/* ===== Sidebar (desktop/tablet) ===== */
.app-sidebar {
  background: var(--surface-0);
  border-right: 1px solid var(--line-1);
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}
.sb-logo {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  padding: 6px;
  box-shadow: 0 0 0 1px var(--line-1);
}
.sb-logo img { width: 100%; height: auto; object-fit: contain; }
.sb-item {
  width: 64px; height: 56px;
  border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--ink-3);
  background: transparent; border: 0; cursor: pointer;
  transition: all .15s var(--ease-out);
  position: relative;
}
.sb-item:hover { color: var(--ink-1); background: var(--surface-2); }
.sb-item[aria-current="true"] { color: var(--vival-red); background: var(--vival-red-soft); }
.sb-item .icon { width: 22px; height: 22px; }
.sb-item-label { font-size: 10px; font-weight: 600; letter-spacing: 0.01em; }
.sb-spacer { flex: 1; }

/* ===== Topbar (mobile) ===== */
.app-topbar {
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--line-1);
  position: sticky; top: 0; z-index: 10;
}
.tb-logo {
  width: 44px; height: 36px;
  border-radius: 6px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
  border: 1px solid var(--line-1);
}
.tb-title { font-weight: 700; font-size: 16px; flex: 1; }
.tb-action {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink-2); position: relative;
}
.tb-action:hover { background: var(--surface-2); }
.tb-action .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--vival-red); border: 2px solid var(--surface-0);
}

/* ===== Bottom nav (mobile) ===== */
.app-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface-0);
  border-top: 1px solid var(--line-1);
  padding: 6px 4px 10px;
  justify-content: space-around;
  z-index: 10;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* Notifications */
.notif-badge {
  position: absolute; top: 4px; right: 6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--vival-red); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface-0);
}
.notif-panel {
  position: absolute;
  background: #fff;
  border: 1px solid var(--line-1);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
  width: 340px; max-width: calc(100vw - 24px);
  z-index: 1000;
  overflow: hidden;
}
.notif-panel-sidebar { left: calc(100% + 8px); bottom: 0; }
.notif-panel-topbar { right: 0; top: calc(100% + 8px); }
@media (max-width: 400px) {
  .notif-panel-topbar, .notif-panel-sidebar { right: 12px; left: auto; }
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line-1); }
.notif-list { max-height: 440px; overflow-y: auto; }
.notif-empty { padding: 28px 18px; text-align: center; color: var(--ink-3); }
.notif-empty .icon { width: 32px; height: 32px; color: var(--success, #1b5e20); margin-bottom: 6px; }
.notif-item {
  width: 100%; display: flex; gap: 10px;
  padding: 10px 14px; border: 0; background: transparent; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--line-2, #f3f3f3);
  align-items: flex-start;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item:last-child { border-bottom: 0; }
.notif-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-icon-order { background: #fde5e6; color: #d10a11; }
.notif-icon-delivery { background: #e0f2fe; color: #0369a1; }
.notif-icon-stock { background: #fef3c7; color: #92400e; }
.notif-icon .icon { width: 18px; height: 18px; }
.notif-text { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 13px; line-height: 1.3; }
.notif-body { font-size: 12px; margin-top: 2px; }

.app-bottomnav .bn-item { min-width: 0; flex: 1 1 0; padding: 8px 2px !important; }
.app-bottomnav .bn-item-label { font-size: 9px !important; text-align: center; }
@media (max-width: 420px) {
  .app-bottomnav .bn-item-label { font-size: 8px !important; }
}
@media (max-width: 360px) {
  .app-bottomnav .bn-item-label { display: none; }
}
@media (max-width: 720px) {
  .app-topbar { padding: 8px 12px !important; gap: 8px !important; }
  .tb-title { font-size: 15px !important; }
}

/* ===== Admin Catalogue : table → cartes sur mobile ===== */
@media (max-width: 767px) {
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .admin-table { background: transparent !important; box-shadow: none !important; }
  .admin-table tr {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    margin-bottom: 10px;
    padding: 10px 12px;
    border-top: 0 !important;
    position: relative;
    display: grid !important;
    grid-template-columns: 56px 1fr auto;
    grid-template-areas:
      "img name price"
      "img meta action";
    gap: 4px 12px;
    align-items: center;
  }
  .admin-table td {
    padding: 0 !important;
    border: 0 !important;
    text-align: left !important;
  }
  .admin-table td:nth-child(1) { grid-area: img; }
  .admin-table td:nth-child(2) { grid-area: name; }
  .admin-table td:nth-child(3) { grid-area: meta; font-size: 11px; color: var(--ink-3); }
  .admin-table td:nth-child(4) { grid-area: price; text-align: right !important; font-size: 15px !important; }
  .admin-table td:nth-child(5) { display: none; }
  .admin-table td:nth-child(6) { grid-area: meta; text-align: right !important; font-size: 11px !important; justify-self: end; margin-left: auto; }
  .admin-table td:nth-child(7) { grid-area: action; justify-self: end; }
  .admin-table td:nth-child(3)::before { content: ""; }
  .admin-table td:nth-child(6)::before { content: "Stock: "; color: var(--ink-3); }
}

/* page-header wrap sur mobile */
@media (max-width: 767px) {
  .page-header { flex-wrap: wrap !important; gap: 8px !important; padding: 16px !important; }
  .page-header .btn { flex: 1 1 auto !important; min-width: 0 !important; white-space: nowrap; padding: 10px 12px; font-size: 13px; }
  .page-header .page-header-grow { flex: 1 0 100% !important; width: 100% !important; min-width: 0 !important; }
  .page-title { font-size: 22px !important; }
  .page-subtitle { font-size: 12px !important; }
  .admin-filters { padding: 0 16px 12px !important; }
  .admin-filters > * { width: 100%; }
  .admin-table-wrap { padding: 0 12px 80px !important; overflow-x: visible !important; }
}
.bn-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink-3);
  border-radius: var(--r-sm);
}
.bn-item[aria-current="true"] { color: var(--vival-red); }
.bn-item .icon { width: 22px; height: 22px; }
.bn-item-label { font-size: 10px; font-weight: 600; }

/* ===== Main content ===== */
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ===== Page header ===== */
.page-header {
  padding: 24px 32px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--line-1);
}
@media (max-width: 767px) { .page-header { padding: 16px; } }

.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.page-subtitle { color: var(--ink-3); font-size: 14px; margin: 4px 0 0; }
.page-header-grow { flex: 1; }

/* ===== Button ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
  background: var(--surface-0);
  color: var(--ink-1);
  cursor: pointer;
  transition: all .12s var(--ease-out);
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn .icon { width: 18px; height: 18px; }

.btn-primary { background: var(--vival-red); color: white; border-color: var(--vival-red); }
.btn-primary:hover { background: var(--vival-red-hover); border-color: var(--vival-red-hover); }
.btn-primary:active { background: var(--vival-red-press); }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-outline { background: var(--surface-0); border-color: var(--line-1); }
.btn-outline:hover { background: var(--surface-2); }

.btn-danger { background: var(--surface-0); color: var(--danger); border-color: var(--line-1); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; border-radius: var(--r-md); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon-sm { width: 36px; height: 36px; padding: 0; }

.btn-block { display: flex; width: 100%; }

/* ===== Input ===== */
.input {
  height: 44px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  background: var(--surface-0);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-1);
  outline: 0;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--vival-red); box-shadow: 0 0 0 3px var(--vival-red-tint); }
.input::placeholder { color: var(--ink-4); }

.input-with-icon { position: relative; }
.input-with-icon .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-4); width: 18px; height: 18px; pointer-events: none; }
.input-with-icon .input { padding-left: 42px; }

.input-lg { height: 52px; font-size: 16px; padding: 0 18px; }
.input-with-icon.input-lg-wrap .input { padding-left: 48px; height: 52px; font-size: 16px; }
.input-with-icon.input-lg-wrap .icon { left: 18px; width: 20px; height: 20px; }

/* ===== Card ===== */
.card {
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
}

/* ===== Badge ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-bio { background: var(--success-soft); color: var(--success); }
.badge-promo { background: var(--vival-red-tint); color: var(--vival-red); }
.badge-new { background: var(--info-soft); color: var(--info); }
.badge-rupture { background: var(--danger-soft); color: var(--danger); }
.badge-stock-low { background: var(--warning-soft); color: var(--warning); }

/* Stock overlay on product image */
.product-stock-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  color: var(--danger);
  text-transform: uppercase; letter-spacing: 0.05em;
}
[data-theme="dark"] .product-stock-overlay { background: rgba(15,18,20,.75); }

/* Pinned section */
.pinned-section {
  padding: 16px 32px 0;
}
@media (max-width: 767px) { .pinned-section { padding: 12px 16px 0; } }
.pinned-title {
  font-size: 11px; font-weight: 800; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 0 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.pinned-row {
  display: flex; gap: 8px; overflow-x: auto;
  scrollbar-width: none; padding-bottom: 8px;
}
.pinned-row::-webkit-scrollbar { display: none; }
.pin-chip {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px;
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-pill);
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
}
.pin-chip:hover { border-color: var(--vival-red); background: var(--vival-red-soft); }
.pin-chip-thumb {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
}
.pin-chip-thumb .icon { width: 18px; height: 18px; color: var(--ink-3); }
.pin-chip-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.pin-chip-price { font-size: 12px; font-weight: 700; color: var(--vival-red); }

/* PIN login */
.pin-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-2) 100%);
  padding: 24px;
}
.pin-card {
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.pin-logo {
  width: 200px; height: auto; max-height: 72px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.pin-logo img { width: 100%; height: auto; object-fit: contain; }
.pin-title { font-size: 22px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.01em; }
.pin-subtitle { color: var(--ink-3); font-size: 14px; margin: 0 0 28px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 28px; }
.pin-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-1);
  transition: all .12s;
}
.pin-dot.filled { background: var(--vival-red); border-color: var(--vival-red); }
.pin-dot.error { border-color: var(--danger); animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.pin-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.pin-key {
  height: 64px;
  border: 0; background: var(--surface-2);
  border-radius: var(--r-md);
  font-family: inherit; font-size: 24px; font-weight: 700;
  cursor: pointer;
  transition: all .08s;
}
.pin-key:hover { background: var(--surface-3); }
.pin-key:active { transform: scale(0.96); background: var(--vival-red-tint); }
.pin-key.action { background: transparent; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.pin-key.action .icon { width: 22px; height: 22px; }

/* Numpad */
.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.numpad-key {
  height: 56px;
  border: 0; background: var(--surface-2);
  border-radius: var(--r-md);
  font-family: inherit; font-size: 20px; font-weight: 700;
  cursor: pointer;
}
.numpad-key:hover { background: var(--surface-3); }
.numpad-display {
  background: var(--surface-2);
  padding: 16px 20px;
  border-radius: var(--r-md);
  font-size: 32px; font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

/* Delivery card */
.delivery-card {
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}
.delivery-order-num {
  background: var(--vival-red);
  color: white;
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
}
.delivery-info { min-width: 0; }
.delivery-name { font-weight: 700; font-size: 15px; }
.delivery-address { color: var(--ink-2); font-size: 13px; margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.delivery-notes { color: var(--warning); font-size: 12px; margin-top: 4px; font-style: italic; }
.delivery-meta { color: var(--ink-3); font-size: 12px; margin-top: 6px; }
.delivery-actions { display: flex; flex-direction: column; gap: 6px; }

/* Customer detail */
.customer-detail-header {
  display: flex; gap: 16px; align-items: center;
  padding: 24px 32px;
  background: linear-gradient(135deg, var(--vival-red-soft), var(--surface-0));
  border-bottom: 1px solid var(--line-1);
}
@media (max-width: 767px) { .customer-detail-header { padding: 16px; } }
.customer-detail-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--vival-red);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 28px;
}

/* Favorites row in customer detail */
.fav-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

/* ===== Segmented control ===== */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 2px;
}
.segmented button {
  height: 36px; padding: 0 14px;
  border: 0; background: transparent;
  border-radius: calc(var(--r-md) - 4px);
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .12s;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface-0);
  color: var(--ink-1);
  box-shadow: var(--shadow-sm);
}

/* ===== Chips (rayons tabs) ===== */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  border: 1px solid var(--line-1);
  background: var(--surface-0);
  color: var(--ink-2);
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
  font-family: inherit;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] {
  background: var(--vival-red);
  color: white;
  border-color: var(--vival-red);
}
.chip .icon { width: 18px; height: 18px; }

/* ===== Product card ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px 32px;
}
@media (max-width: 767px) {
  .products-grid { padding: 12px 16px; grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
[data-pcard="compact"] .products-grid {
  grid-template-columns: 1fr;
  max-width: 720px;
}

.product {
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.product:hover { border-color: var(--ink-3); }
.product:active { transform: scale(0.99); }

.product-image {
  aspect-ratio: 1;
  width: 100%;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
.product-image svg.icon { width: 48%; height: 48%; color: var(--ink-4); }
.product-badges {
  position: absolute;
  top: 8px; left: 8px;
  display: flex; gap: 4px; flex-wrap: wrap;
}

.product-name { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--ink-1); }
.product-format { font-size: 12px; color: var(--ink-3); }
.product-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.product-price { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.product-price .cents { font-size: 12px; vertical-align: top; }
.product-plus {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--vival-red);
  color: white;
  border: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .12s;
}
.product-plus:hover { background: var(--vival-red-hover); }
.product-plus:active { transform: scale(0.9); }
.product-plus .icon { width: 20px; height: 20px; stroke-width: 2.5; }

/* Compact card variant */
[data-pcard="compact"] .product {
  flex-direction: row;
  align-items: center;
}
[data-pcard="compact"] .product-image { width: 56px; aspect-ratio: 1; flex-shrink: 0; }
[data-pcard="compact"] .product-image svg.icon { width: 60%; height: 60%; }
[data-pcard="compact"] .product-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
[data-pcard="compact"] .product-row { margin-top: 0; }
[data-pcard="compact"] .product-badges { position: static; }

/* ===== Cart ===== */
.cart {
  width: 380px;
  flex-shrink: 0;
  background: var(--surface-0);
  border-left: 1px solid var(--line-1);
  display: flex; flex-direction: column;
  height: 100vh;
  position: sticky; top: 0;
  align-self: flex-start;
}
/* iPad paysage / écrans moyens : panier plus étroit pour laisser 3 colonnes produits */
@media (min-width: 1024px) and (max-width: 1366px) {
  .cart { width: 320px; }
}
@media (max-width: 1023px) { .cart { display: none; } }

.cart-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line-1);
  display: flex; align-items: center; gap: 12px;
}
.cart-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; margin: 0; flex: 1; }
.cart-count-pill {
  background: var(--vival-red);
  color: white;
  font-size: 12px; font-weight: 800;
  padding: 2px 10px;
  border-radius: var(--r-pill);
}

.cart-customer {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-1);
  display: flex; align-items: center; gap: 12px;
}
.cart-customer-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  font-weight: 700; font-size: 14px;
}
.cart-customer-info { flex: 1; min-width: 0; }
.cart-customer-name { font-size: 14px; font-weight: 700; color: var(--ink-1); }
.cart-customer-meta { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }

.cart-lines {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.cart-line {
  padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line-2);
}
.cart-line:last-child { border-bottom: 0; }
.cart-line-thumb {
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cart-line-thumb .icon { width: 24px; height: 24px; color: var(--ink-4); }
.cart-line-info { flex: 1; min-width: 0; }
.cart-line-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.cart-line-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.cart-line-price { font-size: 14px; font-weight: 700; white-space: nowrap; }
.qty-control {
  display: inline-flex; align-items: center;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.qty-btn {
  width: 28px; height: 28px;
  border: 0; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); cursor: pointer;
}
.qty-btn:hover { background: var(--surface-3); color: var(--ink-1); }
.qty-btn .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.qty-value { font-size: 13px; font-weight: 700; padding: 0 4px; min-width: 28px; text-align: center; }

.cart-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px;
  text-align: center;
  color: var(--ink-3);
  gap: 12px;
}
.cart-empty .icon { width: 56px; height: 56px; color: var(--ink-4); }
.cart-empty-title { font-weight: 700; color: var(--ink-2); font-size: 15px; }

.cart-totals {
  padding: 16px 20px;
  border-top: 1px solid var(--line-1);
  display: flex; flex-direction: column; gap: 8px;
}
.cart-total-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); }
.cart-total-row.grand { font-size: 18px; font-weight: 800; color: var(--ink-1); margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line-1); }

.cart-actions { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 8px; }

/* ===== Catalog layout (two-pane) ===== */
.catalog {
  display: flex;
  min-height: 100vh;
}
@media (min-width: 768px) {
  .catalog { height: 100vh; min-height: 0; overflow: hidden; }
}
@media (max-width: 1023px) { .catalog .cart { display: none; } }
.catalog-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 768px) {
  .catalog-main { height: 100vh; overflow: hidden; }
}

.catalog-toolbar {
  padding: 16px 32px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--surface-1);
  border-bottom: 1px solid var(--line-1);
}
@media (max-width: 767px) { .catalog-toolbar { padding: 12px 16px; } }
.catalog-search { flex: 1; min-width: 220px; }

.rayons-scroller {
  display: flex;
  gap: 8px;
  padding: 12px 32px;
  overflow-x: auto;
  background: var(--surface-0);
  border-bottom: 1px solid var(--line-1);
  scrollbar-width: none;
}
.rayons-scroller::-webkit-scrollbar { display: none; }
.rayons-scroller, .subrayons { cursor: grab; user-select: none; }
.rayons-scroller.dragging, .subrayons.dragging { cursor: grabbing; }
@media (max-width: 767px) { .rayons-scroller { padding: 12px 16px; } }

.subrayons {
  display: flex; gap: 6px;
  padding: 10px 32px;
  overflow-x: auto;
  background: var(--surface-1);
  border-bottom: 1px solid var(--line-1);
  scrollbar-width: none;
}
.subrayons::-webkit-scrollbar { display: none; }
@media (max-width: 767px) { .subrayons { padding: 10px 16px; } }
.subrayon-chip {
  height: 32px; padding: 0 12px;
  border: 0; background: transparent;
  color: var(--ink-3); font-weight: 600; font-size: 13px;
  border-radius: var(--r-pill);
  cursor: pointer; white-space: nowrap;
  font-family: inherit;
}
.subrayon-chip:hover { color: var(--ink-1); background: var(--surface-2); }
.subrayon-chip[aria-pressed="true"] { color: var(--ink-1); background: var(--surface-3); }

.products-scroll { flex: 1; overflow-y: auto; }

/* ===== Floating cart button (mobile/tablet when cart hidden) ===== */
.floating-cart {
  position: fixed;
  bottom: 88px; right: 16px;
  z-index: 9;
  display: none;
  align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--vival-red);
  color: white;
  border: 0;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}
@media (max-width: 1023px) { .floating-cart.active { display: inline-flex; } }
@media (min-width: 768px) and (max-width: 1023px) { .floating-cart.active { bottom: 16px; } }
.floating-cart .icon { width: 22px; height: 22px; }
.floating-cart-count {
  background: white; color: var(--vival-red);
  font-size: 12px; font-weight: 800;
  padding: 2px 8px; border-radius: var(--r-pill);
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadein .18s var(--ease-out);
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  background: var(--surface-0);
  border-radius: var(--r-xl);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-overlay);
  animation: pop .22s var(--ease-spring);
  overflow: hidden;
}
@keyframes pop { from { transform: scale(.95) translateY(10px); opacity: 0; } }
.modal-header {
  padding: 20px 24px 12px;
  display: flex; align-items: center; gap: 12px;
}
.modal-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; margin: 0; flex: 1; }
.modal-body { padding: 0 24px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line-1);
  display: flex; gap: 8px; justify-content: flex-end;
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

/* Drawer (cart drawer for mobile) */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, 0.45);
  z-index: 100;
  animation: fadein .18s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--surface-0);
  z-index: 101;
  display: flex; flex-direction: column;
  animation: slidein .22s var(--ease-out);
  box-shadow: var(--shadow-overlay);
}
@keyframes slidein { from { transform: translateX(100%); } }

/* ===== KPI cards (dashboard) ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 24px 32px;
}
@media (max-width: 767px) { .kpi-grid { padding: 16px; gap: 12px; } }
.kpi {
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.kpi-label { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink-1); }
.kpi-value .unit { font-size: 18px; color: var(--ink-3); font-weight: 600; margin-left: 4px; }
.kpi-delta { font-size: 12px; color: var(--success); font-weight: 600; }
.kpi-delta.neg { color: var(--danger); }
.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--vival-red-soft);
  color: var(--vival-red);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.kpi-icon .icon { width: 22px; height: 22px; }

/* Order list */
.orderlist {
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  margin: 0 32px 24px;
  overflow: hidden;
}
@media (max-width: 767px) { .orderlist { margin: 0 16px 16px; } }
.orderlist-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-1);
  display: flex; align-items: center; gap: 12px;
}
.orderlist-title { font-size: 16px; font-weight: 700; margin: 0; flex: 1; }

.order-row {
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 40px 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background .12s;
}
.order-row:last-child { border-bottom: 0; }
.order-row:hover { background: var(--surface-1); }
@media (max-width: 767px) {
  .order-row { grid-template-columns: 36px 1fr auto; grid-template-rows: auto auto; gap: 4px 12px; }
  .order-row .col-meta { grid-column: 2 / 4; color: var(--ink-3); font-size: 12px; }
  .order-row .col-total { grid-row: 1; grid-column: 3; }
  .order-row .col-status { grid-row: 2; grid-column: 3; justify-self: end; }
}
.order-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--ink-2); font-size: 13px;
}
.order-name { font-weight: 700; font-size: 14px; color: var(--ink-1); }
.order-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.order-total { font-weight: 800; font-size: 15px; white-space: nowrap; }
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-en-cours { background: var(--info-soft); color: var(--info); }
.status-prete { background: var(--warning-soft); color: var(--warning); }
.status-livree { background: var(--success-soft); color: var(--success); }
.status-payee { background: var(--surface-3); color: var(--ink-3); }
.status-annulee { background: var(--danger-soft, #fde8e8); color: var(--danger, #c02424); }

/* Customer list */
.customer-row {
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}
.customer-row:hover { background: var(--surface-1); }
.customer-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--vival-red-tint), var(--vival-red-soft));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--vival-red);
}

/* ===== Tweaks panel ===== */
.tweaks {
  position: fixed;
  bottom: 16px; right: 16px;
  width: 300px;
  max-height: 70vh;
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-overlay);
  z-index: 50;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.tweaks.open { display: flex; }
.tweaks-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-1);
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-1);
}
.tweaks-title { font-weight: 800; font-size: 14px; flex: 1; }
.tweaks-body { padding: 12px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.tweak { display: flex; flex-direction: column; gap: 6px; }
.tweak-label { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }

/* ===== Scan overlay ===== */
.scan-viewport {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--r-md);
  background: #0a0c0f;
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.7);
}
.scan-frame {
  position: absolute;
  top: 20%; bottom: 20%; left: 12%; right: 12%;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 8px;
}
.scan-frame::before, .scan-frame::after,
.scan-frame > span, .scan-frame > span::after {
  content: ""; position: absolute; width: 20px; height: 20px;
  border: 3px solid var(--vival-red);
}
.scan-frame::before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.scan-frame::after { top: -3px; right: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.scan-frame > span { bottom: -3px; left: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.scan-frame > span::after { bottom: -3px; right: -3px; left: auto; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; width: 20px; height: 20px; }
.scan-line {
  position: absolute; left: 12%; right: 12%;
  height: 2px;
  background: var(--vival-red);
  box-shadow: 0 0 12px var(--vival-red);
  animation: scanmove 2s infinite var(--ease-out);
}
@keyframes scanmove {
  0%, 100% { top: 22%; }
  50% { top: 78%; }
}

/* Misc */
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--font-mono); }
.divider { height: 1px; background: var(--line-1); margin: 8px 0; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--surface-2); font-size: 11px; font-weight: 600; color: var(--ink-2); }

.empty-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state .icon { width: 56px; height: 56px; color: var(--ink-4); }

/* Print A4 */
@media print {
  body * { visibility: hidden; }
  .print-doc, .print-doc * { visibility: visible; }
  .print-doc { position: absolute; top: 0; left: 0; width: 100%; }
}
.print-doc {
  max-width: 794px;
  margin: 24px auto;
  background: white;
  color: black;
  padding: 48px 56px;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  line-height: 1.5;
}
.print-doc .bl-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; border-bottom: 2px solid #000; padding-bottom: 16px; }
.print-doc .bl-logo { width: 56px; height: 56px; background: var(--vival-red); color: white; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; }
.print-doc h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.print-doc .bl-meta { text-align: right; font-size: 12px; }
.print-doc table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.print-doc th, .print-doc td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #ddd; }
.print-doc th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #555; font-weight: 700; }
.print-doc td.num { text-align: right; font-variant-numeric: tabular-nums; }
.print-doc .bl-totals { margin-top: 16px; margin-left: auto; width: 280px; }
.print-doc .bl-totals .row { display: flex; justify-content: space-between; padding: 4px 0; }
.print-doc .bl-totals .row.grand { font-weight: 800; font-size: 16px; border-top: 2px solid #000; padding-top: 8px; margin-top: 8px; }

/* Thermal ticket formats */
.print-doc.ticket-80, .print-doc.ticket-58 {
  max-width: 100%; padding: 6px; font-size: 11px; font-family: ui-monospace, 'Courier New', monospace;
}
.print-doc.ticket-80 { width: 80mm; }
.print-doc.ticket-58 { width: 58mm; font-size: 10px; }
.print-doc.ticket-80 .bl-header, .print-doc.ticket-58 .bl-header { flex-direction: column; align-items: center; text-align: center; border-bottom: 1px dashed #000; padding-bottom: 8px; margin-bottom: 8px; gap: 4px; }
.print-doc.ticket-80 .bl-header > div, .print-doc.ticket-58 .bl-header > div { flex-direction: column; align-items: center; text-align: center; }
.print-doc.ticket-80 h2, .print-doc.ticket-58 h2 { font-size: 14px; }
.print-doc.ticket-80 .bl-logo, .print-doc.ticket-58 .bl-logo { display: none; }
.print-doc.ticket-80 .bl-meta, .print-doc.ticket-58 .bl-meta { text-align: center; flex-direction: column; align-items: center; }
.print-doc.ticket-80 .bl-meta img, .print-doc.ticket-58 .bl-meta img { width: 60px; height: 60px; }
.print-doc.ticket-80 th, .print-doc.ticket-80 td, .print-doc.ticket-58 th, .print-doc.ticket-58 td { padding: 3px 2px; font-size: 10px; }
.print-doc.ticket-58 th, .print-doc.ticket-58 td { font-size: 9px; }
.print-doc.ticket-80 .bl-totals, .print-doc.ticket-58 .bl-totals { width: 100%; }
.print-doc.ticket-80 > div[style*="gridTemplateColumns"], .print-doc.ticket-58 > div[style*="gridTemplateColumns"] { display: block !important; }
@media print {
  @page { margin: 0; }
  .print-doc.ticket-80 { width: 80mm; }
  .print-doc.ticket-58 { width: 58mm; }
}

/* =========================================
   Boutique client publique — mobile first
   ========================================= */

/* Clamp global viewport pour éviter overflow horizontal sur mobile */
html, body { overflow-x: hidden; max-width: 100vw; }

/* Slots bar responsive */
.shop-slots-bar { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; overflow-x: auto; }
.shop-slots-bar > button { flex-shrink: 0; min-width: 150px; }

@media (min-width: 768px) {
  .shop-slots-bar { flex-wrap: wrap; overflow: visible; }
}

/* Rayon tiles mobile = 2 colonnes par défaut */
.shop-rayon-tiles { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) {
  .shop-rayon-tiles { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (min-width: 1024px) {
  .shop-rayon-tiles { grid-template-columns: repeat(4, 1fr) !important; }
}

/* =========================================
   Admin / Caissier — mobile responsive
   ========================================= */

/* Plans d'abonnement */
.plans-grid {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.plans-grid > * { scroll-snap-align: start; }

@media (max-width: 720px) {
  .plans-grid {
    grid-template-columns: 88% 88% 88% !important;
    padding-bottom: 8px;
  }
}
@media (min-width: 721px) and (max-width: 1023px) {
  .plans-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* Page header caissier */
@media (max-width: 720px) {
  .page-header {
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 12px 16px !important;
  }
  .page-header-grow { flex: 1 1 100%; }
  .page-header .segmented { flex: 0 0 auto; overflow-x: auto; max-width: 100%; }
  .page-title { font-size: 20px !important; }
}

/* KPI grid */
@media (max-width: 720px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 0 12px !important;
  }
  .kpi-value { font-size: 20px !important; }
}

/* Catalog admin filters */
.admin-filters { padding: 0 16px 12px !important; gap: 8px !important; }
@media (max-width: 720px) {
  .admin-filters > * { flex-basis: 100% !important; }
}

/* Réglages container + cards */
.settings-container {
  max-width: 100%;
  box-sizing: border-box;
}
.settings-container .card {
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
/* Cible uniquement les éléments problématiques (URLs, messages longs, stacks de flex) */
.settings-container .card a,
.settings-container .card code {
  word-break: break-all;
  overflow-wrap: anywhere;
}
.settings-container .card p,
.settings-container .card .muted {
  overflow-wrap: break-word;
}

@media (max-width: 720px) {
  .settings-container {
    padding: 0 12px 100px !important;
    gap: 12px !important;
    width: 100%;
  }
  .settings-container .card { padding: 14px !important; }
  .settings-container h3 { font-size: 15px !important; }

  /* Force le wrap des flex rows + stack avatar/name/buttons */
  .settings-container .card > div[style*="display:flex"],
  .settings-container .card > div[style*="display: flex"] {
    flex-wrap: wrap !important;
    gap: 10px !important;
    row-gap: 10px !important;
  }
  /* Name column à côté de l'avatar prend au moins 100px restant */
  .settings-container .card [style*="flex:1"],
  .settings-container .card [style*="flex: 1"] {
    flex-basis: 60% !important;
    min-width: 100px !important;
  }
  /* Les boutons en bas du row passent sur leur propre ligne ensemble */
  .settings-container .card button,
  .settings-container .card a[role="button"] {
    white-space: nowrap;
  }
  /* Grids internes dans les cards : stack vertical sur mobile */
  .settings-container .card > div[style*="gridTemplateColumns"],
  .settings-container .card > div[style*="grid-template-columns"],
  .settings-container .card div[style*="gridTemplateColumns:'1fr 1fr'"],
  .settings-container .card div[style*="gridTemplateColumns:'1fr 1fr 1fr'"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

/* =========================================
   AUDIT RESPONSIVE GLOBAL (≤ 720px)
   Couvre tous les écrans admin & modals
   ========================================= */
@media (max-width: 720px) {
  /* Container principal */
  .app-main > * > div[style*="padding:'0 32px"],
  .app-main > * > div[style*="padding: 0 32px"] {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Banners dashboard */
  .dash-banner,
  .dash-top-products {
    margin-left: 12px !important;
    margin-right: 12px !important;
    padding: 12px 14px !important;
    overflow: hidden;
  }
  .dash-top-products h3 { font-size: 13px !important; }
  .dash-top-products > div[style*="grid"] > div { min-width: 0; }

  /* Headers de page (Commandes, Clients, Livraison, etc.) */
  .page-header {
    padding: 12px !important;
  }
  .page-header > * { min-width: 0; }
  .page-title { font-size: 18px !important; }
  .page-subtitle { font-size: 12px !important; }

  /* Filtres admin (Catalogue, Commandes) */
  .admin-filters, div.admin-filters {
    padding: 0 12px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .admin-filters > * { width: 100% !important; max-width: 100% !important; flex: none !important; }

  /* Tableaux admin scrollable horizontal */
  .admin-table-wrap {
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .admin-table-wrap table { min-width: 700px; }

  /* Orderlist, cards de liste */
  .orderlist { padding: 0 12px !important; }
  .orderlist .order-row { padding: 10px 12px !important; gap: 10px !important; }
  .order-row .col-meta { font-size: 11px !important; }
  .order-row .col-total { font-size: 14px !important; white-space: nowrap; }
  .order-row .col-status { display: none; }
  .order-name { font-size: 14px !important; }

  /* Panier drawer — occupe 95% largeur */
  .drawer { width: 95vw !important; max-width: 95vw !important; }
  .cart-panel { padding: 12px !important; }
  .cart-line-thumb { width: 48px !important; height: 48px !important; }
  .cart-line-name { font-size: 13px !important; }

  /* Modals en plein écran mobile */
  .modal {
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  .modal-backdrop { padding: 0 !important; align-items: stretch !important; }
  .modal-header { padding: 12px 16px !important; }
  .modal-body { padding: 0 16px 16px !important; }
  .modal-footer {
    padding: 12px 16px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .modal-footer > * { flex: 1 1 auto; }
  .modal-title { font-size: 16px !important; }

  /* Tableaux dans modals (OrderDetail lines) */
  .modal-body table { font-size: 12px; }
  .modal-body table th,
  .modal-body table td { padding: 6px 4px !important; }

  /* Forms internes : stack tous les grids 1fr 1fr / 1fr 1fr 1fr / 1fr 1fr 1fr 1fr en 1 col */
  div[style*="gridTemplateColumns:'1fr 1fr'"],
  div[style*="gridTemplateColumns: '1fr 1fr'"],
  div[style*="gridTemplateColumns:'1fr 1fr 1fr'"],
  div[style*="gridTemplateColumns: '1fr 1fr 1fr'"],
  div[style*="gridTemplateColumns:'1fr 1fr 1fr 1fr'"],
  div[style*="gridTemplateColumns: '1fr 1fr 1fr 1fr'"],
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Exceptions: payment buttons 2 cols OK, et rayon-tiles déjà gérés */
  .shop-rayon-tiles {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Boutons : si dans un group, wrap */
  .modal-footer,
  .page-header,
  .cart-actions {
    flex-wrap: wrap !important;
  }

  /* Textes / inputs : taille confortable */
  input, select, textarea, button {
    font-size: 14px !important;
  }
  input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="search"], textarea {
    min-width: 0 !important;
    width: 100%;
  }

  /* Réception marchandise modal : items list */
  .modal-body > div[style*="maxHeight:200"] {
    max-height: 30vh !important;
  }

  /* Segmented control (Aujourd'hui / Historique) */
  .segmented {
    width: 100% !important;
    overflow-x: auto;
  }
  .segmented button { flex: 1 1 auto; white-space: nowrap; }

  /* Customer picker list, user rows */
  .customer-row { padding: 10px 12px !important; }

  /* Print doc — laisse tranquille */
  .print-doc { max-width: 100% !important; }

  /* Marketplace tuiles */
  .app-main div[style*="gridTemplateColumns:'repeat(auto-fill, minmax(280px"] {
    grid-template-columns: 1fr !important;
  }
  .app-main div[style*="gridTemplateColumns:'repeat(auto-fill, minmax(180px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Bon de livraison header : stack */
  .print-doc .bl-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .print-doc .bl-meta { text-align: left !important; }
}

/* Médium (721-1023) : tablette */
@media (min-width: 721px) and (max-width: 1023px) {
  .app-main div[style*="gridTemplateColumns:'repeat(auto-fill, minmax(280px"] {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Main padding reduction mobile */
@media (max-width: 720px) {
  .app-main { padding-bottom: 80px; }
  .products-scroll { padding: 0 12px !important; }
  .orderlist { padding: 0 12px !important; }
  .cart-panel { padding: 12px !important; }
}

/* Bottom nav overflow scroll */
.bottom-nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.bottom-nav::-webkit-scrollbar { display: none; }
.bottom-nav .bn-item { flex-shrink: 0; min-width: 60px; }
.shop-layout,
.shop-layout * {
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.shop-layout img { max-width: 100%; height: auto; }

.shop-layout {
  grid-template-columns: 1fr;
  gap: 12px !important;
  padding: 12px !important;
  width: 100%;
  overflow: hidden;
}
.shop-sidebar { position: static; order: -1; width: 100%; }
.shop-sidebar .shop-rayons-list {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.shop-sidebar .shop-rayons-list button {
  white-space: nowrap;
  flex-shrink: 0;
  width: auto !important;
}

/* Header mobile par défaut */
.shop-header-inner {
  gap: 10px !important;
  max-width: 100%;
  box-sizing: border-box;
}
.shop-header-inner > * { min-width: 0; }
.shop-header-inner { overflow: hidden; }

/* Slot picker mobile */
.shop-slot-pick { grid-template-columns: 1fr !important; gap: 16px !important; }
.shop-slot-pick .shop-slots-grid { grid-template-columns: 1fr !important; }

/* Produits — 2 colonnes mobile par défaut */
.shop-products-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
.shop-products-grid > div { padding: 10px !important; }
.shop-products-grid > div .shop-card-img { height: 100px !important; }

/* Homepage mobile par défaut */
.home-hero h1 { font-size: 22px !important; }
.home-store-grid { grid-template-columns: 1fr !important; }
.home-search-form { flex-direction: column; }
.home-search-form input { width: 100%; min-width: 0; }

/* ===== Desktop : >=1024px ===== */
@media (min-width: 1024px) {
  .shop-layout {
    grid-template-columns: 260px 1fr !important;
    gap: 24px !important;
    padding: 24px !important;
  }
  .shop-sidebar {
    position: sticky !important;
    top: 82px !important;
    order: 0 !important;
  }
  .shop-sidebar .shop-rayons-list {
    display: block !important;
    overflow-x: visible !important;
  }
  .shop-sidebar .shop-rayons-list button {
    width: 100% !important;
    white-space: normal !important;
  }
  .shop-header-inner { flex-direction: row !important; align-items: center !important; }
  .shop-slot-pick { grid-template-columns: 1fr 2fr !important; gap: 24px !important; }
  .shop-slot-pick .shop-slots-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
  }
  .shop-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    gap: 12px !important;
  }
  .shop-products-grid > div { padding: 12px !important; }
  .shop-products-grid > div .shop-card-img { height: 120px !important; }
  .home-hero h1 { font-size: clamp(24px, 4vw, 36px) !important; }
  .home-store-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  }
  .home-search-form { flex-direction: row; }
}

/* ===== Tour guidé (onboarding) ===== */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
}
.tour-backdrop-click {
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
}
.tour-hole {
  position: absolute;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(10, 15, 25, 0.72);
  transition: top .32s cubic-bezier(.4,0,.2,1),
              left .32s cubic-bezier(.4,0,.2,1),
              width .32s cubic-bezier(.4,0,.2,1),
              height .32s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  outline: 2px solid rgba(255,255,255,.9);
  outline-offset: 2px;
}
.tour-hole.pulse::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  border: 2px solid var(--vival-red, #e2001a);
  animation: tourPulse 1.4s infinite;
  pointer-events: none;
}
@keyframes tourPulse {
  0%   { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.15); }
}
.tour-bubble {
  position: absolute;
  z-index: 251;
  pointer-events: auto;
  background: var(--surface-0, #fff);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.15);
  padding: 16px 18px;
  max-width: 340px;
  min-width: 260px;
  animation: tourBubblePop .22s cubic-bezier(.175,.885,.32,1.275);
  transition: top .32s cubic-bezier(.4,0,.2,1),
              left .32s cubic-bezier(.4,0,.2,1);
}
.tour-bubble.centered {
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
  max-width: 420px;
}
@keyframes tourBubblePop {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.tour-bubble.centered {
  animation: tourBubblePopCentered .22s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes tourBubblePopCentered {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@media (max-width: 640px) {
  .tour-bubble { max-width: 90vw; min-width: 240px; }
}

/* Alerte température bloquante (niveau 3) */
@keyframes tempPulseBg {
  0%, 100% { background: rgba(220, 20, 20, 0.82); }
  50%      { background: rgba(255, 40, 40, 0.92); }
}
