/* My Order — feuille de style type application */
:root {
    --brand: #e2542c;
    --brand-dark: #b93f1d;
    --brand-soft: #fdeee8;
    --brand-tint: #fff7f4;
    --bg: #f6f4f1;
    --card: #ffffff;
    --text: #1c1a19;
    --text-soft: #55504c;
    --muted: #857d77;
    --border: #ece7e2;
    --ok: #1f9d63;
    --ok-soft: #e8f7ef;
    --warn: #c9821a;
    --warn-soft: #fdf3e2;
    --danger: #cf3b30;
    --danger-soft: #fdecea;
    --info: #2f6fd0;
    --info-soft: #eaf1fd;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 4px 16px rgba(28, 26, 25, .07);
    --shadow-lg: 0 12px 32px rgba(28, 26, 25, .12);
    --nav-h: 66px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; }
p { margin: 0 0 10px; }

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- En-tete ---------- */
.app-top {
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top, 0px);
}
.app-top-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 8px 16px;
}
.app-logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-logo-badge {
    width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto;
    background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px; letter-spacing: -.5px;
}
.app-logo-text { min-width: 0; }
.app-logo-text strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-logo-text span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand-dark);
    transition: transform .12s ease, background .12s ease;
    position: relative;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }

.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; font-weight: 600; color: var(--brand-dark);
    padding: 8px 10px 8px 4px; border-radius: 10px;
}
.back-link svg { width: 18px; height: 18px; }

/* ---------- Barre de navigation du bas ---------- */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
}
.bottom-nav a {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px 4px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    transition: transform .12s ease, color .12s ease, background .12s ease;
}
.bottom-nav a svg { width: 21px; height: 21px; }
.bottom-nav a:active { transform: scale(.95); }
.bottom-nav a.active { color: var(--brand-dark); background: var(--brand-soft); }
.bottom-nav .nav-badge {
    position: absolute; transform: translate(16px, -10px);
    background: var(--brand); color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 17px; height: 17px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---------- Cartes ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 14px;
}
.card-tight { padding: 14px; }
.card-flat { box-shadow: none; border: 1px solid var(--border); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { font-size: 17px; }
.card-head .spacer { margin-left: auto; }

.section-title { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 12px; }
.section-title h2 { font-size: 19px; }
.section-title span { font-size: 13px; color: var(--muted); }
.section-title .spacer { margin-left: auto; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 700; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    padding: 12px 18px;
    border-radius: 15px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 15.5px;
    box-shadow: 0 6px 16px rgba(226, 84, 44, .26);
    transition: transform .12s ease, opacity .12s ease, background .12s ease;
}
.btn svg { width: 19px; height: 19px; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; box-shadow: none; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; width: auto; }
.btn-ghost { background: var(--brand-soft); color: var(--brand-dark); box-shadow: none; }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); box-shadow: none; }
.btn-dark { background: #24211f; box-shadow: 0 6px 16px rgba(36, 33, 31, .22); }
.btn-danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn-ok { background: var(--ok); box-shadow: 0 6px 16px rgba(31, 157, 99, .24); }
.btn-block-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-block-row .btn { flex: 1 1 160px; }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.input, select.input, textarea.input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
    appearance: none;
}
textarea.input { min-height: 90px; resize: vertical; }
select.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23857d77' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- Mot de passe : oeil + robustesse ---------- */
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 56px; }
.pass-eye {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    width: 42px; height: 42px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--muted); background: transparent;
    transition: color .12s ease, background .12s ease;
}
.pass-eye:active { background: var(--brand-soft); color: var(--brand-dark); }
.pass-eye svg { width: 21px; height: 21px; }

.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pw-meter[data-level="0"] { display: none; }
.pw-bars { display: flex; gap: 5px; flex: 1; }
.pw-bars span { flex: 1 1 0; height: 5px; border-radius: 3px; background: #e7e2dd; transition: background .18s ease; }
.pw-meter[data-level="1"] .pw-bars span:nth-child(1) { background: var(--danger); }
.pw-meter[data-level="2"] .pw-bars span:nth-child(-n+2) { background: var(--warn); }
.pw-meter[data-level="3"] .pw-bars span { background: var(--ok); }
.pw-label { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pw-meter[data-level="1"] .pw-label { color: var(--danger); }
.pw-meter[data-level="2"] .pw-label { color: var(--warn); }
.pw-meter[data-level="3"] .pw-label { color: var(--ok); }
.field-row { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14.5px; padding: 10px 0; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--brand); }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch-row .switch-text { flex: 1; min-width: 0; }
.switch-row .switch-text strong { display: block; font-size: 14.5px; }
.switch-row .switch-text span { font-size: 12.5px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; }
.switch span { position: absolute; inset: 0; background: #d9d3ce; border-radius: 15px; transition: background .18s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }

/* ---------- Badges / pastilles ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 700;
    padding: 4px 9px; border-radius: 999px;
    background: var(--brand-soft); color: var(--brand-dark);
    white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #f1eeeb; color: var(--muted); }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    margin: 14px 0 16px;
    min-height: 210px;
    display: flex;
    align-items: flex-end;
    background: #2b2724;
}
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .62; }
.hero-body { position: relative; padding: 20px; color: #fff; width: 100%; }
.hero-body h1 { font-size: 25px; margin-bottom: 6px; }
.hero-body p { font-size: 14px; opacity: .93; margin: 0 0 12px; }

/* ---------- Grilles ---------- */
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.mode-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.cat-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }

.stat {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 15px;
}
.stat .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .stat-value { font-size: 22px; font-weight: 800; margin-top: 3px; letter-spacing: -.5px; }
.stat .stat-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Plats ---------- */
.dish {
    display: flex;
    gap: 12px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 12px;
    transition: transform .12s ease;
}
.dish:active { transform: scale(.995); }
.dish-img {
    width: 88px; height: 88px; flex: 0 0 auto;
    border-radius: 14px; object-fit: cover; background: var(--brand-soft);
}
.dish-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dish-body h3 { font-size: 15.5px; }
.dish-body p { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; }
.dish-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 8px; }
.dish-price { font-weight: 800; font-size: 15.5px; }
.dish-foot .spacer { margin-left: auto; }

.qty { display: inline-flex; align-items: center; gap: 2px; background: var(--brand-soft); border-radius: 12px; padding: 3px; }
.qty button {
    width: 32px; height: 32px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: var(--brand-dark); font-weight: 800; font-size: 17px;
    transition: transform .12s ease;
}
.qty button:active { transform: scale(.9); }
.qty .qty-val { min-width: 26px; text-align: center; font-weight: 700; font-size: 14.5px; }

.add-btn {
    width: 34px; height: 34px; border-radius: 11px;
    background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(226, 84, 44, .3);
    transition: transform .12s ease;
}
.add-btn:active { transform: scale(.92); }
.add-btn svg { width: 18px; height: 18px; }

/* ---------- Lignes de liste ---------- */
.row-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}
.row-item:last-child { border-bottom: none; }
.row-item .row-body { flex: 1; min-width: 0; }
.row-item .row-body strong { display: block; font-size: 15px; }
.row-item .row-body span { font-size: 12.5px; color: var(--muted); }
.row-item .row-side { text-align: right; flex: 0 0 auto; }

/* ---------- Totaux ---------- */
.total-line { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14.5px; }
.total-line .spacer { margin-left: auto; }
.total-line.grand { font-size: 19px; font-weight: 800; padding-top: 12px; border-top: 1px dashed var(--border); margin-top: 6px; }

/* ---------- Etapes de suivi ---------- */
.steps { display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; gap: 12px; padding: 10px 0; }
.step-dot {
    width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
    background: #f1eeeb; color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800;
}
.step.done .step-dot { background: var(--ok); color: #fff; }
.step.current .step-dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 5px var(--brand-soft); }
.step-body strong { display: block; font-size: 14.5px; }
.step-body span { font-size: 12.5px; color: var(--muted); }
.step:not(.done):not(.current) .step-body { opacity: .55; }

/* ---------- Messages ---------- */
.toast-wrap {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
    z-index: 200;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 0 16px;
    pointer-events: none;
}
.toast {
    max-width: 460px; width: 100%;
    background: #24211f; color: #fff;
    padding: 13px 16px; border-radius: 14px;
    font-size: 14px; font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: toastIn .22s ease;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; margin: 0 auto 12px; opacity: .4; }

.alert { border-radius: 14px; padding: 13px 15px; font-size: 13.5px; margin-bottom: 14px; }
.alert-info { background: var(--info-soft); color: #234f96; }
.alert-warn { background: var(--warn-soft); color: #8a5a12; }
.alert-ok { background: var(--ok-soft); color: #157049; }
.alert-danger { background: var(--danger-soft); color: #a02c23; }

.skeleton { background: linear-gradient(90deg, #f0ece8 25%, #f7f4f1 50%, #f0ece8 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Panier flottant ---------- */
.cart-bar {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 10px);
    z-index: 90;
    background: #24211f; color: #fff;
    border-radius: 17px;
    padding: 12px 14px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: toastIn .25s ease;
}
.cart-bar .cart-count {
    width: 30px; height: 30px; border-radius: 10px;
    background: var(--brand); display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px; flex: 0 0 auto;
}
.cart-bar .cart-info { flex: 1; min-width: 0; }
.cart-bar .cart-info strong { display: block; font-size: 14px; }
.cart-bar .cart-info span { font-size: 12px; opacity: .75; }
.cart-bar button { background: rgba(255,255,255,.14); color: #fff; padding: 9px 15px; border-radius: 12px; font-weight: 700; font-size: 14px; transition: transform .12s ease; }
.cart-bar button:active { transform: scale(.95); }

/* ---------- Galerie / selection ---------- */
.cat-tile { position: relative; border-radius: var(--radius); overflow: hidden; background: #2b2724; min-height: 118px; display: flex; align-items: flex-end; }
.cat-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.cat-tile span { position: relative; padding: 12px; color: #fff; font-weight: 700; font-size: 14.5px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto; padding: 9px 15px; border-radius: 999px;
    background: #fff; border: 1.5px solid var(--border);
    font-size: 13.5px; font-weight: 600; color: var(--text-soft);
    transition: transform .12s ease, background .12s ease;
}
.chip:active { transform: scale(.95); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.tabs { display: flex; gap: 6px; background: #efebe7; border-radius: 15px; padding: 5px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
    flex: 1 0 auto; padding: 10px 13px; border-radius: 11px;
    font-size: 13.5px; font-weight: 700; color: var(--text-soft);
    transition: background .15s ease, color .15s ease, transform .12s ease;
}
.tabs button:active { transform: scale(.97); }
.tabs button.active { background: #fff; color: var(--brand-dark); box-shadow: 0 2px 8px rgba(28,26,25,.08); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 6px; }
.bar-chart .bcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; min-width: 0; }
.bar-chart .bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--brand), #f08a63); border-radius: 8px 8px 4px 4px; min-height: 4px; transition: height .5s ease; }
.bar-chart .blabel { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* Graphique des 30 derniers jours (SVG responsive) */
.chart-30 svg { display: block; width: 100%; height: auto; }
.chart-30 .axis { font-size: 11px; fill: var(--muted); font-weight: 600; }
.chart-30 .peak { font-size: 11px; fill: var(--text-soft); font-weight: 700; }

.footer-note { text-align: center; font-size: 11.5px; color: var(--muted); padding: 22px 12px 8px; }

/* ---------- Ecran d'ouverture ---------- */
#app-splash {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--brand);
    color: #fff;
}
#app-splash img { width: 96px; height: 96px; border-radius: 22px; }
#app-splash span { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
#app-splash.show { display: flex; animation: splashOut .4s ease 1.2s forwards; }
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }

/* ---------- Modale ---------- */
.modal {
    position: fixed; inset: 0; z-index: 150;
    background: rgba(24, 21, 19, .5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0;
}
.modal-inner {
    background: var(--card);
    border-radius: 22px 22px 0 0;
    width: 100%; max-width: 560px;
    max-height: 88vh; overflow-y: auto;
    padding: 20px 18px calc(22px + env(safe-area-inset-bottom, 0px));
    animation: sheetUp .25s ease;
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-handle { width: 42px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 14px; }

/* Ecran de mot de passe obligatoire : couvre entierement l'administration */
#passScreen { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
#passScreen .modal-inner { box-shadow: none; max-width: 520px; }

.install-sheet ol { margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-soft); }
.install-sheet ol li { margin-bottom: 7px; }
.store-icons { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }
.store-icons svg { width: 26px; height: 26px; fill: var(--text-soft); }

/* ---------- Grilles de statistiques ---------- */
.kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }

/* ---------- Desktop ---------- */
@media (min-width: 768px) {
    body { padding-bottom: 32px; }
    .bottom-nav { position: sticky; top: 0; bottom: auto; border-top: none; border-bottom: 1px solid var(--border); }
    .field-row { grid-template-columns: repeat(2, 1fr); }
    .field-row-3 { grid-template-columns: repeat(3, 1fr); }
    .grid { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .mode-grid { grid-template-columns: repeat(3, 1fr); }
    .cat-grid { grid-template-columns: repeat(3, 1fr); }
    .kpi-grid { grid-template-columns: repeat(4, 1fr); }
    .hero { min-height: 300px; }
    .hero-body { padding: 32px; }
    .hero-body h1 { font-size: 32px; }
    .cart-bar { left: auto; right: 24px; width: 340px; }
    .modal { align-items: center; padding: 20px; }
    .modal-inner { border-radius: 22px; max-height: 84vh; }
}
@media (min-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Impression ---------- */
@media print {
    body { background: #fff; padding: 0; }
    .bottom-nav, .app-top, .cart-bar, .toast-wrap, .footer-note, #ticketActions,
    #ticketLoading, .modal, .btn, .hero { display: none !important; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .wrap { max-width: 100%; padding: 0; }
}
