/* MboaShop — feuille de style (mobile d'abord) */
:root {
  --green: #087F5B; --green-dark: #066A4C; --green-tint: #E6F4EE;
  --yellow: #F9B233; --yellow-dark: #E59E14; --yellow-tint: #FEF4DF;
  --red: #D92D20; --red-tint: #FDECEA;
  --ink: #102A2A; --ink-2: #3D5A55; --ink-3: #6B817D;
  --bg: #F7F9F8; --card: #FFFFFF; --line: #DDE5E2;
  --radius: 14px; --radius-sm: 10px;
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --brand-font: 'Fredoka', 'Poppins', system-ui, sans-serif;
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
p { margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ── Structure ── */
.app { min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 16px; }
.header { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--brand-font); font-weight: 700; font-size: 22px; letter-spacing: -0.3px; color: var(--green); white-space: nowrap; }
.brand .shop { color: var(--yellow); }
.brand svg { width: 34px; height: 34px; flex: none; }
.header-search { flex: 1; display: none; }
.header-actions { margin-left: auto; display: none; gap: 6px; align-items: center; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; color: var(--ink-3); position: relative; min-height: 44px; }
.bottom-nav a.active { color: var(--green); font-weight: 600; }
.bottom-nav svg { width: 24px; height: 24px; }
.dot { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
@media (min-width: 860px) {
  .app { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .header-search, .header-actions { display: flex; }
  h1 { font-size: 26px; }
  .container { padding: 24px 16px; }
}

/* ── Composants ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.muted { color: var(--ink-3); font-size: 13.5px; }
.small { font-size: 13px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.two-col { display: grid; gap: 16px; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1.2fr 1fr; align-items: start; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-align: center; transition: background .15s, transform .05s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); color: #fff; }
.btn-cta { background: var(--yellow); color: var(--ink); }
.btn-cta:hover:not(:disabled) { background: var(--yellow-dark); color: var(--ink); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--green-tint); color: var(--ink); }
.btn-danger { background: var(--card); border-color: var(--red); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); position: relative; }
.icon-btn svg { width: 22px; height: 22px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; font-size: 14px; }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; }
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--green); outline: 3px solid var(--green-tint); }
.hint { font-size: 13px; color: var(--ink-3); }
.search { position: relative; width: 100%; }
.search input { padding-left: 42px; background: var(--bg); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ink-3); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--green-tint); color: var(--green-dark); white-space: nowrap; }
.badge-yellow { background: var(--yellow-tint); color: #8A5A00; }
.badge-red { background: var(--red-tint); color: #A3241A; }
.badge-grey { background: #EEF2F1; color: var(--ink-2); }
.protected { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--green-tint); color: var(--green-dark); font-weight: 600; font-size: 13px; }
.protected svg { width: 20px; height: 20px; flex: none; }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.alert-error { background: var(--red-tint); color: #8E1F16; }
.alert-ok { background: var(--green-tint); color: var(--green-dark); }
.alert-info { background: var(--yellow-tint); color: #6B4500; }

/* ── Annonces ── */
.product { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); height: 100%; }
.product:hover { color: var(--ink); border-color: #C3D3CE; }
.thumb { aspect-ratio: 1 / 1; width: 100%; object-fit: cover; background: var(--green-tint); }
.thumb-ph { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--green-tint), #F2F7F5); color: var(--green); }
.thumb-ph svg { width: 42%; height: 42%; opacity: .55; }
.product-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-title { font-size: 14px; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.price { font-weight: 700; font-size: 16px; color: var(--ink); }
.price-lg { font-size: 26px; }
.stars { color: var(--yellow-dark); letter-spacing: 1px; }

.hero { background: var(--green); color: #fff; border-radius: var(--radius); padding: 22px 18px; position: relative; overflow: hidden; }
.hero h1 { font-family: var(--brand-font); font-size: 26px; color: #fff; margin-bottom: 8px; }
.hero p { color: #D7EFE5; margin-bottom: 14px; }
.hero .search input { background: #fff; }
.hero-points { display: grid; gap: 8px; margin-top: 14px; grid-template-columns: repeat(3, 1fr); }
.hero-point > span:last-child { font-size: 0; }
.hero-point > span:last-child b { font-size: 12.5px; line-height: 1.3; }
.hero-point { flex-direction: column; align-items: flex-start; gap: 6px; }
.hero-point { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: #E8F6F0; }
.hero-point b { color: #fff; display: block; font-size: 14px; }
.hero-point .ic { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; flex: none; }
.hero-point svg { width: 18px; height: 18px; }
.hero-stripe { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: linear-gradient(90deg, var(--green-dark) 0 50%, var(--red) 50% 66%, var(--yellow) 66%); }
@media (min-width: 860px) {
  .hero { padding: 36px 32px 40px; } .hero h1 { font-size: 36px; } .hero .search { display: none; }
  .hero-point { flex-direction: row; gap: 10px; } .hero-point > span:last-child { font-size: 13.5px; } .hero-point > span:last-child b { font-size: 14px; }
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); white-space: nowrap; cursor: pointer; font-size: 14px; min-height: 40px; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.gallery { border-radius: var(--radius); overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.gallery-main { aspect-ratio: 1 / 1; width: 100%; object-fit: contain; background: #fff; }
.gallery-thumbs { display: flex; gap: 8px; padding: 8px; overflow-x: auto; }
.gallery-thumbs button { border: 2px solid transparent; border-radius: 8px; padding: 0; background: none; cursor: pointer; flex: none; }
.gallery-thumbs button.active { border-color: var(--green); }
.gallery-thumbs img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }

.shop-head { display: flex; gap: 14px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 14px; background: var(--green-tint); color: var(--green); display: flex; align-items: center; justify-content: center; font-family: var(--brand-font); font-weight: 700; font-size: 22px; flex: none; object-fit: cover; }
.avatar-sm { width: 40px; height: 40px; font-size: 16px; border-radius: 10px; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qty button { width: 44px; height: 44px; border: 0; background: var(--card); font-size: 20px; cursor: pointer; }
.qty span { min-width: 36px; text-align: center; font-weight: 600; }

/* ── Commandes ── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 28px; font-size: 14px; color: var(--ink-3); }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li::after { content: ''; position: absolute; left: 10px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--green); }
.timeline li.current { color: var(--ink); font-weight: 600; }
.timeline li.current::before { background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-tint); }
.code-box { display: flex; justify-content: center; gap: 8px; font-family: var(--brand-font); font-size: 34px; font-weight: 700; letter-spacing: 6px; color: var(--green-dark); background: var(--green-tint); border-radius: 12px; padding: 12px; }
.line-item { display: flex; gap: 12px; align-items: center; }
.line-item img, .line-item .thumb-ph { width: 56px; height: 56px; border-radius: 10px; flex: none; aspect-ratio: auto; }
.pay-option { display: flex; align-items: center; gap: 12px; padding: 14px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--card); width: 100%; text-align: left; min-height: 64px; }
.pay-option.selected { border-color: var(--green); background: var(--green-tint); }
.op-logo { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: none; }
.op-mtn { background: #FFCC00; color: #1A1A1A; }
.op-orange { background: #FF7900; color: #fff; }
.op-link { background: var(--ink); color: #fff; }

/* ── Messagerie ── */
.chat { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 12px; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 16px; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble img { border-radius: 10px; max-width: 220px; }
.bubble .time { display: block; font-size: 11px; opacity: .7; margin-top: 3px; text-align: right; }
.composer { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; display: flex; gap: 8px; }
@media (min-width: 860px) { .composer { bottom: 0; } }
.list-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { color: var(--ink); }

/* ── Vendeur ── */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 20px; }
.stat-green { background: var(--green); color: #fff; border-color: var(--green); }
.stat-green .muted { color: #D7EFE5; }
.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 10px 12px; color: var(--ink-3); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.tabs a.active { color: var(--green); border-color: var(--green); }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-grid .ph { position: relative; width: 84px; height: 84px; }
.photo-grid img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; }
.photo-grid .add { width: 84px; height: 84px; border: 2px dashed var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-3); background: var(--card); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--green-tint); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 32px 16px; color: var(--ink-3); }
.empty svg { width: 48px; height: 48px; margin: 0 auto 10px; opacity: .5; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px); z-index: 50; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(16,42,42,.25); }
@media (min-width: 860px) { .toast { bottom: 24px; } }
.footer { border-top: 1px solid var(--line); margin-top: 32px; padding: 24px 16px 32px; text-align: center; color: var(--ink-3); font-size: 13px; }
/* Barre d'achat collante sur mobile */
.buy-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 25; background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.buy-bar .btn { flex: 1; }
.has-buy-bar { padding-bottom: 76px; }
@media (min-width: 860px) { .buy-bar { display: none; } .has-buy-bar { padding-bottom: 0; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Back-office ── */
.admin { max-width: 1280px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.admin-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.admin-nav a { padding: 9px 12px; border-radius: 10px; color: var(--ink-2); white-space: nowrap; font-size: 14px; font-weight: 500; min-height: 40px; display: flex; align-items: center; border: 1px solid var(--line); background: var(--card); }
.admin-nav a.active { background: var(--green); color: #fff; border-color: var(--green); }
.admin-nav-title { display: none; }
.admin-main { min-width: 0; }
@media (min-width: 960px) {
  .admin { grid-template-columns: 230px 1fr; align-items: start; padding: 24px 16px; }
  .admin-nav { flex-direction: column; position: sticky; top: 76px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
  .admin-nav a { border: 0; background: none; }
  .admin-nav a.active { background: var(--green-tint); color: var(--green-dark); }
  .admin-nav-title { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 4px 12px 8px; font-weight: 600; }
}
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 860px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.queue-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.queue { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: var(--ink-2); }
.queue b { font-size: 26px; color: var(--ink-3); }
.queue:hover { color: var(--ink); border-color: #C3D3CE; }
.queue-hot { border-color: var(--yellow); background: var(--yellow-tint); color: var(--ink); }
.queue-hot b { color: var(--ink); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.admin-row { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.doc-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--red); background: var(--red-tint); border-radius: 0 8px 8px 0; font-size: 14px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.switch { width: 48px; height: 28px; border-radius: 14px; border: 0; background: #C9D4D0; position: relative; cursor: pointer; padding: 0; }
.switch span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--green); }
.switch.on span { left: 23px; }

/* Contenu pré-rempli par le serveur (Google, WhatsApp) — remplacé par l'application au chargement */
.prerender { max-width: 720px; margin: 0 auto; padding: 24px 16px; font-family: Poppins, system-ui, sans-serif; color: #1A1A2E; }
.prerender img { max-width: 100%; height: auto; border-radius: 12px; }
.prerender a { color: #087F5B; }

/* ───── Livraison et livreurs ───── */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; font: inherit; color: var(--ink); min-height: 44px; }
.choice svg { color: var(--green); }
.choice:hover { border-color: var(--green); }
.choice.on, .choice[aria-checked="true"] { border-color: var(--green); background: var(--green-tint); }
.delivery-box { background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.delivery-box svg { vertical-align: -3px; }
.availability { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); cursor: pointer; font: inherit; color: var(--ink); }
.availability-dot { width: 16px; height: 16px; border-radius: 50%; background: #B8C4C0; flex: none; box-shadow: 0 0 0 4px #EEF2F1; }
.availability.on { border-color: var(--green); background: var(--green-tint); }
.availability.on .availability-dot { background: var(--green); box-shadow: 0 0 0 4px #BFE3D3; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tabs button { padding: 10px 12px; color: var(--ink-3); border: 0; border-bottom: 3px solid transparent; background: none; white-space: nowrap; font: inherit; font-weight: 500; min-height: 44px; cursor: pointer; }
.tabs button.active { color: var(--green); border-color: var(--green); }
.job-earning { font-size: 22px; color: var(--green-dark); }
.job svg, .leg svg { vertical-align: -3px; }
.leg { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-left: 4px solid var(--line); background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 14px; }
.leg-now { border-color: var(--yellow); background: var(--yellow-tint); }
.leg-done { border-color: var(--green); opacity: .75; }
@media (max-width: 420px) { .choice-grid { grid-template-columns: 1fr; } }
