/* Boutique : cadre de démonstration, application, écrans */
.stage { min-height: 100dvh; display: grid; grid-template-columns: minmax(320px, 400px) 1fr; }
.guide {
  background: var(--felt); color: var(--letter); padding: 36px 32px 28px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; overflow-x: hidden;
}
.guide h1 { font-size: 27px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.12; }
.guide p { color: var(--letter-2); margin-top: 12px; font-size: 15px; max-width: 34ch; }
.scenarios { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.scenarios button, .scenarios a {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--letter); text-align: left; font-size: 14.5px; font-weight: 550; text-decoration: none;
  transition: background-color 150ms ease, transform 140ms var(--ease-out);
}
.scenarios button:active, .scenarios a:active { transform: scale(0.98); }
.scenarios .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--letter-2); flex: none; }
.scenarios [aria-current="true"] { background: var(--felt-3); }
.scenarios [aria-current="true"] .dot { background: var(--changed); border-color: var(--changed); }
@media (hover: hover) and (pointer: fine) { .scenarios button:hover, .scenarios a:hover { background: var(--felt-2); } }
.g-foot { margin-top: auto; display: grid; gap: 12px; justify-items: start; }
.g-foot p { margin: 0; font-size: 12.5px; }
.g-foot .btn.line { background: transparent; color: var(--letter); border-color: var(--felt-3); }
@media (hover: hover) and (pointer: fine) { .g-foot .btn.line:hover { background: var(--felt-2); border-color: var(--letter-2); } }

.device-area { display: grid; place-items: center; padding: 28px; min-width: 0; }
.phone {
  width: 400px; height: min(860px, calc(100dvh - 56px)); border-radius: 48px; padding: 10px; background: #14181c;
  box-shadow: 0 30px 60px -20px rgba(20, 24, 28, 0.45), 0 2px 6px rgba(20, 24, 28, 0.25);
}
.app { position: relative; height: 100%; border-radius: 38px; overflow: clip; background: var(--ground); display: flex; flex-direction: column; isolation: isolate; }

/* Barre du haut */
.topbar { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px; background: var(--felt); color: var(--letter); flex: none; }
.app .topbar { padding-top: 22px; }
.brand { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 2px; font-family: var(--font-letter); font-weight: 700; font-size: 15px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--letter); white-space: nowrap; }
.pickup {
  margin-left: auto; min-width: 0; display: flex; align-items: center; gap: 6px; border: 1px solid var(--felt-3); background: var(--felt-2); color: var(--letter);
  border-radius: 999px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; transition: transform 140ms var(--ease-out), background-color 150ms ease;
}
.pickup span { overflow: clip; text-overflow: ellipsis; white-space: nowrap; }
.pickup:active { transform: scale(0.97); }
.pickup .icon { width: 15px; height: 15px; }
.pickup.alert { border-color: var(--changed); }
.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: inherit; flex: none; transition: transform 140ms var(--ease-out), background-color 150ms ease; }
.iconbtn:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .iconbtn:hover { background: rgba(127, 140, 150, 0.16); } .pickup:hover { background: var(--felt-3); } }

/* Vues */
.views { position: relative; flex: 1; min-height: 0; }
.view { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b8c0c4 transparent; }
.view[hidden] { display: none; }
.pad { padding: 16px 16px 24px; display: grid; gap: 16px; align-content: start; }
.vtitle { font-size: 24px; font-weight: 750; letter-spacing: -0.015em; }
.vsub { color: var(--ink-2); font-size: 14px; margin-top: -10px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.sec-head h2 { font-size: 18px; font-weight: 700; }

/* Formules */
.formules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: #dde2dc; border-radius: 14px; }
.formules button { border: 0; border-radius: 10px; min-height: 52px; background: transparent; display: grid; gap: 1px; align-content: center; justify-items: center; font-weight: 650; font-size: 14px; color: var(--ink-2); transition: background-color 150ms ease, color 150ms ease; }
.formules button small { font-size: 12px; font-weight: 500; color: var(--muted); }
.formules button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(27, 33, 39, 0.12), 0 2px 8px -2px rgba(27, 33, 39, 0.1); }

/* Tableau à lettres */
.board {
  background: var(--felt); color: var(--letter); border-radius: var(--r-l); padding: 18px 18px 16px; perspective: 700px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='1' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E");
  box-shadow: 0 10px 24px -14px rgba(20, 24, 28, 0.6);
}
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(243, 245, 242, 0.16); margin-bottom: 8px; }
.board-head h2 { font-family: var(--font-letter); font-size: 22px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; line-height: 1.1; }
.board-head span { font-family: var(--font-letter); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--letter-2); white-space: nowrap; }
.bl { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: baseline; padding: 5px 0; font-family: var(--font-letter); font-size: 17px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; transform-origin: 50% 50%; backface-visibility: hidden; }
.bl .q { color: var(--letter-2); font-size: 15px; }
.bl.added { color: var(--changed); }
.bl.added .q { color: var(--changed); }
.bl.removed { color: #8e99a2; text-decoration: line-through; text-decoration-thickness: 1.5px; font-size: 14px; padding-top: 0; }
.bl.removed .q { color: #8e99a2; font-size: 13px; }
.bl .tag { display: inline-block; margin-right: 6px; font-size: 11px; letter-spacing: 0.1em; padding: 1px 6px; border-radius: 4px; background: var(--changed); color: var(--felt); vertical-align: 2px; text-decoration: none; }
.bl.removed .tag { background: transparent; color: #8e99a2; border: 1px solid #5d6872; }
.bl.flip { animation: flip-in 440ms var(--ease-drawer) both; }
@keyframes flip-in { from { transform: rotateX(-92deg); opacity: 0.2; } to { transform: rotateX(0); opacity: 1; } }
.board-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-top: 12px; margin-top: 8px; border-top: 1px solid rgba(243, 245, 242, 0.16); }
.board-foot .big { font-size: 30px; font-weight: 750; letter-spacing: -0.01em; line-height: 1; }
.board-foot .sub { font-size: 13px; color: var(--letter-2); margin-top: 4px; }
.board-foot .delta { font-size: 13px; color: var(--changed); font-weight: 650; }
.board-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.board-actions .btn { padding: 0 10px; }
.url-note { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.url-note code { white-space: nowrap; font-family: var(--font); font-weight: 650; color: var(--ink-2); }

/* Listes d'épicerie avec ajout rapide */
.quick { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--rule-2); border-radius: var(--r-l); }
.quick li { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 12px 12px 14px; border-top: 1px solid var(--rule-2); }
.quick li:first-child { border-top: 0; }
.quick .nm { font-weight: 650; font-size: 15px; }
.quick .mt { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.quick .pr { font-size: 14px; font-weight: 700; margin-top: 3px; }
.quick .pr small { font-weight: 500; color: var(--muted); font-size: 12px; }
.qa { display: flex; align-items: center; gap: 2px; }
.qa .plus, .qa .minus { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--felt); background: var(--felt); color: var(--letter); transition: transform 120ms var(--ease-out), background-color 150ms ease; }
.qa .minus { background: var(--card); color: var(--ink); border-color: var(--rule); }
.qa .plus:active, .qa .minus:active { transform: scale(0.92); }
.qa output { min-width: 26px; text-align: center; font-weight: 750; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { border: 1px solid var(--rule); background: var(--card); border-radius: 999px; padding: 7px 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
.filters button[aria-pressed="true"] { background: var(--felt); color: var(--letter); border-color: var(--felt); }

/* Points relais */
.days { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.days button { border: 1px solid var(--rule); background: var(--card); border-radius: 12px; min-height: 48px; font-weight: 650; display: grid; align-content: center; justify-items: center; transition: background-color 150ms ease, border-color 150ms ease; }
.days button small { font-weight: 500; font-size: 12px; color: var(--muted); }
.days button[aria-pressed="true"] { border-color: var(--felt); background: var(--felt); color: var(--letter); }
.days button[aria-pressed="true"] small { color: var(--letter-2); }
.map { border-radius: var(--r-l); overflow: hidden; border: 1px solid var(--rule-2); background: #dfe4de; }
.map svg { width: 100%; height: auto; }
.map .pinbtn { cursor: pointer; }
.map .pinbtn:focus-visible circle.hit { stroke: var(--focus); stroke-width: 3; }
.live { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.relais { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rl { display: grid; gap: 8px; width: 100%; text-align: left; padding: 12px 14px; border-radius: var(--r-m); border: 1px solid var(--rule-2); background: var(--card); transition: border-color 150ms ease, background-color 600ms ease, transform 140ms var(--ease-out); }
.rl:active { transform: scale(0.985); }
.rl[aria-pressed="true"] { border-color: var(--felt); box-shadow: 0 0 0 1px var(--felt); }
.rl.lit { background: var(--changed-tint); }
.rl-top { display: flex; align-items: center; gap: 8px; }
.code { font-family: var(--font-letter); font-weight: 700; font-size: 13px; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 5px; background: var(--felt); color: var(--letter); flex: none; }
.rl-name { font-weight: 700; font-size: 15px; min-width: 0; overflow: clip; text-overflow: ellipsis; white-space: nowrap; }
.rl-top .state { margin-left: auto; }
.rl-meta { font-size: 13px; color: var(--muted); }
.rl-cap { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 13px; font-weight: 650; }
.rl-bans { display: flex; flex-wrap: wrap; gap: 6px; }
.notice { border-radius: var(--r-m); padding: 12px 14px; display: grid; gap: 10px; border: 1px solid; }
.notice.full { background: var(--full-tint); border-color: #efc2ba; color: #6f1c10; }
.notice.warn { background: var(--warn-tint); border-color: #ead1a8; color: #5e3b05; }
.notice.ok { background: var(--ok-tint); border-color: #bfdcc3; color: #1c4f26; }
.notice strong { display: block; font-size: 14.5px; }
.notice p { font-size: 13.5px; }
.notice .row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Mon panier */
.box { background: var(--card); border: 1px solid var(--rule-2); border-radius: var(--r-l); padding: 14px; display: grid; gap: 12px; }
.box h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.cline { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding-top: 10px; border-top: 1px solid var(--rule-2); }
.box > .cline:first-of-type { border-top: 0; padding-top: 0; }
.cline .nm { font-weight: 650; }
.cline .mt { font-size: 12.5px; color: var(--muted); }
.cline .mt.sw { color: var(--changed-ink); background: var(--changed-tint); border-radius: 6px; padding: 2px 6px; display: inline-block; margin-top: 3px; }
.cline .mt.ban { color: var(--full); font-weight: 650; }
.cline .rm { border: 0; background: none; color: var(--muted); font-size: 12.5px; text-decoration: underline; padding: 2px 0; }
.sum { display: grid; gap: 6px; font-size: 14px; }
.sum div { display: flex; justify-content: space-between; gap: 10px; }
.sum .tot { font-size: 18px; font-weight: 750; padding-top: 8px; border-top: 1px solid var(--rule-2); }
.sum .neg { color: var(--ok); font-weight: 650; }
.cse-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.applied { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--ok-tint); border-radius: var(--r-m); padding: 10px 12px; font-size: 13.5px; color: #1c4f26; }
.applied strong { display: block; }
.split { display: grid; gap: 10px; }
.split-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--rule-2); border-radius: var(--r-m); }
.split-row .icon { color: var(--ink-2); }
.split-row .t { font-weight: 650; font-size: 14px; }
.split-row .s { font-size: 12.5px; color: var(--muted); }
.tr-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.tr-input .input { text-align: right; font-weight: 700; }
.paybar { position: sticky; bottom: 0; margin: 0 -16px -24px; padding: 12px 16px 16px; background: linear-gradient(to bottom, rgba(233, 236, 232, 0), var(--ground) 30%); display: grid; gap: 8px; }
.empty { text-align: center; padding: 40px 16px; display: grid; gap: 12px; justify-items: center; color: var(--ink-2); }
.empty .icon { width: 36px; height: 36px; color: var(--muted); }

/* Commandes et confirmation */
.orders { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ord { background: var(--card); border: 1px solid var(--rule-2); border-radius: var(--r-l); padding: 14px; display: grid; gap: 8px; }
.ord-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.ord-top strong { font-size: 15px; }
.ord .mt { font-size: 13px; color: var(--muted); }
.refund { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; background: var(--ok-tint); border-radius: var(--r-m); padding: 10px 12px; font-size: 13.5px; color: #1c4f26; }
.bo-link { margin-top: 6px; }
.ticket { background: var(--felt); color: var(--letter); border-radius: var(--r-l); padding: 20px 18px; display: grid; gap: 6px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='1' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E"); }
.ticket .bl { font-size: 15px; }
.ticket .code-big { font-family: var(--font-letter); font-weight: 700; font-size: 44px; letter-spacing: 0.16em; color: var(--changed); line-height: 1; margin: 8px 0 4px; }

/* Barre d'onglets */
.tabbar { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--rule-2); padding: 6px 6px 14px; }
.tabbar button { border: 0; background: none; display: grid; justify-items: center; gap: 3px; padding: 6px 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 10px; transition: transform 120ms var(--ease-out), color 150ms ease; }
.tabbar button:active { transform: scale(0.95); }
.tabbar button[aria-current="page"] { color: var(--ink); }
.tabbar button[aria-current="page"] .icon { stroke-width: 2.2; }
.tb-ico { position: relative; }
.badge { position: absolute; top: -6px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--changed); color: var(--felt); font-size: 11px; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.badge[hidden] { display: none; }

/* Feuille du bas */
.scrim { position: absolute; inset: 0; background: rgba(20, 24, 28, 0.42); opacity: 0; transition: opacity 260ms ease; z-index: 20; }
.scrim.on { opacity: 1; transition-duration: 380ms; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; z-index: 21; background: var(--card); border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column; transform: translateY(102%); transition: transform 260ms var(--ease-out); touch-action: none;
  box-shadow: 0 -10px 30px -12px rgba(20, 24, 28, 0.35);
}
.sheet.on { transform: translateY(0); transition: transform 440ms var(--ease-drawer); }
.sheet.dragging { transition: none; }
.grab { display: grid; place-items: center; padding: 8px 0 2px; cursor: grab; }
.grab span { width: 40px; height: 5px; border-radius: 99px; background: #cdd3d6; }
.sheet-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 6px; padding: 0 10px 8px; }
.sheet-head h3 { text-align: center; font-size: 16px; font-weight: 700; grid-column: 2; }
.sheet-head #sheet-close { grid-column: 3; }
.sheet-body { overflow-y: auto; overflow-x: hidden; padding: 4px 16px 20px; touch-action: pan-y; display: grid; gap: 12px; }
.rule-box { background: #f1f3f0; border-radius: var(--r-m); padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.opt { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-m); border: 1px solid var(--rule-2); background: var(--card); text-align: left; transition: border-color 150ms ease, transform 140ms var(--ease-out); }
.opt:active:not([disabled]) { transform: scale(0.985); }
.opt .nm { font-weight: 650; }
.opt .mt { font-size: 12.5px; color: var(--muted); }
.opt .d { font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.opt .d.ok { background: var(--ok-tint); color: #1f5a2a; }
.opt .d.no { background: #eef0ee; color: #5a646c; }
.opt[disabled] { cursor: not-allowed; background: #f6f7f5; }
.opt[disabled] .nm { color: #59636b; }
.opt[aria-pressed="true"] { border-color: var(--felt); box-shadow: 0 0 0 1px var(--felt); }
@media (hover: hover) and (pointer: fine) { .opt:not([disabled]):hover, .rl:hover { border-color: #b7bfba; } .filters button:hover, .days button:hover { border-color: #b7bfba; } }
.diff { display: grid; gap: 6px; padding: 12px; border-radius: var(--r-m); background: var(--felt); color: var(--letter); }
.diff .bl { font-size: 15px; }

/* Toast */
.toast {
  position: absolute; left: 50%; bottom: 84px; z-index: 30; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--felt); color: var(--letter); font-size: 14px; font-weight: 600; box-shadow: 0 10px 24px -10px rgba(20, 24, 28, 0.5);
  opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: opacity 200ms ease, transform 200ms var(--ease-out);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); transition-duration: 400ms; }

/* Téléphone : l'application occupe l'écran */
@media (max-width: 899px) {
  .stage { display: block; }
  .guide { display: none; }
  .device-area { padding: 0; display: block; }
  .phone { width: 100%; height: 100dvh; border-radius: 0; padding: 0; background: none; box-shadow: none; }
  .app { border-radius: 0; }
  .app .topbar { padding-top: 12px; }
  .tabbar { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (min-width: 900px) and (max-height: 760px) { .phone { height: calc(100dvh - 32px); } .device-area { padding: 16px; } }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet.on { transition: opacity 200ms ease; transform: none; opacity: 0; }
  .sheet.on { opacity: 1; }
  .bl.flip { animation: fade-in 300ms ease both; }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  .toast, .toast.on { transform: translate(-50%, 0); }
  .rl:active, .opt:active, .qa .plus:active, .qa .minus:active, .tabbar button:active, .iconbtn:active, .pickup:active { transform: none; }
}
