:root {
    --brand: #0e7c66;
    --brand-dark: #0a6654;
    --brand-deep: #0b2a25;
    --brand-soft: #e6f4ef;
    --accent: #f59e0b;
    --accent-soft: #fef3c7;
    --ink: #10201c;
    --muted: #5d6f6a;
    --line: #e2e9e6;
    --bg: #f3f6f5;
    --card: #ffffff;
    --danger: #c2332a;
    --danger-soft: #fdecea;
    --warn: #a35a05;
    --ok: #12773b;
    --ok-soft: #dcf7e6;
    --blue: #2563eb;
    --blue-soft: #e4edff;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(16, 32, 28, .04), 0 4px 16px rgba(16, 32, 28, .05);
    --side: 268px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 14px; }
p { margin: 0 0 12px; }
small, .muted { color: var(--muted); }
.icon { width: 20px; height: 20px; flex: none; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.08rem; color: var(--ink); letter-spacing: -.01em; }
.logo svg { width: 30px; height: 30px; flex: none; }
a:hover .logo { text-decoration: none; }

/* ---------- Structure ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    height: 58px; padding: 0 16px;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar a:hover { text-decoration: none; }
.topbar-business {
    margin-left: auto; max-width: 46%;
    padding: 4px 10px; border-radius: 999px;
    background: var(--brand-soft); color: var(--brand-dark);
    font-size: .8rem; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(11, 42, 37, .55); z-index: 30; }
.sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: var(--side); max-width: 86vw;
    display: flex; flex-direction: column;
    background: var(--brand-deep); color: #cfe1db;
    transform: translateX(-100%); transition: transform .22s ease;
}
.nav-toggle:checked ~ .sidebar { transform: none; }
.nav-toggle:checked ~ .backdrop { display: block; }
.sidebar .logo { color: #fff; }
.sidebar a:hover { text-decoration: none; }
.sidebar-head { padding: 20px 20px 16px; }
.sidebar-business { margin-top: 6px; font-size: .84rem; color: #9fbab2; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-group { padding: 14px 12px 6px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7fa097; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 2px; border-radius: 11px;
    color: #cfe1db; font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .22); }
.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .09); }
.me { display: flex; align-items: center; gap: 10px; }
.me strong { display: block; color: #fff; font-size: .92rem; }
.me small { color: #9fbab2; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand-dark);
    font-weight: 700; font-size: .85rem;
}
.sidebar .avatar { background: rgba(255, 255, 255, .14); color: #fff; }
.logout {
    display: flex; align-items: center; gap: 8px; width: 100%;
    margin-top: 12px; padding: 9px 12px;
    background: rgba(255, 255, 255, .06); border: 0; border-radius: 10px;
    color: #cfe1db; font: inherit; cursor: pointer;
}
.logout:hover { background: rgba(255, 255, 255, .13); color: #fff; }

.content { padding: 20px 16px 110px; max-width: 1180px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
}
.tabbar a, .tabbar label {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; border-radius: 10px;
    color: var(--muted); font-size: .68rem; font-weight: 600; cursor: pointer;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--brand); }
.tabbar .tab-fab {
    justify-self: center; width: 56px; height: 56px; margin-top: -24px; padding: 0;
    justify-content: center; border-radius: 50%;
    background: var(--brand); color: #fff;
    box-shadow: 0 8px 20px rgba(14, 124, 102, .45); border: 4px solid #fff;
}
.tabbar .tab-fab .icon { width: 26px; height: 26px; }

@media (min-width: 960px) {
    .topbar, .backdrop, .tabbar { display: none !important; }
    .sidebar { transform: none; }
    .content { margin-left: var(--side); padding: 32px 36px 56px; max-width: none; }
    h1 { font-size: 1.8rem; }
}
@media print {
    .topbar, .sidebar, .tabbar, .backdrop, .no-print { display: none !important; }
    .content { margin: 0; padding: 0; }
    body { background: #fff; }
}

/* ---------- Cartes et grilles ---------- */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.grid { display: grid; gap: 12px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: 1fr; }
.cols { display: grid; gap: 16px; margin-bottom: 16px; }
.grid .card, .cols .card { margin-bottom: 0; }
@media (min-width: 760px) {
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cols-wide { grid-template-columns: 3fr 2fr; }
}
@media (min-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: .9rem; font-weight: 600; white-space: nowrap; }

.stat { display: flex; gap: 12px; align-items: flex-start; padding: 16px; }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 12px; }
.tone-brand { background: var(--brand-soft); color: var(--brand); }
.tone-amber { background: var(--accent-soft); color: var(--warn); }
.tone-red { background: var(--danger-soft); color: var(--danger); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-green { background: var(--ok-soft); color: var(--ok); }
.stat-body { min-width: 0; }
.stat-body > small { display: block; font-size: .8rem; }
.stat-body strong { display: block; font-size: 1.22rem; line-height: 1.25; margin-top: 2px; overflow-wrap: anywhere; letter-spacing: -.01em; }
.stat-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; min-height: 18px; }
.stat-foot small { font-size: .76rem; }
@media (max-width: 420px) {
    .stat { flex-direction: column; gap: 8px; }
    .stat-body strong { font-size: 1.08rem; }
}
.trend { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: #edf1f0; color: var(--muted); white-space: nowrap; }
.trend-good { background: var(--ok-soft); color: var(--ok); }
.trend-bad { background: var(--danger-soft); color: var(--danger); }

.hero {
    position: relative; overflow: hidden;
    padding: 22px; margin-bottom: 16px; border-radius: 20px; color: #fff;
    background: linear-gradient(135deg, #0e7c66 0%, #0b5a4b 55%, #0b2a25 100%);
    box-shadow: 0 12px 28px rgba(11, 42, 37, .25);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(251, 191, 36, .16); }
.hero > * { position: relative; z-index: 1; }
.hero small { color: #c9e6dd; }
.hero-amount { display: block; font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 6px; overflow-wrap: anywhere; }
.hero-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .16); }
.hero-row div { min-width: 0; }
.hero-row strong { display: block; font-size: 1.02rem; }
.hero .trend { background: rgba(255, 255, 255, .18); color: #fff; }
.hero .progress { background: rgba(255, 255, 255, .2); margin-top: 8px; }
.hero .progress > div { background: #fbbf24; }

.progress { height: 9px; background: #e9efed; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); border-radius: 999px; }

.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.quick a {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 6px; border-radius: var(--radius);
    background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
    color: var(--ink); font-size: .8rem; font-weight: 600; text-align: center;
}
.quick a:hover { text-decoration: none; border-color: var(--brand); }
.quick .stat-icon { width: 44px; height: 44px; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; min-height: 46px;
    border: 1px solid transparent; border-radius: 12px;
    background: var(--brand); color: #fff;
    font: inherit; font-weight: 650; cursor: pointer; text-align: center;
    transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-light { background: var(--card); color: var(--ink); border-color: #d3ddd9; }
.btn-light:hover { background: #f1f5f4; }
.btn-danger { background: var(--card); color: var(--danger); border-color: #f0c4be; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-wa { background: #128c4b; }
.btn-wa:hover { background: #0e733d; }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: .86rem; font-weight: 600; border-radius: 10px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }

.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; background: #e4ebe8; border-radius: 14px; overflow-x: auto; }
.tabs a { flex: 1; padding: 9px 12px; border-radius: 11px; text-align: center; color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--ok-soft); border-color: #b7ecc9; color: #0f5229; }
.alert-error { background: var(--danger-soft); border-color: #f5c6c0; color: #7a1d17; }
.alert-warn { background: var(--accent-soft); border-color: #fde08a; color: #6b3a05; }
.alert a { color: inherit; font-weight: 700; text-decoration: underline; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: #edf1f0; color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--accent-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }

.empty { text-align: center; padding: 26px 8px; color: var(--muted); }
.empty p { margin: 0 0 12px; }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-bottom: 10px; border-radius: 50%; background: #edf2f0; color: #8aa099; }
.empty-icon .icon { width: 24px; height: 24px; }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=search], select, textarea {
    width: 100%; padding: 11px 13px; min-height: 46px;
    border: 1px solid #c9d5d1; border-radius: 12px;
    background: #fff; color: var(--ink); font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.field { margin-bottom: 14px; }
.field .hint { display: block; margin-top: 5px; font-size: .8rem; color: var(--muted); font-weight: 400; }
.form-row { display: grid; gap: 0 12px; }
@media (min-width: 620px) {
    .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.form-narrow { max-width: 720px; }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input, .search select { flex: 1; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand); flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 650; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills label { margin: 0; }
.pills input { position: absolute; opacity: 0; }
.pills span { display: inline-block; padding: 9px 14px; border: 1px solid #c9d5d1; border-radius: 999px; background: #fff; font-weight: 600; font-size: .88rem; cursor: pointer; }
.pills input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pills input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 13px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.list > li:first-child { padding-top: 0; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.row-main { display: flex; gap: 12px; min-width: 0; align-items: flex-start; }
.row-main > div { min-width: 0; }
.row .title { font-weight: 650; overflow-wrap: anywhere; }
.row .title a { color: inherit; }
.row .amount { font-weight: 750; white-space: nowrap; text-align: right; }
.row .amount small { display: block; font-weight: 500; }
.row-actions { margin-top: 10px; }
.due { color: var(--danger); }
details > summary { cursor: pointer; color: var(--brand); font-size: .9rem; font-weight: 600; margin-top: 8px; }
details ul.items { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 10px 8px 0; white-space: nowrap; }
.table td { padding: 10px 10px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; padding-right: 0; }

/* ---------- Périodes ---------- */
.period { margin-bottom: 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; font-size: .88rem; font-weight: 600; }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.active { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.period-more summary { font-size: .85rem; margin-top: 6px; }
.period-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.period-custom input { width: auto; flex: 1; min-width: 130px; min-height: 38px; padding: 6px 8px; }
.period-custom span { color: var(--muted); }

/* ---------- Vente ---------- */
.sale-line { display: grid; grid-template-columns: 1fr 1.4fr 42px; gap: 8px; padding: 12px 0; border-bottom: 1px dashed var(--line); align-items: end; }
.sale-line .sl-product { grid-column: 1 / -1; }
.sale-line label { font-size: .76rem; color: var(--muted); margin-bottom: 3px; }
.sale-line .remove { height: 46px; padding: 0; }
@media (min-width: 760px) {
    .sale-line { grid-template-columns: 3fr 1fr 1.4fr 42px; }
    .sale-line .sl-product { grid-column: auto; }
}
.totals { margin: 14px 0; padding: 14px 16px; border-radius: 14px; background: #f1f6f4; }
.totals div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; color: var(--muted); }
.totals .grand { margin-top: 6px; padding-top: 10px; border-top: 1px solid #d5e0dc; color: var(--ink); font-size: 1.25rem; font-weight: 800; }
.totals .due-line { color: var(--danger); font-weight: 700; }
[hidden] { display: none !important; }

/* ---------- Graphiques ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 210px; }
.chart-max { position: absolute; top: -2px; right: 0; font-size: .72rem; color: var(--muted); }
.grid-line { stroke: #e6ecea; stroke-width: 1; vector-effect: non-scaling-stroke; }
.area-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.pt circle { fill: #fff; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; opacity: 0; }
.pt:hover circle { opacity: 1; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: .72rem; color: var(--muted); }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.donut { position: relative; width: 150px; flex: none; margin: 0 auto; }
.donut svg { display: block; width: 100%; transform: rotate(0deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-center strong { font-size: 1.05rem; }
.donut-center small { font-size: .7rem; }
.legend { flex: 1 1 200px; list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .88rem; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { font-weight: 700; white-space: nowrap; }
.legend-value small { margin-left: 6px; font-weight: 500; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; gap: 10px; margin-bottom: 13px; }
.rank li:last-child { margin-bottom: 0; }
.rank-pos { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-dark); font-size: .76rem; font-weight: 800; }
.rank li:first-child .rank-pos { background: var(--accent); color: #fff; }
.rank-body { flex: 1; min-width: 0; }
.rank-top { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; }
.rank-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-top strong { white-space: nowrap; }
.rank-track { height: 7px; background: #e9efed; border-radius: 999px; margin-top: 5px; overflow: hidden; }
.rank-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.rank small { font-size: .76rem; }

/* ---------- Conseils ---------- */
.tip { display: flex; gap: 14px; align-items: flex-start; }
.tip h2 { margin-bottom: 4px; }
.tip p { margin: 0 0 10px; color: var(--muted); }
.tip p:last-child { margin-bottom: 0; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.checklist .tick { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #c9d5d1; color: transparent; }
.checklist .done .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
.checklist .done a { color: var(--muted); text-decoration: line-through; }
.checklist .tick .icon { width: 15px; height: 15px; }

/* ---------- Reçu ---------- */
.receipt { max-width: 420px; margin: 0 auto 16px; padding: 24px 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.receipt-head { text-align: center; padding-bottom: 14px; border-bottom: 2px dashed #cfd9d6; }
.receipt-head h2 { font-size: 1.25rem; margin: 0 0 2px; }
.receipt-meta { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; font-size: .88rem; color: var(--muted); }
.receipt table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.receipt td { padding: 6px 0; vertical-align: top; }
.receipt td:last-child { text-align: right; white-space: nowrap; }
.receipt .r-total td { padding-top: 10px; border-top: 2px dashed #cfd9d6; font-size: 1.12rem; font-weight: 800; }
.receipt-foot { margin-top: 14px; padding-top: 12px; border-top: 2px dashed #cfd9d6; text-align: center; color: var(--muted); font-size: .88rem; }
@media print {
    .receipt { border: 0; box-shadow: none; max-width: none; padding: 0; }
    .page-head { display: none; }
}

/* ---------- Connexion / inscription ---------- */
.auth { min-height: 100vh; display: grid; }
.auth-side { display: none; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 28px 16px; }
.auth-box { width: 100%; max-width: 430px; }
.auth-box .logo { font-size: 1.3rem; margin-bottom: 18px; }
.auth-box h1 { margin-bottom: 6px; }
.auth-box .tagline { color: var(--muted); margin-bottom: 20px; }
.auth-box .switch { text-align: center; margin-top: 16px; color: var(--muted); }
@media (min-width: 900px) {
    .auth { grid-template-columns: 1fr 1fr; }
    .auth-side {
        display: flex; flex-direction: column; justify-content: center; padding: 56px;
        color: #fff; background: linear-gradient(150deg, #0e7c66, #0b2a25);
    }
    .auth-side .logo { color: #fff; margin-bottom: 36px; }
    .auth-side h2 { font-size: 2rem; line-height: 1.2; margin-bottom: 18px; letter-spacing: -.02em; }
    .auth-side ul { list-style: none; padding: 0; margin: 0; }
    .auth-side li { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; color: #d5ebe4; }
    .auth-side li .icon { color: #fbbf24; margin-top: 2px; }
}

/* Sur téléphone, les cartes d'une rangée de trois restent compactes (icône à gauche). */
.grid-3 .stat { flex-direction: row; gap: 12px; }

/* Grand écran : le logo est déjà dans le panneau de gauche. */
@media (min-width: 900px) { .auth-box > a:first-child { display: none; } }

/* Code de secours : gros caractères espacés, faciles à recopier. */
.recovery-code {
    margin: 16px 0; padding: 18px 10px; border-radius: 14px;
    background: #f1f6f4; border: 2px dashed #b9cbc5;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: clamp(1.05rem, 5vw, 1.6rem); font-weight: 700; letter-spacing: .08em;
    overflow-wrap: anywhere; user-select: all;
}
.auth-box .tabs { margin-bottom: 14px; }

/* ---------- Caisse ---------- */
/* Écran de travail moderne : cartes produits avec photo, une seule couleur d'action, chiffres alignés. */
.pos { --pos-line: #e3e8e6; display: grid; gap: 20px; align-items: start; grid-template-columns: minmax(0, 1fr); }
.pos > * { min-width: 0; }

/* Recherche et scanner */
.pos-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.pos-search { position: relative; flex: 1; min-width: 0; margin: 0; font-weight: 400; }
.pos-search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #8a9692; pointer-events: none; }
.pos-search input { width: 100%; min-height: 48px; padding: 0 14px 0 42px; border: 1px solid var(--pos-line); border-radius: 12px; background: #fff; font-size: .95rem; }
.pos-search input:focus { border-color: var(--brand); outline: 3px solid rgba(14, 124, 102, .14); outline-offset: 0; }
.pos-scan {
    display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 48px; padding: 0 16px;
    border: 1px solid var(--pos-line); border-radius: 12px; background: #fff; color: var(--ink);
    font: inherit; font-weight: 600; cursor: pointer;
}
.pos-scan:hover { border-color: #b9c5c1; background: #fafbfb; }
.pos-scan .icon { width: 19px; height: 19px; }
@media (max-width: 420px) { .pos-scan span { display: none; } .pos-scan { padding: 0 14px; } }

/* Catégories */
.pos-cats { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 2px; scrollbar-width: none; }
.pos-cats::-webkit-scrollbar { display: none; }
.pos-cats .chip {
    flex: none; padding: 8px 15px; border: 0; border-radius: 999px; background: transparent;
    color: var(--muted); font: inherit; font-size: .88rem; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.pos-cats .chip:hover { background: #e7ecea; color: var(--ink); text-decoration: none; }
.pos-cats .chip.active { background: var(--ink); color: #fff; }

/* Cartes produits */
.pos-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pos-key {
    position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden;
    background: #fff; border: 1px solid var(--pos-line); border-radius: 14px;
    font: inherit; color: var(--ink); text-align: left; cursor: pointer;
    touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent;
    transition: border-color .12s, box-shadow .12s;
}
.pos-key:hover { border-color: #c5cfcc; box-shadow: 0 4px 14px rgba(16, 32, 28, .07); }
.pos-key:focus-visible { outline: 3px solid rgba(14, 124, 102, .35); outline-offset: 2px; }
.pos-key-media {
    position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3;
    background: #eef2f1; background: color-mix(in srgb, var(--tone, #5d6875) 9%, #fff);
    color: var(--tone, #5d6875);
}
.pos-key-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pos-key-media .icon { width: 34px; height: 34px; stroke-width: 1.5; }
.pos-key-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; }
.pos-key-name {
    font-size: .9rem; font-weight: 600; line-height: 1.3; min-height: 2.6em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pos-key-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px; }
.pos-key-price { font-size: 1rem; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-key-price small { margin-left: 3px; font-size: .68rem; font-weight: 600; color: var(--muted); }
.pos-key-stock { font-size: .75rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos-key-stock.is-low { color: #a35a05; font-weight: 600; }
.pos-key-stock.is-out { color: var(--danger); font-weight: 600; }
.pos-key-qty {
    position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px; background: var(--brand); color: #fff;
    font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.pos-key.in-cart { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.pos-key:disabled { cursor: not-allowed; background: #fafbfb; }
.pos-key:disabled:hover { border-color: var(--pos-line); box-shadow: none; }
.pos-key:disabled .pos-key-media { filter: grayscale(1); opacity: .45; }
.pos-key:disabled .pos-key-name, .pos-key:disabled .pos-key-price { color: #8b9794; }
@keyframes pos-pop { 50% { transform: scale(.97); } }
@keyframes pos-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.pos-bump { animation: pos-pop .15s ease; }
.pos-shake { animation: pos-shake .2s ease 2; border-color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .pos-bump, .pos-shake { animation: none; } }

/* Vente en cours */
.pos-ticket { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--pos-line); border-radius: 16px; scroll-margin-top: 70px; }
.pos-ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--pos-line); }
.pos-ticket-head h2 { margin: 0; font-size: 1.05rem; }
.pos-ticket-head small { display: block; margin-top: 1px; font-size: .8rem; }
.pos-clear {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.pos-clear .icon { width: 16px; height: 16px; }
.pos-clear:hover { background: var(--danger-soft); color: var(--danger); }
.pos-empty { padding: 36px 24px 40px; text-align: center; color: var(--muted); }
.pos-empty strong { display: block; margin-bottom: 4px; color: var(--ink); }
.pos-empty p { margin: 0; font-size: .9rem; }
.pos-lines { list-style: none; margin: 0; padding: 4px 18px; }
.pos-lines:empty { display: none; }
.pos-line { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef2f0; }
.pos-line:last-child { border-bottom: 0; }
.pos-line-thumb {
    flex: none; width: 44px; height: 44px; border-radius: 10px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #eef2f1; background: color-mix(in srgb, var(--tone, #5d6875) 9%, #fff); color: var(--tone, #5d6875);
}
.pos-line-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pos-line-thumb .icon { width: 20px; height: 20px; }
.pos-line-main { flex: 1; min-width: 0; }
.pos-line-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pos-line-name { font-size: .9rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.pos-line-total { font-size: .95rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos-line-ctrl { display: flex; align-items: center; gap: 8px; }
.pos-stepper { display: inline-flex; align-items: center; flex: none; border: 1px solid var(--pos-line); border-radius: 10px; background: #fff; }
.pos-step {
    width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink);
    font: inherit; font-size: 1.1rem; font-weight: 600; line-height: 1; cursor: pointer; touch-action: manipulation;
}
.pos-step:hover { background: #f1f4f3; }
.pos-plus { color: var(--brand); }
.pos-line-qty { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos-unit { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; margin: 0; font-size: .85rem; font-weight: 400; color: var(--muted); }
.pos-unit .pos-line-price {
    width: 100%; min-width: 0; min-height: 34px; padding: 4px 8px; border: 1px solid transparent; border-radius: 8px;
    background: #f3f6f5; text-align: right; font-size: .9rem; font-variant-numeric: tabular-nums;
}
.pos-unit .pos-line-price:focus { background: #fff; border-color: var(--brand); outline: none; }
.pos-remove {
    flex: none; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 9px; background: transparent; color: #9aa7a3; cursor: pointer;
}
.pos-remove .icon { width: 17px; height: 17px; }
.pos-remove:hover { background: var(--danger-soft); color: var(--danger); }

/* Paiement */
.pos-ticket .totals { margin: 12px 0 18px; padding: 0; border-radius: 0; background: none; }
.pos-ticket .totals > div { padding: 4px 0; font-variant-numeric: tabular-nums; }
.pos-ticket .totals .grand { margin-top: 8px; padding-top: 12px; border-top: 1px dashed #d1dad7; font-size: 1.5rem; letter-spacing: -.01em; }
.pos-discount-row { align-items: center; }
.pos-discount-row label { margin: 0; font-size: 1rem; font-weight: 400; color: var(--muted); }
.pos-discount-row input { width: 120px; min-height: 34px; padding: 4px 10px; border: 1px solid var(--pos-line); border-radius: 8px; background: #fff; text-align: right; }
.pos-label { display: block; margin: 0 0 8px; padding: 0; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pos-ticket fieldset { margin-bottom: 16px; }
.pos-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pos-methods label { position: relative; margin: 0; }
.pos-methods input { position: absolute; opacity: 0; }
.pos-methods span {
    display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 6px 8px;
    border: 1px solid var(--pos-line); border-radius: 10px; background: #fff;
    font-size: .86rem; font-weight: 600; text-align: center; cursor: pointer;
}
.pos-methods span:hover { border-color: #b9c5c1; }
.pos-methods input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand); }
.pos-methods input:focus-visible + span { outline: 3px solid rgba(14, 124, 102, .3); outline-offset: 1px; }
.pos-received { position: relative; }
.pos-received input {
    width: 100%; min-height: 52px; padding: 0 66px 0 14px; border: 1px solid var(--pos-line); border-radius: 12px;
    background: #fff; text-align: right; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pos-received input::placeholder { font-size: .95rem; font-weight: 400; }
.pos-received input:focus { border-color: var(--brand); outline: 3px solid rgba(14, 124, 102, .14); outline-offset: 0; }
.pos-received span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; font-weight: 600; pointer-events: none; }
.pos-cash { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pos-cash .chip {
    padding: 7px 12px; border: 1px solid var(--pos-line); border-radius: 999px; background: #fff; color: var(--ink);
    font: inherit; font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
}
.pos-cash .chip:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.pos-keypad { display: none; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.pos-keypad button {
    height: 46px; border: 0; border-radius: 10px; background: #edf1f0;
    font: inherit; font-size: 1.1rem; font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.pos-keypad button:hover { background: #e2e8e6; }
.pos-keypad button:active { background: #d4ddda; }
.pos-result { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; }
.pos-result span { font-size: .85rem; font-weight: 600; }
.pos-result strong { font-size: 1.35rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos-change { background: var(--ok-soft); color: #0f5229; }
.pos-due { background: var(--danger-soft); color: #7a1d17; }
.pos-more { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--pos-line); }
.pos-more > summary { margin: 0; color: var(--ink); font-size: .9rem; font-weight: 600; }
.pos-more[open] > summary { margin-bottom: 12px; }
.pos-more .field > label { font-size: .85rem; }
.pos-ticket .alert { margin: 14px 0 0; border-radius: 10px; }
.pos-pay { min-height: 56px; border-radius: 12px; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Barre de la vente en cours, sur téléphone */
.pos-bar {
    position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 24;
    display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 14px;
    background: var(--ink); color: #fff; box-shadow: 0 8px 22px rgba(16, 32, 28, .28); font-variant-numeric: tabular-nums;
}
.pos-bar:hover { text-decoration: none; }
.pos-bar span:first-child { font-size: .85rem; color: #c3cfcb; }
.pos-bar strong { font-size: 1.08rem; }
.pos-bar-go { margin-left: auto; font-size: .84rem; font-weight: 600; }
.pos-bar.is-off { display: none; }

@media (max-width: 380px) { .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
@media (min-width: 760px) { .pos-keypad { display: grid; } }
/* Le menu latéral occupe 268 px à partir de 960 px : la vente passe à droite seulement quand il reste assez de place. */
@media (min-width: 960px) { .pos-bar { left: calc(var(--side) + 32px); right: 32px; bottom: 20px; } }
@media (min-width: 1180px) {
    .pos { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
    .pos-ticket { position: sticky; top: 16px; max-height: calc(100vh - 32px); }
    .pos-bar { display: none !important; }
}
@media (min-width: 1440px) { .pos { grid-template-columns: minmax(0, 1fr) 400px; } .pos-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }

/* ---------- Caisse : vente en cours, paiement, plein écran ---------- */
/* La liste des articles défile seule ; le total et « Encaisser » restent toujours visibles. */
.pos-ticket { overflow: visible; }
.pos-ticket-head { flex: none; border-radius: 16px 16px 0 0; }
.pos-lines { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.pos-ticket-error { margin: 12px 18px 0; border-radius: 10px; }
.pos-ticket-foot {
    position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 2; flex: none;
    padding: 14px 18px 16px; border-top: 1px solid var(--pos-line); border-radius: 0 0 16px 16px;
    background: #fbfcfc; box-shadow: 0 -6px 16px rgba(16, 32, 28, .05);
}
.pos-foot-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pos-foot-total span { font-weight: 600; color: var(--muted); }
.pos-foot-total small { font-weight: 500; }
.pos-foot-total strong { font-size: 1.45rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-checkout { min-height: 54px; border-radius: 12px; font-size: 1.05rem; font-weight: 700; }

/* Vente réussie (caisse en plein écran) */
.pos-done { display: flex; gap: 12px; margin: 14px 18px 0; padding: 14px; border-radius: 12px; background: var(--ok-soft); color: #0f5229; }
.pos-done-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--ok); color: #fff; }
.pos-done-icon .icon { width: 18px; height: 18px; }
.pos-done-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.pos-done-body > span { font-size: .9rem; font-variant-numeric: tabular-nums; }
.pos-done-change { display: flex; align-items: baseline; gap: 10px; margin: 4px 0; }
.pos-done-change span { font-size: .85rem; font-weight: 600; }
.pos-done-change strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.pos-done .btn { margin-top: 4px; }

/* Fenêtre de paiement */
.pos-sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(11, 20, 18, .5); }
.pos-sheet-box {
    display: flex; flex-direction: column; width: 100%; max-height: 92vh; max-height: 92dvh;
    border-radius: 18px 18px 0 0; background: #fff; box-shadow: 0 -10px 30px rgba(0, 0, 0, .2);
}
.pos-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--pos-line); flex: none; }
.pos-sheet-head h2 { margin: 0; font-size: 1.1rem; }
.pos-sheet-close { width: 40px; height: 40px; border: 1px solid var(--pos-line); border-radius: 10px; background: #fff; font-size: 1rem; cursor: pointer; }
.pos-sheet-close:hover { background: #f1f4f3; }
.pos-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 16px; }
.pos-sheet-body .totals { margin-top: 12px; }
.pos-sheet-foot { flex: none; padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--pos-line); background: #fbfcfc; }
.pos-sheet .alert { margin: 14px 0 0; border-radius: 10px; }
body.sheet-open { overflow: hidden; }
@media (min-width: 760px) {
    .pos-sheet { align-items: center; padding: 24px; }
    .pos-sheet-box { max-width: 480px; max-height: calc(100vh - 48px); border-radius: 18px; }
    .pos-sheet-foot { border-radius: 0 0 18px 18px; }
}

/* Bouton plein écran */
[data-fullscreen] .icon:nth-of-type(2), .is-fs [data-fullscreen] .icon:nth-of-type(1) { display: none; }
.is-fs [data-fullscreen] .icon:nth-of-type(2) { display: inline-block; }
.topbar-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 38px; margin-right: -6px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; }
.topbar-btn:hover { background: #eef2f1; }

/* Grand écran : la vente en cours est à droite, sa hauteur est ajustée à l'écran par le script. */
@media (min-width: 1180px) {
    .pos-ticket { overflow: hidden; }
    .pos-ticket-foot { position: static; box-shadow: none; }
}
@media (min-width: 960px) and (max-width: 1179px) { .pos-ticket-foot { bottom: 0; } }

/* Caisse en plein écran : menu masqué, toute la largeur pour vendre. */
.is-fs.has-pos .sidebar, .is-fs.has-pos .topbar, .is-fs.has-pos .tabbar, .is-fs.has-pos .page-head { display: none !important; }
.is-fs.has-pos .content { margin-left: 0; max-width: none; padding: 16px 20px 24px; }
.is-fs.has-pos .pos-ticket-foot { bottom: 0; }
.is-fs.has-pos .pos-bar { left: 20px; right: 20px; bottom: 16px; }
@media (min-width: 960px) {
    .is-fs.has-pos .pos { grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
    .is-fs.has-pos .pos-ticket { position: sticky; top: 16px; overflow: hidden; }
    .is-fs.has-pos .pos-ticket-foot { position: static; box-shadow: none; }
    .is-fs.has-pos .pos-bar { display: none !important; }
}

/* ---------- Caisse : montants prévus et code d'envoi ---------- */
.pos-foot-cash-wrap { margin: -4px 0 12px; }
.pos-foot-cash-wrap .pos-label { margin-bottom: 6px; }
.pos-foot-cash { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-foot-cash .chip, .pos-cash .chip {
    flex: 1 1 auto; padding: 8px 10px; border: 1px solid var(--pos-line); border-radius: 10px; background: #fff;
    color: var(--ink); font: inherit; font-size: .86rem; font-weight: 700; font-variant-numeric: tabular-nums;
    text-align: center; cursor: pointer; touch-action: manipulation;
}
.pos-foot-cash .chip:hover, .pos-cash .chip:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.pos-foot-cash .chip.is-on, .pos-cash .chip.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand); }
@media (min-width: 420px) { .pos-methods { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.transfer-field { margin: 0 0 16px; padding: 12px 14px; border: 1px solid #f0d9a4; border-radius: 12px; background: #fff9ea; }
.transfer-field label { font-size: .88rem; }
.transfer-field input { background: #fff; text-transform: uppercase; letter-spacing: .08em; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 700; }
.transfer-field .hint { color: #7a5a17; }

/* ---------- QR codes, étiquettes et scanner ---------- */

.qr-card { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.qr-box { width: 132px; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.qr-box svg, .label-qr svg { display: block; width: 100%; height: auto; }
.qr-card > div:last-child { flex: 1 1 220px; min-width: 0; }
.qr-code-text { margin: 0 0 8px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.1rem; font-weight: 700; letter-spacing: .04em; overflow-wrap: anywhere; }

.label-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.label-options .field { margin: 0; flex: 1 1 160px; }
.labels { display: grid; gap: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); background: #fff; border: 1px solid var(--line); }
.labels-petite { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.label {
    display: flex; align-items: center; gap: 8px; padding: 8px;
    border: 1px dashed #b9c4c0; margin: -1px 0 0 -1px;
    break-inside: avoid; page-break-inside: avoid; overflow: hidden;
}
.label-qr { width: 38%; max-width: 96px; flex: none; }
.label-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; color: #000; }
.label-text strong { font-size: .8rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.label-price { font-size: .95rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.label-text small { font-family: ui-monospace, Consolas, monospace; font-size: .62rem; color: #333; overflow-wrap: anywhere; }
.labels-petite .label { flex-direction: column; text-align: center; gap: 4px; padding: 6px; }
.labels-petite .label-qr { width: 78%; max-width: 110px; }
.labels-petite .label-text strong { font-size: .66rem; -webkit-line-clamp: 2; }
.labels-petite .label-price { font-size: .78rem; }
@media (max-width: 620px) {
    .labels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .labels-petite { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media print {
    @page { margin: 8mm; }
    .labels { grid-template-columns: repeat(3, minmax(0, 1fr)); border: 0; }
    .labels-petite { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .label { border-color: #999; }
}

.scan { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(10, 20, 18, .82); }
.scan-box { width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto; padding: 14px; border-radius: 10px; background: #fff; }
.scan-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.scan-close { width: 40px; height: 40px; border: 1px solid #d5dbd9; border-radius: 6px; background: #fff; font-size: 1rem; cursor: pointer; }
.scan-close:hover { background: #f1f5f4; }
.scan-view { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #0b1513; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 14% 20%; border: 2px solid rgba(255, 255, 255, .9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); pointer-events: none; }
.scan-msg { margin: 10px 0; min-height: 1.4em; font-size: .92rem; font-weight: 600; color: var(--muted); }
.scan-msg.is-ok { color: var(--ok); }
.scan-msg.is-error { color: var(--danger); }
.scan-manual { display: flex; gap: 8px; }
.scan-manual input { flex: 1; min-width: 0; border-radius: 6px; }
.scan-manual .btn { min-height: 46px; border-radius: 6px; }


/* ---------- Photos des produits ---------- */
.thumb {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 44px; height: 44px; border-radius: 6px; overflow: hidden;
    background: #eef2f1; border: 1px solid var(--line);
    color: #7b8885; font-size: .78rem; font-weight: 700; letter-spacing: .03em;
}
.thumb img, .product-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-lg { width: 88px; height: 88px; border-radius: 8px; }
.thumb-lg .icon { width: 28px; height: 28px; }
.photo-field { display: flex; align-items: flex-start; gap: 14px; }
.photo-field > div { flex: 1; min-width: 0; }
.photo-field input[type=file] { width: 100%; font: inherit; font-size: .9rem; }
.product-photo { width: 132px; height: 132px; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.thumb-empty { color: #6b7773; }
.thumb-empty .icon { width: 20px; height: 20px; }
/* ---------- Catalogue : catégories, variantes, logo ---------- */
.cat-list { display: grid; gap: 16px; }
@media (min-width: 1100px) { .cat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.cat-list .card { margin-bottom: 0; scroll-margin-top: 80px; }
.cat-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cat-head h2 { margin: 0 0 2px; }
.cat-head .badge { margin-left: 6px; }
.cat-card.is-off { background: #fafbfb; }
.cat-card.is-off h2 { color: var(--muted); }
.cat-subs { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--line); }
.cat-subs li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid #eef2f0; }
.cat-subs li.is-off .cat-sub-name { color: var(--muted); text-decoration: line-through; }
.cat-sub-name small { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: #eef2f1; font-size: .72rem; font-weight: 700; }
.cat-edit > summary { margin-top: 10px; font-size: .85rem; }
.cat-subs .cat-edit > summary { margin: 0; }
.cat-edit[open] { width: 100%; }
.cat-edit .actions, .cat-edit .search { margin-top: 10px; }

.variant { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 6px; background: #eef2f1; color: var(--ink); font-size: .78rem; font-weight: 600; }
.variant-chips { flex-wrap: wrap; }
.variant-chips .chip small { color: inherit; opacity: .7; }
.chip.is-off { opacity: .55; text-decoration: line-through; }

.pos-subcats { display: flex; gap: 6px; overflow-x: auto; margin: -8px 0 14px; padding: 6px 0 2px 10px; border-left: 3px solid var(--line); scrollbar-width: none; }
.pos-subcats::-webkit-scrollbar { display: none; }
.pos-subcats .chip { flex: none; padding: 6px 12px; border: 1px solid var(--pos-line, #e3e8e6); border-radius: 999px; background: #fff; color: var(--muted); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pos-subcats .chip:hover { border-color: #b9c5c1; color: var(--ink); text-decoration: none; }
.pos-subcats .chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.pos-key-variant { margin-top: -2px; font-size: .78rem; font-weight: 600; color: var(--brand-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-business { display: flex; align-items: center; gap: 10px; }
.sidebar-business img { flex: none; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.sidebar-business span { min-width: 0; overflow-wrap: anywhere; color: #e6f1ee; font-weight: 600; }
.topbar-business { display: inline-flex; align-items: center; gap: 6px; }
.topbar-business img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; }
.receipt-logo { display: block; width: 96px; height: 96px; margin: 0 auto 10px; object-fit: contain; }
.logo-preview img { object-fit: contain; background: #fff; }

/* ---------- Clôture de caisse ---------- */
.den-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 16px; }
.den { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: text; }
.den span { display: flex; flex-direction: column; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.den small { font-weight: 500; font-size: .72rem; color: var(--muted); }
.den input { width: 64px; text-align: center; padding: 6px 4px; }
.den-bill { border-left: 3px solid var(--ok); }
.den-coin { border-left: 3px solid #c9a227; }
.closing-check { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 2px 0 12px; }
.closing-check > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f6f8f7; }
.closing-check small { display: block; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.closing-check strong { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.cl-diff.is-ok { background: var(--ok-soft); border-color: #b7ecc9; color: var(--ok); }
.cl-diff.is-over { background: var(--accent-soft); border-color: #fde08a; color: var(--warn); }
.cl-diff.is-short { background: var(--danger-soft); border-color: #f5c6c0; color: var(--danger); }
.closing-deposit { margin: 0 0 14px; font-weight: 600; }
.receipt .r-sep td { text-align: left; padding-top: 12px; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 1px dashed #cfd9d6; }
.diff-ok { color: var(--ok); }
@media (max-width: 560px) {
    .closing-check { grid-template-columns: 1fr; }
}
