/* Mercalo : un carnet de comptes de revendeur.
   Fond papier froid, encre bleu nuit, une seule couleur d'action,
   le vert est réservé au résultat (la marge). */
:root {
  color-scheme: light dark;
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --fg: #0E1726;
  --muted: #55627A;
  --line: #D5DBE5;
  --accent: #087A82;
  --accent-fg: #FFFFFF;
  --pos: #0B7D52;
  --neg: #B3261E;
  --hl: #FF7A1F;
  --hl-fg: #1A0F05;
  --s1: #3B475E;
  --s2: #6B7791;
  --s3: #97A1B6;
  --s4: #C4CBD8;
  /* le ticket reste du papier blanc dans les deux thèmes */
  --paper: #FFFFFF;
  --paper-ink: #0E1726;
  --paper-muted: #55627A;
  --paper-line: #B7C0CF;
  --night: #0E1726;
  --font-d: 'Archivo', system-ui, sans-serif;
  --font-b: 'Instrument Sans', system-ui, sans-serif;
  --font-m: 'IBM Plex Mono', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1220;
    --surface: #131C2E;
    --fg: #E8EDF6;
    --muted: #9AA7BF;
    --line: #26324A;
    --accent: #5CD3DA;
    --accent-fg: #0B1220;
    --pos: #3DD39A;
    --neg: #FF8A80;
    --s1: #C9D2E3;
    --s2: #97A3BC;
    --s3: #6B7791;
    --s4: #465270;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.55 var(--font-b); }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: 1200px; margin: 0 auto; padding-inline: 24px; }
.eyebrow { font-family: var(--font-m); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sub { color: var(--muted); font-size: 15px; }
.hint { color: var(--muted); font-size: 14px; max-width: 520px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer; }
.btn.big { min-height: 52px; padding: 0 28px; font-size: 17px; }
.btn.hl { background: var(--hl); color: var(--hl-fg); }
.btn.line { background: transparent; color: var(--fg); border: 1.5px solid var(--fg); }
.btn[disabled] { opacity: 0.6; cursor: default; }
.textbtn { min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--accent); font-weight: 600; cursor: pointer; }
.linkbtn { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline; }
.linkbtn.danger { color: var(--neg); font-weight: 600; }

/* Marque */
.brand { display: flex; align-items: center; gap: 12px; }
.word { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-d); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; color: var(--fg); text-decoration: none; padding: 8px 0; }
.beta { font-family: var(--font-m); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; background: var(--hl); color: var(--hl-fg); border-radius: 3px; padding: 2px 8px; }

/* Bandeau de configuration */
.setup { background: var(--hl); color: var(--hl-fg); padding: 12px 24px; font-size: 15px; }
.setup code { font-family: var(--font-m); font-size: 13px; }

/* Site public */
.sitehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 16px; }
.navlinks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.navlink { min-height: 44px; display: inline-flex; align-items: center; color: var(--fg); font-weight: 500; font-size: 16px; text-decoration: none; padding: 0 4px; background: none; border: 0; cursor: pointer; }

.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 56px 72px; padding-block: 48px 80px; }
.hero-text { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 28px; }
.hero h1 { font-family: var(--font-d); font-weight: 800; font-size: clamp(44px, 7vw, 84px); line-height: 0.98; letter-spacing: -0.025em; text-wrap: balance; }
.mark { background: var(--hl); color: var(--hl-fg); padding: 0 0.1em; }
.lead { max-width: 540px; font-size: 19px; color: var(--muted); }
.ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.mono-note { font-family: var(--font-m); font-size: 13px; color: var(--muted); }

.receipt-wrap { flex: 1 1 360px; max-width: 440px; min-width: 0; transform: rotate(1.2deg); filter: drop-shadow(0 18px 28px rgba(14, 23, 38, 0.18)); }
.receipt { background: var(--paper); color: var(--paper-ink); padding: 28px 28px 22px; border-radius: 6px 6px 0 0; font-family: var(--font-m); font-size: 14px; display: flex; flex-direction: column; gap: 16px; }
.r-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.r-title { font-weight: 600; letter-spacing: 0.08em; font-size: 13px; }
.r-tag { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; border: 1px solid var(--paper-line); border-radius: 3px; padding: 2px 8px; color: var(--paper-muted); }
.r-item { display: flex; flex-direction: column; gap: 2px; }
.r-item small { font-size: 12px; color: var(--paper-muted); }
.r-rule { border-top: 1.5px dashed var(--paper-line); }
.r-rows { display: flex; flex-direction: column; gap: 10px; }
.r-row { display: flex; align-items: baseline; gap: 8px; }
.r-row .lead-dots { flex: 1 1 0%; min-width: 8px; border-bottom: 1px dotted var(--paper-line); }
.r-row .v { white-space: nowrap; font-variant-numeric: tabular-nums; }
.r-chip { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.r-chip.hollow { border: 1.5px solid var(--paper-ink); }
.r-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.r-total .big { font-family: var(--font-d); font-weight: 800; font-size: 36px; line-height: 1; color: #0B7D52; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-total .label { font-weight: 600; letter-spacing: 0.08em; font-size: 13px; }
.r-pct { font-size: 12px; color: var(--paper-muted); text-align: right; }
.r-bar { display: flex; height: 14px; gap: 2px; border-radius: 3px; overflow: hidden; }
.r-note { font-size: 12px; color: var(--paper-muted); }
.zigzag { display: block; }

.features { background: var(--surface); border-top: 1px solid var(--line); }
.features .container { padding-block: 88px; display: flex; flex-direction: column; gap: 56px; }
.features h2, .cta h2 { font-family: var(--font-d); font-weight: 800; line-height: 1.04; letter-spacing: -0.02em; text-wrap: balance; }
.features h2 { max-width: 760px; font-size: clamp(32px, 4.5vw, 52px); }
.group { display: flex; flex-wrap: wrap; gap: 24px 64px; padding-top: 32px; border-top: 1.5px solid var(--fg); }
.group > h3 { flex: 1 1 260px; min-width: 0; font-family: var(--font-d); font-weight: 800; font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; }
.group-items { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.feat { display: flex; flex-direction: column; gap: 8px; }
.feat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.feat h4 { font-family: var(--font-d); font-weight: 800; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
.feat p { max-width: 560px; color: var(--muted); }
.tag { font-family: var(--font-m); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; white-space: nowrap; }
.tag.on { color: var(--pos); border-color: var(--pos); }

.cta { background: var(--night); color: #FFFFFF; }
.cta .container { padding-block: 96px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px 48px; }
.cta h2 { flex: 1 1 480px; min-width: 0; font-size: clamp(34px, 5vw, 60px); line-height: 1.02; color: #FFFFFF; }
.cta .mono-note { color: #AAB4C8; }
.cta-box { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.sitefoot { background: var(--night); color: #AAB4C8; border-top: 1px solid #243049; font-size: 14px; }
.sitefoot .container { padding-block: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.sitefoot a { color: #AAB4C8; }

/* Connexion et inscription */
.authwrap { display: flex; flex-direction: column; align-items: center; gap: 24px; padding-block: 24px 72px; }
.authcard { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.authcard h1 { font-family: var(--font-d); font-weight: 800; font-size: 30px; letter-spacing: -0.02em; line-height: 1.1; }
.authlinks { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }
.msg { min-height: 22px; font-size: 14px; font-weight: 500; }
.msg.err { color: var(--neg); }
.msg.ok { color: var(--pos); }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, legend { font-family: var(--font-m); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
legend { padding: 0; margin-bottom: 6px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
input, select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.card input, .card select, .authcard input { background: var(--surface); }
input[type="radio"] { width: 20px; min-height: 0; height: 20px; padding: 0; margin: 0; accent-color: var(--accent); }
.radiorow { display: flex; flex-wrap: wrap; gap: 10px; }
.radio { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; font-weight: 500; font-size: 16px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; }

/* Outil */
.appwrap { max-width: 1100px; margin: 0 auto; padding: 16px 16px 72px; display: flex; flex-direction: column; gap: 20px; font-size: 16px; line-height: 1.5; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; font-weight: 500; min-width: 0; }
.whoname { overflow-wrap: anywhere; }
.who .tag { font-size: 10px; padding: 1px 6px; }
.notice { border: 1.5px dashed var(--line); border-radius: 6px; padding: 10px 14px; color: var(--muted); font-size: 14px; }
.status { min-height: 22px; font-size: 14px; font-weight: 500; color: var(--pos); }
.status.err { color: var(--neg); }
.panel { display: flex; flex-direction: column; gap: 28px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.hero-card { display: flex; flex-direction: column; gap: 10px; }
.bignum { font-family: var(--font-d); font-weight: 800; font-size: clamp(44px, 9vw, 76px); line-height: 1; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.bar { display: flex; gap: 2px; height: 16px; margin-top: 10px; border-radius: 3px; overflow: hidden; background: var(--line); }
.seg.s1 { background: var(--s1); }
.seg.s2 { background: var(--s2); }
.seg.s3 { background: var(--s3); }
.seg.s4 { background: var(--s4); }
.seg.pos { background: var(--pos); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 8px; font-size: 14px; }
.legend li { display: flex; align-items: baseline; gap: 8px; }
.legend b { font-family: var(--font-m); font-weight: 500; font-variant-numeric: tabular-nums; }
.chip { width: 10px; height: 10px; border-radius: 2px; flex: none; display: inline-block; }
.chip.s1 { background: var(--s1); }
.chip.s2 { background: var(--s2); }
.chip.s3 { background: var(--s3); }
.chip.s4 { background: var(--s4); }
.chip.pos { background: var(--pos); }
.stats { display: flex; flex-wrap: wrap; gap: 24px 48px; }
.stat { flex: 1 1 200px; min-width: 0; border-top: 1.5px solid var(--fg); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.val { font-family: var(--font-d); font-weight: 800; font-size: 32px; line-height: 1.1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.preview { font-size: 15px; color: var(--muted); }
.preview b { font-family: var(--font-d); font-weight: 800; font-size: 24px; letter-spacing: -0.01em; margin-right: 6px; font-variant-numeric: tabular-nums; }
.qty { width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 18px; font-weight: 600; cursor: pointer; }
.tablebox { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 15px; }
th { font-family: var(--font-m); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 12px 14px; border-bottom: 1.5px solid var(--fg); white-space: nowrap; }
td { padding: 6px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--font-m); font-size: 14px; }
th.n { text-align: right; }
td.m { font-weight: 600; }
.skuline { display: block; font-family: var(--font-m); font-size: 12px; color: var(--muted); }
.empty { padding: 28px 20px; color: var(--muted); }
.out { color: var(--neg); font-weight: 600; }
.qtycell { display: flex; align-items: center; gap: 8px; }
.qtycell span { min-width: 28px; text-align: center; font-family: var(--font-m); font-weight: 600; }
.acc { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.accname { font-family: var(--font-d); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.acc .hint { flex-basis: 100%; }
@media (prefers-reduced-motion: no-preference) { .seg { transition: flex-grow .3s ease; } }

/* Pages légales */
.legal { max-width: 720px; margin: 0 auto; padding: 24px 24px 72px; display: flex; flex-direction: column; gap: 16px; }
.legal h1 { font-family: var(--font-d); font-weight: 800; font-size: 36px; letter-spacing: -0.02em; }
.legal h2 { font-family: var(--font-d); font-weight: 800; font-size: 24px; margin-top: 24px; }
.legal .todo { background: var(--hl); color: var(--hl-fg); padding: 0 4px; }

.word img { width: 36px; height: 36px; display: block; border-radius: 9px; }

/* Tri par photos */
#photos-card { margin-bottom: 16px; }
.phitem { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.phthumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.phthumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.phwarn { color: var(--neg); max-width: none; }
.phkeep { display: flex; align-items: center; gap: 8px; font-size: 15px; min-height: 44px; }
.phkeep input { width: 20px; height: 20px; }
.phitem .grid .field:first-child { grid-column: span 2; }


.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.scard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.scard.editing { grid-column: span 2; }
@media (max-width: 560px) { .scard.editing { grid-column: auto; } }
.spic { position: relative; aspect-ratio: 1 / 1; background: var(--line); display: flex; align-items: center; justify-content: center; }
.spic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nopic { font-family: var(--font-d); font-weight: 800; font-size: 56px; color: var(--accent); opacity: .5; }
.soldout .spic img { filter: grayscale(1); opacity: .6; }
.sbadge { position: absolute; top: 10px; left: 10px; background: var(--neg); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.sbody { display: flex; flex-direction: column; gap: 6px; padding: 14px; flex: 1; }
.sname { margin: 0; font-family: var(--font-d); font-weight: 700; font-size: 16px; line-height: 1.3; }
.smeta { margin: 0; font-size: 14px; color: var(--muted); }
.sfig { display: flex; gap: 24px; margin-top: 4px; }
.sfig .lbl { display: block; font-family: var(--font-m); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sfig b { font-family: var(--font-m); font-size: 15px; font-variant-numeric: tabular-nums; }
.sfoot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.sact { display: flex; align-items: center; flex-wrap: wrap; }
.editing .sact { margin-top: 6px; gap: 8px; }
.edf { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; font-size: 12px; color: var(--muted); }
.edrow { display: flex; gap: 8px; }
.ed { min-height: 40px; width: 100%; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-size: 15px; box-sizing: border-box; }
.ed[type=file] { padding: 6px 8px; height: auto; }

input[data-f="taille"] { text-transform: uppercase; }
.estbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; }
.linkbtn.est { min-height: 24px; font-size: 16px; text-align: left; padding: 0; color: var(--accent); font-weight: 600; }
.sfig { flex-wrap: wrap; gap: 8px 20px; }
.gain { font-size: 13px; }
.gain.pos { color: var(--pos); }
.gain.neg { color: var(--neg); }
.sfig { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px 16px; }

.scard[data-id] { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.scard[data-id]:hover, .scard[data-id]:focus-visible { box-shadow: 0 6px 20px rgba(11,59,64,.15); transform: translateY(-2px); outline: none; }
.pcount { position: absolute; right: 10px; bottom: 10px; background: rgba(11,59,64,.8); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(11,30,34,.6); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 24px 12px; }
.modal-box { position: relative; width: 100%; max-width: 520px; background: var(--surface); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px; margin: auto; }
.modal-x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: #0b3b40; font-size: 24px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.mdmain { aspect-ratio: 1 / 1; background: var(--line); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.mdmain img { width: 100%; height: 100%; object-fit: contain; background: #111; }
.mdthumbs { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; }
.mdth { position: relative; flex: 0 0 auto; }
.mdth > button:first-child { width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: none; }
.mdth.on > button:first-child { border-color: var(--accent); }
.mdth img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mdrm { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--neg); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.mdbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.mdadd { display: inline-flex; align-items: center; cursor: pointer; color: var(--accent); font-weight: 600; }
.mdfields { display: flex; flex-direction: column; gap: 10px; }
.mdactions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mdactions #md-del { margin-left: auto; }
.edrow .edf { min-width: 0; }

/* Cartes de stock : plus larges et plus lisibles */
.sgrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 22px; }
.scard { border-radius: 16px; box-shadow: 0 1px 3px rgba(11,59,64,.08); }
.sbody { padding: 20px 22px 18px; gap: 8px; }
.skuline { font-size: 13px; letter-spacing: .06em; }
.sname { font-family: var(--font-d); font-weight: 700; font-size: 21px; line-height: 1.25; letter-spacing: -0.01em; color: var(--fg); }
.smeta { font-family: var(--font-b); font-size: 16px; font-weight: 500; color: var(--muted); }
.sfig { margin-top: 8px; gap: 10px 22px; padding: 12px 0 2px; border-top: 1px solid var(--line); }
.sfig .lbl { font-size: 11.5px; margin-bottom: 2px; }
.sfig b { font-family: var(--font-d); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.sfig .est { font-size: 16px; }
.gain { font-family: var(--font-b); font-size: 14.5px; font-weight: 600; }
.sfoot { padding-top: 14px; }
.qty { border-radius: 10px; }
.qtycell span { font-family: var(--font-d); font-size: 18px; }
.nopic { font-size: 72px; }
.modal-box { max-width: 560px; padding: 20px; }
.ed { font-size: 16px; min-height: 44px; border-radius: 10px; }
.edf { font-size: 13px; font-weight: 500; }

.mdann { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
textarea.ed { padding: 10px 12px; min-height: 120px; resize: vertical; line-height: 1.45; }
.btn.alt { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }

.sbadge.st-en_ligne { background: var(--accent); color: #fff; }
.sbadge.st-vendu { background: var(--s1); color: #fff; }
.sbadge.st-stock { background: var(--surface); color: var(--fg); border: 1px solid var(--line); }
.sflow { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 12px; }
.sflow .btn { min-height: 38px; padding: 0 14px; font-size: 14px; }
.crm { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.crmstat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 18px; min-width: 130px; }
.crmstat b { display: block; font-size: 22px; font-family: var(--font-d); }
.crmstat span { color: var(--muted); font-size: 13px; }
.sfilters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.fchip { min-height: 38px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--fg); }
.fchip:hover { border-color: var(--accent); }
.fchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.tic { display: none; }
.ssearch { width: 100%; min-height: 46px; padding: 0 16px; border: 0; border-radius: 12px; background: #E8EDF0; color: var(--fg); font: inherit; font-size: 16px; margin: 0 0 12px; box-sizing: border-box; }
.ssearch:focus { outline: 2px solid var(--accent); }
@media (max-width: 700px) {
  body { padding-bottom: 76px; }
  .appwrap { padding: 12px 12px 90px; gap: 14px; }
  .top { flex-wrap: nowrap; gap: 8px; }
  .whoname, .who .tag { display: none; }
  .who .linkbtn { font-size: 13px; min-height: 36px; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; flex-wrap: nowrap; justify-content: space-around; gap: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 0 4px; font-size: 12px; background: transparent; color: var(--muted); }
  .tabs button span { line-height: 1.1; text-align: center; }
  .tabs button[aria-selected="true"] { background: transparent; color: var(--accent); }
  .tic { display: block; }
  .sgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .scard { border: 0; border-radius: 10px; background: transparent; box-shadow: none; }
  .spic { aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; }
  .sbody { padding: 6px 2px 0; gap: 2px; }
  .skuline { font-size: 11px; }
  .sname { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .smeta { font-size: 13px; }
  .sfig { margin: 2px 0 0; }
  .sfig > div:not(:nth-child(2)) { display: none; }
  .sfig .lbl { display: none; }
  .sfig b { font-family: var(--font-b); font-size: 17px; color: var(--accent); }
  .smeta.gain, .sfoot { display: none; }
  .sflow { margin-top: 6px; gap: 6px; }
  .sflow .btn { flex: 1; min-height: 36px; padding: 0 6px; font-size: 13px; }
  .sflow .linkbtn { display: none; }
  .sbadge { top: 6px; left: 6px; font-size: 11px; padding: 3px 8px; }
  .pcount { font-size: 11px; }
  .sfilters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 12px; padding: 0 12px; scrollbar-width: none; }
  .sfilters::-webkit-scrollbar { display: none; }
  .fchip { flex: none; }
  .crm { gap: 8px; flex-wrap: nowrap; }
  .crmstat { flex: 1; min-width: 0; padding: 8px 10px; }
  .crmstat b { font-size: 17px; }
  .modal { padding: 0; }
  .modal-box { max-width: none; min-height: 100%; border-radius: 0; margin: 0; }
}
@media (max-width: 700px) {
  #panel-stock { gap: 14px; }
  #panel-stock #stock-box { order: -1; }
}
@media (max-width: 700px) {
  .estbar .hint { display: none; }
  .estbar .btn { min-height: 40px; font-size: 14px; width: 100%; }
  .sfig { border-top: 0; }
}

.phone-sheet { display: flex; flex-direction: column; gap: 8px; padding: 12px; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.phone-sheet .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.phone-sheet small { display: block; color: var(--muted); font-size: 12px; }
.phone-sheet .row span { overflow-wrap: anywhere; font-size: 15px; }

body.noscroll { overflow: hidden; }
.tabs .gabbtn { display: inline-flex; align-items: center; gap: 8px; }
.tabs .gabbtn img { width: 26px; height: 26px; }
.gab { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.gab-top { padding: 12px 14px 8px; position: relative; }
.gab-x { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface); font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.gab-bubble { display: flex; align-items: center; gap: 12px; margin-right: 52px; }
.gab-av { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.gab-bubble div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; }
.gab-bubble b { display: block; font-family: var(--font-d); }
.gab-bubble span { font-size: 15px; color: var(--muted); }
.gab-body { flex: 1; overflow-y: auto; padding: 8px 14px 24px; display: flex; flex-direction: column; gap: 12px; }
.gab-foot { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.gab-foot .btn { width: 100%; }
.gab-add { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--accent); border-radius: 16px; background: var(--surface); text-align: center; cursor: pointer; color: var(--accent); }
.gab-add small { color: var(--muted); font-size: 13px; max-width: 280px; }
.gab-plus { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 34px; line-height: 50px; }
.gab-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gab-grid.small { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.gab-th { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--line); }
.gab-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gab-th button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.gab-th span { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 6px; }
.gab-work { align-items: center; justify-content: center; text-align: center; }
.gab-spin { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--accent); animation: gabspin 1s linear infinite; }
@keyframes gabspin { to { transform: rotate(360deg); } }
.gab-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; min-height: 52px; }
.gab-row > span { color: var(--muted); font-size: 14px; flex: none; min-width: 84px; }
.gab-row input, .gab-row select, .gab-row textarea { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; text-align: right; color: var(--fg); padding: 8px 0; outline: none; }
.gab-row.col { flex-direction: column; align-items: stretch; padding-bottom: 10px; }
.gab-row.col textarea { text-align: left; resize: vertical; }
.gab-note { background: #FFF4E8; border: 1px solid #F6C89A; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0; }
.gab-steps { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.gab-steps ol { margin: 6px 0 12px 18px; padding: 0; font-size: 15px; }
.gab-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.gab-acts .btn { flex: 1 1 45%; min-height: 40px; font-size: 14px; padding: 0 10px; }
@media (max-width: 700px) {
  .tabs .gabbtn { flex: 1; flex-direction: column; gap: 0; }
  .tabs .gabbtn img { width: 44px; height: 44px; margin-top: -22px; border: 3px solid var(--surface); border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,.2); background: var(--surface); }
  .tabs .gabbtn span { margin-top: 2px; }
}
.gab-row.col textarea { min-height: 150px; flex: none; }

.iabadge { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .04em; background: var(--hl); color: var(--hl-fg); padding: 1px 6px; border-radius: 6px; vertical-align: 2px; margin-left: 4px; }
.gab-ia { margin: 8px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.gab-row.col { display: block; padding: 10px 14px 12px; }
.gab-row.col > span { display: block; margin-bottom: 6px; }
.gab-row.col textarea { display: block; width: 100%; height: 170px; min-height: 170px; flex: none; text-align: left; box-sizing: border-box; border: 0; resize: none; overflow-y: auto; }
.gab-top { background: var(--bg); position: relative; z-index: 2; }
.gab-body > * { flex-shrink: 0; }

.gab { background: #fff; }
.gab-top { text-align: center; padding: 14px 56px 10px; border-bottom: 1px solid var(--line); background: #fff; }
.gab-top h2 { margin: 0; font-family: var(--font-b); font-size: 17px; font-weight: 700; }
.gab-body { background: #F7F8FA; gap: 14px; padding: 14px 14px 28px; }
.gab-photos { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.gab-photos::-webkit-scrollbar { display: none; }
.gab-photos .gab-add { flex: none; width: 112px; aspect-ratio: 3 / 4; padding: 8px; gap: 2px; border-radius: 12px; }
.gab-photos .gab-plus { width: 38px; height: 38px; font-size: 26px; line-height: 36px; }
.gab-photos .gab-add b { font-size: 13px; }
.gab-photos .gab-add small { font-size: 12px; }
.gab-photos .gab-th { flex: none; width: 112px; aspect-ratio: 3 / 4; }
.gab-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: #E7F5F6; border: 1px solid #BFE3E6; }
.gab-card .gab-av { width: 44px; height: 44px; flex: none; }
.gab-card-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gab-card-t b { font-family: var(--font-d); }
.gab-card-t span { font-size: 13px; color: var(--muted); line-height: 1.3; }
.gab-card .btn { min-height: 40px; padding: 0 14px; font-size: 14px; flex: none; }
.gab-dots::after { content: ''; animation: gabdots 1.2s steps(4) infinite; }
@keyframes gabdots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75%, 100% { content: '...'; } }
.gab-list { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.gab-list .gab-row { border: 0; border-radius: 0; border-top: 1px solid var(--line); background: #fff; }
.gab-list .gab-row:first-child { border-top: 0; }
.gab-row .chev { flex: none; width: 8px; height: 8px; border-top: 2px solid var(--s3); border-right: 2px solid var(--s3); transform: rotate(45deg); margin-left: 2px; }
.gab-row select { appearance: none; -webkit-appearance: none; }
.gab-foot { background: #fff; }

.gab-title { align-items: flex-start; }
.gab-title > span { padding-top: 12px; }
.gab-title textarea { resize: none; overflow: hidden; height: auto; line-height: 1.3; padding: 12px 0; min-height: 0; }

.ins { margin-top: 12px; }
.ins-row { display: flex; gap: 8px; margin: 8px 0; }
.ins-row > div { flex: 1; display: flex; flex-direction: column; }
.ins-row b { font-size: 20px; }
.ins-row span { color: var(--muted); font-size: 13px; }
.ins-list { list-style: none; margin: 8px 0; padding: 0; }
.ins-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ins-list li:first-child { border-top: 0; }
.ins-list em { font-style: normal; color: #b45309; white-space: nowrap; }

.tabs button { position: relative; }
.mbadge { position: absolute; top: 2px; right: 22%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font: 700 11px/18px system-ui; font-style: normal; text-align: center; }
.conv { margin-top: 10px; }
.conv-h { display: flex; justify-content: space-between; gap: 8px; }
.conv-h span, .conv-a { color: var(--muted); font-size: 13px; }
.conv-a { margin: 2px 0 0; }
.conv-d { margin: 6px 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.conv-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.conv .rp { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; }
.conv .rp b { display: block; color: var(--accent); font-size: 12.5px; }
.conv .rp span { display: block; margin: 4px 0; white-space: pre-wrap; }
.conv .ok { color: #1a7f4b; font-size: 13px; }
.conv .note.err { color: #b42318; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }

.chatbtn { margin: 12px 0 0; width: 100%; }
.chat .chat-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #F7F8FA; }
.chat .chat-body > * { flex-shrink: 0; }
.cmsg { max-width: 88%; padding: 10px 12px; border-radius: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.cmsg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.cmsg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.cmsg .linkbtn { display: block; margin-top: 6px; }
.chat-in { display: flex; gap: 8px; padding: 10px 14px 4px; background: #fff; border-top: 1px solid var(--line); }
.chat-in input { flex: 1; min-width: 0; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.chat-note { margin: 0; padding: 0 14px calc(10px + env(safe-area-inset-bottom)); background: #fff; font-size: 12px; color: var(--muted); }
.dots i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: cd 1s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes cd { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-note { border: 0; border-radius: 0; }

.conv-full { margin: 8px 0; padding: 10px 12px; background: #F7F8FA; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; max-height: 50vh; overflow-y: auto; }

/* Messagerie façon Vinted */
.inbox-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.inbox { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 10px; }
.irow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-top: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.irow:first-child { border-top: 0; }
.irow:hover { background: #F7F8FA; }
.av { flex: none; width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #DCE7E8; color: #087a82; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.av.sm { width: 38px; height: 38px; font-size: 14px; }
.imid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ihead { display: flex; justify-content: space-between; gap: 8px; }
.ihead em { font-style: normal; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.iline { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.irow:not(.unread) .iline { color: var(--muted); }
.iart { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irow.unread .ihead b { font-weight: 800; }
.udot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.convview { z-index: 95; background: #F7F8FA; }
.cv-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.cv-back { border: 0; background: transparent; font-size: 34px; line-height: 1; padding: 0 8px; cursor: pointer; color: var(--fg); }
.cv-t { display: flex; flex-direction: column; min-width: 0; }
.cv-t span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.cv-body > * { flex-shrink: 0; }
.bub { max-width: 80%; padding: 9px 12px; border-radius: 16px; overflow-wrap: anywhere; line-height: 1.35; }
.bub.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bub.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.cv-foot { background: #fff; border-top: 1px solid var(--line); padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); max-height: 50vh; overflow-y: auto; }
.cv-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); text-decoration: none; display: inline-flex; align-items: center; }
.cv-foot .rp { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.cv-foot .rp b { display: block; color: var(--accent); font-size: 12.5px; }
.cv-foot .rp span { display: block; margin: 4px 0; white-space: pre-wrap; }
@media (min-width: 701px) { .convview { left: 50%; transform: translateX(-50%); max-width: 640px; inset-block: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
