:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e5e9f0;
  --line2: #eef1f5;
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --brand-soft: #eef2ff;
  --side: #0f172a;
  --side2: #1e293b;
  --side-ink: #cbd5e1;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); font-size: 14px; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h3 { font-size: 15px; }
h4 { font-size: 13px; margin: 16px 0 6px; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.warn { color: var(--warn); }
.ok-t { color: var(--ok); }
.bad-t { color: var(--bad); }
.intro { margin: 0 0 14px; max-width: 900px; }
.loading { padding: 30px 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 380px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 18px 10px; display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-size: 12px; letter-spacing: .5px; flex: none; }
.brand small { display: block; font-weight: 400; color: #94a3b8; font-size: 11px; }
.nav-title { padding: 10px 22px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #64748b; }
.nav { padding: 2px 10px 20px; display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav::-webkit-scrollbar { width: 6px; } .nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.nav a, .nav-parent { color: var(--side-ink); padding: 8px 12px; border-radius: 8px; display: flex; align-items: center; gap: 10px; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font-size: 13.5px; }
.nav a:hover, .nav-parent:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(99, 102, 241, .25); color: #fff; }
.nav .ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-parent span { flex: 1; }
.nav-parent .chev { width: 14px; height: 14px; transition: transform .15s; opacity: .6; }
.nav-group.open .chev { transform: rotate(90deg); }
.nav-group.has-active > .nav-parent { color: #fff; }
.nav-children { display: none; padding: 2px 0 6px 28px; }
.nav-group.open .nav-children { display: block; }
.nav-children a { padding: 6px 12px; font-size: 13px; color: #94a3b8; }
.nav .badge { background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.nav .nb { margin-left: auto; background: #334155; color: #e2e8f0; border-radius: 99px; font-size: 10.5px; padding: 0 6px; font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 17px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; padding: 0 4px; }
.icon-btn { position: relative; background: none; border: 1px solid var(--line); border-radius: 8px; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }
.usermenu { position: relative; }
.userbtn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px 3px 3px; cursor: pointer; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(15, 23, 42, .15); min-width: 240px; padding: 6px; z-index: 30; }
.dropdown a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.dropdown a:hover { background: #f1f5f9; }
.dropdown a.danger { color: var(--bad); }
.dd-h { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.content { padding: 20px 24px 48px; }
.side-ov { display: none; }

/* ---------- Components ---------- */
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink); }
.btn:hover { border-color: #cbd5e1; background: #fafbfc; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.danger { color: var(--bad); }
.btn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 12px 16px; font-size: 16px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-h h3 { margin: 0; font-size: 14px; flex: 1; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: 2fr 1fr; }
.g4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.kpi .v { font-size: 21px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi.ok .v { color: var(--ok); } .kpi.bad .v { color: var(--bad); } .kpi.accent .v { color: var(--brand); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; background: #f1f5f9; color: #475569; font-weight: 600; white-space: nowrap; }
.risk-fiable { background: #dcfce7; color: #166534; }
.risk-moyen { background: #fef3c7; color: #92400e; }
.risk-eleve, .risk-liste_noire { background: #fee2e2; color: #991b1b; }
.risk-nouveau { background: #e0e7ff; color: #3730a3; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; }

.pipeline { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.pipeline a { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--ink); border-top: 3px solid var(--c); }
.pipeline a:hover { box-shadow: var(--shadow); }
.pipeline .n { font-size: 20px; font-weight: 700; }
.pipeline .t { font-size: 12px; color: var(--muted); }
.row-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line2); }
.row-line:last-child { border-bottom: 0; }
.online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; margin-right: 8px; vertical-align: 1px; }
.online.on { background: var(--ok); box-shadow: 0 0 0 3px #dcfce7; }
.rank { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line2); }
.rank:last-child { border-bottom: 0; }
.rk { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.prod-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pcard b { display: block; margin: 2px 0 10px; }
.pc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11px; color: var(--muted); text-align: center; }
.pc-grid span { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfd; white-space: nowrap; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
td.chk, th.chk { width: 34px; }
table.mini td { padding: 6px 4px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.prod-cell { display: flex; align-items: center; gap: 10px; }
.prod-cell img, .prod-cell .ph { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #f1f5f9; display: grid; place-items: center; color: #94a3b8; flex: none; }

/* filtres */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { background: none; border: 0; padding: 10px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .c { background: #eef2f7; border-radius: 99px; padding: 0 7px; font-size: 11px; margin-left: 5px; color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chips button i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, #94a3b8); }
.chips button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.chips .c { font-size: 11px; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters input, .filters select { min-width: 0; }
.filter-panel { margin-bottom: 12px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 12px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; outline: none; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: -3px; }
input[type=color] { padding: 2px; height: 36px; width: 60px; }
.filters .search { flex: 1 1 280px; min-width: 200px; }
.big-input { font-size: 18px; padding: 12px 14px; }
.bulkbar { display: flex; gap: 8px; align-items: center; background: var(--brand-soft); border: 1px solid #c7d2fe; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.bulkbar select { padding: 5px 8px; font-size: 13px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 0; flex-wrap: wrap; }
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.notice.ok { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.insight { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.insight.i-ok { border-left-color: var(--ok); } .insight.i-bad { border-left-color: var(--bad); }
.insight div { color: var(--muted); margin-top: 3px; }

/* formulaires */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form.one { grid-template-columns: 1fr; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field input:not([type=checkbox]):not([type=color]), .field select, .field textarea { width: 100%; }
label.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13.5px; color: var(--ink); font-weight: 400; }
.multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; }
.items-row { display: grid; grid-template-columns: 1fr 80px 110px 34px; gap: 8px; margin-bottom: 8px; }
.items-row.no-price { grid-template-columns: 1fr 90px 34px; }
.totals { background: #f8fafc; border-radius: 8px; padding: 10px 14px; display: grid; gap: 4px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.totals .grand:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: #fff; padding: 8px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active, .seg button:active { background: var(--brand); color: #fff; }
.keybox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
pre.code { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; line-height: 1.5; }

/* modal + drawer */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 760px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal.sm { max-width: 440px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-h h2 { margin: 0; font-size: 16px; flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.x { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.drawer-ov { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100%); background: var(--panel); z-index: 41; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0, 0, 0, .15); }
.drawer-b { padding: 18px 20px 40px; overflow-y: auto; flex: 1; }
.dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.section-t { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.notif-list { display: flex; flex-direction: column; }
.notif { display: flex; justify-content: space-between; gap: 10px; padding: 10px; border-bottom: 1px solid var(--line2); color: var(--ink); }
.notif.unread { background: var(--brand-soft); }

/* chart */
.chart svg { width: 100%; height: 220px; display: block; }
.grid-line { stroke: #eef1f5; } .axis-t { fill: #94a3b8; }
.bar-a { fill: #c7d2fe; } .bar-b { fill: #16a34a; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg-a { background: #c7d2fe; } .lg-b { background: #16a34a; }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bar-cell .bar { height: 6px; border-radius: 3px; background: #e2e8f0; flex: 1; overflow: hidden; }
.bar-cell .bar span { display: block; height: 100%; background: var(--c, var(--brand)); }

/* point de vente, scanner, discussion */
.pos { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }
.pos-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 96px; }
.pos-item:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pos-right { position: sticky; top: 80px; }
.receipt { font-family: ui-monospace, Consolas, monospace; background: #f8fafc; padding: 14px; border-radius: 8px; }
.receipt hr { border: 0; border-top: 1px dashed #cbd5e1; }
.scan-hit { margin-top: 12px; padding: 14px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--line); }
.scan-hit.ok { background: #f0fdf4; border-color: #bbf7d0; } .scan-hit.bad { background: #fef2f2; border-color: #fecaca; }
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 400px; }
.chat-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 75%; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.bubble { display: inline-block; background: #f1f5f9; padding: 8px 12px; border-radius: 12px; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--brand); color: #fff; }
.msg.mine .bubble a { color: #fff; text-decoration: underline; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }
.soon { max-width: 720px; position: relative; }
.soon h2 { margin: 6px 0 8px; }
.soon-badge { display: inline-block; background: #e0e7ff; color: #3730a3; border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.tuto { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

/* connexion */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% 0%, #312e81, #0f172a); }
.login { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.login-logo { width: 46px; height: 46px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; margin-bottom: 14px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login .field { margin-top: 14px; }
.login .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 11px; }
.err { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); }

@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .pipeline { grid-template-columns: repeat(4, 1fr); } .g3, .g2 { grid-template-columns: 1fr; } .pos { grid-template-columns: 1fr; } .pos-right { position: static; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -270px; width: 260px; z-index: 35; transition: left .2s; }
  .sidebar.open { left: 0; }
  .side-ov.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 34; }
  .menu-btn { display: block; }
  .content { padding: 14px 16px 40px; }
  .topbar { padding: 10px 16px; }
  .form { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .g4 { grid-template-columns: 1fr; }
  .items-row { grid-template-columns: 1fr 60px 90px 30px; }
  .hide-m { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 17px; }
}
@media (max-width: 520px) { .hide-xs { display: none; } .userbtn { padding: 3px; } .dl { grid-template-columns: 95px 1fr; } }

/* canaux de vente */
.plat { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.plat i { width: 24px; height: 24px; border-radius: 6px; background: var(--pc); color: #fff; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; flex: none; }
.plat-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.plat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.plat-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.plat-card:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.soon-card { cursor: default; flex-direction: row; justify-content: space-between; align-items: center; opacity: .75; }
.soon-card:hover { border-color: var(--line); box-shadow: none; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }

.chan-table th, .chan-table td { padding: 9px 10px; }
.chan-table .bar-cell { min-width: 96px; }
.chan-table .url-cell { min-width: 150px; max-width: 210px; overflow-wrap: anywhere; }
@media (max-width: 1300px) { .chan-table th:first-child, .chan-table td:first-child { display: none; } }

/* bandeau : l'administrateur principal consulte la boutique d'un autre utilisateur */
.viewbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 18px; background: #fef3c7; color: #92400e; border-bottom: 1px solid #fde68a; font-size: 14px; }
.viewbar .btn { margin-left: auto; }
.dropdown a.accent { color: #4f46e5; font-weight: 600; }

/* ---------- Landing pages : éditeur avec aperçu ---------- */
.lpe { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 46%); gap: 20px; align-items: start; }
.lpe-bar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 10px 0 12px; background: var(--bg, #f4f6fa); }
.lpe-state { flex: 1; text-align: center; }
.lpe-state.warn { color: #b45309; font-weight: 600; }
.lpe-sec { margin-bottom: 16px; }
.lpe-sec h3 { margin: 0 0 14px; font-size: 15px; }
.lpe-slug { display: flex; align-items: stretch; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; overflow: hidden; background: #fff; }
.lpe-slug span { background: #f1f5f9; color: #64748b; padding: 0 10px; display: flex; align-items: center; font-size: 13px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.lpe-slug input { border: 0 !important; border-radius: 0 !important; flex: 1; min-width: 80px; box-shadow: none !important; }
.lpe-offer { display: grid; grid-template-columns: 80px 130px 1fr auto; gap: 8px; margin-bottom: 8px; }
.lpe-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.lpe-img { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line, #e2e8f0); background: #fff; cursor: grab; }
.lpe-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lpe-main { position: absolute; top: 6px; left: 6px; background: rgba(15,23,42,.8); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 6px; }
.lpe-img-a { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; padding: 5px; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.lpe-img-a button { border: 0; background: #fff; border-radius: 6px; width: 28px; height: 26px; cursor: pointer; font-size: 12px; }
.lpe-img-a button:disabled { opacity: .35; cursor: default; }
.lpe-noimg { grid-column: 1 / -1; padding: 14px; border: 1px dashed var(--line, #cbd5e1); border-radius: 10px; text-align: center; }
.lpe-colors { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lpe-sw { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; }
.lpe-sw.on { box-shadow: 0 0 0 2px #0f172a; }
.lpe-colors input[type=color] { width: 44px; height: 32px; padding: 2px; border-radius: 8px; }
.lpe-prev { position: sticky; top: 12px; }
.lpe-prev-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lpe-prev-bar .small { flex: 1; }
.lpe-frame { background: #e2e8f0; border-radius: 16px; padding: 14px; display: flex; justify-content: center; height: calc(100vh - 150px); min-height: 520px; }
.lpe-frame iframe { border: 0; background: #fff; width: 100%; height: 100%; border-radius: 10px; box-shadow: 0 8px 30px -12px rgba(15,23,42,.35); }
.lpe-frame.m iframe { width: 390px; max-width: 100%; border-radius: 26px; border: 8px solid #0f172a; }
.lp-empty { text-align: center; padding: 40px 20px; }
.lp-empty-ic svg { width: 46px; height: 46px; color: #94a3b8; }
@media (max-width: 1100px) { .lpe { grid-template-columns: 1fr; } .lpe-prev { position: static; } .lpe-frame { height: 640px; } }
@media (max-width: 560px) { .lpe-offer { grid-template-columns: 70px 1fr auto; } .lpe-offer [data-o=label] { grid-column: 1 / -1; grid-row: 2; } }
.lpe-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lpe-chips .btn { font-size: 12px; }

/* photo produit */
.pthumb { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; vertical-align: middle; margin-right: 6px; background: #f1f5f9; }
.pos-img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: 4px; background: #f1f5f9; }
.pphoto { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pphoto-prev { width: 96px; height: 96px; border-radius: 12px; border: 1px dashed var(--line); background: #f8fafc; display: grid; place-items: center; overflow: hidden; flex: none; font-size: 28px; color: #94a3b8; }
.pphoto-prev img { width: 100%; height: 100%; object-fit: cover; }
.pphoto-act { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 200px; align-items: flex-start; }
.pphoto-act input[name=image] { width: 100%; }

/* tableau de bord : analyse par produit */
.prod-rep { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.prod-rep > img { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; flex: none; background: #f1f5f9; }

/* sélection de plusieurs produits */
.msel { position: relative; }
.msel-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 320px; max-width: 86vw; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.16); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.msel-pop[hidden] { display: none; }
.msel-pop .search { width: 100%; }
.msel-act { display: flex; gap: 6px; }
.msel-list { max-height: 300px; overflow: auto; display: flex; flex-direction: column; }
.msel-it { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.msel-it:hover { background: #f8fafc; }
.msel-it[hidden] { display: none; }
.msel-it img, .msel-it .ph { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; background: #f1f5f9; display: grid; place-items: center; color: #94a3b8; flex: none; }
.msel-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.prod-imgs { display: grid; gap: 4px; width: 92px; height: 92px; flex: none; }
.prod-imgs img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; background: #f1f5f9; }
.prod-imgs.n1 img { border-radius: 12px; }
.prod-imgs.n2, .prod-imgs.n3, .prod-imgs.n4 { grid-template-columns: 1fr 1fr; grid-auto-rows: 44px; }


.lpe-var { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.lpe-var-h { display: flex; gap: 8px; margin-bottom: 8px; } .lpe-var-h input { flex: 1; font-weight: 600; }
.lpe-chipset { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lpe-vchips { display: contents; }
.lpe-vchip { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-soft, #eef2ff); color: var(--brand, #4f46e5); border-radius: 999px; padding: 4px 6px 4px 11px; font-weight: 600; font-size: 13px; }
.lpe-vchip button { border: 0; background: transparent; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }
.lpe-vin { flex: 1; min-width: 140px; }

/* boutique : aperçu de la photo de couverture */
.shc { border: 1px dashed var(--line); border-radius: 10px; background: #f8fafc; aspect-ratio: 12 / 5; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #94a3b8; font-size: 13px; }
.shc.m { aspect-ratio: 4 / 5; max-width: 200px; }
.shc img { width: 100%; height: 100%; object-fit: cover; }
