:root {
  --primary: #e2001a;
  --primary-dark: #b00014;
  --accent: #ffd200;
  --text: #17181c;
  --muted: #6b7280;
  --panel: rgba(255,255,255,0.96);
  --glass: rgba(255,255,255,0.78);
  --shadow: 0 12px 40px rgba(20,20,30,0.18);
  --shadow-sm: 0 4px 14px rgba(20,20,30,0.12);
  --radius: 16px;
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #111; color: var(--text); font-family: inherit; -webkit-font-smoothing: antialiased; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#scene.dragging { cursor: grabbing; }
#scene.pointing { cursor: pointer; }
.hidden { display: none !important; }
kbd {
  display: inline-block; min-width: 1.5em; padding: 1px 6px; margin: 0 1px;
  border: 1px solid #d5d5da; border-bottom-width: 2px; border-radius: 5px;
  background: #f5f5f7; font: 600 0.8em/1.4 inherit; color: #333; text-align: center;
}
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
#install-btn { margin-top: 2px; }
/* Écran de chargement : barre animée par transform (reste fluide même quand le navigateur calcule la 3D) */
.loader { margin: 0 0 12px; }
.loader-track { position: relative; height: 8px; border-radius: 99px; background: #e8e8ee; overflow: hidden; }
#loader-fill { position: absolute; inset: 0; background: var(--primary); transform-origin: left center; transform: scaleX(0); transition: transform .35s ease-out; border-radius: inherit; }
.loader-track::after {
  content: ""; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: loader-shine 1.3s linear infinite; will-change: transform;
}
@keyframes loader-shine { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
#enter-btn:disabled { opacity: .85; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.error-detail { text-align: left; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.error-detail summary { cursor: pointer; }
.error-detail code { display: block; margin-top: 6px; padding: 8px 10px; background: #ececf1; border-radius: 8px; word-break: break-word; user-select: all; }
/* Aperçu d'un brouillon de l'espace enseigne */
.is-preview::before {
  content: "Aperçu du brouillon — non publié"; position: fixed; left: 50%; top: 0; transform: translateX(-50%); z-index: 60;
  background: #17181c; color: #fff; font: 700 .72rem/1 Inter, sans-serif; padding: 5px 12px; border-radius: 0 0 10px 10px; letter-spacing: .4px;
}
#loading-status.error { color: #b00014; font-size: .95rem; font-weight: 600; line-height: 1.45; }
.old-price { color: var(--muted); font-size: .7em; font-weight: 500; text-decoration: line-through; margin-right: 6px; }
button { font-family: inherit; }
.btn {
  border: none; border-radius: 12px; padding: 10px 18px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; background: #f0f0f3; color: var(--text); transition: transform .08s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(0.96); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); filter: none; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #f0f0f3; filter: none; }
.btn.big { padding: 15px 26px; font-size: 1.05rem; width: 100%; }
.btn.small { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { border: none; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .85rem; }

/* Fondu de transition */
#fade { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .22s ease; z-index: 25; }
#fade.on { opacity: 1; }

/* ---------- Écran d'accueil ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% 30%, rgba(255,255,255,0.25), rgba(30,30,40,0.7));
  backdrop-filter: blur(8px);
}
.welcome-card {
  width: min(520px, 92vw); background: var(--panel); border-radius: 26px; padding: 34px 36px 26px;
  box-shadow: var(--shadow); text-align: center; max-height: 94vh; overflow: auto;
}
.logo { font-size: 2.1rem; font-weight: 800; color: var(--primary); letter-spacing: -0.8px; }
.logo-cart { filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
.tagline { margin: 8px 0 22px; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.tips { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; text-align: left; }
.tips li { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 14px; background: #f6f6f8; }
.tips li div { display: flex; flex-direction: column; line-height: 1.3; }
.tips li b { font-size: .95rem; }
.tips li span:not(.tip-icon) { font-size: .82rem; color: var(--muted); }
.tip-icon { font-size: 1.5rem; width: 36px; text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 16px; font-size: .82rem; color: var(--muted); }
.field select {
  padding: 11px 12px; border-radius: 12px; border: 1px solid #e2e2e6; font-size: .95rem; background: #fff; color: var(--text); font-family: inherit;
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }

#topbar {
  position: absolute; top: 14px; left: 14px; right: 14px; height: 54px; display: flex; align-items: center; gap: 12px;
  padding: 0 8px 0 16px; background: var(--glass); backdrop-filter: blur(14px); border-radius: 18px; box-shadow: var(--shadow-sm);
}
#topbar .brand { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--primary); letter-spacing: -0.3px; }
#search-wrap { position: relative; flex: 1; max-width: 480px; margin-left: 8px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: .85rem; opacity: .6; pointer-events: none; }
#search {
  width: 100%; padding: 10px 14px 10px 34px; border-radius: 999px; border: 1px solid transparent; font-size: .9rem; outline: none;
  background: rgba(0,0,0,0.06); color: var(--text); font-family: inherit;
}
#search:focus { background: #fff; border-color: #ddd; box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
#search-drop {
  position: absolute; top: 48px; left: 0; right: 0; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow);
  color: var(--text); overflow: hidden; z-index: 3;
}
#search-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 10px 6px; border-bottom: 1px solid #ececf0; }
#search-results { margin: 0; padding: 6px; list-style: none; max-height: 55vh; overflow: auto; }
#search-results li { padding: 9px 12px; border-radius: 10px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-size: .9rem; }
#search-results li:hover, #search-results li.sel { background: #f0f0f4; }
#search-results .r-emoji { font-size: 1.3rem; width: 28px; text-align: center; }
#search-results .r-cat { margin-left: auto; color: var(--muted); font-size: .78rem; white-space: nowrap; }
#search-results .r-price { font-weight: 700; color: var(--primary); white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  border: none; background: transparent; color: var(--text); padding: 9px 12px; border-radius: 999px; cursor: pointer;
  font-size: .9rem; font-weight: 600; display: flex; align-items: center; gap: 6px; transition: background .15s;
}
.icon-btn:hover { background: rgba(0,0,0,0.06); }
.icon-btn.cart { background: var(--primary); color: #fff; padding-right: 14px; }
.icon-btn.cart:hover { background: var(--primary-dark); }
.icon-btn.cart.bump { animation: bump .35s ease; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
.badge { background: #fff; color: var(--primary); border-radius: 999px; padding: 0 7px; font-weight: 800; font-size: .78rem; min-width: 20px; text-align: center; }
.icon-btn .total { font-weight: 700; }
#fullscreen-btn .fs-exit, #fullscreen-btn[aria-pressed="true"] .fs-enter { display: none; }
#fullscreen-btn[aria-pressed="true"] .fs-exit { display: block; }
/* Plein écran simulé (iPhone, sans API plein écran) : on libère la vue en masquant la barre des rayons et la mini-carte */
.immersive.view-3d #aisle-bar, .immersive.view-3d #minimap { display: none; }
/* Encoches et barre d'accueil (plein écran, application installée) */
#topbar { margin-top: env(safe-area-inset-top, 0px); }
#aisle-bar, #minimap, #joystick { margin-bottom: env(safe-area-inset-bottom, 0px); }
#joystick { margin-left: env(safe-area-inset-left, 0px); }

#aisle-indicator {
  position: absolute; top: 80px; left: 50%; transform: translateX(-50%); color: var(--text); font-weight: 600;
  padding: 6px 14px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(10px); font-size: .85rem; pointer-events: none;
  box-shadow: var(--shadow-sm); white-space: nowrap; transition: opacity .3s;
}

/* Point de visée discret (mode caméra à la souris) */
#aim {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: rgba(255,255,255,.95); box-shadow: 0 0 0 1.5px rgba(0,0,0,.25), 0 1px 4px rgba(0,0,0,.35); pointer-events: none;
  transition: transform .12s, background .12s;
}
#aim.on-target { transform: scale(1.7); background: var(--primary); box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 1px 6px rgba(0,0,0,.35); }
#resume-hint {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); background: rgba(23,24,28,0.82); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: .9rem; font-weight: 500; pointer-events: none; box-shadow: var(--shadow); backdrop-filter: blur(8px);
  animation: pop .25s ease-out; white-space: nowrap;
}
#zoom-level {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, 28px); padding: 4px 12px; border-radius: 999px;
  background: rgba(23,24,28,0.7); color: #fff; font-size: .78rem; font-weight: 600; pointer-events: none; animation: pop .15s ease-out;
}
.hc-hint { font-size: .78rem; color: var(--muted); padding-top: 2px; }
.hc-hint kbd { font-size: .72rem; }

/* Carte au survol */
#hover-card {
  position: absolute; width: 260px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; animation: pop .16s ease-out; z-index: 5;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.hc-visual { height: 74px; display: flex; align-items: center; justify-content: center; font-size: 42px; background: #f2f2f5; position: relative; }
.hc-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,.35), rgba(0,0,0,.08)); pointer-events: none; }
.hc-body { padding: 10px 12px 12px; }
.hc-brand { font-size: .7rem; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }
.hc-name { font-weight: 700; font-size: .98rem; line-height: 1.25; margin: 2px 0 6px; }
.hc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.hc-price { font-weight: 800; color: var(--primary); font-size: 1.1rem; }
.hc-qty { color: var(--muted); font-size: .8rem; }
.hc-nutri { margin-left: auto; }
.hc-actions { display: flex; gap: 6px; }
.hc-actions .btn { flex: 1; }

/* Accompagnement */
#coach {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  background: rgba(23,24,28,0.86); color: #fff; padding: 12px 16px 12px 14px; border-radius: 999px; font-size: .92rem; font-weight: 500;
  box-shadow: var(--shadow); backdrop-filter: blur(8px); animation: pop .3s ease-out; white-space: nowrap; max-width: 92vw;
}
#coach #coach-icon { font-size: 1.3rem; }
#coach .link { color: rgba(255,255,255,.7); margin-left: 6px; }

/* Barre des rayons */
#aisle-bar {
  position: absolute; left: 14px; right: 250px; bottom: 14px; height: 48px; background: var(--glass); backdrop-filter: blur(14px);
  border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden;
}
#aisle-chips { display: flex; gap: 6px; padding: 7px 10px; overflow-x: auto; scrollbar-width: none; height: 100%; align-items: center; }
#aisle-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; border: none;
  background: rgba(0,0,0,0.05); color: var(--text); font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s;
}
.chip:hover { background: rgba(0,0,0,0.1); }
.chip.active { background: var(--text); color: #fff; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }

#minimap {
  position: absolute; right: 14px; bottom: 14px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm); width: 220px; height: 160px; cursor: pointer; transition: transform .15s;
}
#minimap:hover { transform: scale(1.03); }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--text); color: #fff; z-index: 45;
  padding: 11px 20px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); animation: toast .25s ease-out; font-size: .92rem; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.view-list #toast { bottom: 24px; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 16px);} to { opacity: 1; transform: translate(-50%, 0);} }

/* ---------- Panneaux ---------- */
.panel {
  position: fixed; top: 14px; bottom: 14px; width: min(420px, calc(100vw - 28px)); background: var(--panel); z-index: 30;
  box-shadow: var(--shadow); overflow-y: auto; padding: 22px 24px; animation: slide .22s ease-out; border-radius: 22px;
}
.panel.right { right: 14px; }
.panel.left { left: 14px; --from: -20px; }
@keyframes slide { from { opacity: 0; transform: translateX(var(--from, 20px)); } to { opacity: 1; transform: none; } }
.panel h2 { margin: 4px 0 12px; font-size: 1.3rem; letter-spacing: -0.3px; }
.close {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.85); cursor: pointer; font-size: .95rem; z-index: 2; box-shadow: var(--shadow-sm);
}
.close:hover { background: #fff; }

.product-visual {
  height: 230px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #ffffff, #e9e9ee); margin: 0 0 16px; position: relative; overflow: hidden;
}
#pp-canvas { width: 100%; height: 100%; display: block; }
.pp-emoji { position: absolute; font-size: 96px; pointer-events: none; }
.pp-brand { text-transform: uppercase; letter-spacing: 1px; font-size: .75rem; color: var(--muted); font-weight: 700; }
#pp-name { margin: 2px 0 8px; font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.3px; }
.pp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.tag { padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: #eef; color: #334; }
.tag.bio { background: #e3f6e3; color: #1d6b1d; }
.tag.fr { background: #e6eeff; color: #1d3a8a; }
.tag.promo { background: var(--accent); color: #4a3a00; }
.nutri { display: inline-flex; border-radius: 6px; overflow: hidden; font-weight: 800; font-size: .74rem; }
.nutri span { padding: 3px 6px; color: rgba(255,255,255,.5); }
.nutri span.on { color: #fff; box-shadow: 0 0 0 2px #fff inset; border-radius: 4px; }
.nutri .A { background: #038141; } .nutri .B { background: #85bb2f; } .nutri .C { background: #fecb02; } .nutri .D { background: #ee8100; } .nutri .E { background: #e63e11; }
.pp-price-row { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 12px; }
.pp-price { font-size: 1.9rem; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.pp-ppu { color: var(--muted); font-size: .88rem; }
.pp-desc { line-height: 1.55; color: #333; margin: 16px 0 6px; }
.pp-details { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; font-size: .88rem; margin: 10px 0 18px; }
.pp-details dt { color: var(--muted); }
.pp-details dd { margin: 0; }
.pp-sub { font-size: .82rem; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 6px 0 8px; }
.similar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: thin; }
.sim {
  flex: none; width: 104px; border: none; border-radius: 14px; background: #f5f5f8; padding: 10px 8px; cursor: pointer; text-align: center; font-family: inherit; transition: background .15s;
}
.sim:hover { background: #ebebf0; }
.sim .s-emoji { font-size: 1.6rem; }
.sim .s-name { font-size: .74rem; font-weight: 600; line-height: 1.2; margin: 4px 0 2px; height: 2.4em; overflow: hidden; }
.sim .s-price { font-size: .8rem; font-weight: 700; color: var(--primary); }
#pp-goto { width: 100%; }
.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-stepper { display: flex; align-items: center; border: 1px solid #e2e2e6; border-radius: 12px; overflow: hidden; }
.qty-btn { width: 40px; height: 44px; border: none; background: #fff; font-size: 1.2rem; cursor: pointer; }
.qty-btn:hover { background: #f4f4f6; }
#pp-quantity { min-width: 28px; text-align: center; font-weight: 700; font-size: 1.05rem; }
.qty-row .btn { flex: 1; height: 44px; }

/* Panier */
.cart-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.cart-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: #f6f6f8; }
.cart-item .ci-emoji { font-size: 1.7rem; text-align: center; }
.cart-item .ci-name { font-weight: 600; font-size: .92rem; }
.cart-item .ci-meta { color: var(--muted); font-size: .78rem; }
.cart-item .ci-qty { display: flex; align-items: center; gap: 6px; }
.cart-item .ci-qty button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid #ddd; background: #fff; cursor: pointer; }
.cart-item .ci-line { font-weight: 700; text-align: right; margin-left: 6px; min-width: 64px; }
.cart-empty { text-align: center; color: var(--muted); padding: 40px 10px; line-height: 1.5; }
.cart-footer { border-top: 1px solid #e5e5ea; padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.cart-sum { display: flex; justify-content: space-between; font-size: 1.05rem; margin-bottom: 6px; align-items: baseline; }
.cart-sum strong { color: var(--primary); font-size: 1.4rem; }

/* Plan */
#plan-canvas { width: 100%; height: auto; border-radius: 14px; background: #f2f2f5; margin-bottom: 12px; cursor: crosshair; }
.aisle-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.aisle-list li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #f6f6f8; cursor: pointer; font-size: .85rem; font-weight: 600;
}
.aisle-list li:hover { background: #ebebf0; }
.aisle-list .dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* Modales */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(20,20,30,.45); backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(520px, 92vw); background: var(--panel); border-radius: 22px; padding: 28px 30px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal-card h2 { margin-top: 0; letter-spacing: -0.3px; }
.help-list { line-height: 1.65; padding-left: 18px; }
.help-list li { margin-bottom: 10px; }
.drive-options { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 18px; }
.drive-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 2px solid #e8e8ec; cursor: pointer; transition: border-color .15s; }
.drive-opt:hover { border-color: #ccc; }
.drive-opt.sel { border-color: var(--primary); background: #fff6f6; }
.drive-opt .d-icon { font-size: 1.5rem; }
.drive-opt .d-name { font-weight: 700; }
.drive-opt .d-meta { color: var(--muted); font-size: .85rem; }
#order-confirmation { margin-top: 16px; padding: 16px; border-radius: 14px; background: #e3f6e3; color: #1d6b1d; font-weight: 600; line-height: 1.5; }

/* ---------- Commande : créneaux, récapitulatif, confirmation ---------- */
.checkout-card { width: min(620px, 94vw); }
.co-step { display: flex; align-items: center; gap: 8px; font-size: .95rem; margin: 18px 0 8px; }
.co-step span[aria-hidden] { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; }
.checkout-card .drive-options { margin: 6px 0 4px; }
.slot-days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.slot-days button {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 86px; padding: 8px 10px;
  border: 2px solid #e8e8ec; border-radius: 12px; background: #fff; font: .85rem inherit; color: var(--text); cursor: pointer;
}
.slot-days button small { color: var(--muted); font-size: .72rem; }
.slot-days button[aria-pressed="true"] { border-color: var(--primary); background: #fff6f6; }
.slot-days button:disabled { opacity: .45; cursor: not-allowed; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin: 8px 0 4px; }
.slot-grid button {
  padding: 9px 6px; border: 1.5px solid #dcdce2; border-radius: 10px; background: #fff; font: 600 .85rem inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
}
.slot-grid button small { font-weight: 500; font-size: .7rem; color: var(--muted); }
.slot-grid button[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot-grid button:disabled { background: #f3f3f5; color: #a0a0a8; cursor: not-allowed; text-decoration: line-through; }
.slot-grid button:disabled small { text-decoration: none; }
.co-recap { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: .9rem; margin: 6px 0 10px; }
.co-recap dt { color: var(--muted); }
.co-recap dd { margin: 0; font-weight: 600; }
#order-confirmation { margin-top: 8px; padding: 16px; border-radius: 14px; background: #e3f6e3; color: #17411a; line-height: 1.5; }
#order-confirmation:focus { outline: none; }
.oc-head { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.oc-items { list-style: none; padding: 0; margin: 8px 0; font-size: .88rem; max-height: 180px; overflow: auto; }
.oc-items li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed rgba(0,0,0,.12); }
.oc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.cart-links { display: flex; justify-content: space-between; gap: 4px; flex-wrap: wrap; }
.cart-links .btn { padding: 8px 10px; font-size: .85rem; }

/* Historique */
.orders-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.order { padding: 12px 14px; border-radius: 14px; background: #f6f6f8; }
.o-head { display: flex; justify-content: space-between; font-size: .95rem; }
.o-head span { font-weight: 800; color: var(--primary); }
.o-meta { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.order details { margin: 6px 0; font-size: .85rem; }
.order details ul { padding-left: 18px; margin: 6px 0; }
.o-actions { display: flex; gap: 6px; }

/* Partage */
.share-card { text-align: center; }
.share-qr { width: 220px; height: 220px; margin: 6px auto 14px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 12px; }
.share-qr svg { width: 100%; height: 100%; }
.share-row { display: flex; gap: 6px; margin-bottom: 10px; }
.share-row input { flex: 1; min-width: 0; border: 1px solid #ddd; border-radius: 10px; padding: 10px; font: .85rem inherit; color: var(--muted); }
.import-items { list-style: none; padding: 0; margin: 0 0 12px; max-height: 40vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
#import-modal .btn.big + .btn.big { margin-top: 8px; }

/* Impression du récapitulatif de commande */
@media print {
  body { background: #fff !important; overflow: visible; }
  body > *:not(#checkout-modal) { display: none !important; }
  #checkout-modal { position: static; background: none; backdrop-filter: none; display: block; }
  #checkout-modal .modal-card { box-shadow: none; width: auto; max-height: none; }
  #checkout-modal .close, .oc-actions { display: none !important; }
  #order-confirmation { background: none; color: #000; }
  .oc-items { max-height: none; }
}

/* Safari (iOS) agrandit la page quand un champ de moins de 16 px reçoit le focus : 16 px sur écran tactile.
   On ne bloque pas le zoom dans la balise viewport, qui reste possible pour les personnes malvoyantes. */
@media (pointer: coarse), (max-width: 760px) {
  input, textarea, select { font-size: 16px !important; }
}

/* ---------- Accessibilité ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
body:not(.view-list) .skip-link { display: none; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.panel:focus, .modal-card:focus, #catalog-main:focus { outline: none; }
.link-like { border: none; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.link-like:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Visuels produit (packshot ou pictogramme) */
.pv-img { object-fit: contain; display: block; }
.ci-emoji .pv-img { width: 40px; height: 40px; }
.s-emoji .pv-img { width: 44px; height: 44px; margin: 0 auto; }
.r-emoji .pv-img { width: 26px; height: 26px; }
.hc-visual .pv-img { height: 64px; width: auto; }
.pp-image { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); object-fit: contain; }

/* Pastilles de filtre */
.fchip {
  border: 1px solid #dcdce2; background: #fff; color: var(--text); border-radius: 999px; padding: 6px 12px; font: 600 .8rem inherit; cursor: pointer;
}
.fchip:hover { border-color: #b9b9c2; }
.fchip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }

/* ---------- Itinéraire ---------- */
#route-bar {
  position: absolute; left: 50%; top: 120px; transform: translateX(-50%); width: min(560px, calc(100vw - 28px));
  background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 12px 12px; animation: pop .2s ease-out;
}
.rb-progress { display: flex; align-items: center; gap: 10px; font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.rb-track { flex: 1; height: 5px; border-radius: 9px; background: #ececf0; overflow: hidden; }
#rb-fill { height: 100%; width: 0; background: var(--primary); transition: width .3s; }
.rb-main { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rb-emoji { font-size: 1.8rem; }
#rb-name { font-weight: 700; line-height: 1.2; }
.rb-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rb-actions .btn:disabled { opacity: .35; }
.routing #aisle-indicator { display: none; }

/* ---------- Joystick tactile ---------- */
#joystick {
  position: absolute; left: 18px; bottom: 78px; width: 116px; height: 116px; border-radius: 50%; touch-action: none;
  background: rgba(255,255,255,.35); border: 2px solid rgba(255,255,255,.7); box-shadow: var(--shadow-sm); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
#joystick-knob { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.95); box-shadow: 0 2px 8px rgba(0,0,0,.3); pointer-events: none; }
#joystick.active #joystick-knob { background: var(--primary); }

/* ---------- Liste de courses ---------- */
#list-input {
  width: 100%; border: 1px solid #e2e2e6; border-radius: 12px; padding: 12px; font: .95rem/1.5 inherit; resize: vertical; margin: 4px 0 10px; color: var(--text);
}
.list-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.list-items { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.li-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #f6f6f8; }
.li-item.missing { grid-template-columns: 1fr; background: #fff4e5; }
.li-item.off { opacity: .55; }
.li-item input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); }
.li-body { min-width: 0; }
.li-raw { font-size: .78rem; color: var(--muted); display: block; }
.li-pick { display: flex; gap: 6px; align-items: center; font-weight: 600; font-size: .92rem; margin: 2px 0; }
.li-pick select { flex: 1; min-width: 0; width: 100%; text-overflow: ellipsis; border: 1px solid #ddd; border-radius: 8px; padding: 5px 6px; font: inherit; background: #fff; }
.li-meta { font-size: .78rem; color: var(--muted); }
.li-why { font-size: .78rem; color: #4a4f5c; font-style: italic; }
.ai-box { background: linear-gradient(135deg, #fff7d6, #ffeef0); border-radius: 14px; padding: 12px; margin: 4px 0 14px; }
.ai-label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 8px; }
.ai-row { display: flex; gap: 8px; }
.ai-row input { flex: 1; min-width: 0; border: 1px solid #e2e2e6; border-radius: 10px; padding: 10px 12px; font: .95rem inherit; color: var(--text); background: #fff; }
.ai-note { font-size: .78rem; color: #4a4f5c; margin: 8px 0 0; line-height: 1.45; }
.ai-note b { color: var(--text); }
.ai-box.busy .ai-note::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid var(--primary); border-right-color: transparent; border-radius: 50%; animation: ai-spin .8s linear infinite; vertical-align: -1px; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.li-incart { color: #1d6b1d; font-weight: 600; }
.li-qty { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.li-qty button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid #ddd; background: #fff; cursor: pointer; }

.aisle-link { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; padding: 0; }

/* ---------- Vue liste (sans 3D) ---------- */
.view-list { background: #f4f4f7; }
.view-list #aisle-indicator, .view-list #minimap, .view-list #aisle-bar, .view-list #coach, .view-list #aim,
.view-list #resume-hint, .view-list #route-bar, .view-list #joystick, .view-list #hover-card, .view-list #zoom-level, .view-list #plan-btn { display: none !important; }
.view-list #topbar { box-shadow: 0 2px 10px rgba(0,0,0,.06); background: rgba(255,255,255,.92); }
#catalog-view {
  position: fixed; inset: 82px 0 0; display: grid; grid-template-columns: 260px 1fr; gap: 0; overflow: hidden; color: var(--text);
}
#catalog-nav { overflow-y: auto; padding: 4px 8px 24px 14px; }
#catalog-aisles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
#catalog-aisles button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: none; border-radius: 10px; background: none;
  font: 600 .88rem inherit; color: var(--text); cursor: pointer; text-align: left;
}
#catalog-aisles button:hover { background: rgba(0,0,0,.05); }
#catalog-aisles button[aria-current="page"] { background: #fff; box-shadow: var(--shadow-sm); }
#catalog-aisles button.empty { opacity: .45; }
#catalog-aisles .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ca-name { flex: 1; }
.ca-count { font-size: .75rem; color: var(--muted); font-weight: 700; }
#catalog-main { overflow-y: auto; padding: 8px 22px 40px 14px; }
.catalog-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.catalog-head h1 { font-size: 1.6rem; letter-spacing: -0.5px; margin: 6px 0; }
#catalog-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 16px; }
.catalog-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.catalog-empty { color: var(--muted); padding: 30px 0; }
.pcard { background: #fff; border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column; }
.pc-visual { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 56px; position: relative; }
.pc-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,.4), rgba(0,0,0,.06)); pointer-events: none; }
.pc-visual .pv-img { height: 104px; width: auto; max-width: 90%; position: relative; z-index: 1; }
.pc-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pc-brand { font-size: .68rem; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }
.pc-name { font-size: .98rem; margin: 0; line-height: 1.25; }
.pc-meta { font-size: .78rem; color: var(--muted); }
.pc-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 6px; margin-top: 2px; }
.pc-price { font-weight: 800; color: var(--primary); font-size: 1.1rem; white-space: nowrap; }
.pc-actions .btn { white-space: nowrap; }
.pc-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.pc-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.pc-incart { font-size: .76rem; color: #1d6b1d; font-weight: 600; }
.view-list .panel { top: 82px; }

@media (max-width: 760px) {
  #topbar { left: 8px; right: 8px; top: 8px; height: 50px; padding: 0 4px 0 12px; }
  #topbar .lbl, #topbar .brand-name, .icon-btn .total { display: none; }
  #topbar .brand { display: none; }
  .icon-btn { padding: 9px 9px; }
  #search-wrap { margin-left: 0; }
  #search-drop { position: fixed; left: 8px; right: 8px; top: 64px; }
  #aisle-indicator { top: 68px; font-size: .78rem; }
  #minimap { width: 120px; height: 88px; right: 8px; bottom: 66px; }
  #aisle-bar { left: 8px; right: 8px; bottom: 8px; }
  #coach, #toast { bottom: 120px; font-size: .85rem; white-space: normal; text-align: center; }
  #hover-card { width: 230px; }
  #route-bar { top: 66px; }
  #joystick { bottom: 66px; left: 12px; width: 104px; height: 104px; }
  .panel { top: 0; bottom: 0; left: 0 !important; right: 0 !important; width: 100vw; border-radius: 0; }
  .view-list .panel { top: 0; }
  #catalog-view { inset: 66px 0 0; grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #catalog-nav { padding: 0 8px 6px; overflow-x: auto; overflow-y: hidden; }
  #catalog-aisles { flex-direction: row; gap: 6px; }
  #catalog-aisles button { white-space: nowrap; background: rgba(0,0,0,.05); border-radius: 999px; padding: 8px 12px; }
  .ca-count { display: none; }
  #catalog-main { padding: 4px 10px 30px; }
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .pc-visual { height: 96px; font-size: 44px; }
  .pcard .nutri span { padding: 2px 4px; }
  .pc-actions { flex-wrap: wrap-reverse; justify-content: flex-end; }
  .view-list #toast { bottom: 16px; }
}
@media (max-width: 400px) {
  .icon-btn { padding: 9px 7px; }
  #topbar { gap: 6px; }
}
