/* Tunnel de commande mobile d'abord : mode + adresse, panier en feuille, commande en une page.
   S'appuie sur les variables de thème de la boutique (--brand, --ink, --surface, --line…). */

/* ───────── Mode de commande (À emporter / Livraison) ───────── */
body[data-surface=store] .order-mode{display:grid;gap:10px;padding:12px;border:1px solid var(--line);border-radius:var(--r-card);background:var(--surface)}
body[data-surface=store] .order-mode-bar{margin-top:16px}
body[data-surface=store] .order-mode-cart{padding:0;border:0;background:none;margin-bottom:12px}
body[data-surface=store] .mode-switch{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;border-radius:var(--r-pill);background:var(--soft)}
body[data-surface=store] .mode-switch button{min-height:44px;padding:0 18px;border-radius:var(--r-pill);background:transparent;color:var(--ink);font-size:15px;font-weight:700;transition:background .2s var(--ease),color .2s}
body[data-surface=store] .mode-switch button.is-active{background:var(--ink);color:var(--surface)}
body[data-surface=store] .mode-line{display:flex;align-items:center;gap:12px;width:100%;margin:0;padding:12px 14px;border-radius:var(--r-control);background:var(--soft);color:var(--ink);text-align:left;font-size:14px;line-height:1.35}
body[data-surface=store] button.mode-line{min-height:56px}
body[data-surface=store] .mode-line>span:not(.mode-edit){display:grid;min-width:0;flex:1}
body[data-surface=store] .mode-line b{overflow:hidden;font-size:15px;text-overflow:ellipsis;white-space:nowrap}
body[data-surface=store] .mode-line small{overflow:hidden;color:var(--muted);font-size:13px;text-overflow:ellipsis;white-space:nowrap}
body[data-surface=store] .mode-edit{flex:none;margin-left:auto;font-size:14px;font-weight:700;text-decoration:underline}
body[data-surface=store] .mode-address.is-empty{background:var(--brand-soft);outline:2px dashed var(--brand);outline-offset:-2px}
body[data-surface=store] .mode-hint{margin:0;color:var(--muted);font-size:13px}
body[data-surface=store] .addr-icon{flex:none;color:var(--ink)}
@media(min-width:720px){
  body[data-surface=store] .order-mode-bar{grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:16px}
  body[data-surface=store] .order-mode-bar .mode-hint{grid-column:2}
  body[data-surface=store] .order-mode-bar .mode-switch{min-width:280px}
}

/* ───────── Panier : colonne sur ordinateur, feuille sur mobile ───────── */
body[data-surface=store] .cart-close,body[data-surface=store] .cart-backdrop{display:none}
body[data-surface=store] .cart-heading{gap:10px}
body[data-surface=store] .cart-heading .counter{margin-right:auto}
body[data-surface=store] .cart-footer .cart-note{margin:8px 0 0;text-align:center}
@media(max-width:900px){
  body[data-surface=store] .cart{display:none}
  body[data-surface=store] .cart.is-open{display:block;position:fixed;inset:auto 0 0 0;z-index:70;width:100%;max-height:92dvh;margin:0;overflow:auto;overscroll-behavior:contain;padding:var(--pad) var(--pad) 0;border-radius:calc(var(--r-card) + 6px) calc(var(--r-card) + 6px) 0 0;animation:sheet-in .28s var(--ease)}
  body[data-surface=store] .cart-backdrop.is-open{display:block;position:fixed;inset:0;z-index:65;background:color-mix(in srgb,var(--ink) 55%,transparent)}
  body[data-surface=store] .cart-close{display:grid;place-items:center;width:44px;height:44px;margin:-8px -8px -8px 0;border-radius:50%;background:var(--soft);color:var(--ink);font-size:24px;line-height:1}
  body[data-surface=store] .cart.is-open .cart-footer{position:sticky;bottom:0;margin:0 calc(-1 * var(--pad));padding:12px var(--pad) calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--surface)}
  body[data-surface=store] .cart.is-open .direct-note{display:none}
  body.sheet-open{overflow:hidden}
  body.sheet-open[data-surface=store] .bag-button{display:none}
  body[data-surface=store] .quantity button{width:40px;height:36px}
}

/* ───────── Sélecteur d'adresse ───────── */
body[data-surface=store] .addr-intro{margin:0 0 14px}
body[data-surface=store] .addr-picker{display:grid;gap:12px}
body[data-surface=store] .addr-field{position:relative;display:flex;align-items:center;gap:10px;padding:0 14px;border:2px solid var(--ink);border-radius:var(--r-control);background:var(--surface)}
body[data-surface=store] .addr-field input{flex:1;min-width:0;min-height:52px;padding:0;border:0;outline:0;background:transparent;color:var(--ink);font-size:16px}
body[data-surface=store] .addr-picker label.addr-field{display:flex;gap:10px;font-weight:400}
body[data-surface=store] .addr-field input::-webkit-search-cancel-button{appearance:none}
body[data-surface=store] .addr-locate{display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:0 14px;border-radius:var(--r-control);background:var(--soft);color:var(--ink);font-size:15px;font-weight:700;text-align:left}
body[data-surface=store] .addr-locate:disabled{opacity:.6}
body[data-surface=store] .addr-list{display:grid;margin:0;padding:0;list-style:none;border:1px solid var(--line);border-radius:var(--r-control);overflow:hidden;max-height:min(320px,38dvh);overflow-y:auto}
body[data-surface=store] .addr-list[hidden]{display:none}
body[data-surface=store] .addr-list li{display:flex;align-items:center;gap:12px;min-height:60px;padding:10px 14px;border-bottom:1px solid var(--line);cursor:pointer}
body[data-surface=store] .addr-list li:last-child{border-bottom:0}
body[data-surface=store] .addr-list li:hover,body[data-surface=store] .addr-list li[aria-selected=true]{background:var(--soft)}
body[data-surface=store] .addr-list li>span{display:grid;min-width:0}
body[data-surface=store] .addr-list b{overflow:hidden;font-size:15px;text-overflow:ellipsis;white-space:nowrap}
body[data-surface=store] .addr-list small{color:var(--muted);font-size:13px}
body[data-surface=store] .addr-status{min-height:20px;margin:0;color:var(--muted);font-size:14px;line-height:1.4}
body[data-surface=store] .addr-status[data-tone=error]{color:#ba4029;font-weight:600}
body[data-surface=store] .addr-number,body[data-surface=store] .addr-manual{display:grid;gap:12px}
body[data-surface=store] .addr-number[hidden],body[data-surface=store] .addr-manual[hidden]{display:none}
body[data-surface=store] .addr-row{display:grid;grid-template-columns:1fr 1.4fr;gap:10px}
body[data-surface=store] .addr-picker label,body[data-surface=store] .co-field{display:grid;gap:6px;font-size:14px;font-weight:600}
body[data-surface=store] .addr-picker label input:not(#addr-q),body[data-surface=store] .co-field input,body[data-surface=store] .co-field select,body[data-surface=store] .co-field textarea,body[data-surface=store] .co-promo input{width:100%;min-height:50px;padding:12px 14px;border:1px solid var(--line);border-radius:var(--r-control);background:var(--surface);color:var(--ink);font-size:16px}
body[data-surface=store] .co-field textarea{min-height:76px;resize:vertical}
body[data-surface=store] .addr-picker label input:not(#addr-q):focus,body[data-surface=store] .co-field input:focus,body[data-surface=store] .co-field select:focus,body[data-surface=store] .co-field textarea:focus,body[data-surface=store] .co-promo input:focus{border-color:var(--ink);outline:none}
body[data-surface=store] .co-field small{color:var(--muted);font-weight:500}
body[data-surface=store] .addr-manual-toggle,body[data-surface=store] .addr-pickup{justify-self:start;color:var(--ink);text-decoration:underline;font-weight:600}
body[data-surface=store] .addr-pickup{margin-top:12px;text-decoration:none}

/* ───────── Commande en une page ───────── */
body[data-surface=store] .modal.checkout-modal{display:flex;flex-direction:column;max-width:580px;max-height:min(94dvh,920px);padding:0;overflow:hidden}
body[data-surface=store] .co-head{padding:24px 24px 12px;padding-right:64px}
body[data-surface=store] .co-head h2{margin:0}
body[data-surface=store] .co-head p{margin:4px 0 0}
body[data-surface=store] #co-form{display:flex;flex:1;flex-direction:column;min-height:0}
body[data-surface=store] .co-body{display:grid;flex:1;gap:12px;align-content:start;padding:8px 20px 20px;overflow-y:auto;overscroll-behavior:contain}
body[data-surface=store] .co-card{display:grid;gap:12px;padding:16px;border:1px solid var(--line);border-radius:var(--r-card);background:var(--surface)}
body[data-surface=store] .co-card h3{margin:0;font-size:17px;font-weight:800}
body[data-surface=store] .co-card h3 small{color:var(--muted);font-size:13px;font-weight:500}
body[data-surface=store] .co-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
body[data-surface=store] .co-choice{display:grid;gap:2px;min-height:64px;padding:12px 14px;border:2px solid var(--line);border-radius:var(--r-control);background:var(--surface);color:var(--ink);text-align:left}
body[data-surface=store] .co-choice b{font-size:15px}
body[data-surface=store] .co-choice small{color:var(--muted);font-size:13px}
body[data-surface=store] .co-choice.is-active{border-color:var(--ink);background:var(--soft)}
body[data-surface=store] .co-chips{display:flex;flex-wrap:wrap;gap:8px}
body[data-surface=store] .co-scroll{flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px;scrollbar-width:none}
body[data-surface=store] .co-scroll::-webkit-scrollbar{display:none}
body[data-surface=store] .co-slots{display:grid;gap:10px}
body[data-surface=store] .co-chip{flex:none;min-height:44px;padding:0 16px;border:1px solid var(--line);border-radius:var(--r-pill);background:var(--surface);color:var(--ink);font-size:14px;font-weight:700;white-space:nowrap}
body[data-surface=store] .co-chip.is-active{border-color:var(--ink);background:var(--ink);color:var(--surface)}
body[data-surface=store] .co-link{justify-self:start;min-height:40px;padding:8px 0;background:none;color:var(--ink);font-size:14px;font-weight:600;text-decoration:underline}
body[data-surface=store] .co-muted{color:var(--muted);font-size:13px}
body[data-surface=store] .co-account{display:flex;align-items:center;gap:12px;width:100%;margin:0;padding:14px;border:0;border-radius:var(--r-control);background:var(--brand-soft);color:var(--ink);text-align:left;font-size:14px;line-height:1.4}
body[data-surface=store] .co-account>span:first-child:not(.co-avatar){display:grid;gap:2px;flex:1}
body[data-surface=store] .co-account small{color:var(--muted);font-size:13px}
body[data-surface=store] .co-account.is-signed span:last-child{display:grid;gap:2px}
body[data-surface=store] .co-avatar{display:grid;flex:none;place-items:center;width:38px;height:38px;border-radius:50%;background:var(--brand);color:var(--brand-ink);font-weight:800}
body[data-surface=store] .co-account-form{display:grid;gap:12px;padding:14px;border-radius:var(--r-control);background:var(--soft)}
body[data-surface=store] .co-account-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
body[data-surface=store] .co-password{position:relative;display:block}
body[data-surface=store] .co-password input{padding-right:96px}
body[data-surface=store] .co-reveal{position:absolute;top:50%;right:4px;min-height:40px;padding:0 12px;transform:translateY(-50%);background:none;color:var(--ink);font-size:13px;font-weight:700}
body[data-surface=store] .co-check{display:flex;align-items:flex-start;gap:12px;font-size:14px;line-height:1.45}
body[data-surface=store] .co-check input{flex:none;width:22px;height:22px;margin:0;accent-color:var(--brand)}
body[data-surface=store] .co-check small{color:var(--muted)}
body[data-surface=store] .co-age{padding:14px;border:1px solid var(--line);border-radius:var(--r-card)}
body[data-surface=store] .co-promo{display:flex;gap:8px}
body[data-surface=store] .co-promo input{flex:1}
body[data-surface=store] .co-promo .secondary{min-height:50px}
body[data-surface=store] .co-row{display:flex;justify-content:space-between;gap:12px;font-size:15px}
body[data-surface=store] .co-row span{color:var(--muted)}
body[data-surface=store] .co-total{padding-top:12px;border-top:1px dashed var(--line);font-size:19px;font-weight:800}
body[data-surface=store] .co-total span{color:var(--ink)}
body[data-surface=store] .co-footer{display:grid;gap:8px;padding:12px 20px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--surface)}
body[data-surface=store] .co-footer .error{margin:0;color:#ba4029;font-size:14px!important;font-weight:600}
body[data-surface=store] .co-footer .error:empty{display:none}
body[data-surface=store] .co-footer small{text-align:center}
body[data-surface=store] [aria-invalid=true]{border-color:#ba4029!important}

/* ───────── Compte proposé après la commande ───────── */
body[data-surface=store] .account-prompt{display:grid;gap:12px;margin-top:16px;padding:16px;border:1px solid var(--line);border-radius:var(--r-card);background:var(--brand-soft)}
body[data-surface=store] .account-prompt h3{margin:0;font-size:18px}
body[data-surface=store] .account-prompt p{margin:0;font-size:14px}
body[data-surface=store] .account-prompt form{display:grid;gap:12px}

@media(max-width:600px){
  body[data-surface=store] .modal.checkout-modal{max-width:none;height:100dvh;max-height:100dvh;border-radius:0}
  body[data-surface=store] .co-head{padding:20px 16px 8px;padding-right:60px}
  body[data-surface=store] .co-body{padding:8px 12px 16px}
  body[data-surface=store] .co-footer{padding-right:16px;padding-left:16px}
  body[data-surface=store] .modal:has(.addr-picker){min-height:70dvh}
}

/* Code promo du panier + toast au-dessus de la barre d'action */
body[data-surface=store] .store-coupon-box{display:grid;grid-template-columns:1fr auto;gap:8px;margin:14px 0 4px}
body[data-surface=store] .store-coupon-box input{min-width:0;min-height:46px;padding:0 14px;border:1px solid var(--line);border-radius:var(--r-control);background:var(--surface);color:var(--ink);font-size:16px}
body[data-surface=store] .store-coupon-box input:focus{border-color:var(--ink);outline:none}
body[data-surface=store] .store-coupon-box button{min-height:46px;padding:0 18px;border-radius:var(--r-control);background:var(--soft);color:var(--ink);font-weight:700}
@media (max-width:900px){
  body[data-surface=store] #toast{bottom:calc(96px + env(safe-area-inset-bottom));text-align:center}
}

/* Les styles génériques de label du modal ne doivent pas casser nos cases à cocher */
body[data-surface=store] .modal label.co-check,body[data-surface=store] .account-prompt label.co-check{display:flex;align-items:flex-start;gap:12px;font-weight:500}
body[data-surface=store] .account-prompt label.co-field{display:grid;gap:6px;font-weight:600}
body[data-surface=store] .account-prompt label.co-field small{color:var(--muted);font-weight:400}

/* ───────── Paiement en ligne intégré (Stripe Elements : carte, Apple Pay, Google Pay) ───────── */
body[data-surface=store] .co-part{display:grid;gap:12px;min-width:0;margin:0;padding:0;border:0}
body[data-surface=store] .co-part:disabled{opacity:.55;pointer-events:none}
body[data-surface=store] .co-stripe{display:grid;gap:14px}
body[data-surface=store] .co-stripe[hidden],body[data-surface=store] #co-pay-choices[hidden],body[data-surface=store] .co-pending[hidden],body[data-surface=store] #co-express[hidden],body[data-surface=store] .co-or[hidden]{display:none}
body[data-surface=store] .co-or{display:flex;align-items:center;gap:12px;margin:0;color:var(--muted);font-size:13px;line-height:1}
body[data-surface=store] .co-or::before,body[data-surface=store] .co-or::after{content:"";flex:1;height:1px;background:var(--line)}
body[data-surface=store] #co-card,body[data-surface=store] #pay-card{min-height:44px}
body[data-surface=store] .co-secure{margin:0;color:var(--muted);font-size:12.5px;line-height:1.45}
body[data-surface=store] .co-pending{display:grid;gap:8px;padding:14px;border-radius:var(--r-control);background:var(--brand-soft);font-size:14px;line-height:1.45}
body[data-surface=store] .co-pending p{margin:0}
body[data-surface=store] #co-pay-error:empty,body[data-surface=store] #pay-panel-error:empty{display:none}
body[data-surface=store] #co-pay-error,body[data-surface=store] #pay-panel-error{margin:0;color:#ba4029;font-size:14px;font-weight:600}

/* ───────── Suivi en direct : attente du restaurant, puis compte à rebours ───────── */
.tracking-live:empty{display:none}
.track-live{margin:16px 0 14px;padding:18px;border:1px solid var(--line);border-radius:var(--r-card,16px);background:var(--soft,var(--surface));color:var(--ink)}
.track-live strong{display:block;font-size:16px;line-height:1.35}
.track-live small{display:block;margin-top:4px;color:var(--muted);font-size:13px;line-height:1.5}
.track-live.is-waiting{display:flex;gap:14px;align-items:flex-start}
.track-live-dots{display:flex;gap:5px;flex:0 0 auto;padding:7px 0}
.track-live-dots i{width:8px;height:8px;border-radius:50%;background:var(--brand);animation:track-live-dot 1.2s ease-in-out infinite}
.track-live-dots i:nth-child(2){animation-delay:.15s}
.track-live-dots i:nth-child(3){animation-delay:.3s}
@keyframes track-live-dot{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-4px)}}
.track-live.is-countdown{text-align:center}
.track-live.is-countdown>small:first-of-type{margin:0;text-transform:uppercase;letter-spacing:.08em;font-size:12px;font-weight:600}
.track-live-time{margin:6px 0 12px;font-size:44px!important;font-weight:700;line-height:1!important;font-variant-numeric:tabular-nums;letter-spacing:-.02em;color:var(--brand)}
.track-live-bar{display:block;width:100%;height:6px;border:0;border-radius:99px;overflow:hidden;background:var(--line);appearance:none;-webkit-appearance:none}
.track-live-bar::-webkit-progress-bar{background:var(--line);border-radius:99px}
.track-live-bar::-webkit-progress-value{background:var(--brand);border-radius:99px;transition:width .9s linear}
.track-live-bar::-moz-progress-bar{background:var(--brand);border-radius:99px}
.track-live-bar:indeterminate{background:var(--line)}
.track-live.is-ready{border-color:var(--brand)}
.track-live.is-ready strong{color:var(--brand)}
@media (prefers-reduced-motion:reduce){.track-live-dots i{animation:none;opacity:.7}.track-live-bar::-webkit-progress-value{transition:none}}
