/* =========================================================
   Administration STI-MALI — mêmes couleurs que le site
   ========================================================= */
:root {
    --cream: #fbf6ee;
    --cream-2: #f4ebdc;
    --paper: #fff;
    --ink: #2a211b;
    --ink-soft: #6b5d51;
    --gold: #b8862b;
    --gold-soft: #f6ead2;
    --line: rgba(42, 33, 27, .12);
    --ok: #2d6a4f;
    --ok-soft: #e3f1e8;
    --warn: #a86b00;
    --warn-soft: #fbefd5;
    --err: #b3261e;
    --err-soft: #fbe5e3;
    --info: #1e5fa8;
    --info-soft: #e3edf9;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(60, 35, 10, .06), 0 8px 24px -16px rgba(60, 35, 10, .25);
    --side: 260px;
    --body: 'Manrope', system-ui, sans-serif;
    --display: 'Fraunces', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 var(--body); color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 800; }
p { margin: 0; }
code { font-size: 12.5px; background: var(--cream-2); padding: 1px 5px; border-radius: 5px; }
[hidden] { display: none !important; }

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hint { font-size: 13px; color: var(--ink-soft); background: var(--cream); border-radius: 10px; padding: 10px 12px; }
.lead { font-size: 16px; color: var(--ink-soft); margin-bottom: 22px; }
.link { color: var(--gold); font-weight: 700; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-weight: 700; }
.link:hover { text-decoration: underline; }
.link.small { font-size: 13px; }
.back { display: inline-block; margin-bottom: 16px; color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--gold); }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer;
    font: 700 14px var(--body); text-decoration: none; white-space: nowrap;
    transition: background .2s, border-color .2s, color .2s, transform .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-ghost { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #9d7122; }
.btn-whatsapp { background: #1fa855; color: #fff; }
.btn-whatsapp:hover { background: #178a45; }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.link-danger { background: none; border: 0; padding: 0; color: var(--err); font: 600 14px var(--body); cursor: pointer; }
.link-danger:hover { text-decoration: underline; }
.link-danger.small { font-size: 13px; }

.icon-btn {
    width: 30px; height: 30px; display: inline-grid; place-items: center; flex: none;
    border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink-soft);
    font-size: 15px; cursor: pointer; line-height: 1;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }
.icon-btn.is-ghost { visibility: hidden; }
.icon-btn.star { font-size: 18px; border-color: transparent; background: none; }
.icon-btn.star.on { color: var(--gold); }
.icon-btn.danger:hover { color: var(--err); border-color: var(--err); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

.switch { width: 40px; height: 23px; border-radius: 99px; border: 0; background: #d9d0c3; position: relative; cursor: pointer; padding: 0; transition: background .2s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--ok); }
.switch.on span { transform: translateX(17px); }

/* ---------- Alertes, pastilles ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; font-size: 14px; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-err { background: var(--err-soft); color: var(--err); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--cream-2); color: var(--ink-soft); white-space: nowrap; }
.pill-nouvelle { background: var(--warn-soft); color: var(--warn); }
.pill-en_cours { background: var(--info-soft); color: var(--info); }
.pill-livree, .pill-acceptee, .pill-traitee { background: var(--ok-soft); color: var(--ok); }
.pill-annulee, .pill-refusee { background: var(--err-soft); color: var(--err); }
.pill-role-admin { background: var(--ink); color: #fff; }
.pill-role-utilisateur { background: var(--info-soft); color: var(--info); }
.pill-role-manager { background: var(--ok-soft); color: var(--ok); }
.pill-role-distributeur { background: var(--gold-soft); color: var(--gold); }
.tag { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 5px; background: var(--gold-soft); color: var(--gold); vertical-align: middle; }
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--gold); color: #fff; font-size: 12px; display: grid; place-items: center; }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 16px; align-content: start; }
.form h2 { margin-bottom: -4px; }
label, .label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
label small { font-weight: 500; color: var(--ink-soft); }
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
    background: var(--paper); color: var(--ink); font: 500 14px var(--body);
    transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 134, 43, .15); }
input[type=color] { width: 46px; height: 38px; padding: 3px; cursor: pointer; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.color-field { display: flex; align-items: center; gap: 10px; }
.narrow { max-width: 640px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.inline-form input { padding: 7px 10px; }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form.wrap input { flex: 1 1 180px; width: auto; }
.add-form { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.add-form .btn { justify-self: start; }
.role-form select { width: auto; padding: 6px 10px; font-size: 13px; }
.role-choice { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.role-choice legend { font-size: 13px; font-weight: 700; padding: 0; margin-bottom: 8px; }
.role-option { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .2s, background .2s; }
.role-option:hover { border-color: var(--gold); }
.role-option:has(input:checked) { border-color: var(--ink); background: var(--cream); }
.role-option input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.role-option span { display: grid; gap: 4px; }
.role-option b { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.role-option small { font-weight: 500; color: var(--ink-soft); line-height: 1.45; }

.formats-field { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.formats-field legend { font-size: 13px; font-weight: 700; margin-bottom: 8px; padding: 0; }
#formats { display: grid; gap: 8px; }
.format-row { display: grid; grid-template-columns: 1fr 1.3fr 1fr auto; gap: 8px; align-items: center; }
.formats-field legend small { font-weight: 500; }
.formats-field > .btn { justify-self: start; }

.img-field { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; }
.img-preview {
    aspect-ratio: 1; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
    background: repeating-conic-gradient(#f1ebe2 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line);
}
.img-preview img { width: 100%; height: 100%; object-fit: contain; }
.img-preview.is-empty span { font-size: 12px; color: var(--ink-soft); }
.img-inputs { display: grid; gap: 8px; min-width: 0; }
.img-inputs label.small { font-weight: 600; color: var(--ink-soft); font-size: 12px; }
.file-btn {
    display: inline-flex; justify-self: start; padding: 8px 14px; border-radius: 99px; border: 1.5px dashed var(--gold);
    color: var(--gold); font-weight: 700; cursor: pointer; background: var(--gold-soft);
}
.file-btn:hover { background: #f1dfbd; }
.file-btn input { display: none; }
.file-btn.has-file::after { content: " ✓ " attr(data-name); color: var(--ok); font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-loading { opacity: .6; pointer-events: none; }
.is-loading::after { content: " …"; }

/* ---------- Mise en page ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 40;
    background: var(--ink); color: #e9dfd1; display: flex; flex-direction: column;
    padding: 20px 14px; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 4px 8px 22px; }
.side-brand img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.side-brand strong { display: block; font-family: var(--display); font-size: 18px; color: #fff; }
.side-brand small { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.side-nav { display: grid; gap: 2px; }
.side-group { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #8d7f71; padding: 16px 12px 6px; }
.side-nav a, .side-foot a, .side-foot button {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
    color: #e9dfd1; text-decoration: none; font: 600 14px var(--body); background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
}
.side-nav a:hover, .side-foot a:hover, .side-foot button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-nav a.active { background: var(--gold); color: #fff; }
.side-nav a.active .badge { background: #fff; color: var(--gold); }
.sidebar svg { width: 19px; height: 19px; flex: none; }
.side-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .1); display: grid; gap: 2px; }
.side-backdrop { display: none; }

.main { margin-left: var(--side); min-height: 100vh; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    padding: 16px 32px; background: rgba(251, 246, 238, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-family: var(--display); font-weight: 600; font-size: 24px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who { font-size: 13px; font-weight: 700; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; }
.burger { display: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; padding: 11px 10px; flex-direction: column; justify-content: space-between; }
.burger span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
.content { padding: 28px 32px 60px; max-width: 1280px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { margin-top: 4px; max-width: 640px; }
.card.empty, p.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.span-2 { grid-column: 1 / -1; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.detail aside { display: grid; gap: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.danger-zone { margin-top: 18px; text-align: right; }
.detail aside .danger-zone { margin-top: 0; text-align: center; }

/* ---------- Tableau de bord ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; display: grid; gap: 2px; box-shadow: var(--shadow); transition: border-color .2s, transform .2s; }
.tile:hover { border-color: var(--gold); transform: translateY(-2px); }
.tile span { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.tile strong { font-family: var(--display); font-size: 34px; font-weight: 600; line-height: 1.1; }
.tile small { font-size: 12px; color: var(--ink-soft); }
.tile-alert { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-soft), #fff 70%); }
.tile-alert strong { color: var(--gold); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li + li { border-top: 1px solid var(--line); }
.feed a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 4px; text-decoration: none; font-size: 14px; }
.feed a:hover { color: var(--gold); }
.feed-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.2fr) 2fr 36px; align-items: center; gap: 12px; font-size: 14px; }
.bars li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; background: var(--cream-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.bars b { text-align: right; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Listes & tableaux ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar > p { flex: 1; min-width: 240px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 99px; text-decoration: none; font-weight: 700; font-size: 14px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); }
.tabs a:hover { color: var(--ink); border-color: var(--gold); }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs small { opacity: .65; font-weight: 600; margin-left: 2px; }
nav.tabs { margin-bottom: 18px; }
.toolbar nav.tabs { margin-bottom: 0; }
.search { flex: 0 1 260px; }
.search input { border-radius: 99px; padding: 8px 16px; }

.table-wrap { overflow-x: auto; padding: 0; }
.card.table-wrap { padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fdfaf5; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; }
.table-click tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #fdf8ef; }
.table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--gold); font-weight: 800; }
.table tr.is-off { opacity: .55; }
.table form { margin: 0; display: inline; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 320px; }
.order-cell { display: flex; gap: 4px; white-space: nowrap; }
.row-actions { text-align: right; white-space: nowrap; }
.prod-cell { display: flex; align-items: center; gap: 12px; }
.thumb { width: 46px; height: 46px; border-radius: 10px; background: var(--c); flex: none; overflow: hidden; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); text-decoration: none; font-weight: 700; }
.pager a.active { background: var(--ink); color: #fff; }

.fields { display: grid; grid-template-columns: 190px 1fr; gap: 0; margin: 18px 0 0; }
.fields dt, .fields dd { padding: 10px 0; border-top: 1px solid var(--line); margin: 0; }
.fields dt { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.fields dd { font-weight: 600; overflow-wrap: anywhere; }
.detail .card > .hint { margin-top: 16px; }

.list-edit { list-style: none; margin: 14px 0 0; padding: 0; }
.list-edit li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.list-edit form { margin: 0; }

/* ---------- Pages & textes ---------- */
.page-form { gap: 0; }
.page-form > .hint { margin-bottom: 8px; }
.content-field { padding: 16px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.content-field.is-custom { box-shadow: inset 3px 0 0 var(--gold); padding-left: 14px; }
.field-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sticky-save { position: sticky; bottom: 0; margin: 0 -22px -22px; padding: 14px 22px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Images ---------- */
.upload-form { margin: 0; }
.upload-form label { display: inline-flex; color: #fff; font-size: 14px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.media { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); display: flex; flex-direction: column; }
.media-img { display: block; aspect-ratio: 4 / 3; background: repeating-conic-gradient(#f1ebe2 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.media-img img { width: 100%; height: 100%; object-fit: contain; }
.media figcaption { padding: 10px 12px; display: grid; gap: 4px; border-top: 1px solid var(--line); }
.media-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.media-actions form { margin: 0; }

/* ---------- Ventes ---------- */
.tile-static:hover { transform: none; border-color: var(--line); }
.tile-static.tile-alert:hover { border-color: var(--gold); }
.filters-form { flex: 0 1 auto; flex-wrap: wrap; }
.filters-form input, .filters-form select { width: auto; padding: 7px 10px; }

/* ---------- Caisse (POS) ---------- */
.content-wide { max-width: none; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.pos-top { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.pos-search { flex: 1 1 260px; position: relative; display: block; }
.pos-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-soft); }
.pos-search input { padding: 12px 16px 12px 42px; border-radius: 99px; font-size: 15px; }
.pos-day { display: grid; font-size: 12px; color: var(--ink-soft); text-align: right; }
.pos-day b { color: var(--ink); font-size: 14px; }
.pos-cats { margin-bottom: 14px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.pos-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.pos-card-media { aspect-ratio: 16 / 10; background: var(--c); display: grid; place-items: center; }
.pos-card-media img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.pos-card h3 { font-size: 14px; padding: 10px 12px 6px; line-height: 1.3; }
.pos-formats { display: grid; gap: 6px; padding: 0 10px 10px; margin-top: auto; }
.pos-formats button {
    display: flex; justify-content: space-between; align-items: center; gap: 6px; width: 100%;
    padding: 9px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--cream);
    font: 600 13px var(--body); color: var(--ink); cursor: pointer; text-align: left; transition: border-color .15s, background .15s, transform .1s;
}
.pos-formats button:hover { border-color: var(--gold); background: var(--gold-soft); }
.pos-formats button:active { transform: scale(.97); }
.pos-formats b { white-space: nowrap; }

.pos-cart {
    position: sticky; top: 84px; max-height: calc(100vh - 104px); display: flex; flex-direction: column;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.pos-cart-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.pos-lines { list-style: none; margin: 0; padding: 0 18px; overflow-y: auto; flex: 1 1 auto; min-height: 60px; }
.pos-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name name del" "qty price total"; gap: 6px 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pos-lines li.flash { animation: flash .6s; }
@keyframes flash { from { background: var(--gold-soft); } }
.pos-line-name { grid-area: name; display: grid; }
.pos-line-name small { color: var(--ink-soft); font-size: 12px; }
.pos-lines [data-remove] { grid-area: del; width: 26px; height: 26px; }
.pos-qty { grid-area: qty; display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; justify-self: start; }
.pos-qty button { width: 32px; height: 32px; border: 0; background: var(--cream); font-size: 17px; cursor: pointer; }
.pos-qty button:hover { background: var(--gold-soft); }
.pos-qty input { width: 44px; border: 0; border-radius: 0; text-align: center; padding: 6px 2px; font-weight: 700; }
.pos-line-price { grid-area: price; display: flex; align-items: center; gap: 4px; font-weight: 500; }
.pos-line-price input { width: 86px; padding: 6px 8px; text-align: right; }
.pos-line-price small { white-space: nowrap; }
.pos-line-total { grid-area: total; white-space: nowrap; min-width: 70px; text-align: right; }
.pos-empty { padding: 28px 18px; text-align: center; color: var(--ink-soft); font-size: 14px; }

.pos-pay { padding: 14px 18px 18px; border-top: 1px solid var(--line); display: grid; gap: 12px; background: #fdfaf5; flex: none; overflow-y: auto; max-height: 62vh; }
.pos-totals { display: grid; gap: 6px; }
.pos-totals > div, .pos-remise { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; }
.pos-remise input { width: 120px; padding: 6px 10px; text-align: right; }
.pos-total { font-size: 15px; padding-top: 6px; border-top: 1px dashed var(--line); }
.pos-total b { font-family: var(--display); font-size: 28px; font-weight: 600; }
.pos-modes { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pos-modes legend { font-size: 13px; font-weight: 700; padding: 0; margin-bottom: 6px; }
.pos-modes label { display: block; cursor: pointer; }
.pos-modes input { position: absolute; opacity: 0; pointer-events: none; }
.pos-modes span { display: grid; place-items: center; min-height: 40px; padding: 6px; text-align: center; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.pos-modes input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.pos-modes input:focus-visible + span { box-shadow: 0 0 0 3px rgba(184, 134, 43, .35); }
.pos-cash { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.pos-change { display: grid; text-align: right; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.pos-change b { font-size: 18px; color: var(--ok); }
.pos-change b.is-bad { color: var(--err); }
.pos-client summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.pos-client summary small { font-weight: 500; color: var(--ink-soft); }
.pos-client[open] { display: grid; gap: 10px; }
.pos-client[open] summary { margin-bottom: 2px; }
.pos-pay .alert { margin: 0; }
.pos-submit { padding: 15px; font-size: 16px; }
.pos-submit:disabled { opacity: .45; cursor: not-allowed; }
.pos-mobile-bar { display: none; }

.pos-done { border: 0; border-radius: 22px; padding: 32px; width: min(380px, calc(100% - 32px)); text-align: center; box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); }
.pos-done::backdrop { background: rgba(20, 14, 10, .5); }
.pos-done-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 28px; font-weight: 800; display: grid; place-items: center; margin: 0 auto 12px; }
.pos-done-total { font-family: var(--display); font-size: 34px; font-weight: 600; margin: 8px 0 2px; }
.pos-done .actions { justify-content: center; }

@media (max-width: 1100px) {
    .pos { grid-template-columns: 1fr; }
    .pos-cart { position: static; max-height: none; }
    .pos-lines { max-height: none; }
    .pos-pay { max-height: none; }
    .pos-mobile-bar {
        display: flex; justify-content: space-between; align-items: center; gap: 10px;
        position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 25;
        padding: 14px 20px; border: 0; border-radius: 99px; background: var(--ink); color: #fff;
        font: 700 15px var(--body); box-shadow: 0 12px 30px -8px rgba(0,0,0,.5); cursor: pointer;
    }
    .content-wide { padding-bottom: 96px; }
}
@media (max-width: 600px) {
    .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .pos-card h3 { font-size: 13px; }
    .pos-formats button { flex-direction: column; align-items: flex-start; gap: 0; }
    .pos-modes { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Stock ---------- */
.stack { display: grid; gap: 20px; align-content: start; }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar .tabs { margin-bottom: 0; }
.depot-select { margin: 0; }
.depot-select label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.depot-select select { width: auto; max-width: 320px; padding: 7px 10px; }
.depot-chip { display: inline-flex; padding: 6px 12px; border-radius: 99px; background: var(--gold-soft); color: var(--gold); font-weight: 700; font-size: 13px; }
.tile-money { font-size: 22px !important; line-height: 1.25 !important; }
.tile-danger { border-color: var(--err); background: linear-gradient(180deg, var(--err-soft), #fff 70%); }
.tile-danger strong { color: var(--err); }
.pill-stock-ok { background: var(--ok-soft); color: var(--ok); }
.pill-stock-bas { background: var(--warn-soft); color: var(--warn); text-decoration: none; }
.pill-stock-rupture { background: var(--err-soft); color: var(--err); }
.pill-stock-aucun { background: var(--cream-2); color: var(--ink-soft); }
.pill-mvt-in { background: var(--ok-soft); color: var(--ok); }
.pill-mvt-out { background: var(--err-soft); color: var(--err); }
.qty-cell { text-align: right; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.qty-in { color: var(--ok); }
.qty-out { color: var(--err); }
.table tr.is-muted td { color: var(--ink-soft); }
.table tr.is-muted .thumb { opacity: .5; }
.dlc { font-weight: 700; }
.dlc-proche { color: var(--warn); }
.dlc-perime { color: var(--err); }
.row-menu { position: relative; display: inline-block; }
.row-menu summary { list-style: none; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 260px; text-align: left; white-space: normal;
    background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(60, 35, 10, .35); padding: 8px;
}
.row-menu-panel > a, .row-menu-panel > form > .link, .row-menu-panel > form > .link-danger { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 14px; }
.row-menu-panel > a:hover { background: var(--cream); color: var(--gold); }
.row-menu-panel .table form, .row-menu-panel form { display: block; }
.row-menu-form { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 6px 4px; gap: 10px; }
.row-menu-form .btn { justify-self: start; }

.lines { display: grid; gap: 10px; }
.line-row { display: grid; grid-template-columns: minmax(0, 2.4fr) 110px auto auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fdfaf5; }
.line-row.with-lot { grid-template-columns: minmax(0, 2.4fr) 100px minmax(0, 1fr) 150px minmax(0, .9fr) auto; }
.line-row .icon-btn { margin-bottom: 4px; }
.dispo { font-size: 13px; font-weight: 700; color: var(--ok); padding-bottom: 10px; white-space: nowrap; }
.dispo.is-bad { color: var(--err); }

.transfer-route { display: flex; align-items: center; gap: 18px; margin: 6px 0 18px; padding: 14px 18px; background: var(--cream); border-radius: 12px; }
.transfer-route > div { display: grid; }
.transfer-route b { font-size: 16px; }
.transfer-route .arrow { font-size: 26px; color: var(--gold); }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.signatures div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: 13px; color: var(--ink-soft); min-height: 60px; }

.inventory .table input { padding: 6px 10px; text-align: right; }
.group-row td { background: var(--cream); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); padding: 8px 14px; }
.inv-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.format-card { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fdfaf5; }
.format-main { display: grid; grid-template-columns: 1fr 1.2fr 1.2fr 1fr 90px auto; gap: 10px; align-items: end; }
.format-main .icon-btn { margin-bottom: 4px; }
.format-prices { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding-top: 10px; border-top: 1px dashed var(--line); }
.format-prices > .label { flex-basis: 100%; font-size: 12px; color: var(--ink-soft); }
.format-prices label { flex: 1 1 150px; font-weight: 600; font-size: 12px; }
.input-unit { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); overflow: hidden; }
.input-unit:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 134, 43, .15); }
.input-unit input { border: 0; box-shadow: none !important; text-align: right; min-width: 0; }
.input-unit small { padding: 0 10px; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }

.recv-line { display: grid; grid-template-columns: minmax(0, 1fr) 130px; align-items: center; gap: 10px; font-weight: 600; }
.recv-line small { display: block; font-weight: 500; color: var(--ink-soft); }
.recv-line .input-unit input { padding: 7px 8px; }
.recv-block { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.recv-block .row { grid-template-columns: 1fr 1fr; gap: 8px; }
.recv-block .row input { padding: 6px 8px; }
.line-row.purchase-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1.6fr) 100px 130px auto; }
.barcode-cell svg { width: 150px; height: 38px; display: block; }

.pays-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.pays-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.pays-list a { display: grid; padding: 10px 12px; border-radius: 10px; text-decoration: none; border: 1px solid transparent; }
.pays-list a:hover { background: var(--cream); }
.pays-list li.active a { border-color: var(--ink); background: var(--cream); }
.price-grid td { padding-top: 7px; padding-bottom: 7px; }
.price-grid .input-unit input { padding: 7px 10px; }

.pos-formats small.pos-stock { display: block; font-size: 11px; font-weight: 600; color: var(--ok); }
.pos-formats button.is-out { opacity: .55; }
.pos-formats button.is-out small.pos-stock { color: var(--err); }
.pos-top .depot-select select { max-width: 260px; }

@media (max-width: 1100px) {
    .pays-layout { grid-template-columns: 1fr; }
    .format-main { grid-template-columns: 1fr 1fr 1fr; }
    .line-row.with-lot { grid-template-columns: 1fr 100px 1fr; }
    .line-row.purchase-row { grid-template-columns: 1fr 1fr 100px; }
}
@media (max-width: 600px) {
    .line-row, .line-row.with-lot { grid-template-columns: 1fr 1fr; }
    .line-row > label:first-child { grid-column: 1 / -1; }
    .format-main { grid-template-columns: 1fr 1fr; }
    .transfer-route { flex-direction: column; align-items: flex-start; gap: 6px; }
}
@media print {
    .sidebar, .topbar, .no-print, .side-backdrop, .alert { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    .print-sheet { box-shadow: none; border: 0; padding: 0; }
    body { background: #fff; }
}

/* ---------- Compte d'accès créé depuis la fiche distributeur ---------- */
.account-box { border: 1.5px dashed var(--gold); border-radius: 12px; padding: 14px 16px; margin: 4px 0 0; background: var(--gold-soft); display: grid; gap: 14px; }
.account-box legend { padding: 0 6px; }
.account-box #compteChamps { gap: 14px; }

/* ---------- Mode caisse (vendeurs, plein écran) ---------- */
.mode-caisse .main { margin-left: 0; }
.mode-caisse .content { padding: 16px 20px 40px; }
.caisse-bar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 20px; background: var(--ink); color: #fff;
}
.caisse-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.caisse-brand img { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.caisse-brand b { display: block; font-size: 15px; }
.caisse-brand small { color: var(--gold-light, #e2bd6b); font-size: 12px; font-weight: 700; }
.caisse-state { font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: rgba(255, 255, 255, .1); }
.caisse-state.is-open { background: #1fa855; }
.caisse-user { font-size: 13px; opacity: .85; }
.caisse-bar .icon-btn { background: rgba(255, 255, 255, .1); border-color: transparent; color: #fff; width: 38px; height: 38px; }
.caisse-bar .icon-btn:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.caisse-bar .icon-btn svg { width: 18px; height: 18px; }
.caisse-bar form { margin: 0; }
.mode-caisse .pos-cart { top: 74px; max-height: calc(100vh - 94px); }
.btn-lg { padding: 15px 28px; font-size: 16px; }

.session-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 14px; border-radius: 12px; background: var(--cream-2); font-size: 14px; }
.session-banner.is-open { background: var(--ok-soft); color: var(--ok); }
.session-form { max-width: 900px; margin: 0 auto; }
.session-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.session-head h2 { font-family: var(--display); font-weight: 600; font-size: 26px; }
.step-pill { padding: 6px 14px; border-radius: 99px; background: var(--gold); color: #fff; font-weight: 800; font-size: 13px; }
.session-cash { padding: 16px; border-radius: 12px; background: var(--cream); }
.session-cash > label { max-width: 380px; }
.input-unit.big input { font-size: 22px; font-weight: 800; padding: 12px 14px; }
.count-table input { padding: 8px 10px; text-align: right; font-size: 16px; font-weight: 700; }
.session-stock th.center { text-align: center; }
.session-report .tiles { margin: 6px 0 18px; }
.country-title { font-family: var(--display); font-weight: 600; font-size: 22px; margin: 26px 0 12px; }
.country-title small { font-family: var(--body); font-size: 13px; font-weight: 600; }
.pos-store { margin-bottom: 14px; }
.pos-store .card-head { margin-bottom: 8px; }

/* ---------- Connexion / installation ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #f4e3c3, transparent 50%), var(--cream); }
.auth-box { width: min(400px, 100%); background: var(--paper); border-radius: 22px; padding: 36px 32px; box-shadow: 0 30px 60px -30px rgba(60, 35, 10, .45); border: 1px solid var(--line); text-align: center; }
.auth-box .form { text-align: left; margin-top: 22px; }
.auth-box h1 { font-family: var(--display); font-weight: 600; font-size: 28px; margin-bottom: 4px; }
.auth-box .alert { margin: 18px 0 0; text-align: left; }
/* logo.png est carré avec beaucoup de vide transparent (surtout en bas) : on n'affiche que la partie visible */
.auth-logo { width: 280px; height: 175px; object-fit: cover; object-position: 50% 42%; margin: -8px auto 14px; }
.auth-back { display: inline-block; margin-top: 20px; font-size: 13px; color: var(--ink-soft); text-decoration: none; }
.auth-back:hover { color: var(--gold); }
/* « Mot de passe oublié ? » et sa fenêtre */
.auth-oubli { display: block; margin: 16px auto 0; font-size: 13px; }
.auth-oubli + .auth-back { margin-top: 10px; }
.auth-modal { border: 0; border-radius: 18px; padding: 24px; width: min(440px, calc(100% - 32px)); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .4); text-align: left; }
.auth-modal::backdrop { background: rgba(20, 14, 10, .5); }
.auth-modal-head { display: flex; justify-content: space-between; align-items: center; }
.auth-modal h2 { font-family: var(--display); font-weight: 600; font-size: 22px; }

/* Signature du développeur sous le cadre de connexion */
body.auth { gap: 18px; align-content: center; }
.auth-signature { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--ink-soft); text-decoration: none; text-align: center; }
.auth-signature img { width: 78px; height: auto; transition: transform .2s; }
.auth-signature .signature-slogan { flex-basis: 100%; font-style: italic; }
.auth-signature:hover { color: var(--gold); }
.auth-signature:hover img { transform: translateY(-1px); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .detail { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .menu-open .sidebar { transform: none; }
    .menu-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(20, 14, 10, .45); }
    .main { margin-left: 0; }
    .burger { display: flex; }
    .topbar { padding: 12px 16px; }
    .topbar h1 { font-size: 20px; }
    .content { padding: 20px 16px 48px; }
    .who { display: none; }
}
@media (max-width: 600px) {
    .card { padding: 16px; }
    .sticky-save { margin: 0 -16px -16px; padding: 12px 16px; }
    .fields { grid-template-columns: 1fr; }
    .fields dt { padding-bottom: 0; }
    .fields dd { border-top: 0; padding-top: 2px; }
    .img-field { grid-template-columns: 84px 1fr; }
    .feed a { flex-direction: column; align-items: flex-start; gap: 4px; }
    .search { flex: 1 1 100%; }
    .list-edit li { flex-wrap: wrap; }
}
