/* EPITA Smart Classroom — design system
   Inspiré de l'identité Battre L'Estrade : violet unique, Montserrat, finesse, respiration. */
:root {
  --violet: #5B2D8E;
  --violet-700: #482270;
  --violet-900: #2A1342;
  --violet-50: #F6F2FA;
  --violet-100: #ECE4F4;
  --violet-200: #D6C6E7;
  --ink: #1C1424;
  --ink-2: #4A4253;
  --muted: #7C7486;
  --line: #E7E2EC;
  --bg: #FCFBFD;
  --card: #FFFFFF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(42, 19, 66, .04), 0 8px 28px rgba(42, 19, 66, .06);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-weight: 300; color: var(--ink);
  background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 500; letter-spacing: -.01em; margin: 0; color: var(--violet-900); }
b, strong { font-weight: 600; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .78rem; font-weight: 300; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 14px 32px; background: rgba(252, 251, 253, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--violet); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; }
.brand-text { font-size: .82rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 300; color: var(--violet-900); white-space: nowrap; }
.brand-text strong { font-weight: 600; color: var(--violet); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav-btn {
  font: inherit; font-size: .78rem; font-weight: 500; letter-spacing: .02em; color: var(--ink-2);
  background: none; border: 0; padding: 7px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.nav-btn:hover { color: var(--violet); background: var(--violet-50); }
.nav-btn.is-active { color: #fff; background: var(--violet); }
.model-status { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: var(--muted); white-space: nowrap; }
.model-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--violet-200); animation: pulse 1.2s infinite; }
.model-status.ready .dot { background: var(--violet); animation: none; }
.model-status.error .dot { background: transparent; border: 1.5px solid var(--violet); animation: none; }
.model-status.error .txt { color: var(--violet); font-weight: 500; }
@keyframes pulse { 50% { opacity: .3; } }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 16px 32px 0; padding: 14px 18px; border: 1px dashed var(--violet); border-radius: var(--radius);
  background: var(--violet-50); color: var(--violet-900); font-size: .88rem;
}

/* ---------- Layout ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 32px; }
.view { display: none; animation: fade .35s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.view-head h2 { font-size: 2rem; font-weight: 300; }
.eyebrow { font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; color: var(--violet); font-weight: 500; margin-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 56px 0 40px; max-width: 760px; }
.hero-constellation { position: absolute; right: -380px; top: 10px; width: 600px; color: var(--violet); opacity: .18; pointer-events: none; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 500; line-height: 1.08; }
.hero h1 .thin { font-weight: 200; color: var(--violet); }
.lead { font-size: 1.08rem; color: var(--ink-2); margin: 22px 0 28px; max-width: 620px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 24px 0 8px; }
.step { background: var(--card); padding: 24px; }
.step-n { font-size: .72rem; letter-spacing: .2em; color: var(--violet); font-weight: 600; }
.step h3 { font-size: 1.05rem; margin: 8px 0 6px; }
.step p { font-size: .86rem; color: var(--ink-2); margin: 0; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .16em; color: var(--violet); font-weight: 600; margin-bottom: 12px; }
.card-privacy { background: linear-gradient(160deg, var(--violet-50), #fff 70%); }
.scope-list, .check-list { list-style: none; padding: 0; margin: 0; }
.scope-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.scope-list li:last-child { border: 0; }
.check-list li { position: relative; padding: 7px 0 7px 26px; font-size: .88rem; color: var(--ink-2); }
.check-list li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--violet); }
.check-list b { color: var(--violet-900); }

/* ---------- Tags / statuses (violet-only : intensité + libellé + symbole) ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 500; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tag-yes { background: var(--violet); color: #fff; }
.tag-partial { background: var(--violet-100); color: var(--violet-700); }
.tag-no { background: transparent; color: var(--muted); border: 1px dashed var(--muted); }
.status-ok { background: var(--violet); color: #fff; }
.status-warn { background: #fff; color: var(--violet); border: 1.5px solid var(--violet); }
.status-na { background: transparent; color: var(--muted); border: 1px dashed #B9B2C2; }
.status-pending { background: var(--violet-50); color: var(--muted); }
.status-chip { font-size: .85rem; font-weight: 500; padding: 10px 18px; border-radius: 999px; }

/* ---------- Buttons & inputs ---------- */
.btn {
  font: inherit; font-size: .85rem; font-weight: 500; letter-spacing: .02em; cursor: pointer;
  border-radius: 999px; padding: 11px 22px; border: 1.5px solid var(--violet); transition: all .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--violet-700); border-color: var(--violet-700); }
.btn-ghost { background: transparent; color: var(--violet); }
.btn-ghost:hover:not(:disabled) { background: var(--violet-50); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-sm { padding: 7px 16px; font-size: .78rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn:focus-visible, .nav-btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

input[type="text"], input[type="number"], select {
  font: inherit; font-size: .9rem; color: var(--ink); padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; width: 100%;
}
input[type="number"] { width: 96px; text-align: right; }
input[type="range"] { width: 100%; accent-color: var(--violet); }
.param { display: flex; flex-direction: column; gap: 6px; }
.param label { font-size: .82rem; font-weight: 500; display: flex; justify-content: space-between; }
.param output { color: var(--violet); font-weight: 600; }
.param.inline { max-width: 420px; margin-bottom: 14px; }
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }

/* ---------- Audit stage ---------- */
.audit-layout { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.results-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 20px; align-items: start; }
.results-col > .btn-block { grid-column: 1 / -1; }
.stage {
  position: relative; aspect-ratio: 16 / 10; background: var(--violet-900); border-radius: var(--radius);
  overflow: hidden; display: grid; place-items: center;
}
.stage > video, .stage > canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage #frame { background: var(--violet-900); display: none; }
.stage.frozen #frame { display: block; }
.stage-empty { position: relative; text-align: center; color: var(--violet-200); padding: 24px; }
.stage-empty svg { width: 56px; height: 56px; opacity: .7; }
.stage-empty p { margin-top: 8px; font-size: .9rem; }
.stage-badge { position: absolute; top: 12px; left: 12px; z-index: 3; font-size: .72rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: rgba(91, 45, 142, .85); padding: 5px 12px; border-radius: 999px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.alert { margin-top: 12px; padding: 12px 16px; border-left: 3px solid var(--violet); background: var(--violet-50); border-radius: 8px; font-size: .88rem; color: var(--violet-900); }
.privacy-pill { font-size: .75rem; font-weight: 500; color: var(--violet); background: var(--violet-50); padding: 8px 14px; border-radius: 999px; }

.det-list { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow: auto; }
.det-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .85rem; }
.det-list .bar { grid-column: 1 / -1; height: 3px; background: var(--violet-100); border-radius: 2px; overflow: hidden; }
.det-list .bar span { display: block; height: 100%; background: var(--violet); }
.det-list .below { opacity: .45; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .78rem; color: var(--ink-2); }
.note { font-size: .8rem; color: var(--muted); margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.kpi.primary { background: var(--violet); border-color: var(--violet); }
.kpi.primary .kpi-label, .kpi.primary .kpi-sub { color: var(--violet-200); }
.kpi.primary .kpi-value { color: #fff; }
.kpi-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 2.3rem; font-weight: 200; color: var(--violet-900); line-height: 1.15; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .76rem; color: var(--muted); }
.defs { margin: 0; font-size: .85rem; }
.defs dt { font-weight: 600; color: var(--violet-900); margin-top: 10px; }
.defs dd { margin: 2px 0 0; color: var(--ink-2); }

/* ---------- Report ---------- */
.report { padding: 48px 56px; max-width: 900px; margin: 0 auto; }
.report header { border-bottom: 2px solid var(--violet); padding-bottom: 18px; margin-bottom: 28px; }
.report h1 { font-size: 1.9rem; font-weight: 300; }
.report h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .18em; color: var(--violet); font-weight: 600; margin: 30px 0 10px; }
.report .exec { background: var(--violet-50); border-left: 3px solid var(--violet); padding: 16px 20px; border-radius: 0 10px 10px 0; font-size: .95rem; }
.report .exec strong { color: var(--violet-900); }
.report ul { padding-left: 20px; font-size: .9rem; }
.report li { margin: 4px 0; }
.report .meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 24px; font-size: .82rem; margin-top: 14px; }
.report .meta span { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; }

/* ---------- Footer ---------- */
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 24px 32px; border-top: 1px solid var(--line); font-size: .74rem; color: var(--muted); }

/* ---------- Qualité de prise de vue ---------- */
.nav-link { text-decoration: none; display: inline-flex; align-items: center; }
.stage-badge.warn { background: #fff; color: var(--violet-900); border: 1.5px solid var(--violet); font-weight: 600; }
.q-grade { float: right; font-size: .7rem; letter-spacing: .06em; text-transform: none; padding: 2px 10px; border-radius: 999px; }
.q-bonne, .q-correcte { background: var(--violet); color: #fff; }
.q-moyenne { background: #fff; color: var(--violet); border: 1.5px solid var(--violet); }
.q-insuffisante { background: var(--violet-900); color: #fff; }
.q-list { list-style: none; padding: 0; margin: 0; }
.q-list li { display: flex; flex-direction: column; gap: 2px; padding: 9px 0 9px 14px; border-bottom: 1px solid var(--line); font-size: .84rem; border-left: 3px solid var(--violet-200); margin-bottom: 4px; }
.q-list li:last-child { border-bottom: 0; }
.q-list li b { color: var(--violet-900); font-weight: 600; }
.q-list li span { color: var(--ink-2); font-size: .8rem; }
.q-list li.q-high { border-left-color: var(--violet-900); background: var(--violet-50); }
.q-list li.q-mid { border-left-color: var(--violet); }
.q-list li.q-ok { border-left-color: var(--violet); }

/* ---------- Caméra pleine largeur, grille et guide de prise de vue ---------- */
.stage { aspect-ratio: 16 / 9; max-height: 78vh; width: 100%; }
.stage:fullscreen { max-height: none; }
.frame-guide { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: none; }
.stage.cam-on:not(.frozen):not(.scan) .frame-guide.on { display: block; }
.frame-guide span { position: absolute; background: rgba(255,255,255,.28); }
.fg-v1, .fg-v2 { top: 0; bottom: 0; width: 1px; } .fg-v1 { left: 33.33%; } .fg-v2 { left: 66.66%; }
.fg-h1, .fg-h2 { left: 0; right: 0; height: 1px; } .fg-h1 { top: 33.33%; } .fg-h2 { top: 66.66%; }
.frame-guide .fg-c { width: 28px; height: 28px; background: none; border: 2px solid rgba(255,255,255,.75); }
.fg-c.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; } .fg-c.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; }
.fg-c.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; } .fg-c.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; }
.frame-guide em { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); font-style: normal; font-size: .72rem; color: #fff; background: rgba(42,19,66,.6); padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.stage-empty .small { color: var(--violet-200); opacity: .8; margin-top: 4px; }
.inline-check { margin: 0 0 0 4px; align-self: center; }
.shoot-guide { margin-top: 16px; padding: 18px 22px; }
.shoot-guide summary { cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; list-style: none; }
.shoot-guide summary::-webkit-details-marker { display: none; }
.shoot-guide summary .card-title { margin: 0; }
.shoot-steps { list-style: none; counter-reset: sg; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.shoot-steps li { counter-increment: sg; background: var(--violet-50); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: .84rem; }
.shoot-steps b { color: var(--violet-900); font-weight: 600; }
.shoot-steps span { color: var(--ink-2); font-size: .8rem; }
.shoot-note { font-size: .78rem; color: var(--muted); margin: 12px 0 0; }
@media (max-width: 760px) { .stage { aspect-ratio: 3 / 4; max-height: 70vh; } .frame-guide em { font-size: .6rem; } }

/* ---------- Film de présentation ---------- */
.film { margin: 8px 0 28px; }
.film-stage { position: relative; border-radius: 20px; overflow: hidden; background: var(--violet-900); box-shadow: 0 30px 80px rgba(42,19,66,.25); }
.film-canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.film-stage:fullscreen { border-radius: 0; display: grid; place-items: center; background: #000; }
.film-stage:fullscreen .film-canvas { width: 100vw; height: auto; max-height: 100vh; object-fit: contain; }
.film-stage.is-full { position: fixed; inset: 0; z-index: 300; border-radius: 0; display: grid; place-items: center; background: #000; }
.film-fallback { padding: 40px; color: var(--violet-200); text-align: center; }
.film-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.film-progress { flex: 1 1 200px; height: 6px; background: var(--violet-100); border-radius: 3px; cursor: pointer; overflow: hidden; }
.film-progress span { display: block; height: 100%; width: 0; background: var(--violet); }
.film-time { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.film-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.film-chips button { font: 500 .72rem var(--font); color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.film-chips button.on { background: var(--violet); color: #fff; border-color: var(--violet); }
@media (max-width: 640px) { .film-bar .btn { flex: 1 1 auto; } .film-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .film-chips button { white-space: nowrap; } }

/* ---------- Analyse avancée ---------- */
.adv-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--violet-200); border-radius: 12px; background: #fff; }
.adv-row .small { flex: 1 1 260px; }
.adv-gallery { flex: 1 1 100%; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.adv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.adv-head b { color: var(--violet-900); font-weight: 600; font-size: .86rem; }
.adv-head .btn { margin-left: auto; }
@media (max-width: 640px) { .adv-head .btn { margin-left: 0; width: 100%; } }
@media (max-width: 640px) { .adv-row .btn { width: 100%; white-space: normal; } }

/* ---------- Déclencheur sur la vidéo + bouton capture mis en avant ---------- */
.shutter { position: absolute; z-index: 6; left: 50%; bottom: 18px; transform: translateX(-50%); width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,.18); cursor: pointer; display: none; padding: 0; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.shutter span { display: block; width: 56px; height: 56px; margin: 5px auto; border-radius: 50%; background: #fff; transition: transform .1s ease; }
.shutter:active span { transform: scale(.88); }
.stage.cam-on:not(.scan):not(.frozen):not(.pseudo-full) .shutter { display: block; }
.stage:fullscreen .shutter { display: none !important; }
.stage.cam-on .frame-guide em { bottom: 104px; }
.controls { margin-top: 12px; }
.btn-capture { font-size: .95rem; padding: 13px 26px; box-shadow: 0 6px 18px rgba(91,45,142,.3); }
@media (max-width: 640px) { .controls .btn.btn-capture { flex: 1 1 100%; order: -1; font-size: .95rem; padding: 14px; } }

/* ---------- Plein écran caméra (natif + secours iPhone) ---------- */
.stage.pseudo-full { position: fixed; inset: 0; z-index: 300; width: 100vw; height: 100vh; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; }
body.no-scroll { overflow: hidden; }
.fs-bar { position: absolute; z-index: 6; left: 50%; bottom: 18px; transform: translateX(-50%); display: none; gap: 10px; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100% - 24px); }
.stage:fullscreen:not(.scan) .fs-bar, .stage.pseudo-full:not(.scan) .fs-bar { display: flex; }
.fs-btn { font: 600 .85rem var(--font); color: #fff; background: rgba(42,19,66,.72); border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 12px 18px; cursor: pointer; backdrop-filter: blur(6px); }
.fs-btn.fs-primary { background: #fff; color: var(--violet-900); border-color: #fff; }
.fs-enter { position: absolute; z-index: 6; right: 12px; bottom: 12px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.6); background: rgba(42,19,66,.65); color: #fff; font-size: 1.15rem; cursor: pointer; display: none; }
.stage.cam-on:not(.scan) .fs-enter { display: block; }
.stage:fullscreen .fs-enter, .stage.pseudo-full .fs-enter { display: none !important; }
.stage.pseudo-full .hud-tr #hudFull { display: none; }
.stage:fullscreen .frame-guide em, .stage.pseudo-full .frame-guide em { display: none; }

/* ---------- Responsive global : aucun débordement horizontal ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
main, .view, .card, .report, .audit-layout > *, .results-col > *, .grid-2 > * { min-width: 0; }
.report, .card { overflow-wrap: anywhere; }
.report .table-wrap { margin: 0 -4px; }
@media (max-width: 640px) {
  /* Tableaux → cartes empilées (libellé de colonne à gauche, valeur à droite) */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; background: #fff; }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); text-align: right; }
  .table td:last-child { border-bottom: 0; }
  .table td::before { content: attr(data-label); flex: 0 0 42%; text-align: left; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
  .table td:not([data-label])::before, .table td[data-label=""]::before { display: none; }
  .table td[colspan] { justify-content: flex-start; text-align: left; }
  .table td.num { text-align: right; }
  .table td .tag { white-space: normal; text-align: right; }
  .table td > input, .table td > select { max-width: 56%; min-width: 0 !important; }
  .ano-table td:nth-child(5) { flex-direction: column; align-items: flex-start; text-align: left; }
  .ano-table td:nth-child(5)::before { flex: none; }
  .table-wrap { overflow: visible; }
  .report { padding: 22px 16px; }
  .report h1 { font-size: 1.5rem; }
  .report .meta { grid-template-columns: 1fr 1fr; }
  .view-head h2 { font-size: 1.6rem; }
  .view-head .btn-row { width: 100%; }
  .view-head .btn-row > * { flex: 1 1 auto; }
  #accessCode, #anoFilter { width: 100%; }
  .controls .btn, .controls .file-btn { flex: 1 1 calc(50% - 10px); padding: 11px 12px; font-size: .8rem; }
  .controls #btnScan { flex-basis: 100%; }
  .params { gap: 16px; }
  .kpi-value { font-size: 1.9rem; }
  .fiche-grid, .arch-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .hero { padding-top: 24px; }
  .footer { padding: 18px 16px; }
}

/* ---------- Mode Scan (HUD temps réel) ---------- */
#hud { pointer-events: none; z-index: 4; display: none; }
.stage.scan #hud { display: block; }
.stage.scan { aspect-ratio: 16 / 9; }
.audit-layout.scanning { grid-template-columns: 1fr; }
.stage.scan::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(20,10,34,.55));
}
.stage.scan .stage-badge { display: none; }
.stage:fullscreen { aspect-ratio: auto; border-radius: 0; }
.hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; color: #F2ECF9; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .66rem; letter-spacing: .05em; }
.hud > * { position: absolute; pointer-events: auto; }
.hud-tl { top: 12px; left: 14px; display: flex; flex-direction: column; gap: 2px; }
.hud-live { color: #fff; font-weight: 700; animation: pulse 1.2s infinite; }
.hud-tr { top: 10px; right: 12px; display: flex; gap: 6px; }
.hud-btn { font: inherit; font-size: .68rem; color: #fff; background: rgba(20,10,34,.6); border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: 5px 9px; cursor: pointer; }
.hud-btn:hover { background: rgba(91,45,142,.85); }
.hud-btn-sm { padding: 3px 7px; font-size: .62rem; }
.hud-left { top: 70px; left: 14px; width: 190px; background: rgba(20,10,34,.62); border-left: 2px solid #B794E0; padding: 8px 10px; }
.hud-title { font-weight: 700; color: #fff; margin-bottom: 6px; }
.hud-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 4px 0; }
.hud-row b { color: #fff; } .hud-row i { color: #B794E0; font-style: normal; }
.hud-row.muted { opacity: .6; }
.hud-bar { grid-column: 1 / -1; height: 3px; background: rgba(255,255,255,.15); }
.hud-bar span { display: block; height: 100%; background: #B794E0; transition: width .3s ease; }
.hud-right { top: 52px; right: 12px; width: 270px; display: flex; flex-direction: column; gap: 3px; }
.hud-msg { background: rgba(20,10,34,.62); padding: 4px 8px; border-left: 2px solid rgba(255,255,255,.5); animation: fade .3s ease; }
.hud-msg.warn { border-left-color: #fff; background: rgba(91,45,142,.85); color: #fff; font-weight: 600; }
.hud-bottom { left: 14px; right: 14px; bottom: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hud-audio { width: 280px; background: rgba(20,10,34,.62); padding: 8px 10px; border-left: 2px solid #B794E0; }
.hud-audio-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-weight: 700; color: #fff; }
.hud-audio canvas { width: 100%; height: 40px; display: block; }
.hud-level { height: 3px; background: rgba(255,255,255,.15); margin: 4px 0; }
.hud-level span { display: block; height: 100%; width: 0; background: #fff; transition: width .15s linear; }
.hud-sounds { display: flex; flex-wrap: wrap; gap: 4px 10px; min-height: 1.2em; }
.hud-sounds b { color: #B794E0; }
.hud-capture { font: 600 .9rem var(--font); letter-spacing: .04em; color: var(--violet-900); background: #fff; border: 0; border-radius: 999px; padding: 14px 26px; cursor: pointer; box-shadow: 0 0 0 4px rgba(255,255,255,.25), 0 8px 30px rgba(0,0,0,.35); }
.hud-capture:hover { background: var(--violet-100); }
.hud-persons { background: rgba(20,10,34,.62); padding: 6px 10px; border: 1px dashed rgba(255,255,255,.5); }
@media (max-width: 760px) {
  .hud { font-size: .56rem; }
  .hud-tl span:nth-child(2), .hud-persons { display: none; }
  .hud-left { width: 128px; top: 44px; left: 8px; padding: 5px 7px; }
  .hud-left .hud-row.muted, .hud-left .hud-row:nth-last-child(2) { display: none; }
  .hud-right { width: 150px; top: 44px; right: 8px; }
  .hud-right .hud-msg:nth-child(n+3) { display: none; }
  .hud-bottom { left: 8px; right: 8px; bottom: 8px; }
  .hud-audio { width: 140px; padding: 5px 7px; }
  .hud-audio canvas { height: 24px; }
  .hud-btn { font-size: .58rem; padding: 4px 6px; }
  .hud-capture { padding: 10px 14px; font-size: .72rem; }
  .stage.scan { aspect-ratio: 3 / 4; }
}


/* ---------- Calques du HUD (affichage à la carte) ---------- */
.hud-layers { top: 50px; right: 12px; width: 260px; z-index: 8; background: rgba(20,10,34,.92); border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: .68rem; }
.hud-layers label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.hud-layers input { accent-color: #B794E0; width: 15px; height: 15px; }
.hud-presets { display: flex; gap: 6px; margin-bottom: 4px; }
.hud.no-inv .hud-left, .hud.no-feed .hud-right, .hud.no-audio .hud-audio, .hud.no-info .hud-tl, .hud.no-adds .hud-adds { display: none !important; }
.stage.scan.no-fx::after { background: none; }
.hud:not(.no-feed) ~ .hud-layers { }

/* ---------- Collection d'objets (scan cumulé) ---------- */
.hud-adds { inset: 0; pointer-events: none !important; }
.hud-add { position: absolute; pointer-events: auto; transform: translate(-2px, 4px); font: 700 .66rem var(--font); letter-spacing: .03em; color: var(--violet-900); background: #fff; border: 0; border-radius: 999px; padding: 5px 10px; cursor: pointer; box-shadow: 0 0 0 3px rgba(183,148,224,.55), 0 4px 14px rgba(0,0,0,.35); white-space: nowrap; animation: fade .2s ease; }
.hud-add:hover { background: var(--violet-100); }
.hud-add.done { background: var(--violet); color: #fff; box-shadow: none; cursor: default; }
.hud-btn-accent { background: rgba(255,255,255,.92); color: var(--violet-900); font-weight: 700; border-color: #fff; }
.coll-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.coll-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.coll-sum span { font-size: .78rem; background: var(--violet-50); color: var(--violet-900); padding: 5px 12px; border-radius: 999px; }
.coll-sum b { color: var(--violet); }
.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.coll-item { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; font-size: .68rem; }
.coll-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--violet-50); }
.coll-item div { padding: 4px 6px; display: flex; flex-direction: column; }
.coll-item b { color: var(--violet-900); font-weight: 600; }
.coll-item { cursor: pointer; opacity: .55; transition: all .15s ease; }
.coll-item.on { opacity: 1; border-color: var(--violet); box-shadow: 0 0 0 2px var(--violet-200); }
.coll-item input { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; accent-color: var(--violet); z-index: 1; }
.coll-item button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(42,19,66,.75); color: #fff; cursor: pointer; font-size: .8rem; line-height: 1; }
@media (max-width: 760px) { .hud-tr .hud-btn-accent { font-size: .56rem; } }

/* ---------- Inventaire : fiches objets ---------- */
.fiche-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.fiche { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: grid; grid-template-columns: 120px 1fr; }
.fiche-img { position: relative; background: var(--violet-900); }
.fiche-img img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 120px; }
.fiche-id { position: absolute; left: 6px; bottom: 6px; font: 700 .66rem ui-monospace, Menlo, monospace; color: #fff; background: rgba(91,45,142,.9); padding: 3px 7px; border-radius: 4px; }
.fiche-body { padding: 12px 14px; }
.fiche-body h3 { font-size: 1rem; font-weight: 500; margin-bottom: 6px; }
.fiche dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: .74rem; margin: 0 0 10px; }
.fiche dt { color: var(--muted); }
.fiche dd { margin: 0; color: var(--ink); }
.meter { display: inline-block; width: 60px; height: 4px; background: var(--violet-100); border-radius: 2px; margin-left: 6px; vertical-align: middle; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--violet); }
.sync-note { font-size: .82rem; color: var(--violet); font-weight: 500; margin: -8px 0 16px; }
.kpi-of { font-size: 1.1rem; color: var(--muted); }
@media (max-width: 520px) { .fiche { grid-template-columns: 1fr; } .fiche-img img { aspect-ratio: 16 / 9; } }

/* ---------- Base de données, registre, archives ---------- */
.nav-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--violet); color: #fff; font-size: .66rem; }
.nav-btn.is-active .nav-count { background: #fff; color: var(--violet); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .82rem; margin: 6px 0 4px; }
.check input { accent-color: var(--violet); margin-top: 3px; }
.sev-critique { background: var(--violet-900); color: #fff; }
.sev-majeure { background: var(--violet); color: #fff; }
.sev-mineure { background: var(--violet-100); color: var(--violet-700); }
.ano-table td { vertical-align: top; }
.ano-table select, .ano-table input { font-size: .8rem; padding: 6px 8px; min-width: 120px; }
.ano-table input { min-width: 180px; }
.ano-table .saved { outline: 2px solid var(--violet); }
.nowrap { white-space: nowrap; }
#anoFilter { width: auto; padding: 7px 12px; font-size: .8rem; }
#accessCode { width: 200px; padding: 7px 12px; font-size: .8rem; }
.arch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.arch-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.arch-img { aspect-ratio: 16 / 10; background: var(--violet-50); display: grid; place-items: center; }
.arch-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.arch-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------- Onboarding ---------- */
.tuto-btn { font: inherit; font-size: .75rem; font-weight: 600; color: var(--violet); background: var(--violet-50); border: 1px solid var(--violet-200); border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.tuto-btn:hover { background: var(--violet-100); }
.ob { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.ob-backdrop { position: absolute; inset: 0; background: rgba(42, 19, 66, .55); backdrop-filter: blur(4px); animation: fade .25s ease; }
.ob-dialog { position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 22px; padding: 28px 32px 24px; box-shadow: 0 30px 80px rgba(42, 19, 66, .35); animation: obIn .3s ease; }
@keyframes obIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.ob-skip { position: absolute; top: 16px; right: 18px; font: inherit; font-size: .78rem; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 6px; }
.ob-skip:hover { color: var(--violet); }
.ob-art { height: 150px; margin: 4px -32px 20px; background: linear-gradient(160deg, var(--violet-50), #fff); display: grid; place-items: center; color: var(--violet); border-bottom: 1px solid var(--line); }
.ob-art svg { width: 210px; height: 130px; }
.ob-dialog h2 { font-size: 1.45rem; font-weight: 500; margin-bottom: 10px; }
.ob-text { font-size: .92rem; color: var(--ink-2); min-height: 96px; }
.ob-text ul { margin: 6px 0 0; padding-left: 18px; }
.ob-text li { margin: 3px 0; }
.ob-text .tag { margin-right: 4px; }
.ob-dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0 16px; }
.ob-dots span { width: 7px; height: 7px; border-radius: 999px; background: var(--violet-200); transition: all .2s ease; }
.ob-dots span.on { width: 22px; background: var(--violet); }
.ob-actions { display: flex; justify-content: space-between; gap: 10px; }
.ob-actions .btn:disabled { visibility: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .nav::-webkit-scrollbar { display: none; }
  .brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .model-status { margin-left: auto; }
  main { padding: 20px 16px; }
  .banner { margin: 12px 16px 0; flex-direction: column; align-items: flex-start; }
  .audit-layout, .grid-2, .params { grid-template-columns: 1fr; }
  .steps, .kpis { grid-template-columns: 1fr 1fr; }
  .hero-constellation { display: none; }
  .report { padding: 28px 20px; }
  .report .meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .steps, .kpis { grid-template-columns: 1fr; }
  .brand-text { font-size: .7rem; }
}

/* ---------- Print (rapport PDF) ---------- */
@media print {
  .topbar, .footer, .banner, .no-print, .ob, .view:not(#view-rapport) { display: none !important; }
  #view-rapport { display: block !important; }
  body { background: #fff; }
  main { padding: 0; }
  .report { border: 0; box-shadow: none; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
