/* ---------- styles : un jeu de variables par style, choisi dans Paramètres (attribut data-style de <html>) ---------- */
:root {
  --danger: #a5463c; --danger-bg: #f7ecea; --warn: #8a6322; --warn-bg: #f8f1e4; --ok: #3d6b52; --ok-bg: #e9f1ec;
  --info: color-mix(in srgb, var(--acc) 85%, #000); --info-bg: color-mix(in srgb, var(--acc) 9%, #fff);
  --neutral: #4b525c; --neutral-bg: #eef0f2;
  --brand: var(--side-bg); --accent: var(--acc); --accent-dark: var(--primary-hover);
  --nav-h: 64px; --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --font-head: var(--font); --font-num: var(--font); --font-label: var(--font); --font-btn: var(--font); --body-ls: 0;
  --head-weight: 600; --head-ls: -.02em; --h3-weight: 600; --num-weight: 600;
  --btn-size: 14px; --btn-size-sm: 13px; --btn-size-big: 16px; --btn-weight: 500; --btn-ls: 0; --btn-tt: none; --btn-px: 14px;
  --side-radius: 6px; --scan-radius: 14px; --thumb-radius: 6px; --input-bg: #fff; --icon-border: none; --row-action: var(--link);
  --seg-on-bg: var(--ghost-hover); --seg-on-text: var(--text); --focus-border: var(--acc);
  --disabled-bg: #f1f1f3; --disabled-text: #a1a1aa; --danger-text: #b42318; --danger-border: #f1c4bf;
}
/* Épuré : blanc et noir, menu clair */
:root[data-style="epure"] {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --body-ls: -.006em;
  --bg: #ffffff; --card: #fff; --text: #09090b; --muted: #71717a; --muted-strong: #3f3f46; --line: #ebebee; --line-strong: #d9d9de; --subtle: #fafafa;
  --acc: #18181b; --acc2: #71717a; --link: #18181b; --chart: #27272a; --track: #f0f0f2; --row-action: #3f3f46;
  --side-bg: #f9f9fa; --side-border: #ececef; --side-text: #3f3f46; --side-muted: #8b8b94; --side-strong: #09090b; --side-hover: #f0f0f2; --side-active: #e9e9ec; --side-active-mark: none; --side-border2: #e4e4e8;
  --head-bg: #ffffff; --head-text: #09090b; --head-muted: #71717a; --head-border: #ececef; --head-hover: #f4f4f5;
  --primary: #18181b; --primary-hover: #3f3f46; --primary-text: #fff; --primary-shadow: 0 1px 2px #00000026;
  --btn2-bg: #fff; --btn2-border: #e4e4e7; --btn2-hover: #f7f7f8; --btn2-border-hover: #d4d4d8; --btn2-text: #18181b; --btn2-shadow: 0 1px 2px #0000000d;
  --ghost-hover: #f4f4f5; --seg-bg: #f4f4f5;
  --ctl-h: 38px; --ctl-h-sm: 30px; --btn-radius: 7px; --btn-radius-sm: 6px; --btn-radius-lg: 10px; --input-radius: 7px; --input-border: #e4e4e7; --radius: 10px; --scan-radius: 16px;
  --card-shadow: 0 1px 2px #0000000a; --card-shadow-hover: 0 4px 16px #0000000d;
  --h2-size: 24px; --h3-size: 15px; --h3-tt: none; --h3-ls: -.01em; --h3-color: #09090b;
  --th-tt: none; --th-ls: 0; --th-size: 12.5px; --th-bg: transparent; --th-weight: 500;
  --stat-label-size: 13px; --num-size: 28px;
  --icon-bg: #f4f4f5; --icon-color: #52525b; --badge-radius: 999px;
  --focus: #18181b24; --focus-border: #a1a1aa;
  --login-bg: #f4f4f5; --login-text: #09090b; --login-muted: #52525b; --login-line: #c4c4cc;
}
/* Corporatif : menu bleu marine, boutons bleus */
:root[data-style="corporatif"] {
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f3f5f9; --card: #fff; --text: #13213a; --muted: #5d6b82; --muted-strong: #33415a; --line: #e2e7ef; --line-strong: #cdd5e1; --subtle: #f7f9fc;
  --acc: #1d5fd0; --acc2: #7fb0ff; --link: #1a56bd; --chart: #1d5fd0; --track: #e6ecf5;
  --side-bg: #0b1930; --side-border: #0b1930; --side-text: #b7c3d7; --side-muted: #71819b; --side-strong: #fff; --side-hover: #ffffff12; --side-active: #1b3864; --side-active-mark: inset 3px 0 0 #5b9bff; --side-border2: #ffffff1c;
  --head-bg: #0b1930; --head-text: #fff; --head-muted: #ffffffb3; --head-border: #0b1930; --head-hover: #ffffff1a;
  --primary: #1d5fd0; --primary-hover: #174fb0; --primary-text: #fff; --primary-shadow: 0 1px 2px #0b2a6033, inset 0 1px 0 #ffffff1f;
  --btn2-bg: #fff; --btn2-border: #cfd7e3; --btn2-hover: #f5f8fc; --btn2-border-hover: #b3bfd1; --btn2-text: #1b2b45; --btn2-shadow: 0 1px 2px #0f22400d;
  --ghost-hover: #edf2fa; --seg-bg: #e9eef5; --seg-on-bg: #e8f0fd; --seg-on-text: #1a56bd;
  --ctl-h: 40px; --ctl-h-sm: 32px; --btn-radius: 8px; --btn-radius-sm: 6px; --btn-radius-lg: 10px; --input-radius: 8px; --input-border: #cfd7e3; --radius: 12px;
  --card-shadow: 0 1px 2px #0f22400a, 0 1px 3px #0f22400f; --card-shadow-hover: 0 6px 18px #0f224014;
  --h2-size: 26px; --h3-size: 16px; --h3-tt: none; --h3-ls: -.01em; --h3-color: #13213a;
  --th-tt: uppercase; --th-ls: .05em; --th-size: 11.5px; --th-bg: #f6f8fb; --th-weight: 600;
  --stat-label-size: 13.5px; --num-size: 30px;
  --icon-bg: #e8f0fd; --icon-color: #1d5fd0; --badge-radius: 6px;
  --focus: #1d5fd040;
  --login-bg: #0b1930; --login-text: #fff; --login-muted: #b7c3d7; --login-line: #2c5aa5;
}
/* Chantier : anthracite et orange sécurité, titres condensés */
:root[data-style="chantier"] {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-head: "Barlow Semi Condensed", var(--font);
  --font-num: "Barlow Semi Condensed", var(--font); --font-label: "Barlow Semi Condensed", var(--font); --font-btn: "Barlow Semi Condensed", var(--font);
  --bg: #f0f0ee; --card: #fff; --text: #1c2024; --muted: #686e75; --muted-strong: #3a3f45; --line: #e2e2de; --line-strong: #cbcbc6; --subtle: #f7f7f5;
  --acc: #c2410c; --acc2: #fb923c; --link: #b33c0b; --chart: #c2410c; --track: #ebebe7; --row-action: #2f3439;
  --side-bg: #1b1e22; --side-border: #1b1e22; --side-text: #c3c7cc; --side-muted: #7f858c; --side-strong: #fff; --side-hover: #ffffff0f; --side-active: #ffffff17; --side-active-mark: inset 3px 0 0 #f97316; --side-border2: #ffffff17; --side-radius: 3px;
  --head-bg: #1b1e22; --head-text: #fff; --head-muted: #ffffffb3; --head-border: #f97316; --head-hover: #ffffff1a;
  --primary: #c2410c; --primary-hover: #a3360a; --primary-text: #fff; --primary-shadow: 0 1px 0 #7c2d12;
  --btn2-bg: #fff; --btn2-border: #c9c9c4; --btn2-hover: #f6f6f4; --btn2-border-hover: #a9a9a3; --btn2-text: #1c2024; --btn2-shadow: 0 1px 0 #0000000d;
  --btn-size: 15.5px; --btn-size-sm: 14px; --btn-size-big: 18px; --btn-weight: 600; --btn-ls: .03em; --btn-tt: uppercase; --btn-px: 16px;
  --ghost-hover: #efefec; --seg-bg: #ebebe8; --seg-on-bg: #1b1e22; --seg-on-text: #fff;
  --ctl-h: 40px; --ctl-h-sm: 32px; --btn-radius: 4px; --btn-radius-sm: 3px; --btn-radius-lg: 5px; --input-radius: 4px; --input-border: #cbcbc6; --radius: 6px; --scan-radius: 8px; --thumb-radius: 4px;
  --card-shadow: 0 1px 0 #0000000a; --card-shadow-hover: 0 4px 14px #00000012;
  --h2-size: 30px; --head-ls: 0; --head-weight: 700; --h3-size: 16px; --h3-tt: uppercase; --h3-ls: .05em; --h3-color: #1c2024; --h3-weight: 700;
  --th-tt: uppercase; --th-ls: .06em; --th-size: 13px; --th-bg: #f6f6f4; --th-weight: 600;
  --stat-label-size: 14.5px; --num-size: 36px;
  --icon-bg: #fff1e7; --icon-color: #c2410c; --badge-radius: 3px;
  --focus: #c2410c33;
  --login-bg: #1b1e22; --login-text: #fff; --login-muted: #b9bec4; --login-line: #f9731673;
}
/* Architecte : noir, ivoire et bronze, titres à empattements */
:root[data-style="architecte"] {
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-head: "Source Serif 4", Georgia, serif; --font-num: "Source Serif 4", Georgia, serif;
  --bg: #f5f3ee; --card: #fffefb; --text: #1a1916; --muted: #77716a; --muted-strong: #48443e; --line: #e6e1d7; --line-strong: #d2cabc; --subtle: #faf8f3;
  --acc: #8b6b3e; --acc2: #c9a96e; --link: #7a5c32; --chart: #8b6b3e; --track: #ece7dd; --row-action: #48443e;
  --side-bg: #121211; --side-border: #121211; --side-text: #bcb7ad; --side-muted: #7b766d; --side-strong: #fff; --side-hover: #ffffff0d; --side-active: #ffffff12; --side-active-mark: inset 2px 0 0 #c9a96e; --side-border2: #ffffff14; --side-radius: 2px;
  --head-bg: #121211; --head-text: #fff; --head-muted: #ffffffa6; --head-border: #121211; --head-hover: #ffffff1a;
  --primary: #1a1916; --primary-hover: #3a3731; --primary-text: #fff; --primary-shadow: none;
  --btn2-bg: transparent; --btn2-border: #cbc3b4; --btn2-hover: #f3efe6; --btn2-border-hover: #1a1916; --btn2-text: #1a1916; --btn2-shadow: none;
  --btn-weight: 600; --btn-ls: .01em;
  --ghost-hover: #f0ece3; --seg-bg: #efebe3; --seg-on-bg: #1a1916; --seg-on-text: #fff;
  --ctl-h: 40px; --ctl-h-sm: 32px; --btn-radius: 2px; --btn-radius-sm: 2px; --btn-radius-lg: 3px; --input-radius: 2px; --input-border: #d2cabc; --input-bg: #fffefb; --radius: 4px; --scan-radius: 4px; --thumb-radius: 2px;
  --card-shadow: none; --card-shadow-hover: 0 6px 18px #2a20100f;
  --h2-size: 32px; --head-weight: 500; --head-ls: -.015em; --h3-size: 11.5px; --h3-tt: uppercase; --h3-ls: .14em; --h3-color: #77716a;
  --th-tt: uppercase; --th-ls: .12em; --th-size: 11px; --th-bg: transparent; --th-weight: 600;
  --stat-label-size: 11.5px; --num-size: 34px; --num-weight: 500;
  --icon-bg: transparent; --icon-color: #8b6b3e; --icon-border: 1px solid #e0d8c8; --badge-radius: 2px;
  --focus: #8b6b3e33; --disabled-bg: #ece7dd;
  --login-bg: #121211; --login-text: #fff; --login-muted: #bcb7ad; --login-line: #c9a96e;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); letter-spacing: var(--body-ls); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
td a, .list-line a { color: var(--text); font-weight: 500; text-decoration: none; }
td a:hover, .list-line a:hover { color: var(--link); text-decoration: underline; }
.sku { font-family: var(--mono); font-size: .86em; color: var(--muted); letter-spacing: .01em; }

/* ---------- en-tête et navigation ---------- */
header { background: var(--head-bg); color: var(--head-text); padding: env(safe-area-inset-top) 20px 0; position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--head-border); }
.bar { display: flex; align-items: center; gap: 18px; max-width: 1240px; margin: 0 auto; min-height: 54px; }
.brand { white-space: nowrap; font-weight: 600; font-size: 16px; letter-spacing: -.005em; display: flex; align-items: center; gap: 10px; color: var(--head-text); text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.brand small { font-weight: 400; color: var(--head-muted); }
nav.top { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
nav.top a { color: var(--head-muted); text-decoration: none; padding: 16px 10px 14px; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; font-weight: 500; transition: color .15s; }
nav.top a:hover { color: var(--head-text); }
nav.top a.active { color: var(--head-text); border-bottom-color: var(--acc2); }
.who { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--head-muted); margin-left: auto; }
.icon-btn { position: relative; background: transparent; border: 1px solid transparent; color: var(--head-text); padding: 7px 9px; min-height: 0; box-shadow: none; border-radius: var(--btn-radius); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 13px; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--head-hover); border-color: transparent; }
.dot { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
nav.bottom { display: none; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 1240px; margin: 0 auto; padding: 28px 20px 64px; }
h2 { margin: 0 0 18px; font-family: var(--font-head); font-size: var(--h2-size); font-weight: var(--head-weight); letter-spacing: var(--head-ls); }
h3 { margin: 0 0 14px; font-family: var(--font-label); font-size: var(--h3-size); font-weight: var(--h3-weight); text-transform: var(--h3-tt); letter-spacing: var(--h3-ls); color: var(--h3-color); }
dialog h3 { font-family: var(--font-head); font-size: 19px; font-weight: 600; text-transform: none; letter-spacing: -.01em; color: var(--text); }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { margin: 0; flex: 1; }

/* ---------- éléments ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--card-shadow); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted-strong); margin-bottom: 5px; }
/* Champs et boutons à la même hauteur */
input, select, textarea { width: 100%; height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--input-border); border-radius: var(--input-radius); font: inherit; font-size: 15px;
  background: var(--input-bg); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input[type=checkbox], input[type=radio], input[type=file] { height: auto; padding: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus-border); box-shadow: 0 0 0 3px var(--focus); }
textarea { height: auto; min-height: 60px; padding: 9px 12px; }
/* Boutons : principal (plein), secondaire (contour), discret (ghost) et suppression (danger) */
button, .btn { font-family: var(--font-btn); font-size: var(--btn-size); font-weight: var(--btn-weight); letter-spacing: var(--btn-ls); text-transform: var(--btn-tt); line-height: 1.2;
  min-height: var(--ctl-h); padding: 0 var(--btn-px); border-radius: var(--btn-radius); border: 1px solid var(--btn2-border); background: var(--btn2-bg); color: var(--btn2-text);
  box-shadow: var(--btn2-shadow); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; user-select: none;
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s; }
button:hover, .btn:hover { background: var(--btn2-hover); border-color: var(--btn2-border-hover); }
button:active, .btn:active { filter: brightness(.96); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
button svg.i, .btn svg.i { width: 16px; height: 16px; stroke-width: 2; flex: none; }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; box-shadow: var(--primary-shadow); }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted-strong); }
button.ghost:hover, .btn.ghost:hover { background: var(--ghost-hover); border-color: transparent; color: var(--text); }
button.danger, .btn.danger { color: var(--danger-text); border-color: var(--danger-border); }
button.danger:hover, .btn.danger:hover { background: #fef3f2; border-color: var(--danger-text); }
button.big { width: 100%; min-height: 50px; font-size: var(--btn-size-big); border-radius: var(--btn-radius-lg); }
button.small, .btn.small { min-height: var(--ctl-h-sm); padding: 0 10px; font-size: var(--btn-size-sm); border-radius: var(--btn-radius-sm); }
button:disabled, button:disabled:hover { background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-text); box-shadow: none; cursor: not-allowed; filter: none; }
/* Boutons d'interface (menu, onglets, pavés) : jamais en majuscules, même dans le style Chantier */
.icon-btn, .side-search, .side-out, .seg button, .tabs button, .chips button, .stepper button, .sign-btn, .btn-group button, .net-status, .style-card, .proof-item button, button.icon-only {
  font-family: var(--font); text-transform: none; letter-spacing: 0; }
/* Actions d'une ligne de tableau : boutons discrets, côte à côte */
.btn-group { display: inline-flex; gap: 2px; white-space: nowrap; }
.btn-group button { background: transparent; border-color: transparent; box-shadow: none; color: var(--row-action); font-size: 13px; font-weight: 500; }
.btn-group button:hover { background: var(--ghost-hover); border-color: transparent; color: var(--text); }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.row > .shrink { flex: 0 0 auto; min-width: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { font-family: var(--font-label); font-size: var(--th-size); text-transform: var(--th-tt); letter-spacing: var(--th-ls); color: var(--muted); font-weight: var(--th-weight); background: var(--th-bg); }
tbody tr:hover td { background: var(--subtle); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.low td, tr.low:hover td { background: var(--warn-bg); }
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--badge-radius); font-size: 12px; font-weight: 500; letter-spacing: 0; background: #eef0f3; color: #4a515c; white-space: nowrap; }
.badge.sortie { background: var(--danger-bg); color: var(--danger); }
.badge.entree { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .badge.alerte { background: var(--warn-bg); color: var(--warn); }
.badge.sécurité { background: var(--neutral-bg); color: var(--neutral); }
.muted { color: var(--muted); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--card-shadow); }
.stat-label { font-family: var(--font-label); font-size: var(--stat-label-size); font-weight: 500; text-transform: var(--h3-tt); letter-spacing: var(--h3-ls); color: var(--muted); }
.stat b { display: block; font-family: var(--font-num); font-size: var(--num-size); font-weight: var(--num-weight); letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.list-line { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-line:last-child { border-bottom: none; }
.list-line .grow { flex: 1; min-width: 0; }
.alert-banner { background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 22%, #fff); border-left: 3px solid var(--warn); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; text-decoration: none; }

/* ---------- connexion ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--login-bg); }
.login { width: 100%; max-width: 380px; padding: 28px; box-shadow: 0 12px 32px #0000002e; }
.login .logo { text-align: center; margin-bottom: 16px; }
.login .logo img { width: 56px; height: 56px; border-radius: 10px; }
.login h1 { text-align: center; margin: 8px 0 4px; font-family: var(--font-head); font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.error { color: var(--danger); margin: 8px 0 0; min-height: 1.2em; }

/* ---------- toasts et dialogues ---------- */
.toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 14px; max-width: 90vw; z-index: 50; box-shadow: 0 6px 20px #0003; }
.toast.err { background: var(--danger); }
dialog { border: none; border-radius: 10px; padding: 24px; box-shadow: 0 20px 50px #0000003d; width: min(540px, 94vw); max-height: 90vh; }
dialog::backdrop { background: #0f141a99; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* ---------- sortie panier ---------- */
.results { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }
.results div { padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.results div:hover { background: color-mix(in srgb, var(--accent) 7%, #fff); }
.results div.disabled { color: var(--muted); cursor: not-allowed; }
.cart-line input { width: 90px; }

/* ---------- fiche article (après scan) ---------- */
.quick { max-width: 560px; margin: 0 auto; }
.item-hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; text-align: center; }
.item-hero h2 { margin: 6px 0 12px; font-size: 24px; }
.item-hero .stock-big + .muted, .stock-unit { font-size: 14px; }
.stock-big { font-family: var(--font-num); font-size: 56px; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stock-big.low { color: var(--warn); }
.stepper { display: flex; align-items: stretch; gap: 0; }
.stepper button { min-height: 56px; width: 64px; font-size: 26px; font-weight: 500; padding: 0; box-shadow: none; }
.stepper button:first-child { border-radius: 8px 0 0 8px; }
.stepper button:last-child { border-radius: 0 8px 8px 0; }
.stepper input { height: 56px; text-align: center; font-family: var(--font-num); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; border-radius: 0; border-left: none; border-right: none; padding: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chips button { min-height: 36px; min-width: 56px; padding: 0 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.success { text-align: center; padding: 30px 20px; }
.success .check { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin: 0 auto 14px; }
.success .check svg { width: 40px; height: 40px; stroke-width: 3; }

/* ---------- scanner ---------- */
.scanner { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 4; max-height: 50vh; margin: 0 auto 16px; max-width: 520px; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid #ffffffd0; border-radius: 16px; box-shadow: 0 0 0 999px #0006; }
.scanner .hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; }

/* ---------- étiquettes QR (impression) ---------- */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.label { background: #fff; border: 1px dashed #b9c1ce; border-radius: 8px; padding: 12px; text-align: center; break-inside: avoid; }
.label svg { width: 100%; max-width: 150px; height: auto; display: block; margin: 0 auto 6px; }
.label .n { font-weight: 700; font-size: 14px; line-height: 1.2; }
.label .s { font-size: 12px; color: #444; font-family: ui-monospace, monospace; }
.label .c { font-size: 10px; color: #777; margin-top: 2px; }

@media print {
  header, aside.side, nav.bottom, .no-print, .toast { display: none !important; }
  main { margin-left: 0 !important; }
  body, main { background: #fff; padding: 0; margin: 0; max-width: none; }
  .labels { grid-template-columns: repeat(4, 1fr); gap: 4mm; }
  .label { border: 1px dashed #999; }
}

/* ---------- téléphone ---------- */
@media (max-width: 1450px) { .who .name, .who .txt, .brand small { display: none; } }
@media (max-width: 1100px) { .brand small { display: none; } nav.top a { padding-left: 7px; padding-right: 7px; } }
@media (max-width: 760px) {
  nav.top, .who .name, .who .txt { display: none; }
  main { padding: 16px 12px calc(var(--nav-h) + 30px + env(safe-area-inset-bottom)); }
  nav.bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  nav.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h); color: var(--muted); text-decoration: none; font-size: 11px; }
  nav.bottom a.active { color: var(--acc); }
  nav.bottom a.scan { color: #fff; }
  nav.bottom a.scan span.circle { background: var(--primary); color: var(--primary-text); width: 52px; height: 52px; border-radius: var(--scan-radius); display: grid; place-items: center; margin-top: -22px; box-shadow: 0 4px 12px #0000002e; border: 4px solid var(--card); }
  nav.bottom a.scan .lbl { color: var(--muted); }
  nav.bottom a.scan.active .lbl { color: var(--acc); }
  .toast { bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }
  .hide-sm { display: none; }
  .page-head > .grow { flex-basis: 100%; }
  input, select, textarea { font-size: 16px; }
  th, td { padding: 9px 6px; }
}

/* ---------- images d'articles, chantiers, paramètres ---------- */
.thumb { width: 44px; height: 44px; border-radius: var(--thumb-radius); object-fit: contain; background: #fff; border: 1px solid var(--line); flex: 0 0 auto; display: inline-grid; place-items: center; }
.thumb.sm { width: 34px; height: 34px; border-radius: 6px; }
.thumb.lg { width: 88px; height: 88px; border-radius: 8px; }
.thumb.empty { background: var(--subtle); color: var(--muted); }
.thumb.empty svg { width: 55%; height: 55%; }
.with-thumb { display: flex; align-items: center; gap: 10px; }
.hero-img { display: block; width: 120px; height: 120px; object-fit: contain; margin: 0 auto 10px; border-radius: 8px; background: #fff; }
.image-field { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.site-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.site-card { display: grid; gap: 4px; margin: 0; }
.site-card { transition: border-color .15s; }
.site-card:hover { border-color: var(--line-strong); }
a.plain { color: inherit; text-decoration: none; }
.label .n img { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; margin-right: 5px; }

/* ---------- menu latéral (ordinateur) ---------- */
aside.side { display: none; }
@media (min-width: 1101px) {
  header { display: none; }
  aside.side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 244px; z-index: 10;
    background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border); padding: 18px 12px 12px; }
  main { margin-left: 244px; max-width: none; padding: 32px 40px 64px; }
  main > * { max-width: 1240px; }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: var(--side-strong); text-decoration: none; font-weight: 600; font-size: 15px; line-height: 1.2; }
  .side-brand img { width: 34px; height: 34px; border-radius: 7px; object-fit: contain; }
  .side-brand small { display: block; font-weight: 400; font-size: 12px; color: var(--side-muted); }
  aside.side nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
  .side-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 16px 10px 6px; }
  .side-group:first-child { padding-top: 0; }
  aside.side nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--side-radius); color: var(--side-text); text-decoration: none; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
  aside.side nav a svg.i { width: 18px; height: 18px; stroke-width: 1.8; opacity: .85; }
  aside.side nav a:hover { background: var(--side-hover); color: var(--side-strong); }
  aside.side nav a.active { background: var(--side-active); color: var(--side-strong); box-shadow: var(--side-active-mark); }
  aside.side nav a.active svg.i { opacity: 1; }
  aside.side .count { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; }
  .side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--side-border2); margin-top: 10px; font-size: 13px; color: var(--side-strong); }
  .side-user b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
  .side-user small { color: var(--side-muted); }
  .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--side-active); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: 0 0 auto; }
  .side-out { background: transparent; border: none; color: var(--side-muted); padding: 6px; min-height: 0; box-shadow: none; }
  .side-out:hover { background: var(--side-hover); color: var(--side-strong); }
  .side-out svg.i { width: 18px; height: 18px; }
  .toast { left: calc(50% + 122px); }
}

/* ---------- indicateurs et barres du tableau de bord ---------- */
.stat { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label icon" "value icon" "sub sub"; align-items: start; transition: border-color .15s; }
a.stat:hover { border-color: var(--line-strong); }
.stat .stat-label { grid-area: label; }
.stat b { grid-area: value; }
.stat-icon { grid-area: icon; width: 38px; height: 38px; border-radius: var(--btn-radius); display: grid; place-items: center;
  background: var(--icon-bg); color: var(--icon-color); border: var(--icon-border); }
.stat-icon svg.i { width: 20px; height: 20px; stroke-width: 1.8; }
.stat.is-warn .stat-icon { background: var(--warn-bg); color: var(--warn); }
.stat.is-warn b { color: var(--warn); }
.bar-line { display: block; padding: 8px 0 10px; }
.bar-head { display: flex; gap: 6px; align-items: baseline; font-size: 14px; margin-bottom: 6px; }
.bar-head b { font-variant-numeric: tabular-nums; }
.bar-track { display: block; height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--chart); border-radius: 3px; }
a.bar-line:hover .bar-head .grow { color: var(--link); }

/* ---------- animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } }
@keyframes ring { from { transform: scale(.8); opacity: .6; } to { transform: scale(1.9); opacity: 0; } }
@keyframes sweep { from { top: 10%; } to { top: 90%; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes appear { to { opacity: .75; } }

/* Contenu des pages : apparition en cascade */
main > * { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
main > *:nth-child(2) { animation-delay: .05s; }
main > *:nth-child(3) { animation-delay: .1s; }
main > *:nth-child(n+4) { animation-delay: .15s; }
.stats > *, .grid > .card, .site-grid > * { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.stats > :nth-child(2), .grid > .card:nth-child(2), .site-grid > :nth-child(2) { animation-delay: .06s; }
.stats > :nth-child(3), .grid > .card:nth-child(3), .site-grid > :nth-child(3) { animation-delay: .12s; }
.stats > :nth-child(4), .grid > .card:nth-child(4), .site-grid > :nth-child(n+4) { animation-delay: .18s; }
tbody tr { animation: fade .3s ease-out both; }
a.stat, .site-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
a.stat:hover, a.site-card:hover, .site-card:hover { box-shadow: var(--card-shadow-hover); border-color: var(--line-strong); }
.bar-track span { transform-origin: left; animation: grow 1s .3s cubic-bezier(.2, .7, .2, 1) both; }
.alert-banner svg.i { animation: pulse 2.4s ease-in-out infinite; }

/* Connexion : plan qui se dessine, carte qui monte */
.login-wrap { position: relative; overflow: hidden; }
.login { position: relative; animation: rise .6s .15s cubic-bezier(.2, .7, .2, 1) both; }
.login .logo img { animation: pop .6s .35s cubic-bezier(.2, .9, .3, 1.2) both; }
.blueprint { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.blueprint path { fill: none; stroke: var(--login-line); stroke-width: 1.6; opacity: .7; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw 1.1s var(--d) cubic-bezier(.6, 0, .3, 1) forwards; }
.blueprint text { fill: var(--login-line); opacity: 0; font: 15px var(--mono); text-anchor: middle; animation: appear .6s var(--d) ease-out forwards; }
@media (max-width: 760px) { .blueprint { opacity: .45; } }

/* Confirmation de sortie : coche tracée, onde, stock qui descend */
.success .check { position: relative; animation: pop .5s cubic-bezier(.2, .9, .3, 1.3) both; }
.success .check::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ok); animation: ring .9s .25s ease-out both; }
.success .check path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .45s .3s ease-out forwards; }
.stock-flow { display: grid; justify-items: center; gap: 2px; margin: 14px 0 4px; }
.stock-flow .stock-big { font-variant-numeric: tabular-nums; }

/* Scanner : ligne de balayage */
.scanner .frame::after { content: ""; position: absolute; left: 6%; right: 6%; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); box-shadow: 0 0 14px var(--accent);
  animation: sweep 1.8s ease-in-out infinite alternate; }

.toast:not([hidden]) { animation: toast-in .25s ease-out; }
dialog[open] { animation: rise .25s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- connexion en deux panneaux (ordinateur) ---------- */
.login-wrap.split { padding: 0; display: grid; grid-template-columns: 1fr; place-items: stretch; }
.login-hero { position: absolute; inset: 0; }
.login-hero > :not(.blueprint) { display: none; }
.login-panel { position: relative; display: grid; place-items: center; padding: 20px; min-height: 100vh; }
.only-desk { display: none; }
@media (min-width: 1000px) {
  .login-wrap.split { grid-template-columns: minmax(0, 1.3fr) minmax(440px, 1fr); }
  .login-hero { display: flex; flex-direction: column; justify-content: space-between; position: relative; inset: auto; min-height: 100vh; padding: 40px 56px; color: var(--login-text); }
  .login-hero > :not(.blueprint) { display: revert; }
  .login-hero > .hero-brand { display: flex; }
  .login-hero .blueprint { opacity: .8; }
  .hero-brand { position: relative; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 17px; animation: fade .6s .1s both; }
  .hero-brand img { width: 40px; height: 40px; object-fit: contain; }
  .hero-text { position: relative; max-width: 500px; animation: rise .8s .5s cubic-bezier(.2, .7, .2, 1) both; }
  .eyebrow { margin: 0 0 14px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--acc2); }
  .hero-text h2 { margin: 0 0 16px; font-family: var(--font-head); font-size: 42px; line-height: 1.1; letter-spacing: -.025em; font-weight: var(--head-weight); color: var(--login-text); }
  .hero-text p { margin: 0; max-width: 440px; font-size: 16px; color: var(--login-muted); }
  .hero-text .hero-foot { margin-top: 48px; font-size: 12px; color: var(--login-muted); opacity: .7; }
  .login-panel { background: var(--card); box-shadow: -1px 0 0 #0000001a; }
  .login-panel .login { box-shadow: none; border: none; padding: 0; max-width: 360px; animation: rise .6s .25s cubic-bezier(.2, .7, .2, 1) both; }
  .login-panel .login .logo { display: none; }
  .login-panel .login h1, .login-panel .login > p.muted { text-align: left !important; }
  .login-panel .login h1 { font-size: 26px; margin: 0 0 6px; }
  .login-panel .login > p.muted { margin-bottom: 26px; }
  .only-desk { display: inline; }
  .only-mob { display: none; }
}

/* ---------- en-tête du tableau de bord ---------- */
.page-head .grow { flex: 1; min-width: 0; }
.page-head .sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.page-head .sub::first-letter { text-transform: uppercase; }

/* ---------- graphique d'activité ---------- */
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-head h3 { margin: 0; }
.chart-head b { color: var(--text); font-variant-numeric: tabular-nums; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ytick, .chart .xtick { font: 11px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .ytick { text-anchor: end; }
.chart .xtick { text-anchor: middle; }
.chart .hit { fill: transparent; }
.chart .bar { fill: var(--chart); transition: opacity .15s; }
.chart svg.hovering .col:not(.on) .bar { opacity: .35; }
.chart svg.animate .bar { transform-box: fill-box; transform-origin: bottom; animation: grow-y .7s calc(var(--i) * 18ms + .25s) cubic-bezier(.2, .7, .2, 1) both; }
@keyframes grow-y { from { transform: scaleY(0); } }
.chart-tip { position: absolute; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap; background: #15191f; color: #fff;
  font-size: 12px; line-height: 1.4; padding: 7px 10px; border-radius: 6px; box-shadow: 0 6px 16px #0000002e; }
.chart-tip span { color: #ffffffa6; }
.chart-empty { position: absolute; inset: 0 0 24px 34px; display: grid; place-items: center; margin: 0; }

/* ---------- recherche instantanée ---------- */
kbd { font: 500 11px var(--mono); padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: #fff; white-space: nowrap; }
.palette-back { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px;
  background: #0f141a73; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .15s ease-out; }
.palette { width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 12px;
  box-shadow: 0 24px 60px #00000052, 0 0 0 1px #0000000f; animation: rise .22s cubic-bezier(.2, .7, .2, 1); }
.palette-input { display: flex; align-items: center; gap: 10px; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input svg.i { width: 20px; height: 20px; flex: 0 0 auto; }
.palette-input input { height: auto; border: none; padding: 0; font-size: 16px; box-shadow: none !important; }
.palette-results { overflow-y: auto; padding: 6px; }
.p-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.p-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 14px; }
.p-item.sel { background: color-mix(in srgb, var(--accent) 9%, #fff); }
.p-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-item > .muted { font-size: 13px; white-space: nowrap; }
.p-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 6px; background: var(--subtle); border: 1px solid var(--line); color: var(--muted); }
.p-icon svg.i { width: 17px; height: 17px; }
.p-empty { margin: 0; padding: 26px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 18px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--subtle); font-size: 12px; color: var(--muted); }
.palette-foot kbd { margin-right: 3px; }
@media (max-width: 760px) { .palette-back { padding-top: 8px; } .palette-input kbd, .palette-foot { display: none; } }
.side-search { width: 100%; justify-content: flex-start; gap: 9px; min-height: 36px; margin: 0 0 14px; padding: 0 10px; font-weight: 400; font-size: 13px;
  background: var(--side-hover); border: 1px solid var(--side-border2); color: var(--side-muted); box-shadow: none; border-radius: var(--btn-radius); }
.side-search:hover { background: var(--side-active); border-color: var(--side-border2); color: var(--side-strong); }
.side-search:active { background: var(--side-active); }
.side-search svg.i { width: 16px; height: 16px; }
.side-search kbd { margin-left: auto; background: transparent; color: var(--side-muted); border-color: var(--side-border2); }

/* ---------- squelette de chargement ---------- */
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton { display: grid; gap: 16px; animation: fade .3s .18s both; }
.skeleton span { display: block; border-radius: 8px; background: linear-gradient(90deg, #e8ebef 0%, #f4f5f7 40%, #e8ebef 80%) 0 0 / 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk-title { width: 260px; height: 30px; }
.sk-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.sk-row span { height: 100px; }
.sk-block { height: 220px; }
.sk-block.short { height: 140px; }

/* ---------- fil des dernières sorties ---------- */
.list-line.feed { align-items: flex-start; }
.feed .grow { display: flex; flex-direction: column; gap: 1px; }
.feed-main, .feed small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-main { font-weight: 500; }
.feed .qty { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.feed small { font-size: 13px; color: var(--muted); }
.feed small b { color: var(--text); font-weight: 500; }
.feed time { flex: 0 0 auto; margin-top: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- petits détails ---------- */
.panel-foot { display: none; }
@media (min-width: 1000px) {
  .panel-foot { display: block; margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.5; color: var(--muted); }
}
.all-good { display: flex; align-items: center; gap: 12px; margin: 4px 0 0; }
.all-good svg.i { flex: 0 0 auto; width: 34px; height: 34px; padding: 8px; border-radius: 8px; color: var(--ok); background: var(--ok-bg); stroke-width: 2.4; }
.all-good span { display: flex; flex-direction: column; font-weight: 500; }
.all-good small { font-weight: 400; font-size: 13px; color: var(--muted); }
.all-good svg.i path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .5s .6s ease-out forwards; }

/* ---------- coûts, retours, commandes, inventaire physique ---------- */
.stat-sub { grid-area: sub; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.badge.retour { background: var(--info-bg); color: var(--info); }
.badge.ajustement { background: var(--neutral-bg); color: var(--neutral); }
.badge.st-brouillon { background: #eef0f3; color: #4a515c; }
.badge.st-envoyee { background: var(--info-bg); color: var(--info); }
.badge.st-recue { background: var(--ok-bg); color: var(--ok); }
.badge.st-annulee { background: #f3f4f6; color: #8a909a; text-decoration: line-through; }
.alert-banner.info { background: var(--card); color: var(--text); border-color: var(--line); border-left-color: var(--accent); }
.alert-banner.info svg.i { color: var(--accent); }
.card-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.site-cost { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.site-cost b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
td.neg, .diff.neg { color: var(--danger); }
.diff { font-weight: 600; font-variant-numeric: tabular-nums; }
.diff.pos { color: var(--info); }
.ok-mark { color: var(--ok); display: inline-flex; }
.ok-mark svg.i { width: 18px; height: 18px; }
table.report tfoot td, table.lines tfoot td { font-weight: 600; border-bottom: none; border-top: 2px solid var(--line-strong); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--subtle); }
tr.done td { color: var(--muted); }
tr.done svg.i { width: 15px; height: 15px; color: var(--ok); vertical-align: -3px; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 16%, #fff); } }
tr.flash td { animation: flash 1.2s ease-out; }
.num-in { height: 34px; width: 96px; text-align: right; font-variant-numeric: tabular-nums; padding: 7px 9px; font-size: 15px; }
button.icon-only { min-width: 30px; padding: 0; font-size: 18px; line-height: 1; color: var(--muted); }
table.lines tfoot td:first-child { position: relative; font-weight: 400; }
table.lines tfoot .results { position: absolute; left: 10px; right: 10px; z-index: 5; background: #fff; box-shadow: 0 12px 28px #0000002a; }

/* Sortie / retour sur la fiche d'un article */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--seg-bg); border-radius: calc(var(--btn-radius) + 3px); }
.seg button { min-height: 40px; border: none; background: transparent; box-shadow: none; color: var(--muted); font-weight: 600; gap: 7px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px #10182824; }
.seg button:hover:not(.on):not(:disabled) { background: #ffffff80; }
.seg button:disabled { background: transparent; border-color: transparent; opacity: .45; }

/* Onglets (En cours / Toutes, À compter / Comptés / Écarts) */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { flex: 1; min-width: 180px; max-width: 320px; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: calc(var(--btn-radius) + 2px); box-shadow: var(--card-shadow); }
.toolbar .tabs { margin-bottom: 0; }
.tabs button { min-height: 32px; padding: 0 12px; border: none; box-shadow: none; background: transparent; color: var(--muted); font-size: 13.5px; }
.tabs button.on { background: var(--seg-on-bg); color: var(--seg-on-text); font-weight: 600; }

/* Caméra intégrée (réception, comptage) */
.scanner.small { aspect-ratio: 4 / 3; max-width: 420px; max-height: 40vh; margin: 14px 0 4px; }
.receive-box .scanner.small, .count-head .scanner.small { margin-left: auto; margin-right: auto; }
.count-head { display: grid; gap: 14px; }
.count-head > button.big { max-width: 420px; justify-self: center; }
.count-progress > div { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: 14px; }
.count-progress .bar-track { height: 8px; }
.count-progress .bar-track span { display: block; height: 100%; background: var(--ok); border-radius: 4px; transition: width .4s ease; }
.count-table tr.ok td:last-child { background: color-mix(in srgb, var(--ok-bg) 60%, #fff); }
.count-table tr.warn td:last-child { background: var(--warn-bg); }
.count-dialog { text-align: center; margin-bottom: 14px; }
.count-dialog .thumb.lg { margin: 0 auto 10px; }
.count-dialog h3 { margin: 0 0 4px; }
.count-dialog p { margin: 0; }
.return-lines { max-height: 46vh; overflow-y: auto; margin: 6px 0; border-top: 1px solid var(--line); }
.return-lines .num-in, .return-lines input { width: 90px; flex: 0 0 auto; text-align: right; }

/* Étapes de l'inventaire physique */
.steps { list-style: none; counter-reset: s; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 0 0 20px; padding: 0; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; font-size: 14px; }
.steps li::before { content: counter(s); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent); font-weight: 700; font-size: 13px; }
.steps li span { color: var(--muted); font-size: 13px; }

/* Sécurité */
.checks { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; font-size: 13.5px; color: var(--muted); }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks svg.i { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; color: var(--ok); stroke-width: 2.4; }

/* Documents imprimés : rapport de chantier, bon de commande, rapport d'inventaire */
.print-only { display: none !important; }
.report-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 2px solid #111; }
.report-head img { width: 46px; height: 46px; object-fit: contain; }
.report-head > div { display: flex; flex-direction: column; }
.report-head b { font-size: 18px; }
.report-head span { color: #555; font-size: 13px; }
.report-head .doc-no { margin-left: auto; text-align: right; }
.print-doc label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #666; }
@media print {
  .print-only { display: block !important; }
  .print-only.report-head { display: flex !important; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .card, .stat { box-shadow: none; break-inside: avoid; animation: none !important; }
  .page-head h2 { color: #111 !important; }
  .page-head .sub { color: #555 !important; }
  .hide-sm { display: table-cell !important; }
  * { animation: none !important; }
}
.add-line { margin-top: 12px; max-width: 520px; }
.add-line .results { margin-top: 6px; }
.meta { display: block; color: var(--muted); }
@media (max-width: 760px) {
  table.lines .thumb, table.report .thumb { display: none; }
  table.lines .meta, table.report .meta { display: none; }
}
table.lines td.num { white-space: nowrap; }
/* ---------- choix du style (Paramètres) ---------- */
.style-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px; }
.style-card { display: block; min-height: 0; padding: 0; border-radius: 8px; overflow: hidden; text-align: left; background: #fff; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); color: var(--text); }
.style-card:hover { background: #fff; border-color: transparent; box-shadow: 0 0 0 1px var(--line-strong); }
.style-card.on, .style-card.on:hover { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.st-prev { display: flex; height: 70px; }
.st-prev i { width: 28%; }
.st-prev > span { flex: 1; padding: 10px 9px; display: flex; flex-direction: column; gap: 6px; }
.st-prev em { display: block; height: 6px; border-radius: 2px; background: #00000014; }
.st-prev em + em { width: 70%; }
.st-prev b { display: block; width: 46%; height: 14px; margin-top: auto; }
.st-name { display: block; padding: 7px 10px 0; font-size: 13.5px; font-weight: 600; }
.st-desc { display: block; padding: 0 10px 9px; font-size: 12px; font-weight: 400; color: var(--muted); white-space: normal; line-height: 1.35; }
@media (max-width: 340px) { .style-pick { grid-template-columns: 1fr; } }

/* ---------- v10 : réservations, preuve de sortie, hors ligne, import, courriels ---------- */
.reserved-line { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--info); font-size: 14px; }
.reserved-line svg.i { width: 17px; height: 17px; flex: none; }
p.hint, div.hint { background: var(--info-bg); color: var(--info); border-left: 3px solid var(--accent); border-radius: 6px; padding: 9px 12px; font-size: 13.5px; margin: 10px 0; }
p.hint.warn, div.hint.warn { background: var(--warn-bg); color: var(--warn); border-left-color: var(--warn); }
.booked { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 14px 12px; margin: 4px 0 14px; background: var(--subtle); }
.booked > p { display: flex; gap: 8px; align-items: center; margin: 0 0 4px; }
.booked > p svg.i { width: 18px; height: 18px; color: var(--accent); }
.booked .list-line { padding: 6px 0; }
.booked > button { margin-top: 8px; }
.site-res { display: flex; gap: 6px; align-items: center; font-size: 13px; margin-top: 4px; }
.site-res svg.i { width: 15px; height: 15px; }

.proof { margin: 14px 0 4px; }
.proof-row { display: flex; gap: 10px; flex-wrap: wrap; }
.proof-row > button { display: inline-flex; gap: 7px; align-items: center; }
.proof-row > button svg.i { width: 18px; height: 18px; }
.proof-item { position: relative; display: inline-block; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; padding: 3px; }
.proof-item img { display: block; height: 64px; max-width: 150px; object-fit: contain; border-radius: 4px; }
.proof-item button { position: absolute; top: -9px; right: -9px; width: 24px; height: 24px; min-height: 0; padding: 0; border-radius: 50%; line-height: 1; font-size: 15px; }
.proof-link { display: inline-flex; vertical-align: -3px; color: var(--muted); margin-left: 2px; }
.proof-link svg.i { width: 16px; height: 16px; }
.proof-link:hover { color: var(--accent); }
.sign-dialog { width: min(620px, 96vw); }
.sign-dialog canvas { display: block; width: 100%; height: 220px; border: 1.5px dashed var(--line-strong); border-radius: 6px; background: #fff; touch-action: none; cursor: crosshair; }
.sign-dialog .actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.sign-dialog .grow { flex: 1; }

.success .check.queued { background: var(--info-bg); color: var(--info); }
.success .check.queued::after { border-color: var(--accent); }
.net-status { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 62px);
  display: inline-flex; gap: 7px; align-items: center; min-height: 0; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--primary); color: var(--primary-text); border: 1px solid #ffffff2e; box-shadow: 0 6px 20px #0000002e; }
.net-status svg.i { width: 16px; height: 16px; }
.net-status.bad { background: var(--danger); }
.net-status[hidden] { display: none; }
dialog h4 { margin: 18px 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

dialog.wide { width: min(760px, 96vw); }
.drop { position: relative; display: flex; gap: 10px; align-items: center; justify-content: center; padding: 22px; margin: 12px 0;
  border: 1.5px dashed var(--line-strong); border-radius: 8px; color: var(--muted); background: var(--subtle); font-weight: 500; }
.drop:hover, .drop:focus-within { border-color: var(--accent); color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.import-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 14px 0 10px; }
.import-sum > div { background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.import-sum b { display: block; font-size: 20px; font-weight: 600; line-height: 1.2; }
.import-sum span { font-size: 12.5px; color: var(--muted); }
.import-sum .bad b { color: var(--warn); }
.import-rows { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.import-rows table { font-size: 13.5px; }
.import-rows th { position: sticky; top: 0; background: var(--card); }

.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 400; cursor: pointer; }
.switch-row input { width: 18px; height: 18px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.switch-row .muted { font-size: 13px; }
.switch-row + p { margin-top: 14px; }
@media (min-width: 1101px) { .net-status { top: 14px; } }
@media (max-width: 760px) {
  .net-status { top: calc(env(safe-area-inset-top) + 60px); }
  .import-rows { max-height: 240px; }
}

/* ---------- bon de réception ---------- */
.receipt-pick { max-height: 420px; overflow: auto; margin: -4px 0 10px; }
.receipt-pick label.list-line { margin: 0; font-weight: 400; color: var(--text); cursor: pointer; font-size: 15px; }
.receipt-pick input[type=checkbox] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.receipt-pick .muted { font-size: 13px; }
.sign-btn { display: flex; width: 100%; gap: 14px; align-items: center; text-align: left; padding: 18px; min-height: 84px;
  border: 1.5px dashed var(--line-strong); border-radius: 8px; background: var(--subtle); font-weight: 400; }
.sign-btn svg.i { width: 28px; height: 28px; color: var(--accent); flex: none; }
.sign-btn:hover { border-color: var(--accent); }
.sign-btn .muted { font-size: 13px; }
.sign-done { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.sign-done img { height: 90px; max-width: 100%; object-fit: contain; }
.sent-lines { text-align: left; max-width: 420px; margin: 0 auto; }

.doc { max-width: 860px; padding: 28px 30px; }
.doc-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 2px solid var(--primary); }
.doc-head img { width: 46px; height: 46px; object-fit: contain; }
.doc-head .grow { flex: 1; display: flex; flex-direction: column; }
.doc-head b { font-size: 18px; }
.doc-head span { color: var(--muted); font-size: 13px; }
.doc-num { text-align: right; display: flex; flex-direction: column; }
.doc-num b { font-size: 20px; font-weight: 500; font-family: var(--mono); letter-spacing: .02em; }
.doc-info { margin-bottom: 18px; }
.doc-info label, .doc-sign label, .doc label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.doc table tfoot td { font-weight: 600; }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.doc-sign b { font-size: 17px; }
.doc-sign p { margin: 6px 0 0; font-size: 13px; }
.doc-sign img { display: block; height: 96px; max-width: 100%; object-fit: contain; object-position: left; border-bottom: 1px solid var(--line-strong); margin-bottom: 4px; }
.doc-sign span { font-size: 12px; }
@media (max-width: 760px) {
  .doc { padding: 18px 16px; }
  .doc-sign { grid-template-columns: 1fr; gap: 16px; }
  .doc-info.grid { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .doc-num b { font-size: 16px; }
}
@media print {
  .doc { box-shadow: none; border: none; padding: 0; max-width: none; }
  .doc .thumb { display: none; }
}

/* ---------- mises en page communes aux styles ---------- */
.card > :first-child { margin-top: 0; }
@media (max-width: 760px) { .page-head > .grow { flex: 1 1 100%; } }
.mail-state { margin-bottom: 4px; }
.mail-state > p { margin: 0 0 8px; font-size: 14px; }

/* ---------- facturable au client ---------- */
.bill-row { margin: 14px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--subtle); }
.bill-row:has(input:checked) { border-color: var(--acc); background: var(--info-bg); }
.badge.bill { background: var(--info-bg); color: var(--info); }
.bill-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.bill-total { text-align: right; display: flex; flex-direction: column; }
.bill-total b, .bill-grand b { font-family: var(--font-num); font-size: 22px; font-weight: var(--num-weight); font-variant-numeric: tabular-nums; }
.bill-grand { display: flex; justify-content: space-between; align-items: center; font-weight: 500; }

/* ---------- inventaire : choix d'une catégorie ---------- */
.cat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: 16px; }
.cat-grid[hidden] { display: none; }
.cat-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--card-shadow); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.cat-tile:hover { border-color: var(--accent, var(--text)); transform: translateY(-1px); }
.cat-tile .stat-icon { margin-bottom: 8px; }
.cat-tile b { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.cat-tile .muted { font-size: 13px; }
.cat-tile .badge { margin-top: 6px; }
@media (max-width: 760px) {
  .cat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cat-tile { padding: 12px 14px; }
  .cat-tile .stat-icon { width: 32px; height: 32px; margin-bottom: 4px; }
  .cat-tile b { font-size: 15px; }
}

/* ---------- langue (FR / EN) ---------- */
.lang-row { text-align: center; margin: 14px 0 0; }
.lang-link { background: none; border: none; box-shadow: none; min-height: 0; padding: 4px 8px; font-size: 13px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.lang-btn { font-size: 12px; font-weight: 600; letter-spacing: .04em; width: auto; min-width: 36px; padding: 0 8px; }
.side-out.lang-btn { min-width: 0; padding: 6px 8px; }
