/* ── Caisse ──────────────────────────────────────────────────────────── */
.pos-page { padding: 0; }
.pos {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  height: calc(100dvh - var(--topbar-h));
}
.pos-catalog { overflow-y: auto; padding: 0 24px 32px; min-width: 0; }
.pos-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: 18px; margin: 0 -24px 4px; padding-left: 24px; padding-right: 24px; }
.pos-toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.pos-search { flex: 1; max-width: 520px; }
.pos-search .input { min-height: 46px; font-size: 1rem; border-radius: 12px; }
.pos-stock-btn { min-height: 46px; flex: none; }
@media (max-width: 720px) {
  .pos-toolbar { gap: 10px; }
  .pos-stock-btn { width: 46px; padding: 0; justify-content: center; }
  .pos-stock-label { display: none; }
}
.pos-today { margin-left: auto; text-align: right; line-height: 1.25; display: flex; flex-direction: column; }
.pos-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.pos-cats .chip { flex: none; padding: 8px 14px; }
.cat-dot-sm { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.pos-tile {
  position: relative; display: flex; flex-direction: column; text-align: left;
  padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  font: inherit; color: var(--text); cursor: pointer; overflow: hidden;
  box-shadow: var(--shadow-xs); transition: transform .08s, box-shadow .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pos-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.pos-tile:active { transform: scale(.97); }
.pos-tile:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.pos-tile.in-cart { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.pos-tile.is-out { opacity: .45; cursor: not-allowed; }
.pos-tile-img { position: relative; aspect-ratio: 1; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.pos-tile-img img { width: 100%; height: 100%; object-fit: cover; }
.pos-tile-qty {
  position: absolute; top: 8px; left: 8px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); font-weight: 850; font-size: .9rem; display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.pos-tile-stock {
  position: absolute; bottom: 8px; right: 8px; padding: 1px 8px; border-radius: 999px;
  background: color-mix(in oklab, var(--surface) 88%, transparent); color: var(--text-2); font-size: .74rem; font-weight: 800;
  backdrop-filter: blur(4px);
}
.pos-tile-stock.low { background: var(--warning-soft); color: var(--warning-text); }
.pos-tile-stock.out { background: var(--danger-soft); color: var(--danger-text); }
.pos-tile-name { padding: 9px 11px 0; font-weight: 750; font-size: .88rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pos-tile-price { padding: 2px 11px 11px; font-weight: 850; color: var(--primary-text); }

.pos-cart { display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); min-height: 0; }
.pos-cart-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.pos-cart-head h2 { display: flex; align-items: center; gap: 8px; }
.pos-lines { flex: 1; overflow-y: auto; padding: 4px 0; min-height: 80px; }
.pos-line { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.pos-line-name { font-weight: 750; font-size: .92rem; line-height: 1.25; }
.pos-line-total { width: 76px; text-align: right; font-weight: 800; white-space: nowrap; }
.pos-stepper { display: flex; align-items: center; background: var(--surface-3); border-radius: 10px; }
.pos-stepper button { width: 34px; height: 34px; border: 0; background: none; color: var(--text); cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.pos-stepper button:hover { background: var(--border); }
.pos-stepper button:disabled { opacity: .35; cursor: not-allowed; }
.pos-stepper span { min-width: 26px; text-align: center; font-weight: 850; }
.pos-empty { text-align: center; color: var(--text-3); padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.pos-pay { padding: 14px 18px 18px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; }
.pos-total { display: flex; align-items: baseline; justify-content: space-between; }
.pos-total span { font-weight: 750; color: var(--text-2); }
.pos-total strong { font-size: 2rem; font-weight: 850; letter-spacing: -.02em; }
.pos-cash { display: flex; flex-direction: column; gap: 8px; }
.pos-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.pos-quick .btn { flex: 1; }
.pos-change { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 12px; border-radius: 10px; background: var(--success-soft); color: var(--success-text); font-weight: 750; }
.pos-change strong { font-size: 1.25rem; }
.pos-change.neg { background: var(--danger-soft); color: var(--danger-text); }
.pos-change.big { margin-top: 14px; padding: 14px 18px; }
.pos-change.big strong { font-size: 1.8rem; }
.done-check { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--success); color: #fff; animation: pop .35s var(--ease); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }

.pos-bar, .pos-sheet-backdrop, .show-mobile { display: none !important; }

@media (max-width: 1023px) {
  .pos { grid-template-columns: minmax(0, 1fr); height: auto; min-height: calc(100dvh - var(--topbar-h)); }
  .pos-catalog { padding: 0 14px 110px; overflow: visible; }
  .pos-head { top: var(--topbar-h); margin: 0 -14px 4px; padding: 12px 14px 0; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
  .pos-cart {
    position: fixed; inset: auto 0 0 0; z-index: 60; max-height: 92dvh; border-left: 0;
    border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(105%); transition: transform .25s var(--ease);
  }
  .pos-cart.open { transform: none; }
  .show-mobile { display: inline-flex !important; }
  .pos-bar {
    display: flex !important; align-items: center; gap: 12px; position: fixed; z-index: 50;
    left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); padding: 0 18px; height: 60px;
    border: 0; border-radius: 16px; background: var(--primary); color: var(--on-primary); font: inherit; font-weight: 750;
    box-shadow: var(--shadow-lg); cursor: pointer;
  }
  .pos-bar.empty { background: var(--surface); color: var(--text-3); border: 1px solid var(--border); }
  .pos-bar strong { margin-left: auto; font-size: 1.15rem; }
  .pos-bar-cta { display: inline-flex; align-items: center; gap: 2px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.3); }
  .pos-sheet-backdrop { display: block !important; position: fixed; inset: 0; background: var(--overlay); z-index: 55; }
  .pos-sheet-backdrop[style*="display: none"] { display: none !important; }
}

/* Loupe sur les tuiles : agrandir la photo sans ajouter au panier */
.pos-tile-zoom {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-2);
  background: color-mix(in oklab, var(--surface) 85%, transparent); backdrop-filter: blur(4px);
  box-shadow: var(--shadow-xs); opacity: .85; cursor: zoom-in;
}
.pos-tile-zoom:hover { opacity: 1; color: var(--primary-text); }
@media (hover: hover) { .pos-tile-zoom { opacity: 0; transition: opacity .15s; } .pos-tile:hover .pos-tile-zoom { opacity: .9; } }

.pos-tile-img .pos-tile-logo { width: 62%; height: 62%; object-fit: contain; opacity: .45; }
.pos-tile-img:has(.pos-tile-logo) { background: #fff; }
