:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #1c2230; --muted: #6b7385; --line: #e4e7ec;
  --brand: #1f4fd1; --brand-soft: #e8eefc; --side: #121826; --side-ink: #c9cfdb;
  --ok: #157f4a; --ok-soft: #e3f4ea; --warn: #a15c00; --warn-soft: #fdf1dc;
  --bad: #b42318; --bad-soft: #fde8e6; --erp: #6d3fd1; --pl: #0b8a7a;
  --surface: #ffffff; --soft: #f4f5f7;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { height: 100%; }
/* le corps grandit avec la page : le menu « collant » reste ainsi en place pendant le défilement (tablette comprise) */
body { min-height: 100%; min-height: 100dvh; }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); display: flex; }
a { color: var(--brand); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---- barre latérale */
.side { width: 228px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0; }
.brand { padding: 20px 20px 16px; display: flex; gap: 10px; align-items: center; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--erp), var(--pl));
  display: grid; place-items: center; color: #fff; font-weight: 800; letter-spacing: -.5px; }
.brand b { color: #fff; display: block; font-size: 15px; }
.brand small { color: #8891a5; font-size: 11.5px; }
.nav { padding: 6px 10px; flex: 1; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--side-ink); margin: 1px 0; }
.nav a:hover { background: #1d2536; color: #fff; }
.nav a.active { background: #26314a; color: #fff; }
.nav .ico { width: 18px; text-align: center; opacity: .9; }
.nav .sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #677089; padding: 14px 12px 4px; }
.side-foot { padding: 14px 18px; border-top: 1px solid #222b3d; font-size: 12px; color: #8891a5; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #8891a5; }
.dot.ok { background: #32c26f; } .dot.run { background: #f5b72b; animation: pulse 1s infinite; } .dot.bad { background: #ef4b3d; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---- contenu */
main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 28px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 19px; margin: 0; }
.top .sub { color: var(--muted); font-size: 12.5px; }
.content { padding: 22px 28px 60px; }
.banner { background: var(--warn-soft); color: var(--warn); border: 1px solid #f3d9a6; padding: 9px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }

.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) { .g4, .g3, .g2 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi .label { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.kpi .value { font-size: 25px; font-weight: 700; letter-spacing: -.5px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12.5px; color: var(--muted); }
.up { color: var(--ok); } .down { color: var(--bad); }

.src { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; letter-spacing: .02em; }
.src.erp { background: #efe8fc; color: var(--erp); } .src.pl { background: #e1f5f2; color: var(--pl); }

/* ---- tableaux */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
input[type=text], input[type=email], input:not([type]), input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
input[type=text].search { min-width: 260px; }
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 8px; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #c8cdd6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1a43b4; }
.btn.danger { background: #c62828; border-color: #c62828; color: #fff; }
.btn.danger:hover { background: #a61f1f; }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--brand); font-weight: 600; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: calc(100vh - 230px); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--soft); font-weight: 600; color: var(--muted); font-size: 12px; position: sticky; top: 0; z-index: 1; cursor: pointer; user-select: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 220px; }
tr:hover td { background: var(--soft); }
tr.click { cursor: pointer; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--soft); color: #475067; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--brand-soft); color: var(--brand); }

.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.list li:last-child { border: 0; }
.list .n { font-variant-numeric: tabular-nums; font-weight: 600; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- graphique barres */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 38px; background: linear-gradient(180deg, #4b74e6, var(--brand)); border-radius: 5px 5px 2px 2px; min-height: 2px; position: relative; }
.chart .bar.out { background: linear-gradient(180deg, #f08a7f, var(--bad)); }
.chart .pair { display: flex; gap: 2px; width: 100%; justify-content: center; align-items: flex-end; height: 100%; }
.chart .pair .bar { max-width: 16px; }
.chart .bar.in { background: linear-gradient(180deg, #45c486, var(--ok)); }
.chart .m { font-size: 10.5px; color: var(--muted); }
.chart .bar:hover::after { content: attr(data-v); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; margin-bottom: 4px; }

/* ---- panneau latéral (détail) */
.drawer-bg { position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 20; display: none; }
/* fiches : fenêtre centrée sur le fond grisé (plus grande pour travailler) */
.drawer { position: fixed; top: 3vh; left: 50%; width: min(1180px, 94vw); height: 94vh; background: var(--bg); z-index: 21; overflow: auto;
  border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.28); transform: translate(-50%, 12px) scale(.98); opacity: 0; visibility: hidden;
  transition: transform .18s, opacity .18s, visibility 0s .18s; }
.drawer.open { transform: translate(-50%, 0) scale(1); opacity: 1; visibility: visible; transition: transform .18s, opacity .18s; }
.drawer-bg.open { display: block; }
.drawer header { background: var(--surface); padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 2; border-radius: 14px 14px 0 0; }
.drawer header h2 { margin: 0; font-size: 18px; }
.drawer .body { padding: 18px 22px; display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

.form { display: grid; gap: 14px; max-width: 760px; }
.form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }
.form label span.help { font-weight: 400; color: var(--muted); font-size: 12px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.check { display: flex !important; gap: 10px; align-items: flex-start; grid-template-columns: none !important; font-weight: 400 !important; }
.check input { margin-top: 3px; }
pre.log { background: #0f1420; color: #c7d0e0; padding: 12px 14px; border-radius: 8px; font-size: 12px; max-height: 300px; overflow: auto; margin: 0; white-space: pre-wrap; }
.toast { position: fixed; bottom: 92px; right: 22px; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; z-index: 50;
  box-shadow: var(--shadow); max-width: 420px; opacity: 0; transform: translateY(10px); transition: all .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; } .toast.bad { background: var(--bad); }
.muted { color: var(--muted); } .small { font-size: 12px; }
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; }
.flow .box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface); }
.flow .arrow { color: var(--muted); font-size: 20px; }

/* ---- formulaires commande / catalogue */
.lines td input { width: 100%; padding: 5px 7px; }
.lines td.q input { width: 70px; } .lines td.p input { width: 100px; } .lines td.v input { width: 60px; }
.ac { position: relative; }
.ac-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.12); max-height: 320px; overflow: auto; }
.ac-list div { padding: 7px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.ac-list div:hover, .ac-list div.on { background: var(--brand-soft); }
.totals { display: grid; grid-template-columns: auto auto; gap: 4px 18px; justify-content: end; font-variant-numeric: tabular-nums; }
.totals b { text-align: right; }
.steps { counter-reset: st; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: start; }
.step .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-weight: 700; color: var(--muted); }
.step.done .n { background: var(--ok-soft); color: var(--ok); }
.step h4 { margin: 4px 0 4px; font-size: 14px; }
.lvl { display: inline-block; min-width: 26px; text-align: right; }
.moveform { display: grid; grid-template-columns: repeat(5, auto); gap: 8px; align-items: end; }
.moveform label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.lines td:nth-child(2) { width: 34%; min-width: 170px; }
.lines td:nth-child(1) { width: 120px; }

/* ---- assistant */
body.wizard .side { display: none; }
.wiz { max-width: 820px; margin: 0 auto; }
.wiz-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.wiz-steps span { font-size: 12.5px; padding: 5px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.wiz-steps span.on { background: var(--brand); color: #fff; font-weight: 600; }
.wiz-steps span.done { background: var(--ok-soft); color: var(--ok); }
.wiz-card h3 { margin: 0; }
.wiz-nav { margin-top: 14px; }
.choice { display: flex !important; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; font-weight: 400 !important; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.logo-zone { display: flex; gap: 16px; align-items: center; }
.logo-prev { width: 180px; height: 72px; border: 1px dashed #c8cdd6; border-radius: 8px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.logo-prev img { max-width: 100%; max-height: 100%; }

.sirene { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; }
.sirene label { font-weight: 600; }
.ac-list div { align-items: center; }

/* ---- modale */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 40; display: none; place-items: center; }
.modal-bg.open { display: grid; }
.modal { background: var(--surface); border-radius: 14px; width: min(860px, 94vw); max-height: 92vh; overflow: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { margin: 0 0 14px; font-size: 19px; }

/* ---- caisse */
body.pos-mode .side, body.pos-mode .top { display: none; }
body.pos-mode .content { padding: 0; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: 100vh; }
.pos-left { display: flex; flex-direction: column; min-width: 0; padding: 14px 16px; gap: 12px; overflow: hidden; }
.pos-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pos-bar .info { color: var(--muted); font-size: 13px; }
.pos-search { font-size: 18px !important; padding: 13px 14px !important; width: 100%; border: 2px solid var(--brand) !important; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow: auto; align-content: start; padding-bottom: 10px; }
.pos-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: left; min-height: 92px;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); cursor: pointer; }
.pos-tile:hover { border-color: var(--brand); } .pos-tile:active { transform: scale(.98); }
.pos-tile .t { font-size: 13px; font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.pos-tile .p { font-size: 16px; font-weight: 700; color: var(--brand); margin-top: 6px; display: flex; justify-content: space-between; align-items: baseline; }
.pos-tile .p small { font-size: 11px; color: var(--muted); font-weight: 400; }
.pos-right { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; height: 100vh; }
.cart { flex: 1; overflow: auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.cart-line .lb { font-weight: 600; font-size: 14px; } .cart-line .sub { color: var(--muted); font-size: 12px; }
.cart-line .tt { font-weight: 700; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: flex; gap: 6px; align-items: center; }
.qty button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); font-size: 18px; }
.qty span { min-width: 34px; text-align: center; font-weight: 700; }
.cart-total { padding: 14px 16px; border-top: 2px solid var(--ink); }
.cart-total .big { font-size: 34px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.pay-btn { width: 100%; font-size: 22px; font-weight: 700; padding: 18px; border-radius: 12px; border: 0; background: var(--ok); color: #fff; }
.pay-btn:disabled { background: #b8c2cc; }
.methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.methods button { padding: 16px 8px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; }
.methods button.on { border-color: var(--brand); background: var(--brand-soft); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; } .quick button { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); font-weight: 600; }
.amount-in { font-size: 26px !important; padding: 10px 12px !important; width: 100%; text-align: right; font-weight: 700; }
.remain { display: flex; justify-content: space-between; font-size: 18px; padding: 10px 0; }
.empty-cart { color: var(--muted); text-align: center; padding: 60px 20px; }

.lines td select { width: 100%; padding: 5px 6px; font-size: 12.5px; }
.lines td select + select { display: block; margin-top: 3px; }
.lines td:nth-child(3) { width: 125px; }
.lines th, .lines td { padding: 6px 6px; }
.lines .pill { font-size: 10.5px; white-space: normal; line-height: 1.25; }

.lines td.v { min-width: 74px; } .lines td.q input { width: 58px; } .lines td.p input { width: 88px; }

/* ================================================================ appareils (détection automatique) */
.burger { display: none; border: 0; background: none; font-size: 22px; padding: 4px 8px; margin-left: -6px; color: var(--ink); }
.top { justify-content: flex-start; } .top .ttl { flex: 1; min-width: 0; }
.tabbar, .side-bg { display: none; }
.content .card { overflow-x: auto; }

/* écran tactile : cibles plus grandes */
body.touch .btn, body.touch button.btn { min-height: 40px; }
body.touch input, body.touch select, body.touch textarea { font-size: 16px; min-height: 40px; } /* 16 px : évite le zoom auto d'iOS */
body.touch .nav a { padding: 12px 14px; }
body.touch tbody tr.click td { padding-top: 12px; padding-bottom: 12px; }

/* tablette et téléphone : menu latéral escamotable */
body.dev-tablet .burger, body.dev-phone .burger { display: block; }
body.dev-tablet .side, body.dev-phone .side { display: flex !important; position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
  transform: translateX(-105%); transition: transform .2s ease; width: 264px; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
body.menu-open .side { transform: none !important; }
body.menu-open .side-bg { display: block; position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 29; }
body.dev-tablet.landscape:not(.pos-mode) .side { position: sticky; transform: none; box-shadow: none; width: 220px; z-index: 10; height: 100vh; height: 100dvh; }
body.dev-tablet.landscape .burger { display: none; }

/* téléphone */
body.dev-phone { font-size: 15px; }
body.dev-phone .top { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); flex-wrap: wrap; }
body.dev-phone .top h1 { font-size: 17px; } body.dev-phone .top .sub { display: none; }
body.dev-phone #topActions { width: 100%; display: flex; gap: 6px; flex-wrap: wrap; } body.dev-phone #topActions:empty { display: none; }
body.dev-phone .content { padding: 12px 10px calc(84px + env(safe-area-inset-bottom)); }
body.dev-phone .g4, body.dev-phone .g3, body.dev-phone .g2 { grid-template-columns: 1fr; }
body.dev-phone .kpi .value { font-size: 22px; }
body.dev-phone .form .row { grid-template-columns: 1fr; }
body.dev-phone .drawer { width: 100vw; height: 100vh; top: 0; border-radius: 0; } body.dev-phone .drawer header { border-radius: 0; }
body.dev-phone .modal { width: 100vw; max-height: 100vh; border-radius: 14px 14px 0 0; align-self: end; }
body.dev-phone .modal-bg.open { place-items: end center; }
body.dev-phone .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 11px; color: var(--muted); }
.tabbar a span { font-size: 19px; line-height: 1; } .tabbar a.active { color: var(--brand); font-weight: 600; }
body.pos-mode .tabbar { display: none; }

/* caisse sur téléphone et tablette en portrait : panier sous les articles */
body.dev-phone .pos, body.dev-tablet.portrait .pos { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
body.dev-phone .pos-left { height: 56vh; } body.dev-tablet.portrait .pos-left { height: 58vh; }
body.dev-phone .pos-right, body.dev-tablet.portrait .pos-right { height: auto; border-left: 0; border-top: 2px solid var(--line); }
body.dev-phone .pos-grid { grid-template-columns: repeat(2, 1fr); }
body.dev-phone .methods { grid-template-columns: repeat(2, 1fr); }
body.dev-phone .cart-total .big { font-size: 28px; }
body.dev-tablet .pos-tile { min-height: 110px; } body.dev-tablet .qty button { width: 42px; height: 42px; }

/* carte « cet appareil » */
.devbox { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.devbox .qr { width: 168px; height: 168px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.devbox .urls code { font-size: 15px; font-weight: 600; }
.devline { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; margin: 2px 0; } .devline > span:first-child { color: var(--muted); min-width: 170px; }
/* ---- hébergé : utilisateur, licence, connecteurs */
.user-chip { display: grid; gap: 1px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #222b3d; }
.user-chip b { color: #fff; font-size: 13px; } .user-chip small { color: #8891a5; } .user-chip a { color: #9fb4ff; font-size: 12px; }
.lic-banner { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #f3d9a6; padding: 9px 28px; font-size: 13px; }
.lic-banner.bad { background: var(--bad-soft); color: var(--bad); border-color: #f5c2bd; }
.card.conn { display: flex; flex-direction: column; gap: 4px; } .card.conn p { margin: 2px 0 8px; }
.card.conn.on { border-color: #9fd8b8; box-shadow: 0 0 0 2px var(--ok-soft); }
.card.conn .btn { align-self: flex-start; }
.section-title { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* sélecteur de société (comptes multi-sociétés) */
#coSwitch { padding: 0 16px 12px; }
#coSwitch select { width: 100%; background: #1b2335; color: #fff; border: 1px solid #2c3650; border-radius: 8px; padding: 7px 8px; font-size: 13px; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.co-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line, #e6e8ee); }
.co-card:last-child { border-bottom: 0; }

/* prix de revient */
.lc-lines input { padding: 5px 6px; font-size: 13px; }
.lc-lines td { padding: 3px 4px; white-space: nowrap; }
#lcfees input, #lcfees select { padding: 5px 6px; font-size: 13px; }

/* choix de la mise en page des documents */
.dl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .dl-grid { grid-template-columns: 1fr; } }
.dl-opt { border: 2px solid var(--line, #e3e5ea); border-radius: 12px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.dl-opt.on { border-color: var(--brand, #1f4fd1); box-shadow: 0 0 0 3px rgba(31, 79, 209, .12); }
.dl-opt input[type=radio] { display: none; }
.dl-pg { aspect-ratio: 210 / 170; background: #fff; border: 1px solid #e3e5ea; border-radius: 6px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.dl-opt .btn { align-self: flex-start; }

/* aide intégrée */
.aide-wrap { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .aide-wrap { grid-template-columns: 1fr; } }
.aide-side .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #8a90a0; }
.aide-link { display: block; padding: 5px 8px; border-radius: 6px; color: inherit; text-decoration: none; font-size: 13.5px; }
.aide-link:hover, .aide-link.on { background: var(--brand-soft, #eef2ff); color: var(--brand, #1f4fd1); }
.aide-art { line-height: 1.6; max-width: 820px; } .aide-art h3 { margin-top: 18px; } .aide-art h3:first-child { margin-top: 0; font-size: 20px; }
.aide-art li { margin: 3px 0; } .aide-art code, .chat-msg code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.aide-hit { display: block; padding: 10px 12px; border: 1px solid var(--line, #e3e5ea); border-radius: 8px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.aide-hit:hover { border-color: var(--brand, #1f4fd1); }
#chatBtn { position: fixed; right: 20px; bottom: 20px; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--brand, #1f4fd1);
  color: #fff; font-size: 24px; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.22); z-index: 900; }
body.pos-mode #chatBtn { width: 42px; height: 42px; font-size: 18px; right: 12px; bottom: 12px; opacity: .8; }
#chatPanel { position: fixed; right: 20px; bottom: 86px; width: 400px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 110px);
  background: var(--surface); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25); display: none; flex-direction: column; z-index: 901; overflow: hidden; }
#chatPanel.open { display: flex; }
.chat-head { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line, #e3e5ea); }
.chat-msgs { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--soft); }
.chat-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; }
.chat-msg p { margin: 0 0 6px; } .chat-msg h3, .chat-msg h4 { font-size: 13.5px; margin: 6px 0 4px; } .chat-msg ol, .chat-msg ul { margin: 4px 0 6px; padding-left: 20px; }
.chat-msg.me { align-self: flex-end; background: var(--brand, #1f4fd1); color: #fff; }
.chat-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line, #e3e5ea); }
.chat-srcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chat-src { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 99px; background: var(--brand-soft, #eef2ff); color: var(--brand, #1f4fd1); text-decoration: none; margin: 3px 4px 0 0; }
.chat-rate { margin-top: 6px; display: flex; gap: 6px; align-items: center; } .chat-rate button { border: 1px solid var(--line, #e3e5ea); background: var(--surface); border-radius: 6px; cursor: pointer; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line, #e3e5ea); }
.chat-form textarea { flex: 1; resize: none; border: 1px solid var(--line, #e3e5ea); border-radius: 8px; padding: 8px; font: inherit; }
.chat-dots i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: #9aa0aa; animation: chatdot 1s infinite; }
.chat-dots i:nth-child(2) { animation-delay: .15s; } .chat-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chatdot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.pos-dd { position: absolute; left: 16px; right: 16px; top: 54px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 20; max-height: 280px; overflow: auto; }
.pos-dd div { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.pos-dd div:hover { background: var(--brand-soft); }

/* historique en bas des fiches */
.histlist { list-style: none; margin: 0 0 8px; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.histlist li { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; }
.histlist li::before { content: ""; position: absolute; left: -20px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); border: 2px solid var(--panel); }
.histlist li:first-child::before { background: var(--accent, #3b6ef5); }
.histlist time { white-space: nowrap; }
/* adresses de livraison (fiche client) */
.addrlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.addr { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.addr.def { border-color: var(--accent, #3b6ef5); }
/* paramètres : sous-menu à gauche (ordinateur), rubriques en défilement horizontal (téléphone) */
.psettings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.psnav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.psnav input { margin: 0 0 6px; }
.psnav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; color: inherit; text-decoration: none; font-size: 14px; }
.psnav a span { width: 20px; text-align: center; }
.psnav a:hover { background: var(--bg, #f3f4f6); }
.psnav a.active { background: var(--accent, #3b6ef5); color: #fff; font-weight: 600; }
.pssave { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg, #f3f4f6) 40%); z-index: 2; }
body.dev-phone .psettings, .psettings.narrow { grid-template-columns: 1fr; }
body.dev-phone .psnav { position: static; flex-direction: row; overflow-x: auto; flex-wrap: nowrap; padding: 6px; }
body.dev-phone .psnav input { min-width: 170px; margin: 0 6px 0 0; }
body.dev-phone .psnav a { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 900px) { .psettings { grid-template-columns: 1fr; } .psnav { position: static; flex-direction: row; overflow-x: auto; } .psnav a { white-space: nowrap; flex: 0 0 auto; } .psnav input { min-width: 170px; margin: 0 6px 0 0; } }
.psnav input[type=search] { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 13px; background: var(--bg, #fff); }
/* recherche globale (barre du haut, Ctrl K) */
.top { gap: 14px; }
.gsearch { display: flex; align-items: center; gap: 8px; min-width: 260px; margin-left: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--muted, #6b7280); cursor: pointer; font: inherit; font-size: 14px; }
.gsearch:hover { border-color: var(--accent, #3b6ef5); }
.gsearch .gs-ph { flex: 1; text-align: left; }
.gsearch kbd, .gsfoot kbd { font: 11px/1 inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg, #f3f4f6); color: inherit; margin-right: 3px; }
.gs-ico { font-size: 18px; line-height: 1; }
body.dev-phone .gsearch { min-width: 0; width: 40px; justify-content: center; padding: 8px; } body.dev-phone .gsearch .gs-ph, body.dev-phone .gsearch kbd { display: none; }
.gsbg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1000; display: flex; justify-content: center; align-items: flex-start; padding: 9vh 12px 12px; }
.gsbox { width: 640px; max-width: 100%; max-height: 78vh; display: flex; flex-direction: column; background: var(--panel); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
.gshead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.gshead input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 16px; background: transparent; color: inherit; margin: 0; padding: 4px 0; }
.gstabs { display: flex; gap: 6px; padding: 10px 14px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.gstabs button { flex: 0 0 auto; border: 1px solid var(--line); background: transparent; color: inherit; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.gstabs button.active { background: var(--accent, #3b6ef5); border-color: var(--accent, #3b6ef5); color: #fff; }
.gsres { flex: 1; overflow-y: auto; padding: 6px; min-height: 180px; }
.gsres.busy { opacity: .6; }
.gsgroup { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); padding: 10px 10px 4px; }
.gsitem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.gsitem.sel { background: var(--bg, #eef2ff); outline: 1px solid var(--accent, #3b6ef5); }
.gsic { width: 22px; text-align: center; } .gstxt { flex: 1; min-width: 0; } .gstxt b, .gstxt div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.gsempty { text-align: center; padding: 34px 20px; } .gsbig { font-size: 34px; opacity: .5; }
.gsfoot { display: flex; gap: 16px; flex-wrap: wrap; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted, #6b7280); }
body.dev-phone .gsfoot { display: none; }
body.pos-mode .gsearch, body.wizard .gsearch, body.role-caisse .gsearch { display: none; }
/* ventes : onglets Devis / Bons de commande / BL / Factures / Avoirs */
.vtabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.vtabs a { padding: 9px 14px; color: inherit; text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; }
.vtabs a:hover { color: var(--accent, #3b6ef5); }
.vtabs a.active { border-bottom-color: var(--accent, #3b6ef5); color: var(--accent, #3b6ef5); font-weight: 600; }
/* documents liés */
.docchain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.docchip { display: flex; gap: 8px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; }
.docchip small { display: block; color: var(--muted, #6b7280); font-size: 11px; }
.docchip:hover { border-color: var(--accent, #3b6ef5); }
.docchip.cur { border-color: var(--accent, #3b6ef5); background: var(--bg, #eef2ff); }
.docarrow { color: var(--muted, #6b7280); }
table.dlv { width: 100%; } table.dlv td, table.dlv th { padding: 6px; vertical-align: top; } table.dlv textarea, table.dlv input.small { width: 100%; margin-top: 4px; font-size: 12px; }
table.dlv tr.dlv-done td { opacity: .45; } table.dlv tr.dlv-done td:first-child { color: var(--up, #16a34a); opacity: 1; }
.drawer .form, .modal .form { max-width: none; }
/* classement des factures fournisseurs (dossiers) */
.afolds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.afold { display: flex; gap: 12px; align-items: center; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; }
.afold:hover { border-color: var(--accent, #3b6ef5); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.afold .afi { font-size: 30px; } .afold small { display: block; color: var(--muted, #6b7280); font-size: 12px; margin-top: 2px; }
.acrumbs { font-size: 14px; } .acrumbs a { color: var(--accent, #3b6ef5); text-decoration: none; }

/* =====================================================================
   THÈME ÉPURÉ (par défaut) — fond clair, menu clair, moins de traits et d'ombres, plus d'air.
   L'ancien thème reste disponible : Paramètres → Mise en page des documents → Apparence (body.theme-classic).
   ===================================================================== */
body:not(.theme-classic) {
  --bg: #f8f8fa; --panel: #ffffff; --ink: #18181b; --muted: #71717a; --line: #ececf0;
  --brand: #2f5bea; --brand-soft: #eef2fe; --side: #ffffff; --side-ink: #3f3f46;
  --ok: #15803d; --ok-soft: #ecf8f0; --warn: #b45309; --warn-soft: #fdf6e9; --bad: #c2410c; --bad-soft: #fdf0ea;
  --radius: 12px; --shadow: none;
  font-family: Inter, "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -.005em;
}
/* menu */
body:not(.theme-classic) .side { border-right: 1px solid var(--line); width: 236px; }
body:not(.theme-classic) .brand b { color: var(--ink); }
body:not(.theme-classic) .brand small { color: var(--muted); }
body:not(.theme-classic) .brand .logo { background: var(--ink); border-radius: 10px; }
body:not(.theme-classic) .nav a { color: var(--side-ink); padding: 8px 12px; font-size: 13.5px; }
body:not(.theme-classic) .nav a:hover { background: var(--soft); color: var(--ink); }
body:not(.theme-classic) .nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
body:not(.theme-classic) .nav .ico { opacity: .6; }
body:not(.theme-classic) .nav a.active .ico { opacity: 1; }
body:not(.theme-classic) .nav .sep { color: #a1a1aa; font-weight: 600; letter-spacing: .06em; padding: 18px 12px 6px; }
body:not(.theme-classic) .side-foot { border-top: 1px solid var(--line); color: var(--muted); }
/* barre du haut : sans fond ni trait, le titre respire */
body:not(.theme-classic) .top { background: rgba(248,248,250,.86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 0; padding: 22px 36px 14px; }
body:not(.theme-classic) .top h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
body:not(.theme-classic) .top .sub { font-size: 13px; margin-top: 2px; }
body:not(.theme-classic) .content { padding: 10px 36px 70px; }
/* cartes : un trait très léger, pas d'ombre */
body:not(.theme-classic) .card { border-color: var(--line); padding: 20px 22px; }
body:not(.theme-classic) .card h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
body:not(.theme-classic) .grid { gap: 16px; }
body:not(.theme-classic) .kpi .label { font-size: 12.5px; }
body:not(.theme-classic) .kpi .value { font-size: 27px; font-weight: 650; letter-spacing: -.03em; }
body:not(.theme-classic) .banner { background: var(--warn-soft); border: 0; border-radius: 10px; padding: 11px 16px; }
body:not(.theme-classic) .banner.ok { background: var(--ok-soft); color: var(--ok); }
/* champs et boutons */
body:not(.theme-classic) input[type=text], body:not(.theme-classic) input[type=email], body:not(.theme-classic) input:not([type]),
body:not(.theme-classic) input[type=password], body:not(.theme-classic) input[type=number], body:not(.theme-classic) input[type=date],
body:not(.theme-classic) select, body:not(.theme-classic) textarea { border-color: #e4e4e7; border-radius: 9px; padding: 8px 11px; transition: border-color .15s, box-shadow .15s; }
body:not(.theme-classic) input:focus, body:not(.theme-classic) select:focus, body:not(.theme-classic) textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
body:not(.theme-classic) .btn { border-color: #e4e4e7; border-radius: 9px; padding: 7px 13px; font-weight: 500; transition: background .15s, border-color .15s; }
body:not(.theme-classic) .btn:hover { background: var(--soft); border-color: #d4d4d8; }
body:not(.theme-classic) .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
body:not(.theme-classic) .btn.primary:hover { background: #244ad0; }
body:not(.theme-classic) .btn.danger { background: #dc2626; border-color: #dc2626; }
/* onglets */
body:not(.theme-classic) .tabs, body:not(.theme-classic) .vtabs { border-bottom: 1px solid var(--line); gap: 2px; }
body:not(.theme-classic) .tabs button { padding: 10px 14px; }
body:not(.theme-classic) .tabs button.on { font-weight: 600; }
/* tableaux : pas de cadre lourd, en-têtes discrets, lignes aérées */
body:not(.theme-classic) .table-wrap { border-color: var(--line); border-radius: 12px; }
body:not(.theme-classic) th { background: var(--surface); color: #a1a1aa; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 11px 14px; border-bottom: 1px solid var(--line); }
body:not(.theme-classic) td { padding: 11px 14px; border-bottom: 1px solid #f4f4f5; }
body:not(.theme-classic) tr:last-child td { border-bottom: 0; }
body:not(.theme-classic) tr:hover td { background: var(--soft); }
/* pastilles plus douces */
body:not(.theme-classic) .pill { font-weight: 500; padding: 2px 9px; background: var(--soft); color: #52525b; }
body:not(.theme-classic) .pill.ok { background: var(--ok-soft); color: var(--ok); } body:not(.theme-classic) .pill.warn { background: var(--warn-soft); color: var(--warn); }
body:not(.theme-classic) .pill.bad { background: var(--bad-soft); color: var(--bad); } body:not(.theme-classic) .pill.info { background: var(--brand-soft); color: var(--brand); }
body:not(.theme-classic) .src.erp, body:not(.theme-classic) .src.pl { background: var(--soft); color: #52525b; }
/* graphiques : une seule couleur, sans dégradé */
body:not(.theme-classic) .chart .bar { background: var(--brand); opacity: .85; border-radius: 6px 6px 2px 2px; }
body:not(.theme-classic) .chart .bar.in { background: var(--ok); } body:not(.theme-classic) .chart .bar.out { background: #f97316; }
/* fenêtres */
body:not(.theme-classic) .drawer { background: var(--bg); border-radius: 16px; box-shadow: 0 30px 80px rgba(24,24,27,.22); }
body:not(.theme-classic) .drawer header { border-bottom: 1px solid var(--line); border-radius: 16px 16px 0 0; }
body:not(.theme-classic) .drawer-bg { background: rgba(24,24,27,.38); backdrop-filter: blur(2px); }
body:not(.theme-classic) .modal { border-radius: 16px; box-shadow: 0 30px 80px rgba(24,24,27,.22); }
/* recherche, téléphone */
body:not(.theme-classic) .gsearch { border-color: #e4e4e7; background: var(--surface); border-radius: 10px; }
body:not(.theme-classic) .tabbar { background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
/* barre du haut : le titre garde sa place, les boutons passent à la ligne s'il y en a beaucoup */
.top { flex-wrap: wrap; }
.top .ttl { flex: 1 1 240px; min-width: 220px; }
#topActions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
body:not(.theme-classic) .side-foot { padding: 10px 18px; font-size: 11.5px; line-height: 1.35; }
body.dev-phone .top .ttl { flex: 1 1 0; min-width: 0; }

/* =====================================================================
   MODE SOMBRE — automatique selon l'ordinateur (ou forcé dans Paramètres → Apparence). body.theme-dark
   ===================================================================== */
body.theme-dark {
  --bg: #0e0f11; --panel: #17181b; --ink: #e7e7ea; --muted: #9b9ba6; --line: #26272c;
  --brand: #6f8dff; --brand-soft: rgba(111,141,255,.15); --side: #121316; --side-ink: #c4c4cc;
  --ok: #4ade80; --ok-soft: rgba(74,222,128,.12); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.12);
  --bad: #fb7185; --bad-soft: rgba(251,113,133,.13); --erp: #a78bfa; --pl: #2dd4bf;
  --surface: #1b1c20; --soft: #232429;
  color-scheme: dark;
}
body.theme-dark .top { background: rgba(14,15,17,.86); }
body.theme-dark .brand .logo { background: var(--brand); }
body.theme-dark .nav a:hover, body.theme-dark .btn:hover { background: #222328; color: var(--ink); }
body.theme-dark .card, body.theme-dark .table-wrap, body.theme-dark .modal, body.theme-dark .drawer header, body.theme-dark .gsearch,
body.theme-dark .gsbox, body.theme-dark .psnav, body.theme-dark .afold, body.theme-dark .docchip, body.theme-dark .addr,
body.theme-dark th, body.theme-dark .tabbar { background: var(--panel) !important; color: var(--ink); border-color: var(--line); }
body.theme-dark input, body.theme-dark select, body.theme-dark textarea, body.theme-dark .btn {
  background: #1d1e22 !important; color: var(--ink); border-color: #303137 !important; }
body.theme-dark .btn.primary { background: var(--brand) !important; border-color: var(--brand) !important; color: #0e0f11; }
body.theme-dark .btn.danger { background: #dc2626 !important; border-color: #dc2626 !important; color: #fff; }
body.theme-dark td { border-bottom-color: #202126; }
body.theme-dark tr:hover td { background: #1c1d21; }
body.theme-dark .pill { background: #24252a; color: #c4c4cc; }
body.theme-dark .pill.ok { background: var(--ok-soft); color: var(--ok); } body.theme-dark .pill.warn { background: var(--warn-soft); color: var(--warn); }
body.theme-dark .pill.bad { background: var(--bad-soft); color: var(--bad); } body.theme-dark .pill.info { background: var(--brand-soft); color: var(--brand); }
body.theme-dark .banner { background: var(--warn-soft); color: var(--warn); }
body.theme-dark .banner.ok { background: var(--ok-soft); color: var(--ok); }
body.theme-dark .drawer, body.theme-dark .content { background: var(--bg); }
body.theme-dark .drawer-bg, body.theme-dark .gsbg { background: rgba(0,0,0,.6); }
body.theme-dark .gsitem.sel, body.theme-dark .psnav a:hover, body.theme-dark .docchip.cur { background: #222328; }
body.theme-dark kbd { background: #24252a !important; border-color: #34353b !important; color: var(--muted) !important; }
body.theme-dark .chart .bar { opacity: 1; }
body.theme-dark hr { border-color: var(--line); }
/* couleurs écrites directement dans les pages : fonds clairs -> fond sombre, textes foncés -> texte clair */
body.theme-dark [style*="background:#f"], body.theme-dark [style*="background: #f"], body.theme-dark [style*="background:#e"],
body.theme-dark [style*="background: #e"], body.theme-dark [style*="background:white"] { background: #1d1e22 !important; }
body.theme-dark [style*="border:2px dashed"] { border-color: #3a3d48 !important; }
body.theme-dark [style*="color:#333"], body.theme-dark [style*="color:#1c2230"] { color: var(--ink) !important; }
body.theme-dark [style*="color:#b00020"], body.theme-dark [style*="color:#a4161a"] { color: var(--bad) !important; }
body.theme-dark img { opacity: .92; }
body.theme-dark .toast { background: #2a2c33; color: #f1f1f4; border: 1px solid #3a3c44; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
body.theme-dark .toast.bad { background: #7f1d1d; border-color: #991b1b; }
body.theme-dark .wiz-steps span { background: #1f2025; color: #9b9ba6; border-color: #2c2d33; }
body.theme-dark .wiz-steps span.on { background: var(--brand); color: #0e0f11; }
body.theme-dark .wiz-steps span.done { background: rgba(74,222,128,.14); color: #4ade80; }
/* ---- e-mails aux clients */
.mailform textarea { font: inherit; line-height: 1.5; }
.mailform details summary { cursor: pointer; color: var(--brand); margin: -2px 0 6px; }
.mailatt { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; background: var(--bg); }
.mailvars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: 99px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.mailprev { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.mailprev b { display: block; margin: 4px 0 8px; }
.mailprev pre { white-space: pre-wrap; font: inherit; margin: 0; }
.mailform textarea, .mailform input, #mt_body, #mt_sub { font-family: inherit; font-weight: 400; font-size: 14px; line-height: 1.55; }
/* mode sombre : compléments (couleurs vives avec texte foncé, étiquettes de source) */
body.theme-dark .pay-btn { color: #0b1a10; }
body.theme-dark .pay-btn:disabled, body.theme-dark .pay-btn[disabled] { background: #2a2c33 !important; color: #7c7f8a; }
body.theme-dark .src.erp, body.theme-dark .src.pl { background: #26272d; color: #c4c4cc; }
body.theme-dark .ac-list, body.theme-dark .pos-dd { box-shadow: 0 10px 30px rgba(0,0,0,.55); border-color: #303137; }
body.theme-dark .ac-list div:hover, body.theme-dark .ac-list div.on { background: #262833; }
.bktbl { width: 100%; table-layout: fixed; } .bktbl td { padding: 4px 6px 4px 0; } .bktbl input[type=text] { width: 100%; }
.bkrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
.bkrow.on { border-color: var(--brand); }
.bkrow .bkiban input { font-family: ui-monospace, Menlo, monospace; }
.bkrow .bkact { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.bkrow input[type=text] { min-width: 0; width: 100%; }
.bkrow .bkact label.check { white-space: nowrap; }

/* ---- icônes (Lucide) */
svg.i { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.17em; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; }
.btn svg.i, button svg.i, h3 svg.i, h2 svg.i, h4 svg.i, summary svg.i, .vtabs a svg.i, .chip svg.i { margin-right: .42em; }
.ionly svg.i, .nav .ico svg.i { margin-right: 0; }
.nav .ico { display: inline-flex; align-items: center; justify-content: center; }
.nav .ico svg.i { width: 17px; height: 17px; vertical-align: 0; }
.tabbar svg.i { width: 21px; height: 21px; margin: 0 auto 2px; display: block; }
h3 svg.i { color: var(--muted); }
.btn.primary svg.i, .pay-btn svg.i { color: inherit; }
.iw { display: inline-flex; align-items: center; gap: .42em; }
.iw svg.i { margin-right: 0 !important; }
.iw.ionly { gap: 0; }
.gs-ico svg.i { width: 15px; height: 15px; vertical-align: -2px; }
/* ---- fiches : résumé + actions en haut, onglets */
.drawer header h2 { display: flex; align-items: center; gap: 10px; }
.drawer header h2 .pill { font-size: 12px; }
.dhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 14px;
  padding: 14px 16px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: var(--radius); }
.dsum { display: flex; gap: 28px; flex-wrap: wrap; }
.dk { display: flex; flex-direction: column; gap: 2px; min-width: 90px; }
.dk span { font-size: 11.5px; color: var(--muted); }
.dk b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dk.down b { color: var(--bad); }
.dact { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dmore { position: relative; }
.dmenu { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 230px; padding: 6px;
  background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.14); }
.dmenu.open { display: block; }
.dmenu .btn { display: flex; width: 100%; border: 0; background: transparent !important; text-align: left; padding: 8px 10px; border-radius: 6px; }
.dmenu .btn:hover { background: var(--soft) !important; }
.dtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 14px; overflow-x: auto; }
.dtab { border: 0; background: none; padding: 9px 14px; font: inherit; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.dtab:hover { color: var(--ink); }
.dtab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }
.dcount:not(:empty) { margin-left: 6px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.techinfo { margin-top: 14px; } .techinfo summary { cursor: pointer; color: var(--muted); }
body.theme-dark .dmenu { box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.demobar { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin: -4px 0 14px; }
.demobar a { margin-left: auto; }
/* tableaux un peu plus aérés */
body:not(.theme-classic) td { padding-top: 10px; padding-bottom: 10px; }
.pos-right .toolbar { flex-wrap: nowrap; } .pos-right #cust { min-width: 0; }
.drawer .body { grid-template-columns: minmax(0, 1fr); }
.drawer .body > *, .dpane, .dpane > * { min-width: 0; }
body.dev-phone .drawer header h2 { font-size: 16px; flex-wrap: wrap; gap: 6px; }
body.dev-phone .drawer .body { padding: 12px; }
body.dev-phone .dhead { padding: 12px; gap: 12px; }
body.dev-phone .dsum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; width: 100%; }
body.dev-phone .dact { width: 100%; } body.dev-phone .dact > .btn.primary { flex: 1 1 100%; justify-content: center; }
/* toujours blanc : QR codes (lisibles au scan) et miniatures de page (papier) */
.qrbox, body.theme-dark .qrbox { background: #fff !important; }
body.theme-dark .dl-pg { background: #fff !important; }
body.theme-dark .dl-pg [style*="background:#f"], body.theme-dark .dl-pg [style*="background: #f"] { background: #f2f3f5 !important; }
/* mode sombre : comptage de caisse (pastilles billets / pièces, résultat du comptage) */
body.theme-dark .cnt-d { color: #e7e7ea !important; }
body.theme-dark .cnt-d.bill { background: rgba(111,141,255,.16) !important; border-color: #6f8dff !important; }
body.theme-dark .cnt-d.coin { background: rgba(251,191,36,.14) !important; border-color: #fbbf24 !important; }
body.theme-dark .cnt-st.ok { background: rgba(74,222,128,.12) !important; color: #4ade80 !important; border-color: #4ade80 !important; }
body.theme-dark .cnt-st.ko { background: rgba(251,113,133,.13) !important; color: #fb7185 !important; border-color: #fb7185 !important; }

/* 2.45.1 — finitions (repris de la proposition Gemini, en variables pour clair et sombre) */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
.btn { transition: background .15s, border-color .15s, box-shadow .15s, filter .15s, transform .05s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible, .dtab:focus-visible, .nav a:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--brand-soft); border-color: var(--brand); }
body:not(.theme-classic) .btn.primary { box-shadow: 0 1px 2px rgba(0,0,0,.12); }
body:not(.theme-classic) .btn.primary:hover { background: var(--brand); filter: brightness(.9); }
body.theme-dark .btn.primary:hover { background: var(--brand); filter: brightness(1.1); }
body.theme-classic input:focus, body.theme-classic select:focus, body.theme-classic textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input, select, textarea { transition: border-color .15s, box-shadow .15s; }
body:not(.theme-classic) .btn.danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; filter: brightness(.9); }
body.theme-dark input:focus, body.theme-dark select:focus, body.theme-dark textarea:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3px var(--brand-soft); outline: 0; }

/* ================= 2.46 — caisse (inspirée de la maquette) ================= */
.pos { grid-template-columns: minmax(0, 1fr) 430px; gap: 0; background: var(--bg); }
.pos-left { padding: 22px 24px 14px; gap: 14px; }
.pos-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pos-ttl h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 10px; }
.pos-dev { font-size: 13px; font-weight: 500; color: var(--muted); }
.pos-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pos-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pos-open { display: inline-flex; align-items: center; gap: 6px; }
.pos-open .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.pos-sbox { position: relative; display: flex; align-items: center; }
.pos-sbox > svg.i { position: absolute; left: 15px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; margin: 0; }
.pos-search { font-size: 16px !important; padding: 14px 16px 14px 46px !important; width: 100%; border: 1px solid var(--line) !important;
  border-radius: 12px !important; background: var(--surface) !important; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.pos-search:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 4px var(--brand-soft) !important; }
.pos-sbox.sm > svg.i { left: 11px; width: 16px; height: 16px; }
.pos-sbox.sm input { width: 100%; padding-left: 34px !important; }
.pos-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.pos-chips:empty { display: none; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pos-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; }
.pos-tile { padding: 14px 16px; min-height: 112px; display: flex; flex-direction: column; border-radius: 12px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .05s; }
.pos-tile:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.pos-tile .sku { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.pos-tile .t { font-size: 14px; line-height: 1.3; -webkit-line-clamp: 2; }
.pos-tile .p { margin-top: auto; padding-top: 10px; color: var(--ink); font-size: 16px; align-items: center; }
.pos-tile .p .pill { font-size: 11px; font-weight: 600; padding: 2px 8px; }
/* ticket : carte à droite */
.pos-right { margin: 16px 16px 16px 0; height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.tk-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 10px; }
.tk-head b { font-size: 16px; }
.lnk-bad { border: 0; background: none; color: var(--bad); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 0; }
.lnk-bad:hover { text-decoration: underline; }
.tk-cust { padding: 0 20px 12px; border-bottom: 1px solid var(--line); position: relative; }
.tk-cust #custinfo:not(:empty) { margin-top: 6px; }
.tk-cust .pos-dd { left: 20px; right: 20px; top: 46px; }
.cart-line { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 20px; gap: 8px 12px; }
.cart-line .lb { font-size: 14px; line-height: 1.3; }
.cart-line .cl-act { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.cart-line .cl-act .btn { padding: 5px 7px; color: var(--muted); }
.qty button { width: 30px; height: 30px; font-size: 16px; background: var(--surface); }
.qty span { min-width: 26px; }
.empty-cart { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 70px 20px; }
.empty-cart svg.i { width: 30px; height: 30px; opacity: .45; margin: 0 0 6px; }
.tk-sum { margin: 10px 16px 0; padding: 12px 14px; background: var(--soft); border-radius: 12px; }
.tk-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.tk-tot { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
#tva:not(:empty) + .tk-tot { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.tk-tot > span { font-size: 17px; } .tk-tot small { font-weight: 400; font-size: 12px; }
.tk-tot b { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tk-pay { padding: 12px 16px 8px; }
.pay-btn { background: var(--brand); padding: 16px; font-size: 20px; border-radius: 12px; cursor: pointer; transition: filter .15s; }
.pay-btn:not(:disabled):hover { filter: brightness(.92); }
.tk-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 16px 16px; }
.tk-tools button { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 8px 4px; font: inherit; font-size: 11.5px; color: var(--ink); cursor: pointer; line-height: 1.15; text-align: center; }
.tk-tools button:hover { border-color: var(--brand); color: var(--brand); }
.tk-tools svg.i { width: 17px; height: 17px; margin: 0; }
body.theme-dark .pos-right { background: var(--panel); }
body.theme-dark .pay-btn { color: #0e0f11; }
body.theme-dark .chip.on { background: var(--ink); color: #0e0f11; }
body.dev-phone .pos-right, body.dev-tablet.portrait .pos-right { margin: 0 10px 10px; height: auto; border-radius: 14px; border-top: 1px solid var(--line); }
body.dev-phone .pos-left { padding: 14px 12px; } body.dev-phone .pos-ttl h2 { font-size: 20px; }
body.dev-phone .pos-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
body.pos-mode #chatBtn { right: auto; left: 12px; }
.pos-tile .sku, .pos-tile .t, .pos-tile .p { flex-shrink: 0; }
.pos-grid { grid-auto-rows: minmax(112px, auto); }

/* ================= 2.46 — menu (carte société, groupes) ================= */
.brand { position: relative; margin: 14px 12px 6px; padding: 10px 12px; border-radius: 12px; gap: 10px; }
body:not(.theme-classic) .brand { border: 1px solid var(--line); background: var(--soft); }
.brand .bt { min-width: 0; flex: 1; }
.brand b, .brand small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand b { font-size: 14px; }
.brand small { display: block; font-size: 11.5px; }
.brand .logo { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; overflow: hidden; }
.brand .logo.img { background: #fff !important; border: 1px solid var(--line); }
.brand .logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bchev { color: var(--muted); display: inline-flex; } .bchev svg.i { margin: 0; width: 16px; height: 16px; }
#coSwitch { padding: 0; }
#coSwitch select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
body.multi-co .brand { cursor: pointer; } body.multi-co .brand:hover { border-color: var(--muted); }
body:not(.theme-classic) .nav .sep { font-size: 10.5px; padding: 16px 12px 5px; }
body:not(.theme-classic) .nav a { padding: 8px 12px; border-radius: 9px; }
body.theme-dark .brand { background: var(--soft); }

/* ================= 2.46 — catalogue : liste + fiche à droite ================= */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; letter-spacing: -.01em; }
.cat-tools { align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-q { min-width: 320px; flex: 0 1 380px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 9px; cursor: pointer; color: var(--muted); display: inline-flex; }
.seg button svg.i { margin: 0; }
.seg button.on { background: var(--brand-soft); color: var(--brand); }
.catsplit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); gap: 18px; align-items: start; }
.catlist { min-width: 0; }
.c2 { display: flex; flex-direction: column; gap: 1px; } .c2 b { font-weight: 600; } .c2 > span { font-size: 12px; color: var(--muted); }
.stk { font-variant-numeric: tabular-nums; } .stk.ok { color: var(--ok); } .stk.warn { color: var(--warn); } .stk.bad { color: var(--bad); }
tr.sel td { background: var(--brand-soft) !important; }
tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.artpane { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.ap-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 60px 20px; color: var(--ink); }
.ap-empty svg.i { width: 30px; height: 30px; opacity: .4; margin: 0 0 4px; }
.ap-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.ap-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.ap-ttl h2 { margin: 2px 0 2px; font-size: 18px; line-height: 1.25; }
.artpane .dhead { flex-direction: column; align-items: stretch; gap: 10px; }
.artpane .dsum { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.artpane .moveform { grid-template-columns: 1fr 1fr; }
.locs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.loc { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.loc span { font-size: 12px; color: var(--muted); } .loc b { font-size: 20px; }
.h4 { margin: 6px 0 8px; font-size: 14px; }
.spcard { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
@media (max-width: 1180px) { .catsplit { grid-template-columns: minmax(0, 1fr); } .artpane { display: none; } }
.artpane .moveform label { min-width: 0; } .artpane .moveform select, .artpane .moveform input { width: 100% !important; min-width: 0; }

/* ================= 2.46 — caisse : toujours sur un seul écran, sans faire défiler la page ================= */
body.pos-mode main { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.pos-mode #licBanner:empty { display: none; }
body.pos-mode .content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; max-width: none; }
body.pos-mode .content > .banner { margin: 10px 16px 0; flex: none; }
.pos { flex: 1; min-height: 0; height: auto; }
.pos-left { min-height: 0; }
.pos-grid { min-height: 0; flex: 1; }
.pos-right { height: auto; min-height: 0; }
.cart { min-height: 0; }
/* écrans peu hauts : portable 13-14", écrans tactiles 1024×768 / 1280×800 */
@media (max-height: 820px) {
  .pos-left { padding: 14px 18px 10px; gap: 10px; }
  .pos-ttl h2 { font-size: 20px; } .pos-sub { font-size: 12px; margin-top: 1px; }
  .pos-acts .btn { padding: 6px 10px; }
  .pos-search { padding: 11px 14px 11px 44px !important; font-size: 15px !important; }
  .pos-grid { grid-auto-rows: minmax(96px, auto); gap: 10px; }
  .pos-tile { min-height: 96px; padding: 11px 13px; }
  .pos-right { margin: 10px 10px 10px 0; border-radius: 14px; }
  .tk-head { padding: 12px 16px 8px; } .tk-cust { padding: 0 16px 10px; }
  .cart-line { padding: 9px 16px; }
  .tk-sum { margin: 8px 12px 0; padding: 9px 12px; } .tk-tot b { font-size: 25px; } .tk-tot > span { font-size: 15px; }
  .tk-pay { padding: 8px 12px 6px; } .pay-btn { padding: 12px; font-size: 18px; }
  .tk-tools { padding: 0 12px 10px; }
  .tk-tools button { flex-direction: row; justify-content: center; gap: 5px; padding: 8px 4px; min-height: 38px; }
  .empty-cart { padding: 30px 16px; }
}
@media (max-height: 680px) {
  .pos-sub, .pos-dev { display: none; }
  .tk-row { font-size: 12px; padding: 1px 0; }
  .tk-tools button span { display: none; }
}
/* écrans étroits (petits écrans tactiles en paysage) */
@media (max-width: 1180px) { .pos { grid-template-columns: minmax(0, 1fr) 370px; } .pos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
@media (max-width: 1050px) { .pos { grid-template-columns: minmax(0, 1fr) 340px; } .tk-tools button span { font-size: 11px; } }
/* tablette en portrait : articles en haut, ticket en bas, chacun défile seul ; la page ne bouge pas */
body.dev-tablet.portrait .pos { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1.1fr); height: auto; min-height: 0; }
body.dev-tablet.portrait .pos-left { height: auto; }
body.dev-tablet.portrait .pos-right { margin: 0 10px 10px; height: auto; border-top: 1px solid var(--line); }
/* téléphone : l'écran est trop petit, la page défile (seul cas) */
body.dev-phone main { height: auto; overflow: visible; } body.dev-phone .content { overflow: visible; }
.pos-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: none; } .pos-chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; flex: none; }
.cat-tools .pos-chips { flex: 0 1 auto; }
.pos-tile .p .pill { white-space: nowrap; }
.pos-tile .p { gap: 6px; }
body.dev-tablet.portrait .pos { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
body.dev-tablet.portrait .pos-sub { display: none; }
body.dev-tablet.portrait #tva { display: none; }
body.dev-tablet.portrait .tk-tot b { font-size: 26px; }
body.dev-tablet.portrait .tk-tools button { flex-direction: row; justify-content: center; gap: 6px; }
body.dev-tablet.portrait .tk-head { padding: 12px 16px 6px; } body.dev-tablet.portrait .tk-cust { padding: 0 16px 8px; }
body.dev-tablet.portrait .tk-tot { border-top: 0 !important; margin-top: 0 !important; padding-top: 0 !important; }

/* ================= 2.46 — chiffres en haut des ventes, filtres rapides ================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0 0 16px; }
.kpis:empty { display: none; }
.kpi2 { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.kpi2:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.05); text-decoration: none; }
.kpi2 .kl { font-size: 12.5px; color: var(--muted); }
.kpi2 .kv { font-size: 22px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.kpi2 .kv small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi2 .kv .pill { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.kpi2 .ks { font-size: 12px; color: var(--muted); }
.fchips { flex: 0 1 auto; min-width: 0; }
.toolbar .fchips + * { margin-left: 0; }
.essai table { margin: 6px 0; } .essai p { margin: 4px 0; }
.dupc { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; } .dupc .btn { flex: 1; justify-content: center; padding: 12px; }

/* ================= 2.47 — fenêtres de confirmation / saisie du logiciel ================= */
.askbg { position: fixed; inset: 0; z-index: 3000; background: rgba(15,23,42,.42); display: grid; place-items: center; padding: 16px; animation: askfade .12s ease-out; }
.ask { background: var(--surface); color: var(--ink); border-radius: 14px; width: min(440px, 100%); padding: 22px 22px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.25);
  border: 1px solid var(--line); animation: askpop .14s ease-out; }
.ask h3 { margin: 0 0 8px; font-size: 16px; }
.askmsg p { margin: 0 0 6px; line-height: 1.45; font-size: 14px; color: var(--ink); }
.askmsg p + p { color: var(--muted); font-size: 13px; }
.askin { width: 100%; margin: 8px 0 2px; font-size: 15px; padding: 10px 12px; }
.askbtns { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ask.wide { width: min(560px, 94vw); max-width: none; }
.askbtns .btn { min-width: 96px; justify-content: center; }
@keyframes askfade { from { opacity: 0; } } @keyframes askpop { from { transform: scale(.96); opacity: 0; } }
body.theme-dark .askbg { background: rgba(0,0,0,.6); }
.banner.info { background: var(--brand-soft) !important; color: var(--ink) !important; display: flex; gap: 10px; align-items: flex-start; }
.banner.info svg.i { color: var(--brand); flex: none; margin-top: 2px; }
.banner.bad { background: var(--bad-soft, #fde8e8) !important; color: var(--bad) !important; }

/* ================= 2.47 — pièces jointes ================= */
.pdrop { display: flex; gap: 12px; align-items: center; border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px 16px; background: var(--soft); }
.pdrop.over { border-color: var(--brand); background: var(--brand-soft); }
.pdrop > svg.i { width: 22px; height: 22px; color: var(--muted); margin: 0; flex: none; }
.plist { display: grid; gap: 8px; margin-top: 12px; }
.pitem { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.pitem img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: var(--soft); flex: none; }
.pico { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 8px; background: var(--soft); flex: none; color: var(--muted); }
.pico svg.i { width: 22px; height: 22px; margin: 0; }
.pmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; } .pmeta a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mailpieces { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: grid; gap: 4px; }
.kpi2 .kv > span { white-space: nowrap; }

/* 2.47 — photo et descriptif des articles */
.artc{display:flex;align-items:center;gap:10px;min-width:0}
.athumb{flex:0 0 38px;width:38px;height:38px;border-radius:8px;object-fit:contain;background:var(--bg2,#f3f4f6);border:1px solid var(--line,#e5e7eb)}
span.athumb{display:inline-block}
.amedia{display:grid;grid-template-columns:minmax(140px,220px) 1fr;gap:16px;margin-bottom:16px;padding-bottom:16px;border-bottom:1px solid var(--line,#e5e7eb)}
.amedia .aph{display:flex;flex-direction:column;gap:6px}
.amedia .aph img{width:100%;max-height:240px;object-fit:contain;border-radius:10px;border:1px solid var(--line,#e5e7eb);background:#fff}
.amedia .aph>span{display:flex;align-items:center;justify-content:center;height:120px;border:1px dashed var(--line,#d1d5db);border-radius:10px}
.amedia .aphb{display:flex;gap:6px;flex-wrap:wrap}
.amedia .ashort{font-weight:600;margin:0 0 6px}
.amedia .adesc{max-height:180px;overflow:auto;font-size:13px;line-height:1.5;color:var(--ink2,#374151);padding-right:4px}
.amedia .toolbar{margin-top:8px}
@media (max-width:640px){.amedia{grid-template-columns:1fr}}
.pfiches{margin-top:12px}.pfiches .pfl{display:flex;flex-direction:column;gap:6px;margin:8px 0}
/* 2.47 — articles vendus */
.avbar{flex-wrap:wrap;gap:8px}.avbar .search{flex:1 1 200px}
.avcats{display:flex;flex-wrap:wrap;gap:6px;margin:4px 0 12px}
.avset summary{cursor:pointer;display:flex;gap:10px;flex-wrap:wrap;align-items:baseline}
.pill.abcA{background:#dcfce7;color:#166534}.pill.abcB{background:#e0f2fe;color:#075985}.pill.abcC{background:#f3f4f6;color:#6b7280}

/* 2.48.2 — particulier / entreprise : les champs pro cachés le restent même dans une .row */
.pro-only[hidden]{display:none !important}
.row[hidden],.form [hidden]{display:none !important}
/* calculatrice dans les champs de chiffres */
input.calc-on { outline: 2px solid var(--brand); background: var(--brand-soft); font-variant-numeric: tabular-nums; }
.calc-badge { position: absolute; z-index: 9999; background: #1f2433; color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
.calc-badge[hidden] { display: none; }
.cattree { width: 100%; border-collapse: collapse; }
.cattree td { padding: 6px 8px; border-bottom: 1px solid var(--line, #eceef3); vertical-align: middle; }
.cattree tr:hover td { background: var(--soft); }
.cattree td.num { text-align: right; }
/* rapports */
.rp-grid { display: grid; grid-template-columns: 270px 1fr; gap: 16px; align-items: start; }
.rp-list { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 10px; }
.rp-item { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 11px; border: 1px solid transparent; border-radius: 10px; background: none; cursor: pointer; color: inherit; text-decoration: none; font: inherit; }
.rp-item:hover { background: var(--soft); }
.rp-item.on { background: var(--brand-soft); border-color: var(--brand); }
.rp-item span { display: flex; flex-direction: column; } .rp-item small { color: var(--muted, #6b7280); font-size: 12px; line-height: 1.3; }
.rp-sep { margin: 10px 0 2px 11px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.rp-tools { flex-wrap: wrap; }
.rp-chart { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.rp-row { display: grid; grid-template-columns: 180px 1fr 110px; gap: 10px; align-items: center; font-size: 13px; }
.rp-lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-bars { display: flex; flex-direction: column; gap: 2px; }
.rp-bars .rp-bar { display: block; height: 10px; border-radius: 4px; background: var(--brand); min-width: 2px; }
.rp-bars .rp-bar.prev { background: #c7cde0; height: 6px; }
.rp-bars .rp-bar.neg { background: var(--bad, #d14343); }
.rp-val { text-align: right; font-variant-numeric: tabular-nums; }
.rp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--brand); vertical-align: middle; } .rp-dot.prev { background: #c7cde0; }
@media (max-width: 900px) { .rp-grid { grid-template-columns: 1fr; } .rp-list { position: static; } .rp-row { grid-template-columns: 110px 1fr 90px; } }
.rp-main { min-width: 0; } .rp-main .card { overflow-x: auto; }
.selbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 12px; margin: 0 0 10px; border-radius: 10px; background: var(--brand-soft); border: 1px solid var(--brand); }
.selbar[hidden] { display: none; }
input.pick, #pickall { width: 16px; height: 16px; cursor: pointer; }
.rb-meas { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; margin: 4px 0 6px; }
.rb-meas label { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }

/* ---- fiche client : aperçu (indicateurs, 12 mois, à traiter) */
.trend { font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 99px; vertical-align: middle; }
.trend.up { color: var(--ok); background: var(--ok-soft); }
.trend.down { color: var(--bad); background: var(--bad-soft); }
.cov { display: flex; flex-direction: column; gap: 12px; }
.cov .card { margin: 0; }
.cov-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 18px; }
.cov-kpis > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cov-kpis b { font-size: 18px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cov-grid p { margin: 6px 0; }
.cov-note { background: var(--soft); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }
@media (max-width: 760px) { .cov-grid { grid-template-columns: 1fr; } }

/* ---- tableau de bord : accueil, raccourcis, comparaison N-1, activité récente */
.dash-hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 16px; }
.dash-hello h2 { margin: 0 0 2px; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.dash-hello .muted { font-size: 13px; }
.kbd { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 2px 5px; background: var(--panel); color: var(--ink); }
.dash-short { display: flex; gap: 8px; flex-wrap: wrap; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 88px; padding: 10px 10px 8px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel); color: var(--ink); font-size: 12px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.qa:hover { border-color: var(--brand); transform: translateY(-1px); }
.qa .i { width: 20px; height: 20px; color: var(--brand); }
.dash-row { grid-template-columns: 2fr 1fr; }
.legend { float: right; font-size: 11.5px; font-weight: 400; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.legend .lg-now { background: var(--brand); } .legend .lg-prev { background: var(--brand-soft); border: 1px solid var(--line); }
.chart.cmp .pair .bar { max-width: 15px; }
.chart.cmp .bar.prev, body:not(.theme-classic) .chart.cmp .bar.prev { background: var(--brand-soft); opacity: 1; box-shadow: inset 0 0 0 1px var(--line); }
.feed { list-style: none; margin: 0; padding: 0; max-height: 310px; overflow: auto; }
.feed li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.feed li:last-child { border-bottom: 0; }
.feed li:hover { background: var(--soft); }
.feed .fi { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.feed .fi .i { width: 16px; height: 16px; }
.feed .fi-reglement { background: var(--ok-soft); color: var(--ok); }
.feed .fi-avoir { background: var(--bad-soft); color: var(--bad); }
.feed .fi-reparation { background: var(--warn-soft); color: var(--warn); }
.feed .ft { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.feed .ft b, .feed .ft span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .fr { display: flex; flex-direction: column; align-items: flex-end; flex: none; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .dash-row { grid-template-columns: 1fr !important; } .dash-hello { align-items: flex-start; } }
@media (max-width: 600px) { .dash-short { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; } .qa { min-width: 0; text-align: center; } }
@media (pointer: coarse), (max-width: 600px) { .kbd-hint { display: none; } }
.dash-row .chart.cmp { height: 270px; }
.docsync { position: sticky; top: 0; z-index: 6; } .docsync:empty { display: none; } .docsync .banner { box-shadow: var(--shadow); }

/* ---- menu de gauche compact (icônes seules, noms au clic) — ordinateur uniquement */
.navtog, .navpin { display: none; }
@media (min-width: 901px) {
  body:not(.dev-tablet):not(.dev-phone) .navtog { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; margin: 0 0 4px;
    border: 0; border-radius: 9px; background: transparent; color: var(--side-ink); font-size: 13px; text-align: left; }
  body:not(.dev-tablet):not(.dev-phone) .navtog:hover, body:not(.dev-tablet):not(.dev-phone) .navpin:hover { background: var(--soft); color: var(--ink); }
  body.nav-mini:not(.dev-tablet):not(.dev-phone) .side { width: 68px; }
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav .lbl,
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .brand .bt,
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .brand .bchev,
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .side-foot { display: none; }
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .brand { margin: 12px 8px 6px; padding: 8px; justify-content: center; border-color: transparent; background: transparent; }
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav { padding: 6px 8px; overflow-x: hidden; }
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav a,
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .navtog { justify-content: center; padding: 10px 0; gap: 0; }
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav .ico { width: auto; }
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav .sep { font-size: 0; padding: 0; margin: 9px 10px; height: 1px; background: var(--line); }
  /* noms affichés par-dessus la page, sans la décaler */
  body.nav-mini.nav-peek:not(.dev-tablet):not(.dev-phone) .side { position: fixed; left: 0; top: 0; bottom: 0; width: 248px; z-index: 60;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .22); background: var(--side); }
  body.nav-mini.nav-peek:not(.dev-tablet):not(.dev-phone) main { margin-left: 68px; }
  body.nav-mini.nav-peek:not(.dev-tablet):not(.dev-phone) .navpin { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 12px; margin: 0 0 6px;
    border: 1px dashed var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 12.5px; text-align: left; }
  body.theme-classic.nav-mini.nav-peek .side { background: var(--side); }
}
body.theme-classic .navtog:hover, body.theme-classic .navpin:hover { background: #1d2536 !important; color: #fff !important; }

/* ---- couleur du logiciel (au choix dans Paramètres → Apparence, par appareil) */
body.acc-marine:not(.theme-dark) { --brand: #1e3a8a; --brand-soft: #e8ecf7; }
body.acc-petrole:not(.theme-dark) { --brand: #0f766e; --brand-soft: #e4f3f1; }
body.acc-bleu:not(.theme-dark) { --brand: #2f5bea; --brand-soft: #eef2fe; }
body.acc-violet:not(.theme-dark) { --brand: #6d28d9; --brand-soft: #f1ebfd; }
body.acc-marine.theme-dark { --brand: #7b9cff; --brand-soft: rgba(123, 156, 255, .15); }
body.acc-petrole.theme-dark { --brand: #2dd4bf; --brand-soft: rgba(45, 212, 191, .14); }
body.acc-bleu.theme-dark { --brand: #6f8dff; --brand-soft: rgba(111, 141, 255, .15); }
body.acc-violet.theme-dark { --brand: #a78bfa; --brand-soft: rgba(167, 139, 250, .15); }
.accents { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.accent { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--panel); }
.accent input { position: absolute; opacity: 0; pointer-events: none; }
.accent .sw { width: 22px; height: 22px; border-radius: 6px; }
.accent:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); font-weight: 600; }
/* icônes des indicateurs */
.kico { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; margin-right: 8px; vertical-align: middle; flex: none; }
.kico .i { width: 16px; height: 16px; }
.k-brand { background: var(--brand-soft); color: var(--brand); }
.k-amber { background: rgba(217, 119, 6, .12); color: #d97706; }
.k-red { background: rgba(220, 38, 38, .11); color: #dc2626; }
.k-violet { background: rgba(124, 58, 237, .11); color: #7c3aed; }
.k-teal { background: rgba(13, 148, 136, .12); color: #0d9488; }
.k-green { background: rgba(22, 163, 74, .12); color: #16a34a; }
body.theme-dark .k-amber { color: #fbbf24; } body.theme-dark .k-red { color: #f87171; } body.theme-dark .k-violet { color: #a78bfa; }
body.theme-dark .k-teal { color: #2dd4bf; } body.theme-dark .k-green { color: #4ade80; }
body.acc-petrole.theme-dark .btn.primary, body.acc-petrole.theme-dark #chatBtn { color: #042f2c; }
body.theme-classic .btn.primary:hover { background: var(--brand); filter: brightness(.9); }
/* menu compact : les noms s'ouvrent au survol ; le bouton du haut ne sert plus qu'au menu complet */
@media (min-width: 901px) {
  body.nav-mini:not(.nav-peek):not(.dev-tablet):not(.dev-phone) .navtog { display: none; }
  body.nav-mini.nav-peek:not(.dev-tablet):not(.dev-phone) .navtog { display: none; }
  body.nav-mini.nav-peek:not(.dev-tablet):not(.dev-phone) .side { animation: navslide .14s ease-out; }
}
@keyframes navslide { from { width: 68px; } to { width: 248px; } }
body:not(.theme-classic) .user-chip a { color: var(--brand); }

/* ---- bon de livraison : étapes d'expédition */
.dsteps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 10px; }
.dstep { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--ink); font-size: 13px; cursor: pointer; text-align: center; }
.dstep:hover { border-color: var(--brand); }
.dstep .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--muted); font-weight: 700; font-size: 12px; }
.dstep.done .dot { background: var(--brand-soft); color: var(--brand); }
.dstep.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); font-weight: 600; }
.dstep.on .dot { background: var(--brand); color: #fff; }
@media (max-width: 600px) { .dsteps { grid-template-columns: repeat(2, 1fr); } }
.dstep.skip { opacity: .55; border-style: dashed; }

/* ---- menu en groupes (2.67) : Ventes, Stock & achats, Analyses, Comptabilité, Réglages */
.nav .nghead { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; margin: 1px 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--side-ink); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.nav .nghead:hover { background: var(--soft); color: var(--ink); }
.nav .nghead .lbl { flex: 1; }
.nav .ngchev { display: inline-flex; opacity: .55; transition: transform .15s ease; }
.nav .ngchev svg.i { width: 14px; height: 14px; margin: 0; }
.nav .ngrp.open > .nghead .ngchev { transform: rotate(180deg); }
.nav .ngrp.has-active > .nghead { color: var(--brand); font-weight: 600; }
.nav .ngrp.has-active > .nghead .ico { opacity: 1; }
.nav .ngbody { display: none; margin: 0 0 4px 0; padding-left: 14px; position: relative; }
.nav .ngbody::before { content: ""; position: absolute; left: 21px; top: 2px; bottom: 2px; width: 1px; background: var(--line); }
.nav .ngrp.open > .ngbody { display: block; }
.nav .ngbody a { padding: 7px 12px 7px 20px; font-size: 13px; }
.nav .ngbody a .ico { display: none; }
.nav .nghead:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--brand-soft); }
body.theme-classic .nav .nghead { color: var(--side-ink); }
body.theme-classic .nav .nghead:hover { background: #1d2536; color: #fff; }
body.theme-classic .nav .ngbody::before { background: #2a3346; }
body.theme-dark .nav .nghead:hover { background: #222328; }
body.touch .nav .nghead { padding: 12px 14px; }
@media (min-width: 901px) {
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav .nghead { justify-content: center; padding: 10px 0; gap: 0; }
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav .ngchev,
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav .ngbody { display: none; }
  body.nav-mini:not(.dev-tablet):not(.dev-phone):not(.nav-peek) .nav .ngrp.has-active > .nghead { background: var(--brand-soft); }
}

/* ---- viseur de scan par caméra (2.67) */
.scanov { position: fixed; inset: 0; z-index: 400; background: #000; color: #fff; display: flex; flex-direction: column; }
body.scanning { overflow: hidden; }
.scanbar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); background: rgba(0,0,0,.6); }
.scanbar b { font-size: 16px; }
.scanbtn { border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; border-radius: 10px; padding: 9px 14px; font: inherit; font-weight: 600; }
.scanbtn.primary { background: var(--brand); border-color: var(--brand); }
.scanbtn.on { background: #facc15; color: #000; }
.scanvid { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.scanvid video { width: 100%; height: 100%; object-fit: cover; }
.scanframe { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.scanframe i { width: min(78vw, 420px); height: min(34vw, 190px); border: 3px solid rgba(255,255,255,.9); border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
.scanov.hit .scanframe i { border-color: #22c55e; }
.scanmsg { padding: 12px 16px; font-size: 15px; min-height: 48px; background: rgba(0,0,0,.75); line-height: 1.4; }
.scanmsg.ok { color: #86efac; } .scanmsg.bad { color: #fca5a5; }
.scanman { display: flex; gap: 8px; padding: 10px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: #111; }
.scanman input { flex: 1; min-width: 0; border-radius: 10px; border: 1px solid #444; background: #1c1c1f; color: #fff; padding: 10px 12px; font-size: 16px; }

/* ---- catalogue : choix de l'emplacement (2.67) */
.locpick { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 0 0 0 10px; background: var(--card, #fff); }
.locpick svg.i { width: 15px; height: 15px; margin: 0; opacity: .65; }
.locpick select { border: 0; background: transparent; padding: 7px 8px 7px 2px; max-width: 220px; box-shadow: none; }
.locpick.on { border-color: var(--brand); background: var(--brand-soft); }
.locpick.on svg.i { opacity: 1; color: var(--brand); }
.locsum { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 0 0 10px; border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 12px; flex-wrap: wrap; }
.locsum > svg.i { width: 20px; height: 20px; color: var(--brand); margin: 0; }
.locsum div b { display: block; } .locsum div span { font-size: 12.5px; color: var(--muted); }
.camscan svg.i { margin-right: 6px; }
body.scanning #modalBg, body.scanning .toast, body.scanning #toast { z-index: 500; }
.pos-sbox .sbcam { border: 0; background: transparent; padding: 6px 8px; margin-left: auto; color: var(--muted); border-radius: 8px; cursor: pointer; display: inline-flex; }
.pos-sbox .sbcam:hover { background: var(--soft); color: var(--brand); }
.pos-sbox .sbcam svg.i { width: 18px; height: 18px; margin: 0; }
body.scanning #chatBtn, body.scanning #chatPanel { display: none !important; }
label.locpick > select, body:not(.theme-classic) label.locpick > select { border: 0 !important; box-shadow: none !important; background: transparent !important; min-height: 0; }
.locsum .grow { flex: 1; }
@media (max-width: 700px) { .locpick { flex: 1 1 100%; } .locpick select { max-width: none; flex: 1; } .locsum .grow { display: none; } }

/* menu : défiler dans le menu ne fait pas défiler la page derrière (tablette, téléphone) */
.nav { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.side { height: 100vh; height: 100dvh; }
/* tablette, téléphone, écran tactile : une seule zone qui défile (la page). Les tableaux ne défilent plus
   « dans un cadre » : le doigt faisait défiler le tableau ou le menu au lieu de la page. */
body.dev-tablet .table-wrap, body.dev-phone .table-wrap, body.touch .table-wrap { max-height: none; overflow-y: visible; }
body.dev-tablet .artpane, body.dev-phone .artpane { max-height: none; position: static; }
/* tablette : la barre de titre défile avec la page (elle prenait un quart de l'écran en restant collée en haut) */
body.dev-tablet .top { position: static; }
/* caisse en mode formation (2.68) : impossible de l'oublier */
body.pos-training .pos { box-shadow: inset 0 0 0 4px #f59e0b; }
body.pos-training .pos-left::before { content: "MODE FORMATION — les ventes ne sont pas enregistrées (ni caisse, ni stock, ni chiffre d'affaires)";
  display: block; background: #f59e0b; color: #111; font-weight: 700; padding: 8px 14px; border-radius: 10px; margin: 0 0 10px; font-size: 13px; }
body.pos-training .pay-btn { background: #f59e0b !important; color: #111 !important; }
/* fenêtre « Emplacements de stock » (2.68.4) */
.locrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.locrow:last-child { border-bottom: 0; }
.locname { display: flex; align-items: center; gap: 8px; }
.locname svg.i { width: 16px; height: 16px; margin: 0; color: var(--brand); flex: none; }
.locname input { flex: 1; min-width: 0; font-weight: 600; }
.locmeta { grid-column: 1; padding-left: 24px; } .locmeta a { margin-left: 8px; }
.locacts { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 700px) { .locrow { grid-template-columns: 1fr; } .locacts { grid-column: 1; grid-row: auto; justify-content: flex-start; padding-left: 24px; } }
