/* Lina-Style v2 — thème clair unique, couleurs et police reprises de la v1. */
:root {
  --bg: #f5f8fa;
  --card: #ffffff;
  --ink: #181c32;
  --text: #3f4254;
  --muted: #7e8299;
  --faint: #a1a5b7;
  --line: #eff2f5;
  --line-2: #e4e6ef;
  --primary: #6fa0ac;
  --primary-dark: #5a8a96;
  --primary-light: #eaf3f5;
  --good: #47be7d;  --good-bg: #e8fff3;
  --wait: #b58a00;  --wait-bg: #fff8dd;
  --bad: #f1416c;   --bad-bg: #fff5f8;
  --todo: #009ef7;  --todo-bg: #f1faff;
  --mute-bg: #f5f8fa;
  --r: 12px;
  --shadow: 0 0 20px 0 rgba(76, 87, 125, .05);
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 Poppins, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  -webkit-tap-highlight-color: transparent;
}
body.bare { padding-bottom: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2 { margin: 0; color: var(--ink); font-weight: 600; }
h2 { font-size: 1rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
strong, b { color: var(--ink); font-weight: 600; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ============ Structure */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.top h1 { flex: 1; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.top-btn { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.top-btn:hover, .top-btn:active { background: var(--bg); color: var(--primary); }
.page { max-width: 680px; margin: 0 auto; padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 12px; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--card); border-top: 1px solid var(--line-2); box-shadow: 0 -4px 16px rgba(76, 87, 125, .06);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .66rem; color: var(--faint); min-width: 0; font-weight: 500; }
.tabbar a.is-active { color: var(--primary); }
.tabbar .tab-new .ic { width: 30px; height: 30px; padding: 5px; border-radius: 50%; background: var(--primary); color: #fff; stroke-width: 2.4; }
.tabbar .tab-new { color: var(--ink); }
.tabbar .side-brand, .tabbar .side-extra { display: none; }

/* ============ Blocs */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.order-grid, .order-grid > div { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tiles, .sync-bar { margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hello { margin: 2px 2px 0; color: var(--muted); }
.section-title { margin: 6px 2px 0; font-size: .9rem; color: var(--muted); font-weight: 500; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-big { font-size: 3rem; font-weight: 700; margin: 0; color: var(--ink); }
.txt-bad { color: var(--bad) !important; }

.flash { padding: 12px 14px; border-radius: 10px; font-size: .9rem; margin: 0; }
.flash-ok { background: var(--good-bg); color: #2b8a57; }
.flash-err { background: var(--bad-bg); color: var(--bad); }
.toast { position: fixed; left: 14px; right: 14px; bottom: calc(var(--tab-h) + var(--safe-b) + 12px); z-index: 80; box-shadow: 0 8px 30px rgba(0,0,0,.15); }

/* ============ Puces */
.chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; padding: 3px 9px; border-radius: 6px; font-size: .75rem; font-weight: 600; background: var(--mute-bg); color: var(--muted); border: 0; font-family: inherit; line-height: 1.5; }
.chip-good { background: var(--good-bg); color: var(--good); }
.chip-wait { background: var(--wait-bg); color: var(--wait); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-todo { background: var(--todo-bg); color: var(--todo); }
.chip-mute { background: var(--mute-bg); color: var(--muted); }
button.chip { cursor: pointer; }
.chips-scroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px 2px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip-filter { padding: 7px 14px; font-size: .85rem; background: var(--card); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; font-weight: 500; }
.chip-filter.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============ Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 500; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--bg); border-radius: 10px; appearance: none; -webkit-appearance: none;
  transition: border-color .15s, background .15s;
}
input::placeholder { color: var(--faint); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: 0; background: var(--card); border-color: var(--primary); }
input[type=search]::-webkit-search-cancel-button { display: none; }
input[type=checkbox], input[type=radio] { width: 20px; min-height: 20px; height: 20px; padding: 0; accent-color: var(--primary); appearance: auto; -webkit-appearance: auto; }
.check { display: flex; align-items: center; gap: 10px; min-height: 42px; color: var(--text); }
.input-suffix { position: relative; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-suffix input { padding-right: 44px; }
.input-sm input { min-height: 38px; width: 100px; padding: 6px 36px 6px 8px; text-align: right; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.input-row { display: flex; gap: 6px; }
.input-row input { flex: 1; min-width: 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.inline-form input { flex: 1; min-width: 0; }
.grow { flex: 1; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; color: var(--ink); padding: 0; margin-bottom: 8px; }
.more summary { cursor: pointer; color: var(--muted); font-size: .88rem; padding: 6px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 0;
  background: var(--bg); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-align: center;
  transition: background .15s, color .15s;
}
.btn:hover { background: var(--line-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: var(--primary-light); color: var(--primary-dark); }
.btn-light:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-link { background: none; color: var(--muted); text-decoration: underline; min-height: 40px; font-weight: 400; }
.btn-link:hover { background: none; color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 10px; font-size: .82rem; border-radius: 8px; gap: 5px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-icon { width: 46px; padding: 0; flex: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn, .btn-row > form { flex: 1 1 140px; }
.btn-row > form .btn { width: 100%; }
.link-bad { background: none; border: 0; color: var(--bad); font: inherit; font-size: .8rem; padding: 4px 0; cursor: pointer; }

/* ============ Barre de recherche (listes et combobox) */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.searchbox { position: relative; flex: 1 1 260px; display: flex; align-items: center; }
.searchbox > .ic { position: absolute; left: 13px; color: var(--faint); pointer-events: none; }
.searchbox input { padding-left: 40px; padding-right: 40px; background: var(--card); border: 1px solid var(--line-2); }
.searchbox input:focus { border-color: var(--primary); }
.search-clear { position: absolute; right: 6px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--faint); display: grid; place-items: center; cursor: pointer; }
.search-clear:hover { color: var(--ink); background: var(--bg); }
.search-clear .ic { width: 16px; height: 16px; }
.searchbox.is-loading::after { content: ""; position: absolute; right: 44px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toolbar select { width: auto; min-width: 150px; background-color: var(--card); border: 1px solid var(--line-2); flex: 0 0 auto; }
.list-info { font-size: .82rem; color: var(--muted); margin: -4px 2px 0; }

.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 40px rgba(24, 28, 50, .14);
  max-height: min(60vh, 420px); overflow-y: auto; padding: 6px;
}
.combo-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.combo-item:hover, .combo-item.is-active { background: var(--primary-light); }
.combo-item .thumb { width: 44px; height: 44px; }
.combo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.combo-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-price { font-weight: 600; color: var(--ink); white-space: nowrap; }
.combo-empty { padding: 14px; text-align: center; color: var(--muted); font-size: .88rem; }
.combo mark { background: #fff1b8; color: inherit; border-radius: 3px; padding: 0 1px; }
.combo-sizes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }

/* ============ Lignes de liste (cartes sur mobile, tableau sur PC) */
.rows { display: flex; flex-direction: column; gap: 8px; }
.rows-head { display: none; }
.orow {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px;
  display: grid; grid-template-columns: 52px 1fr auto; gap: 4px 12px; align-items: start; cursor: pointer;
  grid-template-areas: "img client amount" "img prod prod" "img status status" "act act act";
}
.orow:hover { box-shadow: 0 0 0 1px var(--primary-light), var(--shadow); }
.o-img { grid-area: img; }
.o-client { grid-area: client; min-width: 0; }
.o-client strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-client .small { display: block; }
.o-date { display: none; }
.o-prod { grid-area: prod; min-width: 0; font-size: .85rem; color: var(--muted); }
.o-amount { grid-area: amount; font-weight: 600; color: var(--ink); white-space: nowrap; text-align: right; }
.o-amount small { display: block; font-weight: 400; color: var(--faint); font-size: .75rem; }
.o-status { grid-area: status; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.o-status .o-detail { flex-basis: 100%; line-height: 1.3; }
.o-actions { grid-area: act; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.o-actions:empty { display: none; }
.o-actions form { margin: 0; }
.thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--mute-bg); flex: none; }
.thumb-empty { display: block; }
.o-img .thumb + .thumb { display: none; }

.prow { grid-template-columns: 56px 1fr auto; grid-template-areas: "img client amount" "img sizes sizes"; }
.p-sizes { grid-area: sizes; display: flex; flex-wrap: wrap; gap: 4px; }
.size { font-size: .75rem; padding: 2px 7px; border-radius: 6px; background: var(--mute-bg); color: var(--text); }
.size b { font-weight: 600; }
.size.is-out { opacity: .45; text-decoration: line-through; }
.sizes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.crow { grid-template-columns: 44px 1fr auto; grid-template-areas: "img client amount"; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-light); font-weight: 600; color: var(--primary-dark); flex: none; }

.more-btn { margin-top: 4px; }

/* ============ Accueil */
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.hero-num { font-size: 1.9rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.spark { display: flex; align-items: flex-end; gap: 5px; height: 72px; }
.spark-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.spark-col small { font-size: .65rem; color: var(--faint); }
.spark-bar { width: 12px; border-radius: 4px; background: var(--line-2); min-height: 3px; }
.spark-col.is-today .spark-bar { background: var(--primary); }
.h0{height:3px}.h1{height:6px}.h2{height:11px}.h3{height:16px}.h4{height:21px}.h5{height:26px}.h6{height:31px}.h7{height:36px}.h8{height:41px}.h9{height:46px}.h10{height:52px}
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; font-size: .82rem; color: var(--muted); box-shadow: var(--shadow); }
.tile-num { font-size: 1.6rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.tile-money { font-size: 1.3rem; }
.tile-todo .tile-num { color: var(--todo); }
.tile-bad .tile-num { color: var(--bad); }
a.tile:hover { box-shadow: 0 0 0 1px var(--primary-light), var(--shadow); }
.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; color: var(--ink); }
.kv-total { margin-top: 6px; }

/* ============ Commande / produit */
.order-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.order-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.client-block { margin: 12px 0; display: flex; flex-direction: column; gap: 2px; }
.client-block a strong { color: var(--primary-dark); }
.line { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line-2); }
.line:last-child { border-bottom: 0; }
.line-main { flex: 1; min-width: 0; }
.line-main a { display: block; color: var(--ink); font-weight: 500; }
.line-price { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line-edit { flex-wrap: wrap; }
.line-actions { flex-basis: 100%; }
.line-actions > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--primary-dark); font-size: .82rem; cursor: pointer; padding: 2px 0; }
.line-actions > summary::-webkit-details-marker { display: none; }
.line-actions > summary .ic { width: 15px; height: 15px; }
.line-actions > summary::after { content: "Modifier"; }
.line-actions[open] > summary { margin-bottom: 8px; }
.line-actions form + form { margin-top: 6px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.toggle-row > div { flex: 1 1 180px; }
.cod { margin: 0; }
.danger-zone > summary { cursor: pointer; color: var(--bad); font-size: .88rem; padding: 6px 0; }
.danger-zone[open] > summary { margin-bottom: 8px; }
.summary-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--ink); list-style: none; }
.summary-btn::-webkit-details-marker { display: none; }
details[open] > .summary-btn { margin-bottom: 12px; }

.sizes-edit { display: flex; flex-direction: column; gap: 6px; }
.size-row { display: grid; grid-template-columns: 1fr 90px 46px; gap: 6px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.photo { position: relative; margin: 0; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--mute-bg); }
.photo img, .photo video { width: 100%; height: 100%; object-fit: cover; }
.photo.is-default { outline: 3px solid var(--primary); outline-offset: -3px; }
.photo figcaption { position: absolute; inset: 4px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.photo figcaption > * { pointer-events: auto; }
.photo figcaption form { margin: 0; }
.photo figcaption form:last-child { align-self: flex-end; }
.photo figcaption .chip { min-height: 26px; padding: 2px 7px; box-shadow: 0 1px 4px rgba(0,0,0,.15); background: #fff; }
.photo figcaption .chip-bad { background: #fff; color: var(--bad); }
.photo figcaption .chip-good { background: var(--primary); color: #fff; font-size: .68rem; }
.photo figcaption .ic { width: 15px; height: 15px; }
.photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; color: var(--primary-dark); border: 2px dashed var(--line-2); background: var(--primary-light); font-size: .82rem; font-weight: 500; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.menu-list { display: flex; flex-direction: column; padding: 4px 0; }
.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 16px;
  border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; width: 100%; cursor: pointer;
}
.menu-list > :last-child, .menu-list form:last-child button { border-bottom: 0; }
.menu-list .ic { color: var(--primary); }
.ref-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.ref-row .inline-form { flex: 1; }
.ref-row .inline-form input { min-height: 40px; }
.ref-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.inventory { display: flex; flex-direction: column; gap: 8px; }
.inv { display: flex; gap: 12px; align-items: flex-start; }

/* ============ Nouvelle vente */
.sale { display: flex; flex-direction: column; gap: 12px; }
.sale-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .78rem; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; background: var(--primary-light); }
.cart:empty::before { content: "Panier vide — scannez ou cherchez un article ci-dessous."; display: block; color: var(--muted); font-size: .88rem; padding: 2px 0 10px; }
.cart .line:last-child { border-bottom: 1px dashed var(--line-2); margin-bottom: 10px; }
.stepper { display: inline-flex; align-items: center; margin-top: 6px; border-radius: 8px; overflow: hidden; background: var(--bg); }
.stepper button { width: 38px; height: 34px; border: 0; background: none; color: var(--ink); font-size: 1.15rem; cursor: pointer; }
.stepper button:disabled { opacity: .3; }
.stepper span { min-width: 30px; text-align: center; font-weight: 600; color: var(--ink); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 50px; padding: 6px; border-radius: 10px; background: var(--bg); font-weight: 500; font-size: .88rem; line-height: 1.2; cursor: pointer; color: var(--text); border: 2px solid transparent; }
.segmented input:checked + span { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); font-weight: 600; }
.sticky-bar {
  position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--r); padding: 10px 10px 10px 16px; box-shadow: 0 6px 30px rgba(24, 28, 50, .14);
}
.sticky-total { font-size: 1.25rem; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(24, 28, 50, .35); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(30%); opacity: 0; } }
.sheet-head { display: flex; gap: 12px; align-items: center; }
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.size-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; border-radius: 10px; border: 2px solid var(--line-2); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; }
.size-btn small { font-weight: 400; font-size: .72rem; color: var(--muted); }
.size-btn:hover, .size-btn:active { border-color: var(--primary); background: var(--primary-light); }

/* ============ Scanner */
.scanner { width: min(520px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.scanner::backdrop { background: rgba(24, 28, 50, .55); }
.scanner-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 16px; }
.scanner-close { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--bg); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.scanner-close:hover { background: var(--bad-bg); color: var(--bad); }
.scanner-view { position: relative; background: #111; aspect-ratio: 4 / 3; overflow: hidden; }
.scanner-view video, #scanner-fallback { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 30% 12%; border: 2px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); pointer-events: none; }
.scanner-msg { padding: 10px 16px 0; margin: 0; text-align: center; color: var(--muted); font-size: .88rem; }
.scanner-manual { display: flex; gap: 8px; padding: 12px 16px 16px; }

/* ============ Connexion */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 24px 16px; max-width: 420px; margin: 0 auto; }
.brand { font-size: 1.8rem; font-weight: 700; color: var(--ink); text-align: center; }
.brand span { color: var(--primary); }

/* ============ PC : menu latéral + tableaux */
@media (min-width: 960px) {
  body.has-nav { padding-bottom: 0; padding-left: 250px; }
  .tabbar {
    inset: 0 auto 0 0; width: 250px; height: auto; padding: 22px 14px;
    display: flex; flex-direction: column; gap: 2px; border-top: 0; box-shadow: none;
    background: #1e1e2d; overflow-y: auto;
  }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: .92rem; padding: 10px 12px; border-radius: 8px; color: #9899ac; }
  .tabbar a:hover { background: #1b1b28; color: #fff; }
  .tabbar a.is-active { background: #1b1b28; color: #fff; }
  .tabbar a.is-active .ic, .tabbar a:hover .ic { color: var(--primary); }
  .tabbar .tab-new { order: -1; background: var(--primary); color: #fff; margin: 10px 0 14px; justify-content: center; font-weight: 600; }
  .tabbar .tab-new:hover { background: var(--primary-dark); }
  .tabbar .tab-new .ic, .tabbar .tab-new:hover .ic { background: none; padding: 0; width: 20px; height: 20px; color: #fff; }
  .tabbar .tab-more { display: none; }
  .tabbar .side-brand { display: block; order: -2; font-size: 1.3rem; font-weight: 700; color: #fff; padding: 2px 12px 6px; }
  .tabbar .side-brand span { color: var(--primary); }
  .tabbar .side-extra { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #2b2b40; }
  .top { padding: 14px 28px; }
  .top h1 { font-size: 1.3rem; }
  .page { max-width: 1240px; padding: 22px 28px 48px; }
  .page.narrow { max-width: 820px; }

  /* Tableau des commandes */
  .rows { gap: 0; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
  .rows-head, .orow { grid-template-columns: 2fr .8fr 2.3fr .9fr minmax(160px, 1.5fr) 1.6fr; grid-template-areas: "client date prod amount status act"; align-items: center; gap: 0 16px; }
  .rows-head { display: grid; padding: 12px 18px; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--faint); border-bottom: 1px solid var(--line); }
  .orow { border-radius: 0; box-shadow: none; padding: 12px 18px; border-bottom: 1px dashed var(--line-2); }
  .orow:last-child { border-bottom: 0; }
  .orow:hover { box-shadow: none; background: #fafbfc; }
  .o-img { display: none; }
  .o-date { display: block; grid-area: date; font-size: .85rem; color: var(--muted); }
  .o-prod { display: flex; gap: 8px; align-items: center; }
  .o-prod .thumbs { display: flex; flex: none; }
  .o-prod .thumbs .thumb { width: 36px; height: 36px; border: 2px solid #fff; margin-left: -8px; }
  .o-prod .thumbs .thumb:first-child { margin-left: 0; }
  .o-amount { text-align: left; }
  .o-actions { margin: 0; justify-content: flex-end; flex-wrap: nowrap; }
  .o-status .o-meta { display: none; }

  .rows-head.p-head, .prow { grid-template-columns: 56px 3fr 1.3fr 3fr 1fr; grid-template-areas: "img client brand sizes amount"; }
  .prow .o-img { display: block; }
  .p-brand { grid-area: brand; font-size: .88rem; color: var(--muted); }
  .rows-head.c-head, .crow { grid-template-columns: 44px 2fr 1.4fr 1.2fr 1fr; grid-template-areas: "img client phone city amount"; }
  .crow .o-img { display: block; }
  .c-phone { grid-area: phone; } .c-city { grid-area: city; color: var(--muted); }

  .sale { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; gap: 16px; }
  .sale > .sale-col:last-child { position: sticky; top: 90px; }
  .sale .sticky-bar { position: static; box-shadow: var(--shadow); }
  .order-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .order-grid > div { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .inventory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toast { left: auto; right: 24px; bottom: 24px; max-width: 420px; }
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 16px; }
}
@media (max-width: 959px) {
  .c-phone, .c-city, .p-brand { display: none; }
  .crow .o-client .small, .prow .o-client .small { display: block; }
}
@media (max-width: 420px) {
  .hide-sm { display: none; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 > :last-child { grid-column: 1 / -1; }
}
@media print {
  body { padding: 0 !important; background: #fff; }
  .tabbar, .top, .no-print, .flash, .scanner { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .inventory { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
}
.o-prod .thumbs { display: none; }
@media (min-width: 960px) { .o-prod .thumbs { display: flex; } .hide-desk { display: none !important; } }
.rows-body { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 960px) { .rows-body { display: block; } }
.toolbar > form.toolbar { flex: 1 1 320px; }
/* Aucun débordement horizontal possible (sinon le navigateur dézoome et les fenêtres sortent de l'écran) */
html, body { overflow-x: clip; max-width: 100%; }
.o-prod .ellipsis { display: block; }
.o-prod, .o-client { overflow: hidden; }
.o-status .chip { white-space: nowrap; }
.orow > * { min-width: 0; }
.scanner { margin: auto; max-height: calc(100dvh - 24px); overflow-y: auto; }
.o-actions { align-items: center; }
.tabbar .tab-new.is-active, .tabbar .tab-new.is-active:hover { background: var(--primary); color: #fff; }
@media (max-width: 959px) { .tabbar .tab-new.is-active { background: none; color: var(--primary); } }
/* ============ Cathedis */
.no-mb { margin-bottom: 0; }
.check-list { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.check-row { padding: 8px 12px; border-bottom: 1px dashed var(--line-2); gap: 10px; }
.check-row:last-child { border-bottom: 0; }
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px dashed var(--line-2); color: inherit; }
.mini-row:last-child { border-bottom: 0; }
a.mini-row:hover { background: #fafbfc; }
a.mini-row > .ic { transform: rotate(180deg); color: var(--faint); width: 16px; height: 16px; }
.mini-row > span:not(.grow):not(.chip):not(.chev):not(.sub-amount) { min-width: 64px; text-align: right; font-size: .88rem; }
.mini-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--faint); font-weight: 600; }
.mini-head > span { color: var(--faint) !important; font-size: .72rem !important; }
.timeline { list-style: none; margin: 8px 0; padding: 0 0 0 14px; border-left: 2px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); border: 2px solid #fff; }
.timeline .tl-status::before { background: var(--primary); }
.timeline .tl-call::before { background: var(--wait); }
.timeline .tl-money::before { background: var(--good); }
.tl-when { font-size: .75rem; color: var(--faint); }
.tl-what { font-size: .88rem; color: var(--ink); }
.ticket { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ticket-msg { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.ticket-msg p { margin: 2px 0 0; font-size: .88rem; }
.action-box > summary, .timeline-box > summary { padding: 4px 0; }
textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.sync-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sync-bar p { margin: 0; }
.check-row .txt-bad { display: block; }

/* Lignes dépliables (ramassages, virements) */
.xrow > summary { list-style: none; cursor: pointer; }
.xrow > summary::-webkit-details-marker { display: none; }
.xrow:not(:last-child) > summary { border-bottom: 1px dashed var(--line-2); }
.xrow[open] > summary { border-bottom: 0; }
.xrow > summary:hover { background: #fafbfc; }
.xrow .grow { min-width: 0; }
.sub-line { display: block; margin-top: 2px; line-height: 1.35; }
.sub-line .chip { margin-top: 2px; }
.sub-amount { flex: none; text-align: right; white-space: nowrap; font-size: .92rem; }
.chev { flex: none; display: inline-flex; color: var(--faint); transition: transform .15s; transform: rotate(-90deg); }
.chev .ic { width: 16px; height: 16px; }
.xrow[open] > summary .chev { transform: rotate(90deg); }
.sub-list { margin: 0 0 10px; padding: 4px 10px; background: #f7fafb; border-radius: 10px; border: 1px solid var(--line-2); }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; color: inherit; border-bottom: 1px dashed var(--line-2); }
.sub-row:last-child { border-bottom: 0; }
.sub-row:hover { background: #fff; }
.sub-list > p { margin: 8px 2px; }
.mini-row .chip { flex: none; }

/* Statistiques */
.tiles-stats .tile .chip { margin-left: 4px; vertical-align: middle; }
@media (min-width: 960px) { .tiles-stats { grid-template-columns: repeat(3, 1fr); } }
.chart { overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; max-height: 260px; }
.chart svg.chart-wide { width: auto; max-width: none; max-height: none; }
.bar-ca { fill: #cfe0e5; }
.bar-marge { fill: var(--primary); }
.chart g:hover .bar-ca { fill: #b6d0d7; }
.bar-val { font-size: 9px; text-anchor: middle; fill: var(--muted); font-family: inherit; }
.bar-lbl { font-size: 9px; text-anchor: middle; fill: var(--faint); font-family: inherit; }
.bar-lbl-start { text-anchor: start; }
.legend { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin: 8px 0 0; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.dot-ca { background: #cfe0e5; }
.dot-marge { background: var(--primary); }
.stat-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px dashed var(--line-2); color: inherit; }
.stat-row:last-child { border-bottom: 0; }
a.stat-row:hover { background: #fafbfc; }
.stat-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 3px; color: inherit; }
.stat-row .thumb { width: 40px; height: 40px; }
.stat-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-val { flex: none; text-align: right; white-space: nowrap; font-size: .92rem; }
.stat-day { width: 78px; flex: none; font-size: .88rem; }
.hbar { display: block; width: 100%; height: 6px; }
.hbar rect { fill: var(--primary); }
.hbar .hbar-bg { fill: var(--mute-bg); }

/* Aperçu d'un message WhatsApp (page Campagne) */
.wa-preview { background: #e5ddd5; border-radius: 12px; padding: 10px; max-width: 360px; }
.wa-preview img { display: block; width: 100%; border-radius: 8px 8px 0 0; }
.wa-preview p { margin: 0; background: #fff; padding: 8px 10px; color: #111; font-size: 14px; line-height: 1.5; }
.wa-preview .wa-foot { color: #888; font-size: 12px; padding-top: 0; border-radius: 0 0 8px 8px; }
.wa-preview .wa-btn { background: #fff; color: #0a7cff; text-align: center; padding: 9px; margin-top: 3px; border-radius: 8px; font-weight: 500; }
.wa-media { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; background: #fff; border-radius: 8px 8px 0 0; overflow: hidden; }
.wa-media video, .wa-media img { display: block; width: 100%; height: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 0; background: #000; }
.wa-media img { object-fit: contain; background: #fff; }
.addr-box { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--primary-light); border-left: 3px solid var(--primary); }
.addr-box b { font-size: 15px; line-height: 1.4; white-space: pre-line; }

.kv-profit { margin-top: 4px; padding: 2px 12px; border-radius: 10px; background: var(--primary-light); }
.kv-profit > div { padding: 7px 0; }
.txt-good { color: #1f8a4c; }
