/* ==========================================================
   Dachrisa Manager — feuille de styles (mobile first)
   ========================================================== */
:root {
  --green: #5c9e31;
  --green-dark: #4a8424;
  --green-soft: #e8f1da;
  --green-softer: #f3f8ec;
  --ink: #141414;
  --ink-2: #3b3f44;
  --muted: #747980;
  --line: #ebedea;
  --bg: #f6f7f4;
  --card: #ffffff;
  --red: #e5484d;
  --red-soft: #fdecec;
  --yellow: #f1a10a;
  --yellow-soft: #fff4dc;
  --blue: #2f7de1;
  --blue-soft: #e6f0fd;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 18px rgba(20, 20, 20, .06);
  --shadow-lg: 0 18px 50px rgba(20, 20, 20, .16);
  --sidebar: 264px;
  --bottombar: 68px;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.green { color: var(--green); }
.red { color: var(--red); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

.ico {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico--lg { width: 28px; height: 28px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  border: 1px solid var(--line); background: #fff;
  transition: background .18s, border-color .18s, transform .12s, box-shadow .18s;
}
.btn:hover { border-color: #d5dbcf; background: var(--green-softer); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(92, 158, 49, .25); }
.btn--primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--dark:hover { background: #2a2a2a; }
.btn--danger { color: var(--red); }
.btn--danger:hover { background: var(--red-soft); border-color: #f6caca; }
.btn--danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn--soft { background: var(--green-soft); border-color: var(--green-soft); color: var(--green-dark); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn--lg { height: 54px; font-size: 16px; padding: 0 24px; }
.btn--block { width: 100%; }
.btn .ico { width: 18px; height: 18px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%; color: var(--ink-2);
  transition: background .18s;
}
.icon-btn:hover { background: var(--green-softer); }
.icon-btn--bordered { border: 1px solid var(--line); background: #fff; }
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn--sm .ico { width: 17px; height: 17px; }
.icon-btn--danger:hover { background: var(--red-soft); color: var(--red); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #f0f1ef; color: var(--ink-2);
}
.badge--green { background: var(--green-soft); color: var(--green-dark); }
.badge--red { background: var(--red-soft); color: #c4363b; }
.badge--yellow { background: var(--yellow-soft); color: #a46a00; }
.badge--blue { background: var(--blue-soft); color: #1d63bd; }
.badge--gray { background: #f0f1ef; color: var(--muted); }

.count, .dot-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.dot-count { position: absolute; top: -4px; right: -4px; border: 2px solid #fff; height: 22px; line-height: 18px; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .select {
  width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .18s, box-shadow .18s; font-size: 15px;
}
.field textarea { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .select:focus {
  border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft);
}
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .ico { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 44px !important; }
.input-icon__btn { position: absolute; right: 6px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); }
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; font-weight: 500; }
.check-row input { width: 20px; height: 20px; accent-color: var(--green); flex: none; }
.form-grid { display: grid; gap: 0 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; }
.switch i { position: relative; width: 44px; height: 26px; border-radius: 13px; background: #d6d9d3; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 3px solid var(--green-soft); }

/* ---------- Cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
:not(.grid) > .card + .card { margin-top: 16px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card__head h2, .card__head h3 { font-size: 17px; font-weight: 700; }
.card--flush { padding: 0; overflow: hidden; }
.card--flush .card__head { padding: 18px 18px 0; }
.section-title { font-size: 17px; font-weight: 700; margin: 24px 0 12px; }

.grid { display: grid; gap: 16px; }
.grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }

.kpi {
  position: relative; display: flex; flex-direction: column; gap: 6px; overflow: hidden;
  padding: 16px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line);
}
.kpi__label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi__label .ico { width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); }
.kpi__value { font-size: 21px; font-weight: 800; letter-spacing: -.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__sub { font-size: 12px; color: var(--muted); }
.kpi--hero { background: linear-gradient(135deg, #5c9e31, #4a8424); color: #fff; border: 0; grid-column: 1 / -1; }
.kpi--hero .kpi__label, .kpi--hero .kpi__sub { color: rgba(255,255,255,.85); }
.kpi--hero .kpi__label .ico { background: rgba(255,255,255,.18); color: #fff; }
.kpi--hero .kpi__value { font-size: 30px; }
.kpi--red .kpi__label .ico { background: var(--red-soft); color: var(--red); }
.kpi--yellow .kpi__label .ico { background: var(--yellow-soft); color: var(--yellow); }
.kpi--blue .kpi__label .ico { background: var(--blue-soft); color: var(--blue); }
.kpi--locked .kpi__value { color: var(--muted); font-size: 15px; font-weight: 600; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--green-softer); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* Tableaux empilés en mobile */
@media (max-width: 719px) {
  .table--stack thead { display: none; }
  .table--stack tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table--stack td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table--stack td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; }
  .table--stack td.row-main { display: block; text-align: left; font-weight: 600; padding-bottom: 6px; }
  .table--stack td.row-main::before { display: none; }
  .table--stack .row-actions { justify-content: flex-end; width: 100%; }
}

/* ---------- Onglets & barres d'outils ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--ink-2);
}
.tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab .count { background: var(--green); }
.tab.is-active .count { background: #fff; color: var(--ink); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1 1 200px; }
.toolbar .input, .toolbar .select { height: 42px; }
.toolbar form { display: contents; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { color: var(--muted); }
.search-box { position: relative; }
.search-box .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 42px; border-radius: 999px; }

/* ---------- Coquille (shell) ---------- */
.shell { min-height: 100dvh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(84vw, var(--sidebar));
  display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .25s ease;
}
.sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
.backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(15, 20, 10, .35); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sidebar.is-open + .backdrop { opacity: 1; pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; }
.brand img { width: 40px; height: 40px; }
.brand b { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.3px; line-height: 1.1; }
.brand small { display: block; font-size: 12px; color: var(--green); font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.side-nav__item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  font-weight: 500; color: var(--ink-2); transition: background .18s, color .18s;
}
.side-nav__item:hover { background: var(--green-softer); }
.side-nav__item.is-active { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }
.side-nav__item .count { margin-left: auto; }
.side-user { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.side-user__card { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; }
.side-user__card:hover { background: var(--green-softer); }
.side-user__card b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user__card small { color: var(--muted); font-size: 12px; }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--green-soft); color: var(--green-dark); font-weight: 700; font-size: 14px; text-transform: uppercase;
}
.avatar--sm { width: 38px; height: 38px; }

.main { min-width: 0; padding-bottom: calc(var(--bottombar) + 20px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: rgba(246, 247, 244, .92); backdrop-filter: blur(10px);
}
.topbar__title { flex: 1; min-width: 0; }
.topbar__title h1 { font-size: 19px; font-weight: 700; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__title small { color: var(--muted); font-size: 12px; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 4px 16px 24px; max-width: 1440px; }

.bottombar {
  position: fixed; inset: auto 0 0 0; z-index: 50; display: flex; justify-content: space-around;
  height: calc(var(--bottombar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.bottombar__item {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 500; color: var(--muted);
}
.bottombar__item.is-active { color: var(--green); }
.bottombar__item.is-active .ico { stroke-width: 2.3; }
.bottombar__item .count { position: absolute; top: 6px; left: calc(50% + 4px); }

/* ---------- Messages ---------- */
.flashes { padding: 0 16px; max-width: 1440px; }
.flash {
  position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 12px 40px 12px 16px;
  border-radius: var(--radius-sm); font-weight: 500; font-size: 14px; background: var(--green-soft); color: #2f5a14;
}
.flash--error { background: var(--red-soft); color: #a52a2f; }
.flash--info { background: var(--blue-soft); color: #1d4f99; }
.flash--warning { background: var(--yellow-soft); color: #8a5a00; }
.flash__close { position: absolute; right: 10px; font-size: 20px; line-height: 1; opacity: .6; }
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--bottombar) + 16px); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
}
.toast--error { background: #b3262b; }
.toast--success .ico { color: #9ee06a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.empty-state { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; text-align: center; color: var(--muted); }
.empty-state .ico { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.empty-state h2 { color: var(--ink); font-size: 18px; }
.empty-state .btn { margin-top: 8px; }

/* ---------- Modales ---------- */
dialog.modal {
  width: min(560px, 100vw); max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 24px 24px 0 0; background: #fff; box-shadow: var(--shadow-lg); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(15, 20, 10, .45); }
dialog.modal[open] { animation: sheetUp .25s ease; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.modal__head h2 { font-size: 18px; font-weight: 700; }
.modal__body { padding: 18px 20px 22px; }

/* ---------- Tableau de bord ---------- */
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.welcome h2 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.welcome h2 span { color: var(--green); }
.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.quick {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 14px; transition: transform .15s, box-shadow .18s;
}
.quick:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.quick .ico { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--green-soft); color: var(--green-dark); }
.quick--primary { background: var(--green); color: #fff; border-color: var(--green); }
.quick--primary .ico { background: rgba(255,255,255,.2); color: #fff; }
.chart-box { position: relative; height: 260px; }
.list-rows li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-rows li:last-child { border-bottom: 0; }
.list-rows .grow { flex: 1; min-width: 0; }
.list-rows .grow b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-rows .grow small { color: var(--muted); font-size: 12px; }
.rank { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--green-soft); color: var(--green-dark); font-weight: 700; font-size: 13px; flex: none; }
.bar { height: 8px; border-radius: 4px; background: #eef0ec; overflow: hidden; margin-top: 6px; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.bar--red span { background: var(--red); }
.bar--yellow span { background: var(--yellow); }

/* ---------- Vignettes produits ---------- */
.thumb { width: 52px; height: 52px; border-radius: 14px; object-fit: contain; background: var(--green-softer); flex: none; }
.thumb--emoji { display: grid; place-items: center; font-size: 26px; }

/* ---------- Caisse (POS) & prise de commande ---------- */
.pos { display: grid; gap: 16px; }
.pos__menu { min-width: 0; }
.zone-switch { display: inline-flex; padding: 4px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.zone-switch button, .zone-switch label { height: 36px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.zone-switch input { display: none; }
.zone-switch .is-active, .zone-switch input:checked + span { background: var(--green); color: #fff; }
.zone-switch label span { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 999px; margin: 0 -16px; }
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; flex: none;
  background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.chip.is-active { background: var(--green-soft); border-color: var(--green-soft); color: var(--green-dark); }
.prod-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prod {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 16px; text-align: left;
  background: #fff; border: 1px solid var(--line); transition: border-color .15s, transform .12s, box-shadow .18s;
}
.prod:hover { box-shadow: var(--shadow); }
.prod:active { transform: scale(.97); }
.prod .thumb { width: 100%; height: 86px; border-radius: 12px; }
.prod .thumb--emoji { font-size: 40px; }
.prod__name { font-weight: 600; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.prod__price { font-weight: 800; color: var(--green-dark); }
.prod__qty { position: absolute; top: 8px; right: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: var(--green); color: #fff; font-weight: 700; font-size: 13px; line-height: 26px; text-align: center; }
.prod.in-cart { border-color: var(--green); }

.cart { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.cart__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 10px; }
.cart__head h2 { font-size: 17px; font-weight: 700; }
.cart__lines { flex: 1; overflow-y: auto; padding: 0 16px; max-height: 44vh; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.cart-line__name { font-weight: 600; font-size: 14px; }
.cart-line__unit { color: var(--muted); font-size: 12px; }
.cart-line__total { font-weight: 700; text-align: right; }
.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.stepper button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }
.stepper button:hover { background: var(--green-softer); }
.stepper button .ico { width: 16px; height: 16px; stroke-width: 2.4; }
.stepper span { min-width: 24px; text-align: center; font-weight: 700; font-size: 14px; }
.cart__foot { padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.total-row b { font-size: 26px; font-weight: 800; color: var(--green-dark); letter-spacing: -.5px; }
.total-fc { text-align: right; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.cart-empty { padding: 28px 10px; text-align: center; color: var(--muted); font-size: 14px; }

.pay-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.pay-mode { position: relative; }
.pay-mode input { position: absolute; opacity: 0; }
.pay-mode span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1.5px solid var(--line); border-radius: 14px; font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; }
.pay-mode input:checked + span { border-color: var(--green); background: var(--green-softer); color: var(--green-dark); }
.pay-mode .emoji { font-size: 22px; }
.quick-cash { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 14px; }
.change-box { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--green-softer); font-weight: 600; margin-bottom: 14px; }
.change-box b { font-size: 22px; color: var(--green-dark); }
.change-box.is-bad { background: var(--red-soft); }
.change-box.is-bad b { color: var(--red); }

/* Panier flottant mobile */
.cart-fab {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--bottombar) + 12px + env(safe-area-inset-bottom)); z-index: 45;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 20px; border-radius: 999px;
  background: var(--green); color: #fff; font-weight: 700; box-shadow: 0 10px 24px rgba(92,158,49,.35);
}
.cart-fab .count { background: #fff; color: var(--green-dark); }

/* Sélecteur de tables */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.table-pick {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 16px;
  background: #fff; border: 1.5px solid var(--line); font-weight: 600; text-align: center;
}
.table-pick small { color: var(--muted); font-weight: 500; font-size: 12px; }
.table-pick.is-busy { border-color: #f3d9a4; background: var(--yellow-soft); }
.table-pick:hover { border-color: var(--green); }
.table-pick .ico { width: 26px; height: 26px; color: var(--green); }

/* ---------- Commandes ---------- */
.orders { display: grid; gap: 12px; }
.order { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.order--en_attente { border-color: #f3d9a4; box-shadow: 0 0 0 3px var(--yellow-soft); }
.order__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order__table { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.order__meta { color: var(--muted); font-size: 12px; }
.order__lines li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 14px; }
.order__lines b { color: var(--green-dark); margin-right: 6px; }
.order__note { padding: 8px 12px; border-radius: 10px; background: var(--yellow-soft); font-size: 13px; }
.order__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
.order__total { font-weight: 800; font-size: 17px; }
.order__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Scanner QR ---------- */
.scanner { position: relative; overflow: hidden; border-radius: 18px; background: #000; aspect-ratio: 1; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner::after { content: ""; position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9); border-radius: 20px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* ---------- QR codes des tables ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); text-align: center; }
.qr-card__brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.qr-card__brand img { width: 28px; height: 28px; }
.qr-card__code { width: 170px; height: 170px; padding: 8px; border-radius: 12px; background: #fff; }
.qr-card__code img, .qr-card__code svg, .qr-card__code canvas { width: 100%; height: 100%; }
.qr-card__name { font-size: 20px; font-weight: 800; }
.qr-card__zone { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.qr-card__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.qr-card.is-off { opacity: .55; }

/* ---------- Reçu ---------- */
.receipt-page { background: #eceee9; padding: 20px 10px 90px; }
.receipt { width: 80mm; max-width: 100%; margin: 0 auto; padding: 18px 14px; background: #fff; font-size: 12.5px; line-height: 1.45; color: #000; box-shadow: var(--shadow); }
.receipt__logo { width: 56px; height: 56px; margin: 0 auto 6px; }
.receipt h1 { text-align: center; font-size: 18px; font-weight: 800; }
.receipt .center { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 10px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt .r { text-align: right; white-space: nowrap; }
.receipt .big td { font-size: 15px; font-weight: 800; padding-top: 6px; }
.receipt-actions { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; justify-content: center; padding: 14px; background: #fff; border-top: 1px solid var(--line); }
.stamp { display: inline-block; margin: 8px auto; padding: 4px 12px; border: 2px solid var(--red); color: var(--red); font-weight: 800; transform: rotate(-4deg); }

/* ---------- Connexion ---------- */
.login-page { min-height: 100dvh; display: grid; background: #fff; }
.login-hero { display: none; }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px 20px; min-height: 100dvh; background: linear-gradient(180deg, var(--green-soft) 0, #fff 260px); }
.login-card { width: 100%; max-width: 400px; }
.login-card__logo { width: 72px; height: 72px; margin-bottom: 18px; }
.login-card h2 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.login-card > .muted { margin: 4px 0 22px; }
.login-card .btn { margin-top: 6px; }
.login-card__foot { margin-top: 16px; font-size: 13px; text-align: center; }
.login-copy { color: var(--muted); font-size: 12px; }

/* ==========================================================
   ≥ 600px
   ========================================================== */
@media (min-width: 600px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi--hero { grid-column: span 3; }
  .quick-actions { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .prod-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid--2 { grid-template-columns: 1fr 1fr; }
  .form-grid--3 { grid-template-columns: repeat(3, 1fr); }
  dialog.modal { margin: auto; border-radius: 24px; }
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orders { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
}

/* ==========================================================
   ≥ 1024px : barre latérale fixe
   ========================================================== */
@media (min-width: 1024px) {
  .sidebar { transform: none; width: var(--sidebar); box-shadow: none !important; }
  .backdrop, .bottombar, .topbar__menu, .cart-fab { display: none !important; }
  .main { margin-left: var(--sidebar); padding-bottom: 32px; }
  .topbar { padding: 18px 28px; }
  .topbar__title h1 { font-size: 22px; }
  .content, .flashes { padding-left: 28px; padding-right: 28px; }
  .kpis { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .kpi--hero { grid-column: span 2; grid-row: span 2; justify-content: center; }
  .kpi--hero .kpi__value { font-size: 38px; }
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid--main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
  .toasts { bottom: 24px; }
  .pos { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .pos .cart { position: sticky; top: 90px; max-height: calc(100dvh - 110px); }
  .pos .cart__lines { max-height: none; }
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .login-page { grid-template-columns: 1.1fr 1fr; }
  .login-hero {
    position: relative; display: flex; flex-direction: column; justify-content: center; gap: 18px; overflow: hidden;
    padding: 56px; background: linear-gradient(135deg, #e6f0d6 0%, #d6e8bd 100%);
  }
  .login-hero__brand { position: absolute; top: 40px; left: 56px; display: flex; align-items: center; gap: 12px; font-size: 20px; }
  .login-hero__brand b { font-weight: 800; }
  .login-hero h1 { font-size: 56px; line-height: 1.05; font-weight: 800; letter-spacing: -1.5px; max-width: 60%; }
  .login-hero h1 span { color: var(--green); }
  .login-hero p { max-width: 50%; font-size: 17px; color: var(--ink-2); }
  .login-hero__img { position: absolute; right: -60px; top: 50%; width: 46%; max-width: 440px; transform: translateY(-50%) rotate(-8deg); filter: drop-shadow(0 30px 30px rgba(0,0,0,.18)); }
  .login-hero__list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
  .login-hero__list li { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; background: rgba(255,255,255,.7); font-weight: 600; font-size: 14px; }
  .login-hero__list .ico { color: var(--green); }
  .login-panel { background: #fff; }
  .login-card__logo { display: none; }
}

@media (min-width: 1440px) {
  .content, .flashes { padding-left: 40px; padding-right: 40px; }
}

/* ---------- Impression ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .sidebar, .topbar, .bottombar, .backdrop, .no-print, .flashes, .toasts, .receipt-actions, .cart-fab { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .card, .kpi { break-inside: avoid; border-color: #ccc; }
  .receipt-page { padding: 0; background: #fff; }
  .receipt { box-shadow: none; width: 72mm; padding: 0; }
  .print-only { display: block !important; }
  .qr-card { break-inside: avoid; border: 1px dashed #999; }
}
.print-only { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
