/* Kit — styles (thème sombre, pensé pour les coulisses) */

:root {
  --bg: #121417;
  --bg-deep: #0e1013;
  --surface: #1c1f24;
  --raised: #23262b;
  --line: #2a2f36;
  --line-2: #3a4049;
  --text: #edeef0;
  --soft: #b9c2cc;
  --muted: #9aa1ab;
  --amber: #f2a93b;
  --amber-ink: #1a1206;
  --blue: #5aa9f2;
  --blue-ink: #0b1a2b;
  --green: #4cc38a;
  --green-ink: #0e1f16;
  --green-bg: #14261d;
  --green-line: #2f6b4e;
  --red: #f2836b;
  --red-bg: #2b1c17;
  --red-line: #6b3a2c;
  --radius: 14px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-title: "Space Grotesk", Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --tabbar-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
body.scan-open { overflow: hidden; }
a { color: var(--amber); }
a:hover { color: #ffc56b; }
h1, h2, h3 { margin: 0; font-family: var(--font-title); }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.amber { color: var(--amber); }
.red { color: var(--red); }
.green { color: var(--green); }
.upper { text-transform: uppercase; letter-spacing: 0.06em; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.grow { flex: 1 1 auto; min-width: 0; }
.push { margin-left: auto; }
.pad { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.splash { min-height: 100vh; display: grid; place-items: center; font-family: var(--font-title); font-size: 28px; font-weight: 700; color: var(--muted); }

/* ---------- structure */
.shell { min-height: 100vh; display: flex; }
.sidebar { display: none; }
.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 16px 10px; position: sticky; top: 0; z-index: 5; background: rgba(18, 20, 23, 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-title { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.titles { display: flex; flex-direction: column; min-width: 0; }
.titles h1 { font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { color: var(--muted); font-size: 13px; }
.quick-scan { display: none; }
.view { padding: 16px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; max-width: 1400px; width: 100%; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: stretch; justify-content: space-around; background: rgba(14, 16, 19, 0.97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.tab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; position: relative; min-width: 0; }
.tab.current { color: var(--text); }
.tab.current::after { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
.tab-scan { flex: 0 0 auto; width: 64px; height: 64px; margin-top: -14px; border-radius: 20px; background: var(--amber); color: var(--amber-ink); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); }
.tab-scan:hover { color: var(--amber-ink); }
.tab .dot { position: absolute; top: 9px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 99px; background: var(--amber); }
.tab .dot.red { background: var(--red); }
.mobile-only { }

@media (min-width: 960px) {
  .sidebar { display: flex; flex-direction: column; gap: 4px; width: 250px; flex: 0 0 250px; background: var(--bg-deep); border-right: 1px solid var(--line); padding: 24px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .brand { display: flex; flex-direction: column; padding: 0 10px 18px; }
  .side-link { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 10px; color: var(--soft); text-decoration: none; font-size: 15px; }
  .side-link:hover { background: var(--surface); color: var(--text); }
  .side-link.current { background: var(--raised); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--amber); }
  .side-link .badge { margin-left: auto; }
  .side-scan { margin-top: 14px; }
  .side-version { margin-top: auto; padding: 18px 10px 0; font-size: 12px; color: var(--muted); }
  .topbar { padding: 22px 32px 16px; gap: 24px; align-items: flex-end; }
  .titles h1 { font-size: 28px; }
  .quick-scan { display: flex; flex-direction: column; gap: 6px; flex: 0 1 460px; }
  .quick-scan label { font-size: 12px; color: var(--muted); }
  .quick-scan .row { display: flex; gap: 8px; }
  .quick-scan input { flex: 1; min-width: 0; font-family: var(--mono); text-transform: uppercase; }
  .quick-scan input::placeholder { text-transform: none; font-family: var(--font); }
  .tabbar, .mobile-only { display: none !important; }
  .view { padding: 24px 32px 48px; }
}

.brand-small { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.brand-name { font-family: var(--font-title); font-size: 28px; font-weight: 700; }

/* ---------- composants */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card.flush-x { padding: 4px 16px; gap: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title { font-family: var(--font-title); font-size: 17px; font-weight: 600; }
.section-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font); font-weight: 600; margin: 0 0 8px; }
.link-card { text-decoration: none; color: var(--text); }
.link-card:hover { color: var(--text); border-color: var(--line-2); }
.big-number { font-size: 24px; font-weight: 600; }

.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--raised); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.btn:hover { color: var(--text); border-color: #555c66; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn.primary:hover { background: #ffb954; color: var(--amber-ink); }
.btn.light { background: var(--text); border-color: var(--text); color: #121417; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 54px; font-size: 15px; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.green { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.btn.green-solid { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.btn.danger { background: #c8442b; border-color: #c8442b; color: #fff; }
.btn.ghost-danger { background: transparent; border-color: var(--red-line); color: var(--red); }
.btn.outline-amber { background: transparent; border-color: var(--amber); color: var(--amber); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text); border-radius: 10px; text-decoration: none; }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn.boxed { background: var(--raised); border: 1px solid var(--line-2); font-size: 18px; }
.icon-btn.back { margin-left: -10px; }
.link-btn { background: none; border: 0; color: var(--amber); padding: 4px 0; font-size: 13px; font-weight: 600; text-align: left; }

.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--raised); color: var(--soft); white-space: nowrap; }
.pill.outline { background: transparent; border: 1px solid var(--line-2); font-weight: 600; }
.pill.amber { background: #2a2416; color: var(--amber); border: 1px solid #7a5520; font-weight: 600; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-line); font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #2a2416; color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.phase-prep { background: var(--soft) !important; color: #121417 !important; }
.phase-depart { background: var(--amber) !important; color: var(--amber-ink) !important; }
.phase-retour { background: var(--blue) !important; color: var(--blue-ink) !important; }
.phase-clos { background: var(--green) !important; color: var(--green-ink) !important; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); min-width: 0; }
.field-inline { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.field-inline span { flex: 1; }
.field-inline input { width: 96px; text-align: center; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], select {
  min-height: 44px; width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text); font-size: 15px; padding: 0 12px;
}
input:focus, select:focus { border-color: var(--amber); outline: none; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type=date] { color-scheme: dark; }
.form-error { color: var(--red); font-size: 14px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1 1 160px; width: auto; }
.add-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.add-form .field.grow { flex: 2 1 220px; }
.add-form .field:not(.grow) { flex: 1 1 150px; }

.notice { font-size: 14px; color: var(--soft); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; }
.notice svg { vertical-align: -4px; margin-right: 4px; }
.notice.small { font-size: 13px; }
.notice.warn { background: var(--red-bg); border-color: var(--red-line); color: #f4c9bc; }
.notice.muted { color: var(--muted); }
.ok-notice { background: var(--green-bg); border-color: var(--green-line); color: #cdeedc; }

.progress-row { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress .bar { height: 8px; border-radius: 999px; transition: width 0.25s; }

.segmented { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.seg { flex: 1 1 0; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--soft); font-weight: 600; font-size: 14px; padding: 0 10px; white-space: nowrap; }
.seg.on { background: var(--text); color: #121417; }
.segmented.small .seg { font-size: 13px; min-height: 38px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font-size: 13px; font-weight: 600; }
.chip.on { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.chip.static { min-height: 0; padding: 5px 10px; font-weight: 500; background: var(--raised); display: inline-block; }
.chip.static.red { background: var(--red-bg); border-color: var(--red-line); color: #f4c9bc; }

.check { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; border: 2px solid #4a515b; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--amber-ink); padding: 0; }
.check.on { background: var(--amber); border-color: var(--amber); }

.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row { min-height: 60px; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #23272d; color: var(--text); text-decoration: none; flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.list-row.link:hover { background: var(--raised); color: var(--text); }
.list-row .grow { display: flex; flex-direction: column; gap: 2px; }

.group-title { padding: 12px 16px 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; background: var(--bg-deep); border-bottom: 1px solid #23272d; }

.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.log li { display: flex; gap: 14px; font-size: 14px; padding: 7px 0; border-bottom: 1px solid #23272d; }
.log li:last-child { border-bottom: 0; }
.log .when { flex: 0 0 110px; color: var(--muted); font-size: 13px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1 1 240px; }

.danger-zone { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 4px 0; }

/* ---------- accueil */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.trip-card h2 { font-size: 20px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--raised); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.stat b { font-size: 24px; font-weight: 600; }
.stat span { font-size: 12px; color: var(--soft); }
.stat.green { background: var(--green-bg); } .stat.green b { color: var(--green); }
.stat.red { background: var(--red-bg); } .stat.red b { color: var(--red); }
.scan-cta { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; border-radius: 16px; background: var(--text); color: #121417; text-decoration: none; }
.scan-cta:hover { color: #121417; }
.scan-cta > span { display: flex; flex-direction: column; }
.scan-cta b { font-size: 16px; }
.scan-cta span span { font-size: 13px; color: #454b54; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { min-height: 72px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.tile svg { color: var(--amber); }
.tile:hover { color: var(--text); }

/* ---------- colonnes génériques */
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-narrow { flex: 1 1 280px; max-width: 380px; }
.col-wide { flex: 999 1 480px; min-width: 0; }
@media (max-width: 700px) { .col-narrow { max-width: none; } }

/* ---------- tournages */
.trip-head { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.trip-head .field.grow { flex: 2 1 240px; }
.trip-head .field:not(.grow) { flex: 1 1 150px; }
.prep-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.trip-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; min-height: 54px; border-bottom: 1px solid #23272d; }
.trip-row:last-child { border-bottom: 0; }
.trip-row.excluded .name { color: var(--muted); }
.trip-row .grow { display: flex; flex-direction: column; }
.trip-row.head { min-height: 40px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg-deep); }
.state-col { width: 108px; text-align: center; }
.state-btn { width: 108px; white-space: nowrap; min-height: 36px; border-radius: 9px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.state-btn.yes { background: var(--green-bg); border-color: var(--green-line); color: var(--green); opacity: 1; }
.state-btn.missing { background: var(--red-bg); border-color: var(--red-line); color: var(--red); opacity: 1; }
.state-btn:disabled { opacity: 1; }
.state-btn:disabled:not(.yes):not(.missing) { opacity: 0.5; }
@media (max-width: 520px) {
  .state-btn, .state-col { width: 86px; font-size: 12px; }
  .trip-row { gap: 6px; padding-left: 12px; }
}

/* ---------- matériel */
.item-row { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 12px 6px 16px; border-bottom: 1px solid #23272d; flex-wrap: wrap; }
.item-row:last-child { border-bottom: 0; }
.item-link { display: flex; flex-direction: column; color: var(--text); text-decoration: none; padding: 4px 0; }
.item-link:hover { color: var(--amber); }
.qr-card { align-items: center; text-align: center; }
.qr-card .qr { background: #fff; padding: 8px; border-radius: 10px; width: 176px !important; height: 176px !important; }
.big-code { font-size: 28px; font-weight: 700; letter-spacing: 0.08em; }

/* ---------- batteries */
.bat-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.bat-list { flex: 999 1 520px; min-width: 0; }
.bat-detail { flex: 1 1 320px; max-width: 420px; }
.bat-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; min-height: 62px; border-bottom: 1px solid #23272d; flex-wrap: wrap; }
.bat-row:last-child { border-bottom: 0; }
.bat-row.selected { background: var(--raised); box-shadow: inset 3px 0 0 var(--amber); }
.bat-row .state { width: 56px; font-size: 13px; font-weight: 700; color: var(--soft); }
.bat-actions { display: flex; gap: 6px; }
.detail-title { font-size: 24px; }
.state-card { border-radius: 14px; padding: 14px 16px; background: var(--raised); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 2px; }
.state-card b { font-family: var(--font-title); font-size: 32px; }
.state-card.full { background: var(--green-bg); border-color: var(--green-line); }
.state-card.full b { color: var(--green); }
.mini-stat { background: var(--raised); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.mini-stat b { font-size: 17px; }
.notes { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; }
.notes li { display: flex; gap: 10px; align-items: center; font-size: 14px; border-bottom: 1px solid #23272d; padding: 2px 0; }
.notes .when { flex: 0 0 96px; color: var(--muted); font-size: 12px; }
@media (max-width: 959px) {
  .bat-layout.has-detail .bat-list { display: none; }
  .bat-layout:not(.has-detail) .bat-detail { display: none; }
  .bat-detail { max-width: none; }
}

/* ---------- étiquettes */
.labels-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.labels-settings { flex: 1 1 300px; max-width: 380px; }
.labels-preview { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 700px) { .labels-settings { max-width: none; } }
.size-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.size-btn { min-height: 56px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; }
.size-btn.on { border-color: var(--amber); background: #2a2416; }
.size-btn .rec { font-size: 10px; color: var(--amber); font-weight: 600; }
.toggle-row { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px; background: transparent; border: 0; border-bottom: 1px solid #23272d; text-align: left; font-size: 14px; padding: 0; }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row > span:first-child { flex: 1; }
.switch { width: 46px; height: 28px; flex: 0 0 46px; border-radius: 99px; background: var(--line-2); display: flex; align-items: center; padding: 3px; justify-content: flex-start; }
.switch.on { background: var(--amber); justify-content: flex-end; }
.switch span { width: 22px; height: 22px; border-radius: 99px; background: #fff; }
.sel-tools { display: flex; gap: 16px; }
.sel-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.sel-row { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: transparent; border: 0; border-bottom: 1px solid #23272d; text-align: left; font-size: 14px; }
.sel-row .check { width: 22px; height: 22px; flex-basis: 22px; }
.stepper { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.stepper-val { width: 32px; text-align: center; font-size: 16px; }
.preview-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--soft); flex-wrap: wrap; }
.preview-box { --s: 0.5; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 16px; padding: 12px; overflow: auto; }
.preview-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview-pages .label-page { zoom: var(--s); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); }

/* page d'étiquettes (aperçu et impression) */
.label-page { width: 210mm; height: 297mm; padding: 10mm; background: #fff; color: #000; display: flex; flex-direction: column; overflow: hidden; font-family: Arial, Helvetica, sans-serif; }
.label-page-head { height: 6mm; display: flex; justify-content: space-between; font-size: 7pt; color: #555; }
.label-grid { display: grid; }
.label-cell { display: flex; flex-direction: column; align-items: center; padding: 1.5mm 1mm 0; overflow: hidden; }
.label-grid.cut .label-cell { outline: 0.2mm dashed #9a9a9a; outline-offset: -0.1mm; }
.label-cell.blank { background: #f1f1f1; }
.label-cell .qr { display: block; flex: none; }
.label-name { margin-top: 1mm; font-size: 7pt; line-height: 1.15; text-align: center; color: #000; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.label-code { font-family: Consolas, "Courier New", monospace; font-size: 6.5pt; color: #333; letter-spacing: 0.05em; }

#print-root { display: none; }
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .label-page { break-after: page; page-break-after: always; }
  .label-page:last-child { break-after: auto; page-break-after: auto; }
  .label-cell.blank { background: transparent; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- paramètres */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; max-width: 1100px; }
.version-line { font-size: 16px; font-weight: 600; }

/* ---------- connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; gap: 14px; }
.login-card .brand-name { font-size: 40px; }

/* ---------- message */
.toast { position: fixed; left: 50%; transform: translate(-50%, 20px); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; width: min(560px, calc(100% - 24px)); display: none; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); font-size: 14px; opacity: 0; transition: opacity 0.15s, transform 0.15s; }
.toast.show { display: flex; opacity: 1; transform: translate(-50%, 0); }
.toast .toast-text { flex: 1; padding: 6px 0; }
.toast.ok { background: var(--green-bg); border-color: var(--green-line); color: #cdeedc; }
.toast.warn, .toast.error { background: var(--red-bg); border-color: var(--red-line); color: #f4c9bc; }
.toast .icon-btn { color: inherit; }
body.scan-open .toast { bottom: auto; top: calc(70px + env(safe-area-inset-top)); }
@media (min-width: 960px) { .toast { bottom: 24px; } }

/* ---------- vue de scan */
.scan { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.scan-cam { position: relative; flex: 1 1 auto; min-height: 40vh; overflow: hidden; background: #0b0c0e; }
.scan-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder { position: absolute; left: 50%; top: 50%; width: min(64vw, 260px); aspect-ratio: 1; transform: translate(-50%, -50%); }
.viewfinder i { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; }
.viewfinder i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.viewfinder i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.viewfinder i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.viewfinder i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.scan-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 13px; background: rgba(0, 0, 0, 0.7); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.scan-top { position: absolute; left: 0; right: 0; top: 0; padding: max(14px, env(safe-area-inset-top)) 14px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scan-top .pill { font-size: 12px; letter-spacing: 0.04em; padding: 6px 12px; }
.round-btn { width: 46px; height: 46px; border-radius: 99px; border: 0; background: rgba(0, 0, 0, 0.7); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.round-btn.on { background: var(--amber); color: var(--amber-ink); }
.round-btn[hidden] { display: none; }
.scan-sheet { flex: 0 1 auto; max-height: 58vh; overflow-y: auto; background: var(--surface); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; margin-top: -18px; position: relative; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.scan-result { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line-2); }
.scan-result .grow { display: flex; flex-direction: column; gap: 2px; }
.scan-result .res-icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 99px; display: flex; align-items: center; justify-content: center; background: var(--line-2); }
.scan-result.ok { background: var(--green-bg); border-color: var(--green-line); }
.scan-result.ok .res-icon { background: var(--green); color: var(--green-ink); }
.scan-result.warn, .scan-result.error { background: var(--red-bg); border-color: var(--red-line); }
.scan-result.warn .res-icon, .scan-result.error .res-icon { background: var(--red); color: #2b1209; }
.scan-fiche { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 960px) {
  .scan { flex-direction: row; }
  .scan-cam { min-height: 0; }
  .scan-sheet { flex: 0 0 420px; max-height: none; margin-top: 0; border-radius: 0; border-top: 0; border-left: 1px solid var(--line); padding: 24px; }
  .scan-hint { bottom: 24px; }
}
