:root {
  --brand: #15803d; --brand-2: #14532d; --brand-soft: #ecfccb;
  --accent: #7be403; --accent-soft: #f3fde4;
  --bg: #f6f7f5; --card: #ffffff; --ink: #14201e; --muted: #66736f; --line: #e4e8e6;
  --bad: #c2410c; --bad-soft: #fdecea; --ok: #15803d; --warn: #b45309;
  --r: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(20,40,10,.07);
  --font: 'Noto Sans Arabic', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
html[dir=ltr] body { font-family: 'Inter', 'Noto Sans Arabic', system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Coquille ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-family: 'Inter', sans-serif; }
.brand b { color: var(--brand); }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; display: block; }
.top-actions { display: flex; gap: 6px; }
.mini { padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 96px; }
main.wide { max-width: 1300px; padding-bottom: 40px; }
.tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; font-size: 11px; color: var(--muted); text-align: center; }
.tabs a span { font-size: 20px; line-height: 1; }
.tabs a.on { color: var(--brand); font-weight: 600; }
.cart-ic { position: relative; }
.cart-ic i { position: absolute; top: -6px; inset-inline-end: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font: 700 11px/18px 'Inter', sans-serif; font-style: normal; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* ---------- Éléments ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; transition: transform .05s, background .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-danger { background: #fff; border-color: #f3c3b5; color: var(--bad); }
.btn-lg { padding: 14px 20px; font-size: 16px; }
.btn-block { display: flex; width: 100%; margin-top: 12px; }
.btn-sm { padding: 5px 9px; font-size: 13px; border-radius: 9px; }
.btn-add { width: 100%; padding: 8px; font-size: 13px; background: var(--brand-soft); border-color: transparent; color: var(--brand-2); }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.err { color: var(--bad); background: var(--bad-soft); padding: 10px 12px; border-radius: 10px; margin: 0; }
.ok { color: var(--ok); }
.link { color: var(--brand); font-weight: 600; }
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); }
.title { font-size: 22px; }
.sec { font-size: 18px; margin: 22px 0 10px; }
.sec-row { display: flex; align-items: baseline; justify-content: space-between; }
.sec-row a { color: var(--brand); font-weight: 600; font-size: 14px; }
.box, .summary { background: var(--card); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); margin: 12px 0; }

/* Accueil */
.hero { background: linear-gradient(135deg, #0c130a 0%, #14532d 65%, #15803d 100%); color: #fff; border-radius: 20px;
  padding: 22px 20px; margin-bottom: 14px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.08);
  inset-inline-end: -50px; top: -60px; }
.hero h1 { font-size: 22px; margin-bottom: 4px; }
.hero p { margin: 0 0 12px; opacity: .9; }
.hero-cod { display: inline-block; background: var(--accent); color: #142a03; font-weight: 700; padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.search input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 14px; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; background: #fff; border-radius: var(--r);
  box-shadow: var(--shadow); font-size: 12px; text-align: center; }
.cat-ic { font-size: 26px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chip { flex: none; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Grille produits */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card-img { position: relative; aspect-ratio: 1; background: #f0f2f1; }
.pimg { width: 100%; height: 100%; object-fit: cover; }
.pimg.ph { display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft)); font-size: 44px; }
.pimg.ph.big { font-size: 90px; }
.badge { position: absolute; top: 8px; inset-inline-start: 8px; padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.badge.sale { background: var(--accent); color: #142a03; }
.badge.out { background: rgba(20,32,30,.75); color: #fff; inset-inline-start: auto; inset-inline-end: 8px; }
.card-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.price { font-weight: 800; color: var(--brand-2); font-family: 'Inter', sans-serif; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.price s { color: var(--muted); font-weight: 400; font-size: 12px; margin-inline-start: 4px; }
.card-body .btn-add, .card-body .stepper { margin-top: auto; }
.stepper { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; min-width: 120px; }
.stepper button { width: 38px; height: 36px; border: 0; background: var(--brand-soft); color: var(--brand-2); font-size: 18px; cursor: pointer; }
.stepper button:disabled { opacity: .4; }
.stepper span { font-weight: 700; font-family: 'Inter', sans-serif; }

/* Fiche produit */
.pdp { display: grid; gap: 18px; }
@media (min-width: 800px) { .pdp { grid-template-columns: 1fr 1fr; } }
.pdp-img { border-radius: 20px; overflow: hidden; aspect-ratio: 1; background: #fff; box-shadow: var(--shadow); }
.pdp h1 { font-size: 22px; }
.pdp .price { font-size: 24px; margin: 6px 0; }
.st { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.st.ok { background: #e7f6ec; color: var(--ok); } .st.low { background: var(--accent-soft); color: var(--warn); } .st.out { background: var(--bad-soft); color: var(--bad); }
.pdp-actions { display: flex; gap: 10px; align-items: center; margin: 16px 0; flex-wrap: wrap; }
.pdp-actions .btn-lg { flex: 1; }
.desc { color: #34423f; }
.cod-note { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border: 1px solid #f7deaa; padding: 12px 14px;
  border-radius: 12px; font-size: 14px; margin: 12px 0; text-align: start; }

/* Panier */
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { display: flex; gap: 12px; align-items: center; background: var(--card); padding: 10px; border-radius: var(--r); box-shadow: var(--shadow); }
.line-img { width: 72px; height: 72px; flex: none; border-radius: 10px; overflow: hidden; }
.line-img .pimg.ph { font-size: 28px; }
.line-info { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.line-info .stepper { width: 130px; }
.line-total { font-weight: 700; font-family: 'Inter', sans-serif; white-space: nowrap; }
.summary .row { display: flex; justify-content: space-between; padding: 4px 0; }
.summary .row.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; font-size: 18px; }
.empty-state { text-align: center; padding: 40px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.big-ic { font-size: 56px; }
.done h1 { color: var(--ok); }
.total-big { font-size: 26px; font-weight: 800; font-family: 'Inter', sans-serif; margin: 0; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; }
.form small { font-weight: 400; color: var(--muted); font-size: 12px; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .form textarea {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-weight: 400; width: 100%; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
fieldset.pay { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin: 0; background: #fff; }
fieldset.pay legend { font-weight: 700; padding: 0 6px; }
.radio { flex-direction: row !important; align-items: flex-start; gap: 10px !important; font-weight: 400 !important; }
.radio input { margin-top: 5px; accent-color: var(--brand); }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400 !important; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.auth { max-width: 420px; margin: 10px auto; text-align: center; }
.auth .form { text-align: start; margin-bottom: 14px; }
.logo-big { font-size: 48px; }
.menu { display: flex; flex-direction: column; background: #fff; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.menu a { padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.menu a:last-child { border: 0; }

/* Commandes client */
.orders { display: flex; flex-direction: column; gap: 10px; }
.order-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; padding: 12px 14px; border-radius: var(--r); box-shadow: var(--shadow); }
.order-row .end { text-align: end; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-weight: 700; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.s-recue { background: #eef2ff; color: #3730a3; } .s-confirmee, .s-preparation { background: #e0f2fe; color: #075985; }
.s-expediee, .s-livraison { background: var(--accent-soft); color: var(--warn); }
.s-livree, .s-payee { background: #e7f6ec; color: var(--ok); }
.s-refusee, .s-annulee { background: var(--bad-soft); color: var(--bad); }
.p-approved { background: #e7f6ec; color: var(--ok); } .p-pending { background: var(--accent-soft); color: var(--warn); }
.p-rejected { background: var(--bad-soft); color: var(--bad); } .p-sold { background: #eef0ef; color: var(--muted); }
.timeline { list-style: none; padding: 16px; margin: 0 0 12px; background: #fff; border-radius: var(--r); box-shadow: var(--shadow); }
.timeline li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; color: var(--muted); position: relative; }
.timeline li:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 7px; top: 28px; height: calc(100% - 16px); width: 2px; background: var(--line); }
.timeline li.done { color: var(--ink); } .timeline li.done:not(:last-child)::after { background: var(--brand); }
.timeline .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); background: #fff; }
.timeline li.done .dot { background: var(--brand); border-color: var(--brand); }
.timeline li.now .dot { box-shadow: 0 0 0 5px var(--brand-soft); }
.timeline li.now span { font-weight: 700; }
.timeline small { color: var(--muted); font-size: 12px; }
.cancelled-box { margin-bottom: 12px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 600; transition: .25s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }

/* ---------- Admin ---------- */
.admin { display: grid; gap: 16px; font-family: 'Inter', system-ui, sans-serif; }
@media (min-width: 900px) { .admin { grid-template-columns: 210px 1fr; align-items: start; } }
.admin-nav { display: flex; gap: 6px; overflow-x: auto; background: #fff; padding: 8px; border-radius: var(--r); box-shadow: var(--shadow); }
@media (min-width: 900px) { .admin-nav { flex-direction: column; position: sticky; top: 76px; } }
.admin-nav a { padding: 9px 12px; border-radius: 10px; white-space: nowrap; font-weight: 600; font-size: 14px; }
.admin-nav a.on { background: var(--brand-soft); color: var(--brand-2); }
.admin-nav .to-shop { color: var(--muted); font-weight: 400; }
.admin-body { min-width: 0; }
.admin h1 { font-size: 24px; }
.admin h2 { font-size: 16px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.head-row h1 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpis.small { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.kpi { background: #fff; border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.kpi span { color: var(--muted); font-size: 13px; } .kpi b { font-size: 22px; } .kpi small { color: var(--muted); }
.kpis.small b { font-size: 20px; }
.panel { background: #fff; border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.chart { width: 100%; height: auto; }
.chart .bar { fill: var(--brand); } .chart .bar:hover { fill: var(--accent); }
.chart .axis { font-size: 10px; fill: var(--muted); }
.toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); font-size: 14px; }
.panel .tbl { box-shadow: none; }
.tbl th { text-align: start; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfa; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #f7faf9; }
.tbl tr.total td { font-weight: 800; }
.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bad { color: var(--bad); font-weight: 700; } .warn { color: var(--warn); font-weight: 700; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: #f0f2f1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 16px; }
.cols { display: grid; gap: 14px; } @media (min-width: 800px) { .cols { grid-template-columns: 1fr 1fr; } }
.cols .panel p { margin: 6px 0; }
.cols a { color: var(--brand); font-weight: 600; }
.hist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-form { max-width: 820px; }
.lang-block { display: grid; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.lang-block:last-child { border: 0; }
@media (min-width: 700px) { .lang-block { grid-template-columns: 1fr 1.4fr; } }
.grid2 { display: grid; gap: 12px; } @media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.img-edit { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.img-prev { width: 120px; height: 120px; border-radius: 12px; overflow: hidden; background: #f0f2f1; display: grid; place-items: center; font-size: 36px; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }
.scroll { overflow-x: auto; }
.tbl.edit input:not([type=checkbox]) { width: 100%; min-width: 110px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; }
.tbl.edit .w-ic { min-width: 50px; width: 56px; text-align: center; }
.tbl.edit .w-num { min-width: 70px; width: 90px; }
.nowrap { white-space: nowrap; }

/* Ajouts */
.hero-free { margin-top: 8px; font-size: 13px; opacity: .95; }
.free-hint { padding: 2px 0 4px; }
.city-other { margin-top: 6px; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumbs button { width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; flex: none; background: #fff; }
.thumbs button.on { border-color: var(--brand); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.alert { display: block; background: var(--accent-soft); border: 1px solid #f7deaa; color: #6b4200; padding: 10px 14px; border-radius: 12px; margin: 0 0 12px; font-weight: 600; }
.chart .val { font-size: 10px; fill: var(--ink); }
.big-pay { font-size: 18px; }
.img-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.img-tile { position: relative; width: 110px; height: 110px; border-radius: 12px; overflow: hidden; background: #f0f2f1; display: grid; place-items: center; }
.img-tile img { width: 100%; height: 100%; object-fit: cover; }
.img-tile:first-child::after { content: 'Principale'; position: absolute; bottom: 0; inset-inline: 0; background: rgba(15,118,110,.85); color: #fff; font-size: 11px; text-align: center; padding: 2px; }
.img-tile button { position: absolute; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 12px; }
.img-tile [data-rm] { right: 4px; } .img-tile [data-left] { left: 4px; }
.file-btn { display: inline-flex !important; flex-direction: row !important; padding: 9px 14px; border: 1px dashed var(--brand); border-radius: 11px; color: var(--brand); cursor: pointer; width: fit-content; }
.form label.inline { flex-direction: row; align-items: center; gap: 10px; margin-top: 10px; font-weight: 400; }
.form .w-ic { width: 64px !important; text-align: center; }
.tabs[hidden] { display: none; }

/* Favoris */
.card { position: relative; }
.heart { border: 0; background: rgba(255,255,255,.92); color: var(--muted); width: 34px; height: 34px; border-radius: 50%;
  font-size: 18px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.12); flex: none; }
.heart.on { color: #e11d48; }
.heart.on-card { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 2; }
.card .badge.out { top: 48px; }
.heart.big { width: 44px; height: 44px; font-size: 24px; }
.pdp-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
/* Avis */
.reviews { margin-top: 24px; background: #fff; border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.reviews h3 { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.avg { font-size: 14px; font-weight: 600; color: var(--muted); }
.stars { color: var(--accent); letter-spacing: 1px; direction: ltr; unicode-bidi: isolate; }
.stars .off { color: #d9dedc; } .stars.sm { font-size: 13px; }
.review { border-top: 1px solid var(--line); padding: 10px 0; }
.review-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.review p { margin: 4px 0 0; }
.review-form { background: var(--brand-soft); padding: 12px; border-radius: 12px; margin-bottom: 12px; }
.rate-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; direction: ltr; gap: 2px; }
.rate-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate-input label { font-size: 30px; color: #cfd6d3; cursor: pointer; font-weight: 400 !important; }
.rate-input input:checked ~ label, .rate-input label:hover, .rate-input label:hover ~ label { color: var(--accent); }
.rate-input input:focus-visible + label { outline: 2px solid var(--brand); border-radius: 4px; }
/* Vendeur */
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.mine { display: flex; gap: 10px; align-items: center; min-width: 0; }
.order-row .thumb { flex: none; }

.hero-logo { position: absolute; inset-inline-end: 14px; top: 14px; width: 64px; height: 64px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); z-index: 1; }
.hero h1, .hero p { padding-inline-end: 72px; position: relative; z-index: 1; }
.logo-img { width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 6px; display: block; box-shadow: var(--shadow); }
.cod-note { background: #fffbeb; border-color: #fde68a; }
