/* =============================================================================
   RECOUVRA — design system (mobile-first). Un seul fichier pour tout le site.
   ============================================================================= */
/* Police hébergée sur le site (plus de dépendance à Google Fonts : affichage plus rapide) */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('vendor/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Couleurs du Sénégal : vert = payé / marque, jaune = partiel / promesse, rouge = impayé / retard */
  --sn-green: #00853F;
  --sn-yellow: #FDEF42;
  --sn-red: #E31B23;
  --bg: #F7F5EE;
  --surface: #FFFFFF;
  --surface-2: #F2F0E8;
  --text: #14201B;
  /* Textes secondaires : contraste ≥ 7:1 (text-2) et ≥ 5,5:1 (text-3) pour rester lisibles en plein soleil */
  --text-2: #3F4C46;
  --text-3: #5A6660;
  --border: #E6E2D6;
  --brand: #0B7A3E;
  --brand-600: #086230;
  --brand-50: #E5F3EA;
  --on-brand: #FFFFFF;   /* texte posé sur la couleur de marque */
  --ok: #0B7A3E;      --ok-bg: #E3F3EA;
  --warn: #7A5A00;    --warn-bg: #FFF6BF;
  --danger: #C41E27;  --danger-bg: #FDE8E9;
  /* Motif de fond : losanges façon tissage (vert), cœur jaune, petits points rouges. Très discret. */
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M32 4 60 32 32 60 4 32Z' fill='none' stroke='%2300853F' stroke-opacity='.09' stroke-width='1.5'/%3E%3Cpath d='M32 22 42 32 32 42 22 32Z' fill='%23FDEF42' fill-opacity='.35'/%3E%3Cg fill='%23E31B23' fill-opacity='.14'%3E%3Ccircle cx='0' cy='0' r='2.5'/%3E%3Ccircle cx='64' cy='0' r='2.5'/%3E%3Ccircle cx='0' cy='64' r='2.5'/%3E%3Ccircle cx='64' cy='64' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
  --flag: linear-gradient(90deg, var(--sn-green) 0 33.34%, var(--sn-yellow) 0 66.67%, var(--sn-red) 0);
  --info: #2457B8;    --info-bg: #E6EEFC;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20,32,27,.05), 0 4px 14px rgba(20,32,27,.06);
  --shadow-lg: 0 12px 40px rgba(20,32,27,.22);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav-h: 64px;
  --sidebar-w: 232px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1512; --surface: #151F1B; --surface-2: #1B2723;
    --text: #EAF1EE; --text-2: #B4C1BB; --text-3: #8E9C95; --border: #263430;
    --brand: #3DCB7C; --brand-600: #66DB97; --brand-50: #14301F; --on-brand: #062A16;
    --ok: #52CB8A; --ok-bg: #153024; --warn: #F6DC4B; --warn-bg: #3A3410;
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M32 4 60 32 32 60 4 32Z' fill='none' stroke='%233DCB7C' stroke-opacity='.10' stroke-width='1.5'/%3E%3Cpath d='M32 22 42 32 32 42 22 32Z' fill='%23FDEF42' fill-opacity='.09'/%3E%3Cg fill='%23E31B23' fill-opacity='.16'%3E%3Ccircle cx='0' cy='0' r='2.5'/%3E%3Ccircle cx='64' cy='0' r='2.5'/%3E%3Ccircle cx='0' cy='64' r='2.5'/%3E%3Ccircle cx='64' cy='64' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
    --danger: #FF7C7C; --danger-bg: #3A1B1B; --info: #86A9F5; --info-bg: #182640;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }
/* iPhone zoome automatiquement sur un champ dont le texte fait moins de 16px : on l'évite partout */
input, select, textarea { font-size: 16px; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.45;
  background: var(--pattern) 0 0 / 64px 64px, var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 800; }
/* petit repère vert · jaune · rouge sous le titre de chaque page */
.page-head h1::after { content: ''; display: block; width: 54px; height: 4px; border-radius: 2px; margin-top: 8px; background: var(--flag); }
h2 { font-size: 1.125rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.xs { font-size: .78rem; }
.bold { font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Boutons (zone tactile >= 44px) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1.5px solid color-mix(in srgb, var(--brand) 35%, transparent); background: var(--brand-50); color: var(--brand-600);
  font-weight: 700; cursor: pointer; transition: background .15s, transform .08s, box-shadow .15s, filter .15s;
  text-decoration: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 55%, transparent); }
.btn:active { transform: scale(.97); filter: brightness(.94); }
/* Bouton « Retour / Annuler » des fenêtres : discret, mais encadré pour rester visible */
.btn[data-close]:not(.btn-primary):not(.btn-danger) { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 1px;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-danger { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-whatsapp { background: #1FAA59; border-color: #1FAA59; color: #fff; }
.btn-whatsapp:hover { background: #178f4a; border-color: #178f4a; }
.btn-ghost, .btn-ghost:hover { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-lg { min-height: 54px; font-size: 1.05rem; padding: 0 24px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: .9rem; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after, .spinner {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulaires ---------- */
.field { display: block; }
.field + .field, .field-row + .field, .field + .field-row { margin-top: 14px; }
.field > label, .field > .lbl { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); font-size: 16px; /* évite le zoom iOS */
}
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: .8rem; color: var(--text-3); margin-top: 4px; }
.field-row { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.field-row .field + .field { margin-top: 0; }
.search {
  width: 100%; min-height: 48px; padding: 10px 14px 10px 42px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface) no-repeat 14px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%238A968F' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m17 17-4.5-4.5'/%3E%3C/svg%3E");
}

/* ---------- Cartes, listes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); min-height: 64px; }
.list > .item:last-child { border-bottom: 0; }
.list > .item.click { cursor: pointer; }
.list > .item.click:hover { background: var(--surface-2); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand); font-weight: 800;
}
.item-title { font-weight: 600; }
.item-sub { font-size: .85rem; color: var(--text-2); }
.amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--text-2); }

/* ---------- Statistiques ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat { border-top: 3px solid var(--brand); }
.stat.danger { border-top-color: var(--sn-red); }
.stat.warn { border-top-color: var(--sn-yellow); }
.stat.warn .v { color: var(--warn); }
.stat .k { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.stat .v { font-size: 1.2rem; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat.danger .v { color: var(--danger); }
.stat.ok .v { color: var(--ok); }

/* Gros boutons d'accueil : les 3 gestes */
.big-actions { display: grid; gap: 12px; }
.big-action {
  display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text);
  min-height: 84px; transition: transform .08s, border-color .15s;
}
.big-action:hover { border-color: var(--brand); }
.big-action:active { transform: scale(.99); }
.big-action .ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; background: var(--brand-50); flex: none; }
.big-action .num { font-size: .8rem; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.big-action .t { font-size: 1.15rem; font-weight: 800; }
.big-action.danger .ico { background: var(--danger-bg); }
.big-action.danger .num { color: var(--danger); }
.big-action.danger:hover { border-color: var(--sn-red); }
/* 1 vert (stock) · 2 jaune (facture) · 3 rouge (dettes) */
.big-action:nth-child(2) .ico { background: var(--warn-bg); }
.big-action:nth-child(2) .num { color: var(--warn); }
.big-action:nth-child(2):hover { border-color: var(--sn-yellow); }

/* graphique simple */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.bars .bar i { width: 100%; max-width: 38px; background: var(--brand); border-radius: 6px 6px 2px 2px; min-height: 3px; opacity: .85; }
.bars .bar span { font-size: .7rem; color: var(--text-3); }

/* ---------- Coque d'application ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 16px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
/* bande aux couleurs du Sénégal sous la barre du haut */
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--flag); pointer-events: none; }
.topbar .topbar-ent { max-width: 34vw; }
@media (max-width: 479px) { .topbar .topbar-ent { display: none; } }
.topbar .icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 1.25rem; cursor: pointer; text-decoration: none; }
.topbar .icon-btn:active { transform: scale(.96); }
.topbar .title { font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .brand span:last-child { display: none; }
@media (min-width: 420px) { .topbar .brand span:last-child { display: inline; } }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 800; overflow: hidden; flex: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.content { padding: 16px 16px calc(var(--nav-h) + 44px); max-width: 960px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tabbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; height: 64px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 8px 28px rgba(20,32,27,.16); padding: 0 4px;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .72rem; font-weight: 700; color: var(--text-3); position: relative; height: 100%; -webkit-tap-highlight-color: transparent; }
.tabbar a .i { display: grid; place-items: center; width: 46px; height: 28px; border-radius: 14px; transition: background .18s, color .18s, transform .1s; }
.tabbar a .i svg { width: 23px; height: 23px; }
.tabbar a:active .i { transform: scale(.92); }
.tabbar a.active { color: var(--brand); }
.tabbar a.active .i { background: var(--brand-50); }
.tabbar a.main { color: var(--text-2); }
.tabbar a.main .i { width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: var(--on-brand); margin-top: -26px; box-shadow: 0 6px 16px rgba(11,122,62,.45); border: 4px solid var(--bg); }
.tabbar a.main .i svg { width: 26px; height: 26px; }
.tabbar a.main.active { color: var(--brand); }
.tabbar a.main.active .i { background: var(--brand-600); }
.tabbar a.main span:not(.i):not(.dot) { margin-top: -2px; }
.tabbar a .dot { position: absolute; top: 8px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; display: grid; place-items: center; }

.banner { padding: 10px 16px; font-size: .9rem; font-weight: 600; display: flex; gap: 10px; align-items: center; justify-content: center; text-align: center; flex-wrap: wrap; }
.banner-warn { background: var(--warn-bg); color: var(--warn); }
.banner-danger { background: var(--danger-bg); color: var(--danger); }
.banner-info { background: var(--info-bg); color: var(--info); }
.banner-compact { padding: 4px 8px 4px 16px; justify-content: space-between; text-align: left; flex-wrap: nowrap; font-size: .85rem; }
.banner-compact .btn { min-height: 36px; padding: 0 12px; background: var(--info); border-color: var(--info); color: var(--info-bg); }
.banner-compact .btn-ghost { background: transparent; border-color: transparent; color: var(--info); padding: 0 8px; }
.banner a { text-decoration: underline; color: inherit; }

@media (min-width: 900px) {
  .shell { padding-left: var(--sidebar-w); }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; gap: 4px; z-index: 35;
  }
  .sidebar .brand { padding: 4px 10px 18px; font-size: 1.15rem; }
  .sidebar a.nav {
    display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 48px; border-radius: 10px;
    color: var(--text-2); font-weight: 600;
  }
  .sidebar a.nav:hover { background: var(--surface-2); }
  .sidebar a.nav.active { background: var(--brand-50); color: var(--brand); }
  .sidebar a.nav .i { width: 26px; display: grid; place-items: center; } .sidebar a.nav .i svg { width: 22px; height: 22px; }
  .sidebar::after { content: ''; position: absolute; top: 0; bottom: 0; right: -1px; width: 3px; background: linear-gradient(180deg, var(--sn-green) 0 33.34%, var(--sn-yellow) 0 66.67%, var(--sn-red) 0); pointer-events: none; }
  .sidebar .count { margin-left: auto; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 9px; }
  .sidebar .foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--border); }
  .tabbar { display: none; }
  .topbar .brand { display: none; }
  .topbar .icon-btn { display: none; }
  .content { padding: 24px 28px 48px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .big-actions { grid-template-columns: repeat(3, 1fr); }
  .big-action { flex-direction: column; align-items: flex-start; }
}

/* ---------- Modale (feuille du bas sur mobile) ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,14,11,.55); display: flex;
  align-items: flex-end; justify-content: center; animation: fade .15s ease;
}
.modal {
  background: var(--surface); width: 100%; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease; box-shadow: var(--shadow-lg);
}
.modal h2 { margin-bottom: 14px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn { flex: 1; }
@media (min-width: 600px) {
  .overlay { align-items: center; padding: 20px; }
  .modal { max-width: 480px; border-radius: 18px; }
  .modal.wide { max-width: 640px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 200; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 440px; width: 100%; padding: 12px 16px; border-radius: 12px;
  background: #14201B; color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); animation: up .2s ease;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.ok { background: #1B7F4B; } .toast.err { background: #C23030; }
@media (min-width: 900px) { .toasts { bottom: 24px; left: auto; right: 24px; align-items: flex-end; } }

/* ---------- Divers ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .big { font-size: 2.6rem; margin-bottom: 8px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 18px; }
.skeleton.row-sk { height: 64px; border-radius: 0; margin-bottom: 1px; }
@keyframes sk { to { background-position: -200% 0; } }
.seg { display: flex; background: var(--surface-2); padding: 4px; border-radius: 12px; gap: 4px; overflow-x: auto; }
.seg button { flex: 1; min-height: 40px; padding: 0 14px; border: 0; background: transparent; border-radius: 9px; font-weight: 700; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
/* Réglages : onglets sur plusieurs lignes, tous visibles sans défilement */
/* Onglets de Réglages : de vraies tuiles, l'onglet ouvert en vert plein */
.seg-wrap { flex-wrap: wrap; overflow: visible; background: transparent; padding: 0; gap: 8px; }
.seg-wrap button { flex: 1 1 30%; min-height: 48px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); font-size: .9rem; }
.seg-wrap button i { color: var(--brand); }
.seg-wrap button.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.seg-wrap button.on i { color: var(--on-brand); }
.seg-wrap button:active { transform: scale(.97); }
.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500; }
.alert-err { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.total-line { display: flex; justify-content: space-between; padding: 6px 0; }
.total-line.big { font-size: 1.25rem; font-weight: 800; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; cursor: pointer; }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

/* ---------- VENDRE : grille de produits + panier ---------- */
.prod-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.prod {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; min-height: 92px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; position: relative; min-width: 0; overflow-wrap: anywhere;
}
.prod:hover { border-color: var(--brand); }
.prod:active { transform: scale(.98); }
.prod .n { font-weight: 700; line-height: 1.2; }
.prod .p { color: var(--brand); font-weight: 800; margin-top: auto; }
.prod .s { font-size: .75rem; color: var(--text-3); }
.prod.out { opacity: .5; pointer-events: none; }
.prod .qty-badge { position: absolute; top: 4px; right: 4px; min-width: 48px; height: 40px; border-radius: 12px; background: var(--brand); color: var(--on-brand); font-weight: 800; font-size: .8rem; display: grid; place-items: center; padding: 0 6px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: var(--surface-2); font-size: 1.25rem; font-weight: 700; cursor: pointer; }
.stepper input { width: 56px; height: 44px; border: 0; text-align: center; font-weight: 700; background: var(--surface); font-size: 16px; }
.cartbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-h) + 34px + env(safe-area-inset-bottom)); z-index: 38; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
@media (min-width: 900px) {
  .prod-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cartbar { left: var(--sidebar-w); right: 0; bottom: 0; border-radius: 0; border-width: 1px 0 0; box-shadow: 0 -6px 20px rgba(0,0,0,.08); }
}
@media (min-width: 1100px) { .prod-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Page de connexion ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(900px 400px at 10% -10%, var(--brand-50), transparent), var(--pattern) 0 0 / 64px 64px, var(--bg); }
.auth::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: 6px; background: var(--flag); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; font-size: 1.5rem; margin-bottom: 8px; }

/* ---------- Impression de la facture ---------- */
.invoice { background: #fff; color: #111; padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); }
.invoice table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.invoice th, .invoice td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #e5e5e5; font-size: .92rem; }
.invoice th:nth-child(n+2), .invoice td:nth-child(n+2) { text-align: right; }
@media print {
  .sidebar, .tabbar, .topbar, .banner, .no-print, .toasts, .cartbar { display: none !important; }
  .shell { padding: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  body { background: #fff; }
  .invoice { border: 0; padding: 0; }
}

/* Import / progress */
.alert-ok { background: var(--ok-bg, #E6F4EA); color: var(--ok, #1E7B3A); }
.progress { height: 10px; border-radius: 999px; background: var(--border, #e5e7eb); overflow: hidden; }
.progress > #bar, .progress > .bar { display: block; height: 100%; width: 0; background: var(--primary, var(--brand)); transition: width .2s; }

/* Pastille paiements à valider */
.topbar .icon-btn, .sidebar .nav { position: relative; }
.pay-badge { background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; }
.topbar .icon-btn .pay-badge { position: absolute; top: 2px; right: 0; }
.sidebar .nav .pay-badge { margin-left: auto; }

/* Bulle d'aide (ouvre l'assistant) */
.help-fab { position: fixed; right: 14px; bottom: calc(var(--nav-h) + 30px + env(safe-area-inset-bottom)); z-index: 39; width: 52px; height: 52px; border-radius: 50%; background: var(--brand); color: var(--on-brand); border: 0; cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.28); -webkit-tap-highlight-color: transparent; }
.help-fab:active { transform: scale(.94); }
.help-fab svg { width: 26px; height: 26px; }
/* Sur téléphone, l'aide WhatsApp est dans la barre du haut : la bulle ne cache plus le contenu */
@media (max-width: 899px) { .help-fab { display: none; } }
.topbar .icon-btn svg { width: 22px; height: 22px; }
@media (min-width: 900px) { .help-fab { right: 24px; bottom: 24px; } }
@media print { .help-fab { display: none !important; } }

/* Partage de l'application */
.share-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.share-qr img { border: 1px solid var(--border, #E5E7EB); border-radius: 14px; }
/* ---------- Icônes (dessinées, couleur = couleur du texte) : <i class=ic-NOM></i> ---------- */
i[class^="ic-"] { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -0.24em; flex: none; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.ic-alert { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z%22/%3E%3Cpath d=%22M12 9v4M12 17h.01%22/%3E%3C/svg%3E"); }
.ic-check { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%229%22/%3E%3Cpath d=%22m8 12 3 3 5-6%22/%3E%3C/svg%3E"); }
.ic-search { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2211%22 cy=%2211%22 r=%227%22/%3E%3Cpath d=%22m20 20-3.5-3.5%22/%3E%3C/svg%3E"); }
.ic-users { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2%22/%3E%3Ccircle cx=%229%22 cy=%227%22 r=%224%22/%3E%3Cpath d=%22M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8%22/%3E%3C/svg%3E"); }
.ic-user { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%228%22 r=%224%22/%3E%3Cpath d=%22M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1%22/%3E%3C/svg%3E"); }
.ic-box { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 8l-9-5-9 5 9 5 9-5z%22/%3E%3Cpath d=%22M3 8v8l9 5 9-5V8%22/%3E%3Cpath d=%22M12 13v8%22/%3E%3C/svg%3E"); }
.ic-receipt { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M6 3h12v18l-3-2-3 2-3-2-3 2z%22/%3E%3Cpath d=%22M9 8h6M9 12h6%22/%3E%3C/svg%3E"); }
.ic-money { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%222%22 y=%226%22 width=%2220%22 height=%2212%22 rx=%222%22/%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%222.5%22/%3E%3Cpath d=%22M6 12h.01M18 12h.01%22/%3E%3C/svg%3E"); }
.ic-truck { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M1 4h13v12H1zM14 8h4l3 3v5h-7%22/%3E%3Ccircle cx=%225.5%22 cy=%2218%22 r=%222%22/%3E%3Ccircle cx=%2217.5%22 cy=%2218%22 r=%222%22/%3E%3C/svg%3E"); }
.ic-chart { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M3 3v18h18%22/%3E%3Cpath d=%22M7 16v-4M12 16V8M17 16v-7%22/%3E%3C/svg%3E"); }
.ic-upload { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M12 15V3M7 8l5-5 5 5%22/%3E%3Cpath d=%22M20 15v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4%22/%3E%3C/svg%3E"); }
.ic-download { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M12 3v12M7 10l5 5 5-5%22/%3E%3Cpath d=%22M20 15v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4%22/%3E%3C/svg%3E"); }
.ic-printer { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M6 9V2h12v7%22/%3E%3Crect x=%222%22 y=%229%22 width=%2220%22 height=%229%22 rx=%222%22/%3E%3Cpath d=%22M6 14h12v8H6z%22/%3E%3C/svg%3E"); }
.ic-trash { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M3 6h18M8 6V4h8v2M6 6l1 15h10l1-15%22/%3E%3Cpath d=%22M10 11v6M14 11v6%22/%3E%3C/svg%3E"); }
.ic-chat { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 11.5a8.4 8.4 0 0 1-12.4 7.4L3 20.5l1.6-5.4A8.5 8.5 0 1 1 21 11.5z%22/%3E%3C/svg%3E"); }
.ic-phone { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z%22/%3E%3C/svg%3E"); }
.ic-mobile { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%226%22 y=%222%22 width=%2212%22 height=%2220%22 rx=%222%22/%3E%3Cpath d=%22M11 18h2%22/%3E%3C/svg%3E"); }
.ic-qr { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%223%22 y=%223%22 width=%227%22 height=%227%22 rx=%221%22/%3E%3Crect x=%2214%22 y=%223%22 width=%227%22 height=%227%22 rx=%221%22/%3E%3Crect x=%223%22 y=%2214%22 width=%227%22 height=%227%22 rx=%221%22/%3E%3Cpath d=%22M14 14h3v3h-3zM21 14v.01M14 21h.01M17 21h4v-4%22/%3E%3C/svg%3E"); }
.ic-camera { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z%22/%3E%3Ccircle cx=%2212%22 cy=%2213.5%22 r=%223.5%22/%3E%3C/svg%3E"); }
.ic-pin { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M12 22s7-6.2 7-12a7 7 0 0 0-14 0c0 5.8 7 12 7 12z%22/%3E%3Ccircle cx=%2212%22 cy=%2210%22 r=%222.5%22/%3E%3C/svg%3E"); }
.ic-file { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z%22/%3E%3Cpath d=%22M14 2v6h6M8 13h8M8 17h5%22/%3E%3C/svg%3E"); }
.ic-folder { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z%22/%3E%3C/svg%3E"); }
.ic-calendar { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%223%22 y=%224%22 width=%2218%22 height=%2218%22 rx=%222%22/%3E%3Cpath d=%22M16 2v4M8 2v4M3 10h18%22/%3E%3C/svg%3E"); }
.ic-key { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%227.5%22 cy=%2215.5%22 r=%224.5%22/%3E%3Cpath d=%22m10.7 12.3 9.3-9.3M17 6l3 3M14 9l2 2%22/%3E%3C/svg%3E"); }
.ic-refresh { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M21 12a9 9 0 1 1-2.6-6.4L21 8%22/%3E%3Cpath d=%22M21 3v5h-5%22/%3E%3C/svg%3E"); }
.ic-clock { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%229%22/%3E%3Cpath d=%22M12 7v5l3 2%22/%3E%3C/svg%3E"); }
.ic-bell { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9%22/%3E%3Cpath d=%22M13.7 21a2 2 0 0 1-3.4 0%22/%3E%3C/svg%3E"); }
.ic-lock { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%224%22 y=%2211%22 width=%2216%22 height=%2210%22 rx=%222%22/%3E%3Cpath d=%22M8 11V7a4 4 0 0 1 8 0v4%22/%3E%3C/svg%3E"); }
.ic-shield { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z%22/%3E%3C/svg%3E"); }
.ic-gift { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%223%22 y=%228%22 width=%2218%22 height=%224%22 rx=%221%22/%3E%3Cpath d=%22M12 8v13M19 12v9H5v-9%22/%3E%3Cpath d=%22M7.5 8a2.5 2.5 0 0 1 0-5C11 3 12 8 12 8s1-5 4.5-5a2.5 2.5 0 0 1 0 5%22/%3E%3C/svg%3E"); }
.ic-ban { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%229%22/%3E%3Cpath d=%22m5.6 5.6 12.8 12.8%22/%3E%3C/svg%3E"); }
.ic-offline { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22m2 2 20 20M8.5 16.5a5 5 0 0 1 7 0M2 8.8a15 15 0 0 1 4.2-2.7M10.7 5.1A15 15 0 0 1 22 8.8M5 12.9a10 10 0 0 1 5.2-2.8M16.9 10.6A10 10 0 0 1 19 12.9M12 20h.01%22/%3E%3C/svg%3E"); }
.ic-wrench { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.8-3.8a6 6 0 0 1-7.9 7.9l-6.9 6.9a2.1 2.1 0 0 1-3-3l6.9-6.9a6 6 0 0 1 7.9-7.9l-3.8 3.8z%22/%3E%3C/svg%3E"); }
.ic-bag { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z%22/%3E%3Cpath d=%22M3 6h18M16 10a4 4 0 0 1-8 0%22/%3E%3C/svg%3E"); }
.ic-car { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M5 17H3v-5l2-5h14l2 5v5h-2%22/%3E%3Ccircle cx=%227%22 cy=%2217%22 r=%222%22/%3E%3Ccircle cx=%2217%22 cy=%2217%22 r=%222%22/%3E%3Cpath d=%22M9 17h6M3 12h18%22/%3E%3C/svg%3E"); }
.ic-bowl { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M3 11h18a9 9 0 0 1-18 0z%22/%3E%3Cpath d=%22M8 7c0-2 2-2 2-4M13 7c0-2 2-2 2-4%22/%3E%3C/svg%3E"); }
.ic-factory { --i: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M2 20V9l6 4V9l6 4V4h6v16z%22/%3E%3Cpath d=%22M6 17h.01M11 17h.01M16 17h.01%22/%3E%3C/svg%3E"); }
.empty .big i { color: var(--text-3); }
.big-action .ico { color: var(--brand); }
.big-action.danger .ico { color: var(--danger); }
.alert i[class^="ic-"], .banner i[class^="ic-"] { margin-right: 2px; }
/* Mode sombre : barre de menu plus claire que la page pour bien la distinguer */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tabbar { background: color-mix(in srgb, #2A3A34 98%, transparent); border-color: #3B4F47; box-shadow: 0 8px 28px rgba(0,0,0,.5); }
  :root:not([data-theme="light"]) .tabbar a { color: #B9C7C1; }
  :root:not([data-theme="light"]) .tabbar a.active { color: var(--brand-600); }
  :root:not([data-theme="light"]) .tabbar a.active .i { background: #2C4A40; }
  :root:not([data-theme="light"]) .tabbar a.main .i { border-color: #2A3A34; }
}
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.prod .n { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }


/* ---------- Écran de chargement (connexion lente) ---------- */
#rc-splash { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center;
  background: var(--bg) var(--pattern); opacity: 0; animation: rcSplashIn .35s .4s ease forwards; transition: opacity .25s; }
#rc-splash.out { opacity: 0 !important; animation: none; pointer-events: none; }
#rc-splash p { margin: 0; color: var(--text-2); font-size: .95rem; max-width: 280px; }
#rc-splash .rc-s1 { font-weight: 700; color: var(--text); font-size: 1.05rem; }
@keyframes rcSplashIn { to { opacity: 1; } }

/* Logo « R » : la jauge vert / jaune / rouge monte uniquement dans le blanc de la lettre (illusion de chargement) */
#rc-splash .rc-logo { width: 104px; height: 104px; border-radius: 28px; background: #1F6F5C; box-shadow: var(--shadow-lg); display: grid; place-items: center; }
#rc-splash .rc-r { position: relative; display: block; font: 800 66px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: -1px; color: #fff; }
#rc-splash .rc-r::after { content: attr(data-t); position: absolute; left: 0; top: 0; color: transparent;
  background: linear-gradient(to top, var(--sn-green) 0 36%, var(--sn-yellow) 36% 66%, var(--sn-red) 66% 100%); -webkit-background-clip: text; background-clip: text;
  clip-path: inset(100% 0 0 0); animation: rcFill 3.2s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes rcFill { 0% { clip-path: inset(100% 0 0 0); opacity: 1; } 78% { clip-path: inset(0 0 0 0); opacity: 1; } 92% { clip-path: inset(0 0 0 0); opacity: 1; } 100% { clip-path: inset(0 0 0 0); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #rc-splash .rc-r::after { animation: none; clip-path: inset(0); } }

/* ---------- Application Android / iOS (classe posée par app.js dans l'application des stores) ----------
   L'écran va sous l'encoche et la barre d'état : on réserve leur place en haut. Le bas est déjà géré plus haut. */
html.is-native body { padding-top: env(safe-area-inset-top, 0px); }
html.is-native .topbar { margin-top: calc(-1 * env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); height: calc(56px + env(safe-area-inset-top, 0px)); }
html.is-native .auth { min-height: calc(100vh - env(safe-area-inset-top, 0px)); }
html.is-native, html.is-native body { overscroll-behavior-y: none; }
html.is-native { -webkit-touch-callout: none; }

/* ---------- Assistant d'aide (IA) ---------- */
.aide-fil { display: flex; flex-direction: column; gap: 8px; max-height: min(46vh, 420px); overflow-y: auto; padding: 2px; }
.aide-msg { max-width: 88%; padding: 10px 12px; border-radius: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.aide-msg.ia { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.aide-msg.moi { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 4px; }
.aide-msg.err { background: var(--danger-bg); color: var(--danger); }
.aide-msg.attente { color: var(--text-2); animation: aide-pulse 1s ease-in-out infinite; }
@keyframes aide-pulse { 50% { opacity: .45; } }
.aide-form { display: flex; gap: 8px; align-items: flex-end; }
.aide-form textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 120px; resize: none; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); font-size: 16px; /* évite le zoom iOS */ }
.aide-form .btn { flex: none; min-height: 44px; }
.aide .chips .chip { white-space: nowrap; }
/* Voix de l'assistant : 🔊 sous chaque réponse, 🎤 à côté d'Envoyer, bouche du robot qui bouge pendant la lecture */
.aide-son { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: 6px 0 0 auto; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--brand); cursor: pointer; }
.aide-son.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.aide-micro { width: 48px; padding: 0; display: flex; align-items: center; justify-content: center; color: var(--brand); }
.aide-micro.ecoute { background: var(--danger); border-color: var(--danger); color: #fff; animation: aide-ecoute 1.1s ease-in-out infinite; }
@keyframes aide-ecoute { 0%, 100% { box-shadow: 0 0 0 0 rgba(196, 30, 39, .45); } 50% { box-shadow: 0 0 0 9px rgba(196, 30, 39, 0); } }
.robot-mini.dit .r-bouche, .robot.dit .r-bouche { transform-box: fill-box; transform-origin: center top; animation: robot-bouche .22s ease-in-out infinite alternate; }
.robot-mini.dit .r-bras, .robot.dit .r-bras { animation: robot-salut .4s ease-in-out infinite alternate; }
@keyframes robot-bouche { from { scale: 1 .6; } to { scale: 1.15 2.6; } }
@media (prefers-reduced-motion: reduce) { .aide-micro.ecoute, .robot-mini.dit .r-bouche, .robot.dit .r-bouche, .robot-mini.dit .r-bras, .robot.dit .r-bras { animation: none; } }
@media (prefers-reduced-motion: reduce) { .aide-msg.attente { animation: none; } }

/* ---------- Zone pouce ----------
   Sur téléphone, l'action principale de la page (+ Ajouter un produit, + Nouveau client, + Nouvel achat) flotte
   en bas à droite, au-dessus de la barre de menu : atteignable d'une main. Masquée quand le clavier est ouvert. */
@media (max-width: 899px) {
  .fab { position: fixed; right: 14px; bottom: calc(var(--nav-h) + 46px + env(safe-area-inset-bottom)); z-index: 38;  /* au-dessus du bouton rond « Vendre » du menu */
    min-height: 54px; padding: 0 20px; border-radius: 999px; font-size: 1rem;
    background: var(--brand); border-color: var(--brand); color: var(--on-brand);
    box-shadow: 0 8px 22px rgba(0,0,0,.28); }
  .fab:hover { background: var(--brand-600); border-color: var(--brand-600); }
  body.has-fab .content { padding-bottom: calc(var(--nav-h) + 44px + 92px); }
  body.kb-open .fab { display: none; }
}
@media print { .fab { display: none !important; } }

/* ---------- Retours visuels immédiats ---------- */
.list > .item.click:active { background: var(--surface-2); }
.chip:active, .tabbar a:active { transform: scale(.95); }
.toast.ok, .toast.err { animation: up .2s ease, toast-pop .32s ease; }
@keyframes toast-pop { 40% { transform: scale(1.04); } }
.succes-pop { color: var(--ok); animation: succes-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes succes-pop { from { transform: scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast.ok, .toast.err, .succes-pop { animation: none; } }

/* ---------- Nouvelle version disponible ---------- */
.maj-banner { position: fixed; z-index: 60; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top)); max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-radius: 16px;
  background: var(--surface); color: var(--text); border: 1px solid var(--brand); box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: .92rem; animation: maj-in .25s ease; }
.maj-banner .btn { flex: none; min-height: 40px; }
.maj-banner #maj-x { min-width: 40px; padding: 0; }
@keyframes maj-in { from { transform: translateY(-16px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .maj-banner { animation: none; } }
@media print { .maj-banner { display: none !important; } }

/* ---------- Robot de l'assistant ---------- */
.robot { position: fixed; z-index: 39; width: 66px; height: 74px; padding: 0; border: 0; background: none; cursor: grab;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
/* Position par défaut : téléphone = en bas à gauche au-dessus du menu (le bouton d'ajout est à droite) ; ordinateur = en bas à droite */
.robot.defaut { left: 10px; bottom: calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .robot.defaut { left: auto; right: 24px; bottom: 24px; } }
/* Vendre : au-dessus de la barre du panier (téléphone) ; sur ordinateur la barre est en bas, on remonte aussi */
.robot.defaut.sur-vendre { bottom: calc(var(--nav-h) + 150px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .robot.defaut.sur-vendre { bottom: 104px; } }
.robot svg { position: absolute; left: 1px; top: 0; width: 64px; height: 64px; overflow: visible;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.22)); animation: robot-flotte 3.2s ease-in-out infinite; }
.robot .r-ombre { position: absolute; left: 50%; bottom: 1px; width: 34px; height: 7px; margin-left: -17px; border-radius: 50%;
  background: rgba(0,0,0,.2); animation: robot-ombre 3.2s ease-in-out infinite; }
.robot .r-yeux { transform-box: fill-box; transform-origin: center; animation: robot-cligne 4.8s infinite; transition: translate .25s; }
.robot .r-lumiere { animation: robot-lumiere 2.2s ease-in-out infinite; }
.robot .r-bras { transform-box: fill-box; transform-origin: 0% 100%; }
.robot.regarde-bas .r-yeux { translate: 0 2px; }
.robot.regarde-haut .r-yeux { translate: 0 -2px; }
.robot.parle svg { animation: robot-saut .55s ease-out, robot-flotte 3.2s .55s ease-in-out infinite; }
.robot.parle .r-bras { animation: robot-salut .32s ease-in-out 6 alternate; }
.robot.parle .r-yeux { animation: none; scale: 1 .55; }  /* yeux plissés : il sourit */
.robot.entre svg { animation: robot-entre .6s cubic-bezier(.3, 1.5, .5, 1); }
.robot.glisse { cursor: grabbing; }
.robot.glisse svg { animation: none; transform: scale(1.1) rotate(-6deg); }
.robot:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 16px; }
@keyframes robot-flotte { 50% { transform: translateY(-7px); } }
@keyframes robot-ombre { 50% { transform: scaleX(.72); opacity: .55; } }
@keyframes robot-cligne { 0%, 93%, 100% { scale: 1 1; } 95% { scale: 1 .1; } }
@keyframes robot-lumiere { 50% { opacity: .45; } }
@keyframes robot-salut { to { rotate: -38deg; } }
@keyframes robot-saut { 35% { transform: translateY(-16px) rotate(-5deg); } 70% { transform: translateY(0) rotate(3deg); } }
@keyframes robot-entre { from { transform: translateY(60px) scale(.6); opacity: 0; } }
.robot-bulle { position: fixed; z-index: 39; max-width: min(240px, 70vw); padding: 10px 14px; border-radius: 16px 16px 16px 16px;
  background: var(--surface); color: var(--text); border: 1.5px solid var(--brand); box-shadow: var(--shadow-lg);
  font: 600 .92rem/1.35 var(--font); text-align: left; cursor: pointer; animation: robot-bulle .3s cubic-bezier(.3, 1.5, .5, 1); }
.robot-bulle:not(.g) { border-bottom-right-radius: 4px; }
.robot-bulle.g { border-bottom-left-radius: 4px; }
@keyframes robot-bulle { from { transform: translateY(8px) scale(.9); opacity: 0; } }
.robot-mini svg { width: 34px; height: 34px; display: block; }
body.kb-open .robot, body.kb-open .robot-bulle { display: none; }
@media print { .robot, .robot-bulle { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .robot svg, .robot .r-ombre, .robot .r-yeux, .robot .r-lumiere, .robot.parle .r-bras, .robot-bulle { animation: none !important; }
}

/* ---------- Bien démarrer (Accueil) ---------- */
.demarrage { margin-bottom: 16px; border-top: 3px solid var(--brand); }
.demarrage.fini { display: flex; gap: 14px; align-items: center; }
.dm-barre { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 12px 0 6px; }
.dm-barre i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .4s ease; }
.dm-etapes { list-style: none; margin: 0; padding: 0; }
.dm-etapes li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.dm-etapes li:last-child { border-bottom: 0; padding-bottom: 0; }
.dm-etapes .btn { flex: none; min-height: 40px; }
.dm-coche { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem;
  border: 2px solid var(--border); color: var(--text-2); }
.dm-t { font-weight: 700; }
.dm-etapes li.fait .dm-coche { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.dm-etapes li.fait .dm-t { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }
/* ---------- À relancer aujourd'hui (Dettes) ---------- */
.aujourdhui-card { border-top: 3px solid var(--sn-yellow); }

/* ---------- Photos des produits ---------- */
.avatar.a-photo { border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.avatar img, .photo-apercu img, .prod .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar-lg.a-photo { cursor: zoom-in; border-radius: 14px; }
.photo-champ { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.photo-apercu { width: 76px; height: 76px; flex: none; border-radius: 14px; border: 1.5px dashed var(--border); background: var(--surface-2); color: var(--text-3); display: grid; place-items: center; overflow: hidden; font-size: 1.5rem; }
.photo-apercu.a-photo { border-style: solid; }
.prod .ph { display: none; height: 86px; margin: -12px -12px 6px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: var(--surface-2); }
.prod .ph.a-photo { display: block; }

/* ---------- Visite guidée (première vente) ---------- */
.visite { position: fixed; inset: 0; z-index: 180; pointer-events: none; }
.visite.sombre { background: rgba(8, 14, 11, .55); }
.v-trou { position: fixed; box-shadow: 0 0 0 200vmax rgba(8, 14, 11, .58); border: 3px solid #FDEF42; transition: left .25s, top .25s, width .25s, height .25s; animation: v-pulse 1.6s ease-in-out infinite; }
@keyframes v-pulse { 50% { border-color: #fff; outline: 6px solid rgba(253, 239, 66, .35); } }
.v-doigt { position: fixed; width: 48px; height: 48px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); animation: v-tape 1.2s ease-in-out infinite; transform-origin: 30% 20%; transition: left .25s, top .25s; }
.v-doigt svg { width: 48px; height: 48px; display: block; }
@keyframes v-tape { 0%, 100% { transform: translate(10px, 14px) scale(1); } 45% { transform: translate(2px, 2px) scale(.9); } 55% { transform: translate(2px, 2px) scale(.9); } }
.v-bulle { position: fixed; left: 12px; right: 12px; max-width: 420px; margin: 0 auto; pointer-events: auto; background: var(--surface); color: var(--text);
  border: 2px solid var(--brand); border-radius: 18px; padding: 12px 14px 10px; box-shadow: 0 14px 34px rgba(0,0,0,.3); animation: robot-bulle .25s ease-out; }
.v-tete { display: flex; align-items: center; gap: 8px; }
.v-robot svg { width: 34px; height: 34px; display: block; }
.v-etape { font-size: .78rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .03em; }
.v-texte { margin: 6px 0 8px; font-weight: 600; line-height: 1.45; }
.v-actions { display: flex; justify-content: space-between; gap: 8px; }
.v-actions .v-ok { margin-left: auto; }
body.visite-on .robot, body.visite-on .robot-bulle { display: none !important; }
.dm-visite { margin-top: 12px; min-height: 46px; font-weight: 700; color: var(--brand); border-color: var(--brand); }
@media (prefers-reduced-motion: reduce) { .v-trou, .v-doigt { animation: none; transition: none; } }
