/* 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: 66px;
  --tap: 48px;            /* zone à toucher standard (≥ 44 px, recommandé 48) */
}

* { 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: 16px; line-height: 1.45; 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: 18px; } h3 { font-size: 16px; }
.muted { color: var(--muted); } .small { font-size: 14px; } .tiny { font-size: 12.5px; }
.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: 12.5px; color: var(--muted); font-weight: 600; }
.topbar h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn {
  width: 44px; height: 44px; 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: 12px; 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: 12px; font-weight: 700;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--brand); }
.tabbar a.plus span.dot {
  width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; margin-top: -8px; box-shadow: 0 4px 12px rgba(14,92,67,.35);
}
.tabbar a.plus svg { width: 24px; height: 24px; }
.tabbar .brandmark, .tabbar .only-desk { display: none; }

/* Trois mises en page :
   téléphone (< 700 px) : barre d'onglets en bas ;
   tablette (700–1099 px) : colonne d'icônes à gauche, tout le menu visible ;
   ordinateur (≥ 1100 px) : barre de gauche complète, tableau de bord détaillé. */
.tabbar .navsep { display: none; }
.tabbar .dk { display: none; }
html:not([data-device=phone]) .shell { padding-bottom: 0; padding-left: 92px; }
html:not([data-device=phone]) .tabbar { top: 0; right: auto; width: 92px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 12px 8px; gap: 2px; overflow-y: auto; scrollbar-width: none; }
html:not([data-device=phone]) .tabbar::-webkit-scrollbar { display: none; }
html:not([data-device=phone]) .tabbar .only-desk { display: flex; }
html:not([data-device=phone]) .tabbar a.only-phone { display: none; }
html:not([data-device=phone]) .tabbar a { flex: none; height: 62px; border-radius: 12px; font-size: 12px; text-align: center; line-height: 1.15; padding: 0 2px; }
html:not([data-device=phone]) .tabbar a.active { background: var(--brand-soft); }
html:not([data-device=phone]) .tabbar a.plus span.dot { width: 36px; height: 36px; margin: 0; }
html:not([data-device=phone]) .tabbar .navsep { display: block; height: 1px; background: var(--line); margin: 6px 10px; }
html:not([data-device=phone]) .tabbar .brandmark { display: block; padding: 2px 0 10px; text-align: center; }
html:not([data-device=phone]) .tabbar .brandmark .logo { font-size: 15px; }
html:not([data-device=phone]) .tabbar .brandmark .shopname { display: none; }
html:not([data-device=phone]) main { max-width: 1000px; padding: 8px 22px 24px; }
html:not([data-device=phone]) .topbar { padding: 14px 22px 10px; }
html:not([data-device=phone]) .toast { bottom: 20px; left: calc(50% + 46px); }
html:not([data-device=phone]) .sticky-total { bottom: 12px; }
html:not([data-device=phone]) .list.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
html:not([data-device=phone]) .grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html[data-device=desktop] .shell { padding-left: 236px; }
html[data-device=desktop] .tabbar { width: 236px; padding: 18px 12px; }
html[data-device=desktop] .tabbar .brandmark { text-align: left; padding: 4px 10px 18px; }
html[data-device=desktop] .tabbar .brandmark .logo { font-size: 24px; }
html[data-device=desktop] .tabbar .brandmark .shopname { display: block; }
html[data-device=desktop] .tabbar a { height: 42px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 14.5px; text-align: left; }
html[data-device=desktop] .tabbar a.plus span.dot { width: 22px; height: 22px; background: none; color: inherit; }
html[data-device=desktop] .tabbar .navsep { margin: 10px 8px; }
html[data-device=desktop] .tabbar .dk { display: inline; }
html[data-device=desktop] .tabbar .ph { display: none; }
html[data-device=desktop] main { max-width: 1480px; padding: 8px 28px 28px; }
html[data-device=desktop] .topbar { padding: 16px 28px 12px; }
html[data-device=desktop] .toast { left: calc(50% + 118px); }
html[data-device=desktop] .grid.lg-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html[data-device=desktop] .grid.lg-two-one { grid-template-columns: 2fr 1fr; }
html[data-device=desktop] .grid.lg-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-device=tablet] .grid.md-two-t { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.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; }
.only-phone-block { display: block; } .only-wide { display: none; }
@media (min-width: 700px) { .only-phone-block { display: none; } .only-wide { display: block; } }

/* ---------- 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.md-two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.kpi .label { font-size: 13px; 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: 12.5px; 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: var(--tap); padding: 0 20px; font-size: 16px;
  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.wave { background: #1dc4ff; border-color: #1dc4ff; color: #062033; }
.btn.ghost { border-color: var(--line); color: var(--text); background: var(--card); }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 17px; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14.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: 0 16px; min-height: 44px;
  display: inline-flex; align-items: center; font-size: 14.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: 14px; font-weight: 700; color: var(--muted); margin: 0 2px 5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 52px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 14px; outline: none; font-size: 16px; /* 16 px : l'iPhone ne zoome pas */
}
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: 13px; 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: 44px; font-size: 15px; 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: 13.5px; color: var(--muted); margin-top: 3px; }
.item .amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.status { display: inline-flex; align-items: center; border-radius: var(--pill); padding: 4px 10px; font-size: 12.5px; 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: 2px 8px; font-size: 12.5px; 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: 12.5px; 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: 12px; 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: 12px; 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: 13px; 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: 46px; height: 46px; border: 0; background: none; font-size: 20px; font-weight: 700; cursor: pointer; color: var(--brand); }
.stepper input { width: 48px; height: 46px; text-align: center; border: 0; outline: none; font-weight: 800; background: none; font-size: 17px; }
.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);
}

/* 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: 12px; 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: 16px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .18s ease-out; overscroll-behavior: contain;
}
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 14px; }
.sheet-head h2 { margin: 0; font-size: 19px; }
body.noscroll { overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .5; } }

.toast {
  position: fixed; font-size: 15px; 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: 0 14px; min-height: 40px; font-weight: 700; cursor: pointer; }

.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: 14px; 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; } }

/* ---------- v0.2 : photos, écarts, interrupteurs ---------- */
.thumb { border-radius: 8px; object-fit: cover; background: #fff; border: 1px solid var(--line); flex: none; display: inline-block; vertical-align: middle; }
.thumb.none { display: inline-grid; place-items: center; color: #c9c0b8; background: #f4f0ec; }
.thumb.none svg { width: 55%; height: 55%; }
.photo-pick { display: flex; gap: 12px; align-items: center; }
.photo-pick .thumb { cursor: pointer; }
.photo-pick input[type=file] { display: none; }
.delta { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.delta.up { background: var(--ok-bg); color: var(--ok); } .delta.down { background: var(--danger-bg); color: var(--danger); } .delta.flat { background: #eceae8; color: var(--muted); }
.kpi.main .delta.up, .kpi.main .delta.down, .kpi.main .delta.flat { background: rgba(255,255,255,.18); color: #fff; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.toggle + .toggle { margin-top: 8px; }
.toggle input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: #cfc7c0; position: relative; flex: none; cursor: pointer; transition: background .15s; margin: 2px 0 0; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--brand); } .toggle input:checked::after { left: 21px; }
.toggle b { display: block; } .toggle .help { margin: 2px 0 0; }
.hbar { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 5px 0; }
.hbar .l { width: 44px; color: var(--muted); font-weight: 600; flex: none; }
.hbar .b { flex: 1; height: 16px; background: #efe9e3; border-radius: 4px; overflow: hidden; }
.hbar .b i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.hbar .v { width: 92px; text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.danger-zone { border-color: #efc4bf; }
.danger-zone h2 { color: var(--danger); }
.pick .thumb, .cartline .thumb { width: 40px; height: 40px; }
.seg button svg { width: 17px; height: 17px; vertical-align: -3px; margin-right: 5px; }
details > summary { list-style: none; } details > summary::before { content: '▸ '; } details[open] > summary::before { content: '▾ '; }

/* ---------- v0.3 : bandeau d'abonnement, écran Abonnement, accueil façon Wave ---------- */
.licbar { display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 0 16px 8px; padding: 10px 14px; border-radius: 12px; text-decoration: none; font-size: 14.5px; font-weight: 600; }
.licbar svg { width: 20px; height: 20px; flex: none; }
.licbar .grow { flex: 1; }
.licbar.info { background: var(--info-bg); color: var(--info); }
.licbar.warn { background: var(--warn-bg); color: var(--warn-text); }
.licbar.bad { background: var(--danger); color: #fff; }
html:not([data-device=phone]) .licbar { margin: 0 22px 10px; }
html[data-device=desktop] .licbar { margin: 0 28px 10px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 4px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 7px; text-decoration: none; color: var(--text); font-size: 13px; font-weight: 700; text-align: center; min-height: 84px; padding-top: 2px; }
.quick a .ic { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.quick a.main .ic { background: var(--brand); color: #fff; }
.quick a .ic svg { width: 26px; height: 26px; }
.pcard { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; min-height: 72px; }
.pcard .grow { min-width: 0; }
.pcard .name { font-weight: 700; }
.pcard .meta { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.pcard .big { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.pcard .big small { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.plan { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.plan + .plan { margin-top: 8px; }
.plan .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.plan.on { border-color: var(--brand); background: #f1f7f3; }
.plan.on .dot { border-color: var(--brand); }
.plan.on .dot::after { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); }
.plan .grow { flex: 1; min-width: 0; }
.plan .t { display: block; font-weight: 800; font-size: 16px; }
.plan .s { display: block; font-size: 13.5px; color: var(--muted); }
.plan .p { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.plan .p small { display: block; font-size: 12.5px; color: var(--ok); font-weight: 700; }
.plan[disabled] { opacity: .45; cursor: not-allowed; }
.durs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.durs .plan + .plan { margin-top: 0; }
.bigcheck { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 6px auto 12px; background: var(--ok-bg); color: var(--ok); }
.bigcheck svg { width: 40px; height: 40px; }
.bigcheck.wait { background: var(--warn-bg); color: var(--warn-text); }
.steplist { list-style: none; margin: 0; padding: 0; counter-reset: st; }
.steplist li { position: relative; padding: 0 0 16px 44px; counter-increment: st; }
.steplist li::before { content: counter(st); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 15px; }
.steplist li.done::before { content: '✓'; background: var(--ok, #1f9d55); }
.meter { height: 10px; border-radius: 5px; background: rgba(255,255,255,.25); overflow: hidden; margin-top: 12px; }
.meter i { display: block; height: 100%; background: #fff; border-radius: 5px; }
.copyrow { display: flex; gap: 8px; align-items: center; }
.copyrow .input { font-variant-numeric: tabular-nums; font-weight: 700; }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; }
.filters { display: flex; gap: 8px; margin: 8px 0 10px; }
.filters select { max-width: 220px; }
html[data-device=phone] .filters { flex-direction: column; }
html[data-device=phone] .filters select { max-width: none; }
input.chip { font-size: 16px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tag { white-space: nowrap; }
/* un libellé long passe à la ligne au lieu de dépasser (petits téléphones) */
.btn.block, .btn.big, .grid > .btn, .btns > .btn { white-space: normal; text-align: center; line-height: 1.2; padding-top: 8px; padding-bottom: 8px; }
details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
/* petits téléphones : 3 cases côte à côte deviennent 2 + 1 large (les montants ne sont plus coupés) */
@media (max-width: 380px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.three > :nth-child(3):last-child { grid-column: span 2; } }
/* montants : la taille suit la largeur de l'écran (jamais coupés sur 320 px) */
.kpi .value { font-size: clamp(16px, 5.2vw, 22px); }
.hero .big { font-size: clamp(28px, 9.5vw, 34px); }

/* ---------- v0.3.1 : plus léger (pastilles, textes, icônes, menu, glisser d'un écran à l'autre) ---------- */
:root { --nav-h: 60px; }
h1 { font-size: 21px; } h2 { font-size: 17px; font-weight: 700; } h3 { font-size: 15.5px; font-weight: 700; }
.topbar { padding-bottom: 8px; }
.topbar .shop { font-size: 12px; }
.topbar h1 { font-size: 21px; line-height: 1.2; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; margin: 20px 2px 8px; }
/* icônes : trait plus fin */
svg[stroke-width="2"] { stroke-width: 1.8; }
.tabbar svg, .menu svg, .quick svg, .iconbtn svg { stroke-width: 1.6; }

/* barre du bas : plus fine */
.tabbar a { gap: 2px; font-size: 12px; font-weight: 600; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.plus span.dot { width: 42px; height: 42px; margin-top: -4px; box-shadow: 0 2px 8px rgba(14,92,67,.28); }
.tabbar a.plus svg { width: 22px; height: 22px; stroke-width: 2; }
html:not([data-device=phone]) .tabbar a { font-size: 12px; font-weight: 600; }
html[data-device=desktop] .tabbar a { font-size: 14px; font-weight: 600; }

/* pastilles : plus petites ; la zone à toucher reste de 44 px (marge invisible) */
.chips { gap: 6px; padding: 4px 0; margin: 0 0 4px; }
.chip { position: relative; min-height: 36px; padding: 0 13px; font-size: 13.5px; font-weight: 600; border-color: var(--line); }
.chip::before { content: ''; position: absolute; left: 0; right: 0; top: -4px; bottom: -4px; }
.chips.wrap { row-gap: 8px; }
/* rangée de périodes : glisse de côté, avec un fondu au bord au lieu d'une pastille coupée net */
.chips.period { margin-right: -16px; padding-right: 16px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
html:not([data-device=phone]) .chips.period { margin-right: 0; padding-right: 0; -webkit-mask-image: none; mask-image: none; }

/* choix à cases (segments) : plus fins */
.seg { border-width: 1px; padding: 3px; gap: 2px; background: var(--card); }
.seg button, .seg a { flex: 1 1 auto; border: 0; background: none; min-height: 38px; padding: 0 10px; font-size: 14px; font-weight: 600; border-radius: var(--pill);
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
.seg button, .seg a { position: relative; }
.seg button::before, .seg a::before { content: ''; position: absolute; left: 0; right: 0; top: -4px; bottom: -4px; }
.seg button.on, .seg a.on { background: var(--brand); color: #fff; }
.seg.tabs { margin: 0 0 8px; overflow-x: auto; scrollbar-width: none; }
.seg.tabs::-webkit-scrollbar { display: none; }
html:not([data-device=phone]) .seg.tabs { max-width: 520px; }

/* champs un peu moins hauts */
.input, select.input, textarea.input { min-height: 48px; padding: 10px 14px; border-width: 1px; }
input[type=search].input { min-height: 44px; border-radius: var(--pill); padding-left: 40px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6461' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px 50% / 18px; }
.filters { margin: 4px 0 10px; }
label.field > span { font-size: 13.5px; font-weight: 600; }

/* boutons */
.btn { font-size: 15.5px; }
.btn.big { min-height: 54px; font-size: 16.5px; }
.btn.sm { font-size: 14px; }

/* chiffres et cartes */
.kpi .label { font-size: 12.5px; }
.kpi .value { font-weight: 750; }
.hero { border-radius: 16px; padding: 16px 18px; }
.hero .big { font-weight: 800; }
.card h2 { font-size: 16px; }
.item .name { font-weight: 650; }

/* raccourcis ronds de l'accueil */
.quick { margin: 14px 0 6px; }
.quick a { gap: 6px; font-size: 12.5px; font-weight: 600; min-height: 74px; }
.quick a .ic { width: 50px; height: 50px; }
.quick a .ic svg { width: 22px; height: 22px; }

/* menu « Plus » : une liste groupée, icônes fines, sans bulles */
.menu { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.menu + .menu { margin-top: 14px; }
.menu a { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 8px 14px; text-decoration: none; color: var(--text); }
.menu a + a { border-top: 1px solid #ebe5df; }
.menu a:active { background: #f3efe9; }
.menu .mi { color: var(--brand); display: grid; place-items: center; flex: none; }
.menu .mi svg { width: 22px; height: 22px; }
.menu .mt { display: block; font-weight: 600; font-size: 15.5px; }
.menu .ms { display: block; font-size: 13px; color: var(--muted); }
.menu .mc { color: #b5aca5; display: grid; }
.menu .mc svg { width: 18px; height: 18px; }

/* message du bas : une seule ligne quand il est court (il n'était large que de la moitié de l'écran) */
.toast { width: max-content; max-width: calc(100vw - 32px); padding: 8px 8px 8px 18px; min-height: 48px; }
.toast:not(:has(button)) { padding: 12px 18px; }
.toast button { position: relative; white-space: nowrap; flex: none; min-height: 36px; background: #fff; color: var(--text); }
.toast.err button { color: var(--danger); }
.toast button::before { content: ''; position: absolute; left: 0; right: 0; top: -6px; bottom: -6px; }

/* glisser d'un onglet à l'autre (téléphone) */
main.swiping { transition: none !important; will-change: transform; }
main.snap { transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .22s; }
@keyframes inR { from { transform: translateX(28%); opacity: 0; } }
@keyframes inL { from { transform: translateX(-28%); opacity: 0; } }
main.in-r { animation: inR .24s cubic-bezier(.2,.8,.2,1); }
main.in-l { animation: inL .24s cubic-bezier(.2,.8,.2,1); }
@media (prefers-reduced-motion: reduce) { main.snap { transition: none; } main.in-r, main.in-l { animation: none; } }

html[data-device=phone] .seg.tabs.n5 a { padding: 0 7px; font-size: 13.5px; }
.pick .name, .pcard .name { text-wrap: pretty; }
/* flèche de comparaison : toujours sous le libellé (cases alignées) */
.grid.kpis .kpi .label .delta { display: table; margin: 3px 0 0; }
/* onglets du haut trop nombreux pour l'écran : fondu au bord, comme les périodes */
html[data-device=phone] .seg.tabs.n5 { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
@media (min-width: 380px) { html[data-device=phone] .seg.tabs.n5 { -webkit-mask-image: none; mask-image: none; } }
