/* Inventaire Secotech — thème clair (v2.2) */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/inter-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #f4f6fa; --card: #fff; --ink: #0f172a; --ink2: #475569; --ink3: #64748b; --line: #e6eaf1; --line2: #eef1f6;
  --blue: #2563eb; --blue-d: #1d4ed8; --blue-soft: #e8efff; --violet: #6d4cff;
  --navy1: #0f1f44; --navy2: #1e3a8a; --navy3: #2f5bd3;
  --gold: #fcd34d; --green: #16a34a; --green-soft: #e7f7ee; --amber: #b45309; --amber-soft: #fff4dc; --red: #dc2626; --red-soft: #fdecec;
  --r: 18px; --r-sm: 12px;
  --sh: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --sh-lg: 0 10px 30px rgba(15, 31, 68, .18);
  --tab-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 24px); min-height: 100vh; font-feature-settings: 'tnum' 1, 'cv11' 1; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.i { width: 20px; height: 20px; flex: none; }
.i.xs { width: 14px; height: 14px; vertical-align: -2px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.mt { margin-top: 12px; }
.center { text-align: center; }
.t-warn { color: var(--amber); }
.t-blue { color: var(--blue); }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; }

/* ---------------------------------------------------------------- en-tête dégradé */
.hero { background: linear-gradient(135deg, var(--navy1) 0%, var(--navy2) 55%, var(--navy3) 100%); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 16px; border-radius: 0 0 26px 26px; box-shadow: 0 8px 24px rgba(15, 31, 68, .22);
  position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.12), rgba(255,255,255,0) 70%); pointer-events: none; }
.hero-row { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.hero-btn { width: 44px; height: 44px; border-radius: 14px; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; }
.hero-btn:active { background: rgba(255,255,255,.2); }
.hero-titles { flex: 1; min-width: 0; }
.hero h1 { font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-btn { background: none; border: 0; padding: 2px 0; color: rgba(255,255,255,.78); font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%; min-height: 28px; text-align: left; }
.session-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 3px rgba(255,255,255,.12); flex: none; }
.sync-dot.ok { background: #4ade80; } .sync-dot.err { background: #f87171; }
.stats { display: grid; grid-template-columns: 1fr 1fr 1.25fr; margin-top: 16px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px; position: relative; z-index: 1; backdrop-filter: blur(6px); }
.stat { padding: 10px 8px; text-align: center; min-width: 0; }
.stat + .stat { border-left: 1px solid rgba(255,255,255,.14); }
.stat-v { font-size: 19px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.stat-v .i { width: 17px; height: 17px; opacity: .75; }
.stat-l { font-size: 11.5px; color: rgba(255,255,255,.72); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.gold .stat-v { color: var(--gold); }
/* en-tête compact hors accueil */
body:not([data-view="home"]) .hero { padding-bottom: 12px; border-radius: 0 0 22px 22px; }
body:not([data-view="home"]) .stats { margin-top: 12px; }
body:not([data-view="home"]) .stat { padding: 6px 6px; }
body:not([data-view="home"]) .stat-v { font-size: 16px; }
body:not([data-view="home"]) .stat-l { font-size: 10.5px; }

/* ---------------------------------------------------------------- mise en page */
main { overflow-x: clip; padding: 16px 14px 0; max-width: 720px; margin: 0 auto; }
.view { display: none; } .view.active { display: block; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h2 { font-size: 16px; font-weight: 700; }
.head-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.head-ico .i { width: 18px; height: 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 10px; }
.sec-head h2 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sec-head h2 .i { color: var(--blue); width: 18px; height: 18px; }
.pill { background: var(--blue-soft); color: var(--blue); font-weight: 600; font-size: 13px; padding: 3px 11px; border-radius: 99px; }
.hint { color: var(--ink3); font-size: 13px; margin: 8px 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foot { text-align: center; color: var(--ink3); font-size: 12.5px; margin: 22px 0 8px; line-height: 1.6; }

/* ---------------------------------------------------------------- boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 14px; border: 0;
  font-weight: 600; font-size: 15px; background: var(--blue-soft); color: var(--blue-d); transition: transform .05s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn-primary { background: linear-gradient(135deg, #2f6bff, var(--blue-d)); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .28); }
.btn-soft { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 16px; }
.link { background: none; border: 0; color: var(--blue); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 4px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink2); display: grid; place-items: center; flex: none; }
.icon-btn.danger { color: var(--red); background: var(--red-soft); border-color: transparent; }
body:not(.is-admin) .admin-only { display: none !important; }

/* ---------------------------------------------------------------- accueil */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat-card { background: #fff; border: 0; border-left: 4px solid var(--c); border-radius: 16px; box-shadow: var(--sh); padding: 14px 12px 14px 14px; text-align: left;
  display: flex; flex-direction: column; gap: 4px; min-height: 128px; }
.cat-card:active { transform: scale(.985); }
.cat-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--ct); color: var(--c); display: grid; place-items: center; margin-bottom: 6px; }
.cat-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-n { color: var(--ink3); font-size: 12.5px; display: flex; align-items: center; gap: 4px; }
.cat-v { font-weight: 700; color: var(--ink); font-size: 15px; margin-top: auto; padding-top: 4px; }
.cat-card.todo { border-left-color: #d6dce6; background: #fbfcfe; box-shadow: none; outline: 1px dashed #d6dce6; outline-offset: -1px; }
.cat-card.todo .cat-ico { filter: grayscale(.4); opacity: .8; }
.cat-card.todo .cat-n { color: var(--blue); font-weight: 600; margin-top: auto; }

/* ---------------------------------------------------------------- notices, badges */
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--blue-soft); color: #1e3a8a; border-radius: 14px; padding: 12px 14px;
  margin-bottom: 12px; font-size: 14px; text-align: left; border: 0; width: 100%; }
.notice .i { margin-top: 1px; }
.notice.warn { background: var(--amber-soft); color: #92400e; }
.notice.slim { padding: 9px 12px; font-size: 13px; margin: 8px 0; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #f1f5f9; color: var(--ink2); white-space: nowrap; }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink2); min-height: 34px; }
.chip.warn { background: var(--amber-soft); color: var(--amber); border-color: #fde3b0; }
.chip.on { background: var(--amber); color: #fff; }

/* ---------------------------------------------------------------- recherche */
.searchbar { position: sticky; top: 0; z-index: 5; padding: 8px 0 10px; margin-top: -8px; background: linear-gradient(var(--bg) 80%, rgba(244,246,250,0)); }
.search-field { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 0 6px 0 14px;
  box-shadow: var(--sh); min-height: 54px; }
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.search-field > .i { color: var(--ink3); }
.search-field input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; min-width: 0; height: 52px; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field.slim { min-height: 48px; margin-bottom: 12px; box-shadow: none; }
.search-field.slim input { height: 46px; font-size: 15.5px; }
.clear-btn { width: 44px; height: 44px; border: 0; border-radius: 12px; background: #f1f5f9; color: var(--ink2); display: grid; place-items: center; }
.result-count { color: var(--ink3); font-size: 13px; font-weight: 600; margin: 4px 4px 8px; }
.create-row { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink3); font-size: 14px; padding: 16px 0 8px; text-align: center; }

/* ---------------------------------------------------------------- listes */
.list { background: #fff; border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; margin-bottom: 14px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 68px; cursor: pointer; position: relative; }
.item + .item { border-top: 1px solid var(--line2); }
.item:active { background: #f7f9fc; }
.item-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.item-ico.lg { width: 52px; height: 52px; border-radius: 15px; }
.item-ico.lg .i { width: 24px; height: 24px; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .sub { color: var(--ink3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.item .meta:empty { display: none; }
.price { font-size: 12.5px; color: var(--ink2); font-weight: 500; }
.item .right { text-align: right; flex: none; max-width: 40%; }
.item .qty { font-weight: 700; font-size: 16px; white-space: nowrap; }
.item .qty small { font-weight: 500; color: var(--ink3); font-size: 12px; }
.item .val { color: var(--ink3); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.item.counted::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green); }
.item.counted .qty { color: var(--green); }
.item.sess.on { background: #f5f8ff; }
.unit-chip { display: inline-block; background: #f1f5f9; color: var(--ink2); font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 8px; white-space: nowrap; }
.group-head { display: flex; align-items: center; gap: 8px; margin: 18px 4px 8px; font-weight: 700; font-size: 14px; }
.group-head .dot { width: 10px; height: 10px; border-radius: 3px; }
.group-head .g-name { flex: 1; }
.group-head .g-v { color: var(--ink2); font-weight: 600; }
.empty { text-align: center; padding: 36px 20px; background: #fff; border-radius: var(--r); box-shadow: var(--sh); }
.empty-ico { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 18px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.empty-ico .i { width: 28px; height: 28px; }
.empty-t { font-weight: 700; font-size: 16px; }
.empty-s { color: var(--ink3); font-size: 14px; margin: 6px 0 14px; }
.empty-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

/* résumé inventaire */
.summary { padding: 16px; }
.sum-main { display: flex; gap: 12px; align-items: center; }
.sum-ico { width: 44px; height: 44px; border-radius: 13px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.sum-t { font-weight: 700; font-size: 16px; }
.sum-s { color: var(--ink3); font-size: 13px; display: flex; align-items: center; gap: 4px; }
.sum-v { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line2); }
.sum-v small { color: var(--ink3); font-size: 13px; }
.sum-v b { font-size: 24px; font-weight: 700; color: var(--navy2); }
.export-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.export-btn { display: flex; align-items: center; gap: 10px; background: #fff; border: 0; border-radius: 16px; box-shadow: var(--sh); padding: 12px; text-align: left; min-height: 64px; font-weight: 600; }
.export-btn small { display: block; color: var(--ink3); font-weight: 500; font-size: 12px; }
.ex-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.export-btn.xl .ex-ico { background: var(--green-soft); color: var(--green); }
.export-btn.pdf .ex-ico { background: var(--red-soft); color: var(--red); }

/* ---------------------------------------------------------------- feuille (bottom sheet) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(18px + var(--safe-b)); position: relative; box-shadow: 0 -10px 40px rgba(15,23,42,.2); overscroll-behavior: contain; }
.handle { width: 40px; height: 5px; border-radius: 99px; background: #d9dee7; margin: 0 auto 10px; }
.close-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #f1f5f9; color: var(--ink2); display: grid; place-items: center; z-index: 2; }
.sheet h2 { font-size: 19px; font-weight: 700; padding-right: 48px; line-height: 1.3; }
.sheet h2.center { padding: 0; }
.cs-sub { color: var(--ink3); font-size: 13.5px; margin-top: 3px; }
.sheet-sec { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); font-weight: 700; margin: 18px 0 8px; display: flex; align-items: center; gap: 6px; }
.cs-top { display: flex; gap: 12px; align-items: center; padding-right: 44px; }
.cs-top h2 { padding-right: 0; font-size: 18px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cs-status { display: flex; align-items: center; gap: 8px; background: #f4f6fa; border-radius: 12px; padding: 10px 12px; margin-top: 14px; font-size: 14px; color: var(--ink2); }
.cs-status.done { background: var(--green-soft); color: #166534; }
.cs-status > span:not(.cs-price) { flex: 1; }
.cs-status small { color: inherit; opacity: .75; }
.cs-price { font-weight: 600; color: var(--ink2); font-size: 13px; white-space: nowrap; }
.cost-in { display: flex; align-items: center; gap: 10px; background: var(--amber-soft); color: #92400e; border-radius: 12px; padding: 8px 8px 8px 12px; margin-top: 10px; font-size: 14px; font-weight: 600; }
.cost-in > span { flex: 1; line-height: 1.25; }
.cost-in small { display: block; font-weight: 500; font-size: 12px; opacity: .8; }
.cost-in input { width: 108px; height: 44px; border: 1.5px solid #f3cf8a; border-radius: 10px; background: #fff; text-align: right; padding: 0 10px; font-size: 17px; font-weight: 600; }
.qty-display { display: flex; align-items: baseline; gap: 10px; border: 2px solid var(--blue); border-radius: 18px; padding: 10px 16px; margin-top: 12px; background: #fafcff; }
.qty-label { font-size: 13px; color: var(--ink3); font-weight: 600; align-self: center; }
.qty-display .v { flex: 1; text-align: right; font-size: 40px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.qty-display .v.empty-v { color: #c3cad6; }
.qty-display .u { font-size: 16px; color: var(--ink2); font-weight: 600; }
.qty-hint { font-size: 13px; color: var(--ink3); text-align: right; min-height: 20px; margin: 4px 4px 2px; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 4px; }
.keypad button { height: 56px; border-radius: 14px; border: 0; background: #f2f4f8; font-size: 22px; font-weight: 600; color: var(--ink); display: grid; place-items: center; }
.keypad button:active { background: #e3e8f0; transform: scale(.97); }
.keypad .k-op { background: var(--blue-soft); color: var(--blue-d); font-size: 17px; }
.cs-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 12px; }
.cs-actions .btn { min-height: 56px; font-size: 16.5px; }
.cs-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.cs-links .link { font-size: 13.5px; }
.input, .field input, .field select, .field textarea, .map-row select { width: 100%; height: 48px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; font-size: 16px; outline: 0; }
.input:focus, .field input:focus, .field select:focus, .map-row select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.field { display: block; margin-top: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 6px; }
.field > span em { font-style: normal; font-weight: 500; color: var(--amber); margin-left: 4px; }
.big-input { height: 60px !important; font-size: 26px !important; font-weight: 700; text-align: right; }
.stat3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-top: 14px; }
.stat3 > div { background: #f4f6fa; border-radius: 12px; padding: 10px 12px; }
.stat3 small { display: block; color: var(--ink3); font-size: 12px; }
.stat3 b { font-size: 16px; }
.entries { display: grid; gap: 8px; }
.entry { display: flex; align-items: center; gap: 8px; background: #f8fafc; border: 1px solid var(--line2); border-radius: 14px; padding: 10px 10px 10px 14px; }
.entry .main { flex: 1; min-width: 0; }
.e-meta { color: var(--ink3); font-size: 12.5px; margin-top: 2px; }
.info-box { background: #f4f6fa; border-radius: 14px; padding: 6px 14px; margin: 14px 0; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14.5px; }
.kv + .kv { border-top: 1px solid var(--line); }
.done-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 6px auto 12px; }
.done-ico .i { width: 30px; height: 30px; }
/* import */
.file-chip { display: flex; gap: 12px; align-items: center; background: var(--green-soft); color: #166534; border-radius: 14px; padding: 12px; margin-top: 12px; }
.file-chip small { display: block; color: #3f7a55; font-size: 12.5px; }
.map-grid { display: grid; gap: 8px; }
.map-row { display: grid; grid-template-columns: 42% 1fr; gap: 10px; align-items: center; font-size: 13.5px; font-weight: 600; color: var(--ink2); }
.map-row select { height: 44px; font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.map-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.map-table th, .map-table td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.map-table th { background: #f4f6fa; color: var(--ink3); font-weight: 600; }
/* interrupteur */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; font-size: 14.5px; margin-top: 6px; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: #d5dbe5; position: relative; flex: none; transition: background .15s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .15s; }
.switch:checked { background: var(--blue); } .switch:checked::after { left: 23px; }
/* segment rôle */
.seg { display: grid; gap: 8px; }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; }
.seg label > span { display: block; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.seg label > span small { display: block; color: var(--ink3); font-size: 12.5px; }
.seg input:checked + span { border-color: var(--blue); background: #f5f8ff; }
.seg input:focus-visible + span { outline: 3px solid rgba(37,99,235,.45); }

/* ---------------------------------------------------------------- réglages */
.profile { display: flex; align-items: center; gap: 14px; }
.profile b { font-size: 16.5px; display: block; }
.profile small { color: var(--ink3); font-size: 13px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, var(--violet)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.avatar.sm { width: 40px; height: 40px; font-size: 14px; }
.avatar.off { background: #cbd5e1; }
.role { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #f1f5f9; color: var(--ink2); }
.role.admin { background: #ede9fe; color: #5b21b6; }
.role.user { background: var(--blue-soft); color: var(--blue-d); }
.card.menu { padding: 4px 0; }
.menu-row, .user-row { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; padding: 10px 16px; min-height: 56px; text-align: left; }
.menu-row + .menu-row { border-top: 1px solid var(--line2); }
.m-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.m-txt { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; }
.m-txt small { display: block; color: var(--ink3); font-weight: 500; font-size: 12.5px; }
.menu-row .chev { color: #a5afbf; width: 18px; height: 18px; }
.menu-row.danger { color: var(--red); } .menu-row.danger .m-ico { background: var(--red-soft); color: var(--red); }
.set-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink3); font-weight: 700; margin: 20px 4px 8px; }
.users { display: grid; }
.user-row { padding: 10px 0; }
.user-row + .user-row { border-top: 1px solid var(--line2); }
.timeline { display: grid; gap: 0; margin-top: 12px; }
.ev { display: flex; gap: 12px; padding: 10px 0; }
.ev + .ev { border-top: 1px solid var(--line2); }
.ev-ico { width: 32px; height: 32px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.ev.bad .ev-ico { background: var(--red-soft); color: var(--red); }
.ev .main { flex: 1; min-width: 0; font-size: 14px; }
.ev-d { color: var(--ink2); font-size: 13px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- barre d'onglets, FAB, toast */
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); box-shadow: 0 -4px 20px rgba(15,23,42,.05); }
#tabbar button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: #7a8599;
  min-height: 52px; justify-content: center; border-radius: 14px; }
#tabbar button .i { width: 23px; height: 23px; }
#tabbar button.active { color: var(--blue); }
#tabbar button.active .i { background: var(--blue-soft); border-radius: 10px; padding: 3px 10px; width: 46px; height: 28px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 18px); z-index: 80; background: #0f172a; color: #fff;
  padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; display: flex; gap: 8px; align-items: center; max-width: calc(100vw - 32px);
  box-shadow: var(--sh-lg); pointer-events: none; }
.toast.err { background: #b91c1c; }
body.sheet-open .toast { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 14px); }
.toast .i { color: #4ade80; } .toast.err .i { color: #fff; }

/* ---------------------------------------------------------------- connexion */
.login { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow-y: auto; }
.login-hero { background: linear-gradient(135deg, var(--navy1) 0%, var(--navy2) 55%, var(--navy3) 100%); color: #fff; text-align: center;
  padding: calc(env(safe-area-inset-top, 0px) + 56px) 24px 86px; border-radius: 0 0 32px 32px; }
.login-logo { width: 68px; height: 68px; border-radius: 20px; background: rgba(255,255,255,.14); display: grid; place-items: center; margin: 0 auto 14px; }
.login-logo .i { width: 34px; height: 34px; }
.login-hero h1 { font-size: 24px; font-weight: 700; }
.login-hero p { margin: 6px 0 0; color: rgba(255,255,255,.75); }
.login-box { background: #fff; border-radius: 22px; box-shadow: var(--sh-lg); max-width: 420px; margin: -58px auto 24px; padding: 22px 20px; width: calc(100% - 32px); }
.login-box h2 { font-size: 19px; }
.login-box .btn { margin-top: 18px; }
.login-msg { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 10px; }

@media (min-width: 700px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 360px) { .stat-v { font-size: 16px; } .keypad button { height: 52px; } }

/* ---------------------------------------------------------------- unités (v2.3) */
.unit-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.u-chip { min-height: 56px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 6px 4px; color: var(--ink); transition: background .12s, border-color .12s; }
.u-chip b { font-size: 17px; font-weight: 700; line-height: 1.1; }
.u-chip small { font-size: 11px; color: var(--ink3); font-weight: 500; white-space: nowrap; }
.u-chip:active { transform: scale(.97); }
.u-chip.on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-d); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.u-chip.on small { color: var(--blue-d); }
.u-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px 0 12px; margin-left: 2px; border-radius: 12px; border: 1.5px solid #c9d7fb;
  background: var(--blue-soft); color: var(--blue-d); font-size: 16px; font-weight: 700; align-self: center; white-space: nowrap; }
.u-btn[aria-expanded="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.cs-units { margin-top: 10px; background: #f6f8fc; border-radius: 16px; padding: 10px; }
.cs-units .hint { margin: 8px 2px 0; font-size: 12.5px; }
/* mode sélection (unité en lot) */
.bulk-cta { display: flex; align-items: center; gap: 12px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; min-height: 60px;
  text-align: left; margin: 10px 0 2px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.bulk-cta .chev { color: #a5afbf; width: 18px; height: 18px; }
.item.selectable { padding-left: 12px; }
.sel-box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #c3cad6; display: grid; place-items: center; flex: none; color: transparent; background: #fff; }
.sel-box .i { width: 16px; height: 16px; stroke-width: 3; }
.item.selected { background: #f3f7ff; }
.item.selected .sel-box { background: var(--blue); border-color: var(--blue); color: #fff; }
.bulk-bar { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); z-index: 32; background: #fff; border-radius: 20px;
  box-shadow: 0 10px 34px rgba(15, 31, 68, .22); padding: 10px 12px 12px; max-width: 640px; margin: 0 auto; border: 1px solid var(--line); }
.bb-top { display: flex; align-items: center; font-size: 15px; }
.bb-top .link { margin-left: auto; }
.bb-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; }
.bb-row .btn { min-height: 46px; padding: 0 12px; font-size: 14.5px; }
.bb-select { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 14px; padding: 0 8px 0 10px; min-width: 0; color: var(--ink3); }
.bb-select select { border: 0; background: none; height: 44px; min-width: 0; width: 100%; font-size: 14.5px; font-weight: 600; color: var(--ink); outline: 0; }
body.bulk { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 140px); }
/* réglages : unités */
.unit-edit { display: flex; flex-wrap: wrap; gap: 8px; }
.u-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-soft); color: var(--blue-d); border-radius: 12px; padding: 4px 4px 4px 12px; min-height: 44px; }
.u-tag small { color: var(--ink3); font-size: 11.5px; }
.u-tag button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255,255,255,.7); color: var(--ink2); display: grid; place-items: center; }
.add-unit { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.add-unit .btn { min-height: 48px; }

/* ---------------------------------------------------------------- prix d'achat à compléter */
.price-card { margin-top: 14px; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; background: #fff; }
.price-card.missing { border-color: #f3cf8a; background: var(--amber-soft); }
.price-card label { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; font-size: 15px; color: var(--ink); }
.price-card.missing label { color: #92400e; }
.price-card label small { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink3); margin-top: 1px; }
.price-card.missing label small { color: #92400e; opacity: .85; }
.price-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.price-in { display: flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; min-height: 52px; }
.price-card.missing .price-in { border-color: #f0c26f; }
.price-in:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.price-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 22px; font-weight: 700; text-align: right; height: 48px; }
.price-in span { color: var(--ink3); font-weight: 600; font-size: 14px; white-space: nowrap; }
.price-row .btn { min-height: 52px; }
.price-preview { font-size: 13.5px; color: var(--ink2); margin-top: 8px; min-height: 18px; }
.price-preview:empty { display: none; }
.inline-cost { display: flex; align-items: center; gap: 6px; margin-top: 8px; background: var(--amber-soft); border: 1.5px solid #f3cf8a; border-radius: 12px; padding: 3px 3px 3px 10px; }
.inline-cost:focus-within { border-color: var(--blue); background: #fff; }
.ic-in { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 40px; font-size: 17px; font-weight: 600; }
.ic-u { color: #92400e; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ic-ok { width: 44px; height: 40px; border: 0; border-radius: 10px; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }
button.notice u, .notice u { text-underline-offset: 2px; }
.chips-row .hint { margin: 0; align-self: center; }

/* ---------------------------------------------------------------- cycle de vie des inventaires */
.st-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.st-badge.open { background: var(--green-soft); color: #166534; }
.st-badge.closed { background: #eef0f4; color: #475569; }
.st-badge.active { background: var(--blue-soft); color: var(--blue-d); }
.sum-main .st-badge { margin-left: auto; align-self: flex-start; }
.inv-card { background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 12px; margin-top: 10px; }
.inv-card.on { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.inv-card.closed { background: #fafbfc; }
.inv-top { display: flex; gap: 10px; align-items: flex-start; }
.inv-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.inv-card.closed .inv-ico { background: #eef0f4; color: #64748b; }
.inv-top .main { flex: 1; min-width: 0; }
.inv-top b { display: block; font-size: 15.5px; line-height: 1.3; }
.inv-top small { display: block; color: var(--ink3); font-size: 12.5px; margin-top: 2px; }
.inv-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.inv-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 13.5px; border-radius: 12px; gap: 5px; }
.icon-btn.sm { width: 44px; height: 44px; }
.verif { margin-top: 12px; }
.verif-t { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink2); align-items: center; }
.verif-t span { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verif-t b { white-space: nowrap; color: var(--ink); }
.bar { height: 8px; border-radius: 99px; background: #e8ecf3; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #22c55e, #16a34a); }
.verif.sm { margin-top: 10px; }
.badge.todo, .chip.todo { background: #f3e8ff; color: #7e22ce; border-color: #e9d5ff; }
.chip.todo.on { background: #7e22ce; color: #fff; }
.chip.warn.on { background: var(--amber); color: #fff; }
.item.unverified::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: #a855f7; }
.item.unverified .qty { color: #7e22ce; }
.verify-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; margin-top: 14px; background: #faf5ff; border: 1.5px solid #e9d5ff;
  border-radius: 16px; padding: 12px; color: #6b21a8; }
.verify-card b { display: block; font-size: 15px; }
.verify-card small { display: block; font-size: 12.5px; opacity: .85; }
.verify-card .btn { grid-column: 1 / -1; min-height: 52px; background: linear-gradient(135deg, #9333ea, #7e22ce); box-shadow: 0 4px 12px rgba(126, 34, 206, .25); }
.notice.ok { background: var(--green-soft); color: #166534; }
/* correctifs v2.3 */
.price-in { min-width: 0; }
.price-in input { width: 100%; }
.ic-in { font-size: 15.5px; }
.ic-in::placeholder { font-weight: 500; color: #b07a2c; }
.bb-row { grid-template-columns: auto 1fr; }
.bb-row #bulk-unit { grid-column: 1 / -1; }
/* Compter = écran d'accueil */
#view-count .notice.slim, #view-count .verif-strip { width: 100%; text-align: left; margin: 0 0 10px; }
.verif-strip { display: block; padding: 10px 14px 12px; border: 1px solid var(--line, #e2e8f0); cursor: pointer; font: inherit; color: inherit; }
.verif-strip .verif { margin-top: 0; }
.todo-t { color: #7e22ce; }
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 4px; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid #e2e8f0; background: #fff; color: var(--ink); font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; }
.cat-chip .i { color: var(--c); }
.cat-chip small { font-weight: 600; color: var(--ink3); font-size: 11.5px; }
.cat-chip.on { background: var(--ct); border-color: transparent; }
.create-empty { text-align: center; padding: 18px 6px; }
.create-empty p { margin: 0 0 12px; color: var(--ink2); }
.create-empty small { display: block; margin-top: 8px; color: var(--ink3); font-size: 12.5px; }
.inv-card:not(.on) { cursor: pointer; }
.co-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; } .co-logo small { color: var(--ink3); font-size: 12.5px; }
