:root {
    color-scheme: light;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
    --bg: #f5f5f7;
    --bg-elevated: rgba(255, 255, 255, .78);
    --surface: rgba(255, 255, 255, .86);
    --surface-solid: #ffffff;
    --surface-subtle: rgba(247, 247, 249, .9);
    --surface-hover: rgba(0, 0, 0, .035);
    --sidebar: rgba(250, 250, 252, .82);
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #8e8e93;
    --border: rgba(0, 0, 0, .09);
    --border-strong: rgba(0, 0, 0, .16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 5px 18px rgba(0, 0, 0, .035);
    --shadow-md: 0 20px 55px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .08);
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-soft: rgba(0, 113, 227, .11);
    --success: #248a3d;
    --success-soft: rgba(36, 138, 61, .12);
    --warning: #b25000;
    --warning-soft: rgba(255, 159, 10, .14);
    --danger: #d70015;
    --danger-soft: rgba(215, 0, 21, .1);
    --info: #0071e3;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --sidebar-width: 252px;
    --rail: 76px;
    --control-height: 40px;
    --page-gap: 22px;
}

html[data-accent="indigo"] { --accent: #5856d6; --accent-hover: #4f4dc8; --accent-soft: rgba(88, 86, 214, .12); }
html[data-accent="graphite"] { --accent: #48484a; --accent-hover: #3a3a3c; --accent-soft: rgba(72, 72, 74, .12); }
html[data-accent="green"] { --accent: #147d64; --accent-hover: #0d725a; --accent-soft: rgba(20, 125, 100, .12); }

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #09090b;
    --bg-elevated: rgba(28, 28, 30, .78);
    --surface: rgba(30, 30, 32, .86);
    --surface-solid: #1c1c1e;
    --surface-subtle: rgba(44, 44, 46, .88);
    --surface-hover: rgba(255, 255, 255, .055);
    --sidebar: rgba(19, 19, 21, .84);
    --text: #f5f5f7;
    --text-secondary: #aeaeb2;
    --text-tertiary: #8e8e93;
    --border: rgba(255, 255, 255, .1);
    --border-strong: rgba(255, 255, 255, .18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .22);
    --shadow-md: 0 24px 70px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .32);
    --accent-soft: color-mix(in srgb, var(--accent) 19%, transparent);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        color-scheme: dark;
        --bg: #09090b;
        --bg-elevated: rgba(28, 28, 30, .78);
        --surface: rgba(30, 30, 32, .86);
        --surface-solid: #1c1c1e;
        --surface-subtle: rgba(44, 44, 46, .88);
        --surface-hover: rgba(255, 255, 255, .055);
        --sidebar: rgba(19, 19, 21, .84);
        --text: #f5f5f7;
        --text-secondary: #aeaeb2;
        --text-tertiary: #8e8e93;
        --border: rgba(255, 255, 255, .1);
        --border-strong: rgba(255, 255, 255, .18);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .22);
        --shadow-md: 0 24px 70px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .32);
    }
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }
svg { display: block; }

.background-motif { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .7; }
html[data-pattern="aurora"] .background-motif {
    background:
        radial-gradient(circle at 92% -8%, color-mix(in srgb, var(--accent) 8%, transparent) 0, transparent 33%),
        radial-gradient(circle at 28% 105%, rgba(100, 130, 180, .055) 0, transparent 30%);
}
html[data-pattern="mesh"] .background-motif {
    background:
        radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 28%),
        radial-gradient(circle at 85% 25%, rgba(100, 100, 110, .06), transparent 30%),
        radial-gradient(circle at 55% 90%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 35%);
}
html[data-pattern="grid"] .background-motif {
    opacity: .35;
    background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}
html[data-pattern="none"] .background-motif { display: none; }

.app-shell { position: relative; z-index: 1; min-height: 100vh; }
.sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; width: var(--rail); height: 100vh; padding: 14px 12px;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--sidebar); border-right: 1px solid var(--border);
    backdrop-filter: blur(34px) saturate(145%); -webkit-backdrop-filter: blur(34px) saturate(145%);
    transition: width .18s ease, box-shadow .18s ease;
}
.sidebar:hover { width: var(--sidebar-width); box-shadow: var(--shadow-md); }
.main { min-width: 0; margin-left: var(--rail); transition: margin-left .18s ease; display: flex; flex-direction: column; min-height: 100vh; }
.brand-link { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; text-decoration: none; color: inherit; }
.brand-link .brand-mark { width: 30px; height: 30px; border-radius: 9px; background: none; }
.brand-name { font-size: 17px; font-weight: 750; letter-spacing: -.4px; white-space: nowrap; }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-divider { width: 1px; height: 26px; background: var(--border); flex: 0 0 auto; }
/* Mode épinglé : barre ouverte en permanence, contenu décalé */
html[data-sidebar="pinned"] .sidebar { width: var(--sidebar-width); box-shadow: none; }
html[data-sidebar="pinned"] .main { margin-left: var(--sidebar-width); }
.brand-block { height: 52px; display: flex; align-items: center; gap: 11px; padding: 0 6px; flex: 0 0 auto; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: var(--text); color: var(--surface-solid); font-size: 18px; font-weight: 750; letter-spacing: -.6px;
}
.brand-copy { min-width: 0; flex: 1; display: grid; }
.brand-copy strong { font-size: 17px; letter-spacing: -.3px; }
.brand-copy small { color: var(--text-secondary); font-size: 10px; font-weight: 650; letter-spacing: .65px; text-transform: uppercase; }
.sidebar-toggle { width: 28px !important; height: 28px !important; font-size: 20px; }

.nav { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; padding: 10px 2px 18px; }
.nav-group { margin-top: 15px; }
.nav-group:first-child { margin-top: 2px; }
.nav-label { padding: 0 10px 5px; color: var(--text-tertiary); font-size: 10px; font-weight: 700; letter-spacing: .55px; text-transform: uppercase; }
.nav a {
    min-height: 38px; margin: 2px 0; padding: 8px 10px; border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-weight: 550; white-space: nowrap;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav a svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.sidebar-user { flex: 0 0 auto; padding: 10px 0 0; border-top: 1px solid var(--border); }
.user-card { width: 100%; border: 0; background: transparent; border-radius: 13px; padding: 8px; color: var(--text); display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.user-card:hover { background: var(--surface-hover); }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 750; }
.user-copy { min-width: 0; flex: 1; display: grid; }
.user-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); font-size: 10px; }
.chevron { color: var(--text-tertiary); letter-spacing: 1px; }

/* Barre repliée (rail) : icônes seules quand ni survolée ni épinglée */
html:not([data-sidebar="pinned"]) .sidebar:not(:hover) .nav a span,
html:not([data-sidebar="pinned"]) .sidebar:not(:hover) .user-copy,
html:not([data-sidebar="pinned"]) .sidebar:not(:hover) .chevron { display: none; }
html:not([data-sidebar="pinned"]) .sidebar:not(:hover) .nav a,
html:not([data-sidebar="pinned"]) .sidebar:not(:hover) .user-card { justify-content: center; }
html:not([data-sidebar="pinned"]) .sidebar:not(:hover) .nav a { padding-inline: 8px; }

.main { min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 20; min-height: 78px; padding: 13px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    background: color-mix(in srgb, var(--bg-elevated) 90%, transparent); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%);
}
.page-heading { min-width: 0; }
.eyebrow { display: block; margin-bottom: 1px; color: var(--text-tertiary); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; }
.page-heading h1 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.55px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.context-pill { padding: 8px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-secondary); font-size: 12px; box-shadow: var(--shadow-sm); }
.context-pill b { margin: 0 5px; color: var(--text-tertiary); }
.icon-button {
    width: var(--control-height); height: var(--control-height); border: 1px solid var(--border); border-radius: 50%;
    display: inline-grid; place-items: center; background: var(--surface); color: var(--text); cursor: pointer; box-shadow: var(--shadow-sm);
}
.icon-button:hover { background: var(--surface-solid); border-color: var(--border-strong); }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.page { width: min(100%, 1540px); margin: 0 auto; padding: 28px 30px 40px; }
.app-footer { margin-top: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; padding: 16px 30px; border-top: 1px solid var(--border); color: var(--text-tertiary); font-size: 12px; }
.app-footer a { color: var(--text-secondary); font-weight: 600; text-decoration: none; }
.app-footer a:hover { color: var(--accent); text-decoration: underline; }
.foot-structure { font-weight: 650; color: var(--text-secondary); }
.foot-version { margin-left: auto; font-variant-numeric: tabular-nums; opacity: .85; }
.grid { display: grid; gap: var(--page-gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
    position: relative; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.card h2 { margin: 0 0 14px; font-size: 17px; letter-spacing: -.25px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.metric { min-height: 118px; overflow: hidden; }
.metric::after { content: ""; position: absolute; inset: auto -22px -32px auto; width: 92px; height: 92px; border-radius: 50%; background: var(--accent-soft); opacity: .7; }
.metric .label { position: relative; z-index: 1; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.metric .value { position: relative; z-index: 1; margin-top: 8px; font-size: clamp(22px, 2vw, 29px); font-weight: 720; letter-spacing: -.7px; }
.metric.green { --accent: var(--success); --accent-soft: var(--success-soft); }
.metric.amber { --accent: var(--warning); --accent-soft: var(--warning-soft); }
.metric.red { --accent: var(--danger); --accent-soft: var(--danger-soft); }

.toolbar { margin-bottom: 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar form, .inline-form { display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.toolbar-title h2 { margin: 0; font-size: 18px; }
.toolbar-title p { margin: 3px 0 0; color: var(--text-secondary); }

.btn {
    min-height: var(--control-height); padding: 8px 15px; border: 1px solid transparent; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 650; line-height: 1; cursor: pointer;
    transition: transform .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.btn:active { transform: scale(.975); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-solid); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-small { min-height: 32px; padding: 6px 10px; border-radius: 9px; font-size: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--text-secondary); font-size: 12px; font-weight: 620; }
input, select, textarea {
    width: 100%; min-height: var(--control-height); padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface-solid); color: var(--text); outline: none; transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; }
.switch-row { min-height: 52px; padding: 10px 0; display: flex !important; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--border); }
.switch-row span { display: grid; gap: 2px; }
.switch-row small { color: var(--text-tertiary); font-weight: 450; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: transparent; }
th, td { padding: 12px 11px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--text-tertiary); font-size: 10px; font-weight: 720; text-transform: uppercase; letter-spacing: .55px; white-space: nowrap; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: 0; }
.number { text-align: right; white-space: nowrap; }
.muted { color: var(--text-secondary); }
.empty-state { padding: 44px 20px; text-align: center; color: var(--text-secondary); }
.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border-radius: 999px; background: var(--surface-subtle); color: var(--text-secondary); font-size: 10px; font-weight: 720; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.toast {
    position: relative; margin-bottom: 18px; padding: 13px 42px 13px 14px; border: 1px solid var(--border); border-radius: 13px;
    display: flex; align-items: center; gap: 9px; background: var(--surface-solid); box-shadow: var(--shadow-sm); font-weight: 550;
}
.toast > span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 800; }
.toast-success > span { background: var(--success-soft); color: var(--success); }
.toast-error > span { background: var(--danger-soft); color: var(--danger); }
.toast > button { position: absolute; right: 10px; border: 0; background: transparent; color: var(--text-tertiary); font-size: 19px; cursor: pointer; }
.alert { padding: 12px 14px; border-radius: 11px; border: 1px solid var(--border); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

dialog.modal { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 18px; border: 0; background: transparent; color: var(--text); overflow: auto; }
dialog.modal::backdrop { background: rgba(0, 0, 0, .32); backdrop-filter: blur(13px); -webkit-backdrop-filter: blur(13px); }
.modal[open] { display: grid; place-items: center; }
.modal-panel {
    width: min(100%, 620px); max-height: min(90vh, 900px); display: flex; flex-direction: column;
    background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden;
    animation: modal-in .18s ease-out both;
}
.modal-small .modal-panel { width: min(100%, 440px); }
.modal-large .modal-panel { width: min(100%, 960px); }
.modal-xlarge .modal-panel { width: min(100%, 1180px); }
.modal-header { flex: 0 0 auto; min-height: 74px; padding: 18px 20px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.modal-kicker { display: block; margin-bottom: 2px; color: var(--text-tertiary); font-size: 10px; font-weight: 720; letter-spacing: .65px; text-transform: uppercase; }
.modal-close { width: 30px; height: 30px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--surface-subtle); color: var(--text-secondary); font-size: 21px; cursor: pointer; }
.modal-close:hover { color: var(--text); background: var(--surface-hover); }
/* Le <form> qui enveloppe corps+pied est neutralisé (display:contents) afin que
   .modal-body et .modal-footer deviennent des enfants flex directs de .modal-panel :
   le corps peut alors rétrécir (min-height:0) et défiler, le pied reste visible. */
.modal-panel > form { display: contents; }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.modal-footer { flex: 0 0 auto; padding: 13px 20px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); background: var(--surface-subtle); }
.modal-loading { min-height: 180px; display: grid; place-items: center; color: var(--text-secondary); }
.modal-page-content > .card { border: 0; padding: 0; box-shadow: none; background: transparent; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

.preference-section { margin-bottom: 20px; }
.preference-section h3 { margin-bottom: 10px; }
.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-option { cursor: pointer; }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-preview { height: 76px; display: block; border: 2px solid var(--border); border-radius: 12px; background: #f5f5f7; box-shadow: inset 18px 0 #e8e8ed; }
.theme-preview-dark { background: #1c1c1e; box-shadow: inset 18px 0 #101011; }
.theme-preview-system { background: linear-gradient(135deg, #f5f5f7 50%, #1c1c1e 50%); box-shadow: inset 18px 0 rgba(120,120,125,.3); }
.theme-option input:checked + .theme-preview { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), inset 18px 0 rgba(120,120,125,.22); }
.theme-option strong { display: block; margin-top: 6px; color: var(--text); text-align: center; font-size: 11px; }
.account-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-page::before { content: ""; position: fixed; inset: 0; background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--accent) 10%, transparent), transparent 42%); pointer-events: none; }
.login-card { position: relative; width: min(430px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-md); backdrop-filter: blur(24px); }
.login-card h1 { margin: 0; color: var(--text); font-size: 34px; letter-spacing: -1.2px; }
.login-card form { display: grid; gap: 16px; margin-top: 26px; }

.pos-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(350px, .65fr); gap: var(--page-gap); }
.pos-search { position: relative; display: flex; gap: 8px; margin-bottom: 15px; }
.pos-search input { flex: 1; min-width: 0; min-height: 50px; font-size: 17px; }
.pos-suggest {
    position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 40;
    max-height: 340px; overflow-y: auto; padding: 6px;
    background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
}
.pos-suggest[hidden] { display: none; }
.pos-suggest-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.pos-suggest-item.active, .pos-suggest-item:hover { background: var(--accent-soft); }
.pos-suggest-item .ps-main { flex: 1; min-width: 0; }
.pos-suggest-item .ps-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-suggest-item .ps-sku { color: var(--text-secondary); font-size: 12px; margin-top: 1px; }
.pos-suggest-item .ps-price { flex: 0 0 auto; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.pos-suggest-empty { padding: 14px 12px; color: var(--text-secondary); text-align: center; font-size: 14px; }
.cart-table input { width: 82px; }
.pos-total { margin: 15px 0; color: var(--text); font-size: 32px; font-weight: 750; letter-spacing: -1px; text-align: right; }
.payment-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto; gap: 7px; margin-bottom: 8px; }

.receipt-page { margin: 0; padding: 20px; background: #e9e9eb; }
.receipt { width: 80mm; margin: 0 auto; padding: 5mm; background: #fff; color: #000; font-family: "Courier New", monospace; font-size: 11px; }
.receipt h1 { margin: 0 0 4px; text-align: center; font-size: 17px; }
.receipt .center { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #000; }
.receipt table { font-size: 10px; }
.receipt th, .receipt td { padding: 3px 1px; border: 0; background: transparent; }
.receipt .total { font-size: 15px; font-weight: 800; }
.receipt-actions { width: 80mm; margin: 0 auto 10px; display: flex; gap: 8px; }

html[data-density="compact"] { --control-height: 34px; --page-gap: 14px; }
html[data-density="compact"] .page { padding-top: 20px; }
html[data-density="compact"] .card { padding: 15px; }
html[data-density="compact"] th,
html[data-density="compact"] td { padding-block: 8px; }
html[data-reduce-motion="1"] *, html[data-reduce-motion="1"] *::before, html[data-reduce-motion="1"] *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }

/* Navigation mobile — masquée sur desktop, activée sous 650px */
.mobile-tabbar { display: none; }
.sheet-nav { display: flex; flex-direction: column; gap: 4px; }
.sheet-group { display: flex; flex-direction: column; gap: 2px; }
.sheet-group + .sheet-group { margin-top: 6px; }
.sheet-group .nav-label { padding: 8px 6px 4px; color: var(--text-tertiary); font-size: 10px; font-weight: 700; letter-spacing: .55px; text-transform: uppercase; }
.sheet-nav a { display: flex; align-items: center; gap: 13px; padding: 12px; border-radius: 12px; color: var(--text); text-decoration: none; font-size: 15px; font-weight: 500; }
.sheet-nav a svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sheet-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }

@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .page { padding-inline: 20px; }
}
@media (max-width: 650px) {
    .app-shell { display: block; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
    .sidebar { display: none !important; }
    .main { margin-left: 0; }
    .mobile-tabbar {
        display: flex; position: fixed; inset: auto 0 0; z-index: 30;
        background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
        -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
        border-top: 1px solid var(--border); box-shadow: 0 -8px 22px -14px rgba(0, 0, 0, .45);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 2px;
    }
    .mobile-tabbar a, .mobile-tabbar .tabbar-more {
        flex: 1 1 0; min-width: 0; background: none; border: 0; cursor: pointer; font-family: inherit;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        padding: 7px 2px; border-radius: 12px; color: var(--text-secondary);
        font-size: 10px; font-weight: 600; text-decoration: none; -webkit-tap-highlight-color: transparent;
    }
    .mobile-tabbar a svg, .mobile-tabbar .tabbar-more svg { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .mobile-tabbar a span, .mobile-tabbar .tabbar-more span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-tabbar a.active { color: var(--accent); }
    .mobile-tabbar a.active svg { stroke-width: 2.1; }
    .topbar { min-height: 66px; padding: 10px 16px; }
    .brand-name, .topbar-divider { display: none; }
    .app-footer { padding: 16px 14px; }
    .page { padding: 18px 14px 40px; }
    .context-pill { display: none; }
    .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .theme-picker { grid-template-columns: 1fr; }
    .theme-preview { height: 52px; }
    dialog.modal { padding: 8px; align-items: end; }
    .modal-panel { width: 100% !important; max-height: 94vh; border-radius: 22px 22px 14px 14px; }
    .payment-row { grid-template-columns: 1fr 1fr; }
}
@media print {
    .receipt-actions { display: none !important; }
    .receipt-page { padding: 0; background: #fff; }
    .receipt { margin: 0; box-shadow: none; }
    @page { margin: 0; }
}
