:root {
  --bg: #f4f4f7; --surface: #ffffff; --ink: #1c1e2e; --muted: #676a7a; --line: #dfe0e7;
  --brand: #373373; --brand-ink: #ffffff; --brand-soft: #ebebf5; --danger: #c43a3a; --warn: #c98a00;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,40,30,.06), 0 4px 14px rgba(20,40,30,.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); }
h1 { font-size: 1.45rem; margin: 0 0 .15rem; line-height: 1.2; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- barre du haut */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); background: var(--brand); color: var(--brand-ink); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 700; }
.brand img { border-radius: 7px; border: 1px solid rgba(255,255,255,.3); }
#nav { display: flex; gap: 14px; margin-left: auto; align-items: center; flex-wrap: wrap; }
#nav a, #nav .link { color: #fff; text-decoration: none; font-size: .92rem; opacity: .92; }
#nav a:hover { opacity: 1; text-decoration: underline; }
.sync { border: 0; border-radius: 99px; padding: 4px 10px 4px 22px; font-size: .78rem; font-weight: 600; cursor: pointer;
  position: relative; background: rgba(255,255,255,.14); color: #fff; }
.sync::before { content: ""; position: absolute; left: 9px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #7ee2a8; }
.sync.wait::before { background: #ffd34d; } .sync.off::before { background: #ff8a8a; }
.sync.off { background: rgba(0,0,0,.28); }

main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 120px; }
.loading, .empty { padding: 48px 0; text-align: center; color: var(--muted); }
.empty p { color: var(--ink); max-width: 480px; margin: 0 auto 16px; }

/* ---------- boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
  font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #b9c0b8; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #28255a; border-color: #28255a; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-ghost { color: var(--danger); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .84rem; }
.btn-block { width: 100%; }
select.btn { appearance: auto; font-weight: 500; }
.btn-scan { min-height: 56px; padding: 10px 22px; font-size: 1.05rem; background: var(--brand); color: #fff; border: 0;
  border-radius: 14px; box-shadow: 0 4px 14px rgba(29,92,70,.3); }
.btn-scan:hover { background: #28255a; }
.btn-allclear { margin: 12px 0; min-height: 48px; background: var(--brand-soft); border-color: #c9c8e2; color: var(--brand); }
.icon-btn { border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; padding: 6px 8px; color: var(--muted); border-radius: 8px; }
.icon-btn:hover { background: var(--bg); }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }

/* ---------- mise en page */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head p { margin: 2px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.section-title { margin: 22px 0 8px; font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 6px 0 4px; }
.hero p { margin: 0; }
.hero p::first-letter { text-transform: uppercase; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.geo-fs { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 12px; margin: 0 0 12px; }
.geo-fs legend { font-weight: 700; font-size: .85rem; padding: 0 4px; }
.notice { background: #eef4f8; border: 1px solid #cfe0ea; color: #24495e; border-radius: 10px; padding: 9px 12px; font-size: .88rem; margin: 0 0 12px; }
.notice.warn { background: #fff6dc; border-color: #f0d58a; color: #6b4d00; margin-top: 10px; }
.warn-txt { color: var(--warn); font-weight: 600; } .bad-txt { color: var(--danger); font-weight: 600; }
.geo-line { margin-top: 4px; font-size: .8rem; }
.q.appear { animation: appear .35s ease-out; }
@keyframes appear { from { background: #fff6dc; } to { background: transparent; } }

.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.list-item:first-child { border-top: 0; }
a.list-item:hover, .list-item a.grow:hover { background: #fafaf7; }
.list-item a.grow { color: inherit; text-decoration: none; }
.list-item > div:first-child { flex: 1; min-width: 0; }
.group { margin-bottom: 14px; }
.group-title { font-weight: 700; margin: 12px 2px 6px; }
.empty-line { padding: 4px 2px; }
.search { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); font: inherit; margin-bottom: 10px; background: var(--surface); }

.progress-mini { width: 90px; text-align: right; font-size: .82rem; font-weight: 600; }
.bar { height: 6px; border-radius: 6px; background: #e6e6ee; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .3s; }
.bar.big { height: 10px; margin-top: 8px; }
.progress { margin-bottom: 12px; }
.scan-bar { position: sticky; bottom: 12px; z-index: 10; display: flex; justify-content: center; margin: 0 0 12px; order: 9; }
@media (max-width: 700px) { .scan-bar { position: fixed; left: 16px; right: 16px; bottom: max(14px, env(safe-area-inset-bottom)); margin: 0; }
  .scan-bar .btn-scan { width: 100%; } }

/* ---------- puces */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600;
  background: color-mix(in srgb, var(--c, #888) 14%, white); color: color-mix(in srgb, var(--c, #888) 75%, black); border: 1px solid color-mix(in srgb, var(--c, #888) 35%, white); white-space: nowrap; }
.chip-todo { --c: #8d9690; }
.chip-done { --c: var(--brand); }
.pend { color: var(--warn); font-size: .8rem; margin-left: 4px; }
.count { background: var(--line); border-radius: 99px; padding: 0 7px; font-size: .78rem; }
.scan-badge { display: inline-flex; align-items: center; gap: 3px; font-size: .75rem; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.scan-badge svg { width: 14px; height: 14px; }
.scan-badge.ok { color: var(--brand); } .scan-badge.warn { color: var(--warn); } .scan-badge.bad { color: var(--danger); }

/* ---------- onglets */
.tabs, .seg { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button, .seg button { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.active, .seg button.active { color: var(--brand); border-bottom-color: var(--brand); }
/* onglets d'étage (plusieurs plans par site) */
.floor-bar { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.floor-bar .floors { flex: 1 1 auto; margin-bottom: 0; overflow-x: auto; scrollbar-width: thin; }
.seg.floors button { white-space: nowrap; padding: 8px 12px; }
.floor-bar > .btn { margin-bottom: 4px; }
.plan-list .list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 4px 6px; align-items: center; }
.plan-list input { margin: 0; }
.plan-list .plan-info { grid-column: 1 / -1; }
/* historique des plans */
.hist-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 12px; margin-bottom: 8px; }
.hist-bar label { margin: 0; } .hist-bar input { width: auto; }
.hist-thumb { width: 72px; height: 48px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; flex: none; }
#hVers .list-item.hist-on { outline: 2px solid var(--brand); outline-offset: -2px; }
.hist-events { max-height: 40vh; overflow: auto; }
.r-plan-title { margin: 10px 0 4px; font-size: 12px; }

/* ---------- formulaires */
[hidden] { display: none !important; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-weight: 400; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
label.check { display: flex; gap: 8px; align-items: center; } label.check input { width: auto; margin: 0; }
.form-err { color: var(--danger); font-size: .88rem; min-height: 1em; }
.field-label { font-weight: 600; font-size: .88rem; margin-bottom: 6px; }

/* ---------- fenêtres */
.modal-bg { position: fixed; inset: 0; background: rgba(15,25,20,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; padding: 18px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.confirm-msg { font-size: 1rem; margin: 4px 0 16px; }
@media (max-width: 560px) { .modal-bg { align-items: flex-end; padding: 0; } .modal { border-radius: 16px 16px 0 0; max-height: 94vh; } }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 460px); }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.2); transition: opacity .3s, transform .3s; }
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- connexion */
.login { max-width: 380px; margin: 40px auto; text-align: center; }
.login img { border-radius: 14px; }
.login img.login-logo { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto 18px; border-radius: 0; }
.login form { text-align: left; margin-top: 20px; }

/* ---------- plan */
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.plan-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.plan-scroll { overflow: auto; max-height: 72vh; -webkit-overflow-scrolling: touch; }
.plan-canvas { position: relative; min-width: 100%; user-select: none; -webkit-user-select: none; }
.plan-canvas img { display: block; width: 100%; height: auto; pointer-events: none; }
.plan-canvas.adding { cursor: crosshair; }
.plan-canvas.adding::after { content: ""; position: absolute; inset: 0; outline: 3px dashed var(--brand); outline-offset: -3px; pointer-events: none; }
.plan-empty { aspect-ratio: 3 / 2; background-image: linear-gradient(#eeeef3 1px, transparent 1px), linear-gradient(90deg, #eeeef3 1px, transparent 1px);
  background-size: 40px 40px; display: flex; align-items: flex-start; justify-content: center; padding: 16px; color: var(--muted); font-size: .9rem; }
.plan-markers { position: absolute; inset: 0; pointer-events: none; }
.plan-zoom { position: absolute; right: 10px; top: 10px; z-index: 3; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.plan-zoom button { width: 38px; height: 36px; border: 0; background: #fff; font-size: 1.15rem; cursor: pointer; border-top: 1px solid var(--line); }
.plan-zoom button:first-child { border-top: 0; }

/* éditeur de plan dessiné */
.plan-editor.modal { max-width: 1100px; }
.pe-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pe-sub { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; min-height: 38px; }
.pe-sub label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.pe-sub select { width: auto; min-height: 34px; margin: 0; }
.pe-text { flex: 1 1 220px; min-height: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.pe-stage { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; touch-action: none; cursor: crosshair; }
.pe-stage svg { display: block; width: 100%; height: auto; max-height: 62vh; user-select: none; -webkit-user-select: none; }
.pe-hint { margin: 6px 0 2px; color: var(--brand); font-weight: 600; }
.pe-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.pe-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pe-lg { display: inline-block; width: 22px; height: 6px; background: #222; }
.pe-lg.door { height: 3px; background: #d9480f; }
.pe-lg.garage { height: 10px; background: #f8c9a8; border: 2px solid #d9480f; }

.mk { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; border: 0; background: none; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; touch-action: manipulation; }
.mk.draggable { touch-action: none; cursor: grab; }
.mk.dragging { cursor: grabbing; z-index: 5; }
.mk-dot { width: 18px; height: 18px; background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); border-radius: 50%; }
.mk-label { position: absolute; top: 100%; margin-top: 1px; font-size: 10px; font-weight: 700; background: rgba(255,255,255,.9); padding: 0 3px; border-radius: 3px; white-space: nowrap; color: #1c1e2e; line-height: 1.3; }
.shape-square .mk-dot { border-radius: 3px; }
.shape-diamond .mk-dot { border-radius: 2px; transform: rotate(45deg) scale(.88); }
.shape-triangle .mk-dot { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); border: 0; width: 20px; height: 18px; }
.shape-hex .mk-dot { border-radius: 0; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); border: 0; width: 20px; }
.mk.todo .mk-dot { opacity: .75; }
.mk.problem .mk-dot { outline: 3px solid var(--danger); outline-offset: 1px; }
.mk.pulse .mk-dot { animation: pulse 1s ease-in-out 3; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--c) 30%, transparent); } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--muted); margin: 8px 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 12px; height: 12px; background: var(--c); border-radius: 50%; vertical-align: -1px; margin-right: 2px; }
.lg.shape-square { border-radius: 2px; } .lg.shape-diamond { border-radius: 1px; transform: rotate(45deg) scale(.85); }
.lg.shape-triangle { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); } .lg.shape-hex { border-radius: 0; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.lg.ring { background: #fff; border: 3px solid var(--danger); }
.lg.big { width: 20px; height: 20px; }

/* ---------- tableaux */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafaf7; }
.table td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }

/* ---------- feuille d'inspection */
.trap-row .trap-code { font-weight: 700; min-width: 64px; display: inline-flex; align-items: center; gap: 6px; }
.trap-row.is-done { background: #fbfbfe; }
.trap-status { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
@media (max-width: 560px) { .trap-row { flex-wrap: wrap; } .trap-row .grow { flex-basis: calc(100% - 80px); } .trap-status { width: 100%; justify-content: flex-start; padding-left: 70px; } }
.closing textarea { min-height: 70px; }
.prod-row { display: grid; grid-template-columns: 2fr 1.4fr 1.4fr 1fr 1.6fr auto; gap: 6px; margin-bottom: 6px; }
.prod-row input { margin: 0; padding: 8px 10px; font-size: .88rem; }
@media (max-width: 760px) { .prod-row { grid-template-columns: 1fr 1fr; padding: 8px; border: 1px solid var(--line); border-radius: 10px; } }
.sigs { margin-top: 14px; }
.sig { width: 100%; height: 120px; border: 1px dashed #b9c0b8; border-radius: 10px; background: #fff; touch-action: none; display: block; }
.trap-qr { display: flex; gap: 14px; align-items: center; padding: 10px; background: var(--bg); border-radius: 10px; margin-bottom: 8px; }
.trap-qr svg { width: 96px; height: 96px; }

/* ---------- fiche piège */
.fiche-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.fiche-code { font-size: 1.6rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.scan-info { display: flex; gap: 8px; align-items: flex-start; font-size: .82rem; padding: 8px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.scan-info.code { background: #fff6dc; color: #8a6200; } .scan-info.manuel { background: #fde8e8; color: var(--danger); }
.scan-info svg { margin-top: 2px; flex: none; }
.fiche .q { padding: 12px 0; border-top: 1px solid var(--line); }
.fiche .q:first-child { border-top: 0; padding-top: 0; }
.q-label { font-weight: 700; margin-bottom: 8px; }
.req { color: var(--danger); }
.q.missing .q-label { color: var(--danger); }
.q.missing { background: #fff5f5; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-height: 42px; padding: 8px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: .92rem; cursor: pointer; color: var(--ink); }
.opt.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.opt[style].on { background: var(--c); border-color: var(--c); }
.opt[style]:not(.on) { border-color: color-mix(in srgb, var(--c) 45%, white); }
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 46px; border: 0; background: var(--bg); font-size: 1.3rem; cursor: pointer; }
.stepper input { width: 80px; margin: 0; border: 0; border-radius: 0; text-align: center; font-size: 1.05rem; }
.photo { display: block; max-width: 260px; max-height: 220px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--line); }
.fiche.readonly .opt { pointer-events: none; }
.sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(6px); }
@media (max-width: 560px) { .sticky-actions .btn { flex: 1; padding: 8px; font-size: .85rem; } .sticky-actions a.btn { flex: 0 0 auto; } }

/* ---------- scanner */
.scan-view { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 60vh; width: 100%; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18% 14%; border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scan-msg { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: #fff; font-size: .9rem; margin: 0; padding: 0 12px; }
.scan-msg.err { top: 30%; bottom: auto; }
.scan-manual { margin-top: 12px; }
.scan-manual .row { display: flex; gap: 8px; margin-top: 4px; } .scan-manual input { margin: 0; text-transform: uppercase; }

/* ---------- étiquettes */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.label { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px dashed #aab; border-radius: 8px; padding: 10px; break-inside: avoid; }
.label-qr svg { width: 100px; height: 100px; display: block; }
.label-code { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.label-type { font-weight: 600; font-size: .8rem; margin: 3px 0; }
.label-site, .label-zone { font-size: .7rem; color: #444; line-height: 1.25; }
.label { cursor: pointer; position: relative; }
.label.off { opacity: .3; border-style: dotted; }
.label:not(.off)::after { content: "✓"; position: absolute; top: 3px; right: 5px; font-size: .7rem; font-weight: 800; color: var(--brand); }
.label-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px 0; }
.label-tools label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.label-tools select { width: auto; margin: 0; padding: 6px 10px; }
.label-sel { display: inline-flex; gap: 6px; }
/* rouleau : étiquette à sa taille réelle (--lw × --lh), tout est proportionnel à la hauteur */
.labels.roll { display: flex; flex-wrap: wrap; gap: 10px; }
.labels.roll .label { width: var(--lw); height: var(--lh); padding: calc(var(--lh) * .06); gap: calc(var(--lh) * .07);
  border-radius: 0; overflow: hidden; align-items: center; color: #000; }
.labels.roll .label-qr { flex: none; }
.labels.roll .label-qr svg { width: calc(var(--lh) * .88); height: calc(var(--lh) * .88); }
.labels.roll .label-txt { min-width: 0; flex: 1; overflow: hidden; }
.labels.roll .label-code { font-size: calc(var(--lh) * .27); }
.labels.roll .label-type { font-size: calc(var(--lh) * .115); margin: calc(var(--lh) * .02) 0; }
.labels.roll .label-site, .labels.roll .label-zone { font-size: calc(var(--lh) * .09); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #000; }

/* ---------- rapport */
.report-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch a { padding: 8px 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
.lang-switch a.active { background: var(--brand); color: #fff; }
.report-bar .lang-note { flex-basis: 100%; margin: 0; }
.report { background: #fff; color: #111; padding: 32px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; line-height: 1.4; }
.report h3 { font-size: 14px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--brand); color: var(--brand); break-after: avoid; }
.report h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #555; }
.report p { margin: 4px 0 8px; }
.r-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--brand); padding-bottom: 12px; flex-wrap: wrap; }
.r-company { font-size: 16px; font-weight: 800; color: var(--brand); }
.r-doc { text-align: right; } .r-title { font-size: 20px; font-weight: 800; }
.r-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
@media (max-width: 760px) { .r-grid { grid-template-columns: 1fr 1fr; } .report { padding: 16px; overflow-x: auto; } .report .r-table { min-width: 560px; } }
.r-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.r-kpis .kpi-warn { border-color: #f0b4b4; background: #fff5f5; } .r-kpis .kpi-warn b { color: var(--danger); }
.small-kpis b { font-size: 16px; }
.r-kpis div { border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px; }
.r-kpis b { display: block; font-size: 20px; } .r-kpis span { font-size: 11px; color: #555; }
.r-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 11.5px; }
.r-table th { background: #eeeef6; text-align: left; padding: 5px 6px; border: 1px solid #cfcfe0; font-size: 10.5px; }
.r-table td { padding: 4px 6px; border: 1px solid #dedee8; vertical-align: top; }
.r-table tr { break-inside: avoid; }
.r-table .num { text-align: right; }
.r-table .bad { color: var(--danger); font-weight: 700; }
.r-table .chip { font-size: 10px; padding: 0 6px; }
.r-missing td { color: #a33; background: #fff6f6; }
.r-trend .tcell { text-align: center; background: color-mix(in srgb, var(--c) 22%, white); font-weight: 600; font-size: 10.5px; }
.r-trend .tcell.na { background: #f6f6f6; color: #aaa; }
.r-total td { font-weight: 700; background: #f5f5f9; text-align: center; } .r-total td:first-child { text-align: left; }
.r-warn { color: #a33; font-weight: 600; }
.r-box { border: 1px solid #d3d3e6; background: #f6f6fb; border-radius: 6px; padding: 8px 12px; margin: 8px 0; break-inside: avoid; }
.r-box.warn { border-color: #f0c9a0; background: #fff8ef; }
.r-plan { position: relative; border: 1px solid #ccc; break-inside: avoid; }
.r-plan img { display: block; width: 100%; }
.r-plan .mk { cursor: default; } .r-plan .mk-dot { width: 13px; height: 13px; } .r-plan .mk-label { font-size: 8px; }
.r-plan .shape-triangle .mk-dot, .r-plan .shape-hex .mk-dot { width: 14px; height: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin: 0 4px 0 6px; vertical-align: -1px; }
.r-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.r-photos figure { margin: 0; break-inside: avoid; } .r-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; }
.r-photos figcaption { font-size: 10px; }
.r-sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 30px; break-inside: avoid; }
.r-sigs img, .sig-empty { height: 70px; max-width: 100%; display: block; border-bottom: 1px solid #333; margin-bottom: 4px; }
.r-sigs img { object-fit: contain; object-position: left bottom; width: 100%; }
.r-foot { margin-top: 24px; color: #666; border-top: 1px solid #ddd; padding-top: 8px; }
.qr-missing { font-size: .75rem; color: var(--danger); width: 100px; }

/* ---------- impression */
@media print {
  @page { size: letter; margin: 12mm; }
  body { background: #fff; }
  .no-print, .topbar, #toasts, .report-bar, .sticky-actions { display: none !important; }
  main { max-width: none; padding: 0; }
  .report { border: 0; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .label { border: 1px dashed #999; }
  .label.off { display: none; }
  .label::after { display: none; }
  /* rouleau : une étiquette par page, sans bordure ni espace */
  .labels.roll { display: block; }
  .labels.roll .label { border: 0; margin: 0; break-after: page; page-break-after: always; }
  .labels.roll .label.last { break-after: auto; page-break-after: auto; }
}

/* ---------- portail client (consultation) */
.table .num { text-align: right; }
.table tr.clickable, .r-table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--brand-soft); }
.portal-kpis div { background: var(--surface); border-color: var(--line); border-radius: 10px; }
.portal-kpis b { font-size: 1.15rem; } .portal-kpis b small { font-size: .75rem; font-weight: 600; }
.portal-kpis span { font-size: .78rem; color: var(--muted); }
.portal-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.portal-trend { background: var(--surface); font-size: 12px; margin: 0; }
.portal-trend th { white-space: nowrap; }
.chart-card { padding: 10px 12px; }
.bar-chart { width: 100%; height: auto; display: block; }
.bar-chart .grid { stroke: var(--line); stroke-width: 1; }
.bar-chart .ax { fill: var(--muted); font-size: 11px; }
.bar-chart .val { fill: var(--ink); font-size: 12px; font-weight: 700; }
.bar-chart .cbar { fill: var(--warn); } .bar-chart .cbar.zero { fill: #2f9e62; }
.zone-bar { display: grid; grid-template-columns: minmax(90px, 30%) 1fr 32px; align-items: center; gap: 10px; padding: 4px 0; font-size: .9rem; }
.zone-bar i { display: block; height: 12px; border-radius: 6px; background: var(--warn); opacity: .75; }
.zone-bar b { text-align: right; }
.tech-opt { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.tech-opt input { width: auto; margin: 0; min-height: 0; }
.tech-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.assign-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.assign-tools .search { flex: 1; min-width: 200px; margin: 0; }
.assign-sum { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.assign-bar { position: sticky; top: 64px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; margin-bottom: 10px; }
.table td input[type=checkbox], .table th input[type=checkbox] { width: 18px; height: 18px; margin: 0; }
#scope { margin-bottom: 8px; } #techFilter { margin-bottom: 8px; }
.assign-bar[hidden] { display: none; }

/* Suppression d'une inspection ouverte (bureau) */
.delete-insp { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line, #e5e7eb); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

/* Bouton « voir le mot de passe » */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; bottom: 3px; width: 40px; height: 38px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--ink); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); }

/* Documents PDF */
.doc-row a.grow { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.doc-row a.grow > span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.doc-ico { flex: none; color: #b3261e; }
.doc-group + .doc-group { margin-top: 6px; }
.folder-ico { flex: none; color: #b58a1b; }
.folder-row { cursor: pointer; }
.move-btns { display: flex; gap: 2px; }
.move-btns .icon-btn { width: 34px; height: 34px; font-size: .8rem; color: var(--muted); }
.move-btns .icon-btn:disabled { opacity: .25; cursor: default; }
.folder-row:hover { background: #fafaf7; }
.chev { color: var(--muted); font-size: 1.3rem; line-height: 1; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.doc-folder { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; overflow: hidden; }
.doc-folder > summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.doc-folder > summary::-webkit-details-marker { display: none; }
.doc-folder[open] > summary .chev { transform: rotate(90deg); }
.doc-folder > .list { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; }
.doc-folder > .empty-line { padding: 8px 14px; }
.folder-count { display: block; }
/* Traitements hors pièges (clôture de l'inspection) */
.treat-row { display: grid; grid-template-columns: 1.6fr 2fr 1fr 1fr auto; gap: 6px; margin-bottom: 8px; }
.treat-row input, .treat-row textarea { margin: 0; padding: 8px 10px; font-size: .88rem; }
.treat-row textarea { grid-column: 1 / -1; min-height: 0; }
.prod-auto input { background: var(--bg, #f5f6f8); }
.prod-auto .chip { align-self: center; }
@media (max-width: 760px) {
  .treat-row { grid-template-columns: 1fr 1fr auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
  .treat-row [data-k="endroit"] { grid-column: 1 / 3; grid-row: 1; }
  .treat-row .icon-btn { grid-column: 3; grid-row: 1; }
  .treat-row [data-k="nom"] { grid-column: 1 / -1; }
  .treat-row [data-k="unite"] { grid-column: 2 / -1; }
  .prod-auto .chip { justify-self: start; }
}
