/* Adetɔn — même famille que Sika : fond chaud, cartes claires, Figtree, boutons ronds. */
@font-face { font-family: 'Figtree'; font-style: normal; font-display: swap; font-weight: 300 900;
  src: url('../fonts/figtree-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-style: normal; font-display: swap; font-weight: 300 900;
  src: url('../fonts/figtree-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --brand: #0e5c43;        /* vert marché */
  --brand-dark: #09412f;
  --brand-soft: rgba(14, 92, 67, 0.09);
  --gold: #b7791f;         /* commissions */
  --gold-soft: #fbf1dc;
  --bg: #efebe7;
  --card: #faf8f5;
  --text: #1c1a1a;
  --muted: #6b6461;
  --line: #ddd6d0;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --ok: #1e7f4f;
  --ok-bg: #e5f3ea;
  --warn-bg: #fff4d6;
  --warn-text: #6b4e00;
  --info: #1f5fa8;
  --info-bg: #e6eef9;
  --radius: 10px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(0,0,0,.05);
  --nav-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.4; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; font-weight: 800; color: var(--brand-dark); letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- structure ---------- */
#app { min-height: 100vh; }
.shell { min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px 10px;
  padding-top: calc(12px + env(safe-area-inset-top)); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .title { flex: 1; min-width: 0; }
.topbar .shop { font-size: 12px; color: var(--muted); font-weight: 600; }
.topbar h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn {
  width: 40px; height: 40px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--card);
  display: inline-grid; place-items: center; cursor: pointer; position: relative; flex: none;
}
.iconbtn svg { width: 20px; height: 20px; }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
main { padding: 4px 16px 16px; max-width: 760px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card);
  border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; min-width: 0; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--brand); }
.tabbar a.plus span.dot {
  width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; margin-top: -6px;
}
.tabbar a.plus svg { width: 24px; height: 24px; }
.tabbar .brandmark, .tabbar .only-desk { display: none; }

/* ordinateur : barre de gauche */
@media (min-width: 1024px) {
  .shell { padding-bottom: 0; padding-left: 232px; }
  .tabbar {
    top: 0; right: auto; width: 232px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line);
    padding: 18px 12px; gap: 2px; overflow-y: auto;
  }
  .tabbar .brandmark { display: block; padding: 4px 10px 18px; }
  .tabbar .only-desk { display: flex; }
  .tabbar a {
    flex: none; height: 42px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px;
    border-radius: 10px; font-size: 14.5px;
  }
  .tabbar a.active { background: var(--brand-soft); }
  .tabbar a.plus span.dot { width: 22px; height: 22px; margin: 0; background: none; color: inherit; }
  .tabbar a.only-phone { display: none; }
  .tabbar .navsep { display: block; height: 1px; background: var(--line); margin: 10px 8px; }
  main { max-width: 1240px; padding: 8px 28px 28px; }
  .topbar { padding: 16px 28px 12px; }
}
.tabbar .navsep { display: none; }
.tabbar .dk { display: none; }
@media (min-width: 1024px) { .tabbar .dk { display: inline; } .tabbar .ph { display: none; } }
.brandmark .logo { font-size: 24px; font-weight: 900; color: var(--brand); letter-spacing: -0.02em; }
.brandmark .shopname { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }

/* ---------- cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card.tight { padding: 10px 12px; }
.card h2 { margin-bottom: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.section-title { margin: 22px 2px 8px; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.grid { display: grid; gap: 10px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } .grid.md-two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid.lg-three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid.lg-two-one { grid-template-columns: 2fr 1fr; } }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 22px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.main { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi.main .label, .kpi.main .sub { color: rgba(255,255,255,.8); }
.kpi.gold { background: var(--gold-soft); border-color: #efd9a9; }
.kpi.gold .value { color: #7a4f0c; }
.kpi.bad .value { color: var(--danger); }
.kpi.good .value { color: var(--ok); }
a.kpi { text-decoration: none; color: inherit; display: block; }

.hero {
  background: linear-gradient(140deg, var(--brand) 0%, #13775a 100%); color: #fff; border-radius: 14px; padding: 18px;
}
.hero .label { opacity: .85; font-weight: 600; font-size: 13.5px; }
.hero .big { font-size: 34px; font-weight: 900; letter-spacing: -0.02em; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.hero .sub { opacity: .9; font-size: 13.5px; }
.hero .pill-in { display: inline-block; background: rgba(255,255,255,.16); border-radius: var(--pill); padding: 3px 10px; font-size: 12.5px; font-weight: 600; margin-top: 8px; }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--pill); border: 1.5px solid var(--brand); background: transparent; color: var(--brand);
  font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger.primary { background: var(--danger); color: #fff; }
.btn.wa { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.btn.ghost { border-color: var(--line); color: var(--text); background: var(--card); }
.btn.block { width: 100%; }
.btn.big { min-height: 54px; font-size: 16.5px; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1 1 auto; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: var(--pill); padding: 7px 13px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--text);
}
a.chip, table.t a { text-decoration: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .count { opacity: .75; margin-left: 4px; }

/* ---------- formulaires ---------- */
label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 2px 5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 10px 12px; outline: none;
}
textarea.input { min-height: 70px; resize: vertical; }
.input:focus { border-color: var(--brand); }
.input.bigcode { font-size: 34px; letter-spacing: .5em; text-align: center; font-weight: 800; padding-left: .5em; }
.help { font-size: 12.5px; color: var(--muted); margin: 5px 2px 0; }
.form > * + * { margin-top: 12px; }
.seg { display: flex; border: 1.5px solid var(--line); border-radius: var(--pill); padding: 3px; background: #fff; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; min-height: 38px; border-radius: var(--pill); font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ---------- listes ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  display: block; color: inherit; text-decoration: none;
}
a.item:active { background: #f3efe9; }
.item .top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.item .name { font-weight: 700; }
.item .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.item .amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 1024px) { .list.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }

.status { display: inline-flex; align-items: center; border-radius: var(--pill); padding: 3px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st-confirmee { background: var(--info-bg); color: var(--info); }
.st-assignee { background: #ece8f7; color: #5b3fa0; }
.st-recuperee { background: var(--warn-bg); color: var(--warn-text); }
.st-livree { background: var(--ok-bg); color: var(--ok); }
.st-echec { background: var(--danger-bg); color: var(--danger); }
.st-annulee { background: #eceae8; color: var(--muted); }
.tag { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; background: #eceae8; color: var(--muted); }
.tag.gold { background: var(--gold-soft); color: #7a4f0c; }
.tag.red { background: var(--danger-bg); color: var(--danger); }
.tag.green { background: var(--ok-bg); color: var(--ok); }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 8px; border-bottom: 1px solid #ebe5df; vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t .num, table.t th.num { text-align: right; }
.tablewrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
.rank { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; background: #eceae8; }
.rank.r1 { background: #f5d77a; } .rank.r2 { background: #dcdcdc; } .rank.r3 { background: #e9b98e; }

/* ---------- commande ---------- */
.steps { display: flex; gap: 4px; margin: 4px 0 2px; }
.steps .s { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.steps .s .bar { height: 5px; border-radius: 3px; background: var(--line); margin-bottom: 6px; }
.steps .s.done .bar { background: var(--brand); }
.steps .s.done { color: var(--brand-dark); }
.steps .s.bad .bar { background: var(--danger); }
.steps .s .t { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.codebox { background: var(--gold-soft); border: 1px dashed #d8b46a; border-radius: 12px; padding: 14px; text-align: center; }
.codebox .code { font-size: 40px; font-weight: 900; letter-spacing: .22em; color: #6a430a; font-variant-numeric: tabular-nums; }
.lines { width: 100%; border-collapse: collapse; }
.lines td { padding: 6px 0; vertical-align: top; }
.lines td.num { text-align: right; }
.lines tr.sep td { border-top: 1px solid var(--line); padding-top: 9px; }
.lines tr.total td { font-weight: 800; font-size: 16px; }
.strike { text-decoration: line-through; color: var(--muted); font-size: 12px; margin-right: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 12px 18px; font-size: 13.5px; }
.timeline li::before { content: ''; position: absolute; left: 3px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ''; position: absolute; left: 6.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }

/* panier (nouvelle vente) */
.pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.pick.inCart { border-color: var(--brand); background: #f1f7f3; }
.pick .avail { font-size: 12.5px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--pill); background: #fff; }
.stepper button { width: 38px; height: 38px; border: 0; background: none; font-size: 20px; font-weight: 700; cursor: pointer; color: var(--brand); }
.stepper input { width: 46px; text-align: center; border: 0; outline: none; font-weight: 800; background: none; }
.cartline { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fff; }
.sticky-total {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 10; margin-top: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.12);
}
@media (min-width: 1024px) { .sticky-total { bottom: 12px; } }

/* graphique */
.chart { width: 100%; height: 190px; display: block; }
.chart .bar { fill: var(--brand); }
.chart .bar.today { fill: var(--gold); }
.chart .axis { stroke: var(--line); }
.chart text { font-size: 10.5px; fill: var(--muted); font-family: inherit; }

/* ---------- fenêtres ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,16,14,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .18s ease-out;
}
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h2 { margin-bottom: 12px; }
.sheet .close { float: right; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .5; } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); z-index: 80;
  background: #1c1a1a; color: #fff; border-radius: var(--pill); padding: 11px 18px; font-weight: 600; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100vw - 32px); display: flex; gap: 12px; align-items: center;
}
.toast.err { background: var(--danger); }
.toast button { background: rgba(255,255,255,.18); border: 0; color: #fff; border-radius: var(--pill); padding: 6px 12px; font-weight: 700; cursor: pointer; }
@media (min-width: 1024px) { .toast { bottom: 20px; left: calc(50% + 116px); } }

.notice { border-radius: 12px; padding: 11px 13px; font-size: 14px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice.bad { background: var(--danger-bg); color: var(--danger); }
.notice.good { background: var(--ok-bg); color: var(--ok); }
.notice.info { background: var(--info-bg); color: var(--info); }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty svg { width: 36px; height: 36px; opacity: .5; }
.loading { text-align: center; padding: 40px; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* connexion */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 380px; }
.auth .logo { font-size: 40px; font-weight: 900; color: var(--brand); letter-spacing: -0.03em; text-align: center; }
.auth .tag-line { text-align: center; color: var(--muted); margin: 2px 0 26px; font-weight: 600; }
.pinshow { font-size: 42px; font-weight: 900; letter-spacing: .2em; text-align: center; color: var(--brand-dark); background: #fff; border: 2px dashed var(--brand); border-radius: 14px; padding: 12px; }

.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--danger); color: #fff; text-align: center; font-size: 13px; font-weight: 700; padding: 5px; }

@media (max-width: 520px) { .grid.three .kpi { padding: 10px; } .grid.three .kpi .value { font-size: 17px; } .grid.three .kpi .label { font-size: 12px; } }
