/* Unicat — Material 3 (style Pixel), police ERSF Sans, accent #1D77BC */

@font-face {
  font-family: "ERSF Sans";
  src: url("../fonts/ERSFSans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #1D77BC;
  --appbar: #1D77BC;
  --on-appbar: #ffffff;
  --primary: #1D77BC;
  --on-primary: #ffffff;
  --primary-container: #d3e4ff;
  --on-primary-container: #001c38;
  --secondary-container: #dbe3f1;
  --on-secondary-container: #141c27;
  --tertiary-container: #d7f3dc;
  --on-tertiary-container: #0b3a17;
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #410002;
  --surface: #f8f9ff;
  --surface-dim: #d8dae0;
  --surface-c-lowest: #ffffff;
  --surface-c-low: #f2f3f9;
  --surface-c: #eceef4;
  --surface-c-high: #e6e8ee;
  --surface-c-highest: #e1e2e8;
  --on-surface: #191c20;
  --on-surface-variant: #43474e;
  --outline: #73777f;
  --outline-variant: #c3c6cf;
  --situation: #e2f4fd;
  --situation-border: #00a0dc;
  --on-situation: #00344a;
  --done: #c9efcf;
  --on-done: #0b3a17;
  --scrim: rgba(0, 0, 0, .45);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 1px 3px 1px rgba(0, 0, 0, .12);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 6px 2px rgba(0, 0, 0, .15);
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --radius-xl: 28px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #a1c9ff;
    --on-primary: #00315c;
    --primary-container: #004882;
    --on-primary-container: #d3e4ff;
    --secondary-container: #3c4758;
    --on-secondary-container: #d7e3f8;
    --tertiary-container: #1e5128;
    --on-tertiary-container: #c9efcf;
    --error: #ffb4ab;
    --error-container: #93000a;
    --on-error-container: #ffdad6;
    --surface: #111318;
    --surface-dim: #111318;
    --surface-c-lowest: #0c0e13;
    --surface-c-low: #191c20;
    --surface-c: #1d2024;
    --surface-c-high: #272a2f;
    --surface-c-highest: #32353a;
    --on-surface: #e1e2e8;
    --on-surface-variant: #c3c6cf;
    --outline: #8d9199;
    --outline-variant: #43474e;
    --situation: #0d3446;
    --situation-border: #3fbdf0;
    --on-situation: #d5f1ff;
    --done: #1e5128;
    --on-done: #c9efcf;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --primary: #a1c9ff;
    --on-primary: #00315c;
    --primary-container: #004882;
    --on-primary-container: #d3e4ff;
    --secondary-container: #3c4758;
    --on-secondary-container: #d7e3f8;
    --tertiary-container: #1e5128;
    --on-tertiary-container: #c9efcf;
    --error: #ffb4ab;
    --error-container: #93000a;
    --on-error-container: #ffdad6;
    --surface: #111318;
    --surface-dim: #111318;
    --surface-c-lowest: #0c0e13;
    --surface-c-low: #191c20;
    --surface-c: #1d2024;
    --surface-c-high: #272a2f;
    --surface-c-highest: #32353a;
    --on-surface: #e1e2e8;
    --on-surface-variant: #c3c6cf;
    --outline: #8d9199;
    --outline-variant: #43474e;
    --situation: #0d3446;
    --situation-border: #3fbdf0;
    --on-situation: #d5f1ff;
    --done: #1e5128;
    --on-done: #c9efcf;
    color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "ERSF Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--surface);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ icons */
.ic { width: 24px; height: 24px; fill: currentColor; flex: none; display: inline-block; vertical-align: middle; }
.ic.s { width: 18px; height: 18px; }
.ic.l { width: 32px; height: 32px; }

/* ------------------------------------------------------------------ layout */
.app { min-height: 100%; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--appbar); color: var(--on-appbar);
  padding-top: var(--sat);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12);
}
.appbar-row { height: 64px; display: flex; align-items: center; gap: 2px; padding: 0 4px; max-width: 1280px; margin: 0 auto; padding-left: max(4px, env(safe-area-inset-left, 0px)); padding-right: max(4px, env(safe-area-inset-right, 0px)); }
.appbar .title { flex: 1; min-width: 0; font-size: 22px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 8px; }
.appbar .title small { display: block; font-size: 13px; opacity: .85; font-weight: 400; margin-top: -2px; }
.appbar .logo { height: 30px; margin-left: 10px; display: block; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; flex: none;
  color: inherit;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.icon-btn:active { background: color-mix(in srgb, currentColor 14%, transparent); }

.shell { flex: 1; display: flex; width: 100%; max-width: 1280px; margin: 0 auto; }
main { flex: 1; min-width: 0; padding: 16px 16px calc(96px + var(--sab)); }

/* bottom navigation (mobile) */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: var(--surface-c); display: flex; justify-content: space-around;
  padding: 12px 0 calc(12px + var(--sab));
  border-top: 1px solid var(--outline-variant);
}
.navbar a, .rail a {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-decoration: none; color: var(--on-surface-variant); font-size: 12px; font-weight: 600; letter-spacing: .3px;
}
.navbar a .pill, .rail a .pill {
  width: 64px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.navbar a.on, .rail a.on { color: var(--on-surface); }
.navbar a.on .pill, .rail a.on .pill { background: var(--secondary-container); color: var(--on-secondary-container); }

/* navigation rail (desktop) */
.rail { display: none; }
@media (min-width: 600px) {
  .navbar { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 14px; width: 96px; flex: none; padding: 20px 0;
    position: sticky; top: calc(64px + var(--sat)); height: calc(100vh - 64px - var(--sat)); align-self: flex-start;
    padding-left: env(safe-area-inset-left, 0px);
  }
  .rail a { max-width: none; flex: none; }
  main { padding: 20px 24px calc(40px + var(--sab)); }
}

/* ------------------------------------------------------------------ typography */
h1, h2, h3 { margin: 0; font-weight: 600; }
.display { font-size: 32px; line-height: 40px; font-weight: 700; }
.headline { font-size: 24px; line-height: 32px; font-weight: 600; }
.title-l { font-size: 20px; line-height: 28px; font-weight: 600; }
.title-m { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: .1px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--on-surface-variant); }
.muted { color: var(--on-surface-variant); }
.small { font-size: 14px; }
.section-title { margin: 28px 4px 10px; font-size: 14px; font-weight: 700; color: var(--primary); letter-spacing: .2px; }

/* ------------------------------------------------------------------ cards & lists */
.card {
  background: var(--surface-c-low); border-radius: var(--radius-m); padding: 16px;
  border: 1px solid var(--outline-variant);
}
.card.elev { background: var(--surface-c-lowest); border: 0; box-shadow: var(--shadow); }
.card.filled { background: var(--surface-c-highest); border: 0; }
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.tile {
  display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit;
  background: var(--surface-c-low); border-radius: var(--radius-l); padding: 16px; border: 1px solid var(--outline-variant);
  cursor: pointer; transition: background .15s, box-shadow .15s;
}
.tile:hover { background: var(--surface-c); }
.tile:active { background: var(--surface-c-high); }
.tile .avatar {
  width: 48px; height: 48px; border-radius: 14px; background: var(--primary-container); color: var(--on-primary-container);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex: none;
}
.tile .t { font-weight: 600; font-size: 17px; line-height: 1.25; }
.tile .s { font-size: 14px; color: var(--on-surface-variant); margin-top: 2px; }
.tile .grow { flex: 1; min-width: 0; }
.tile.hero { background: var(--primary-container); color: var(--on-primary-container); border: 0; }
.tile.hero .avatar { background: var(--primary); color: var(--on-primary); }
.tile.hero .s { color: inherit; opacity: .8; }

.list { background: var(--surface-c-low); border-radius: var(--radius-l); overflow: hidden; border: 1px solid var(--outline-variant); }
.li {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 64px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--outline-variant); cursor: pointer;
}
.li:last-child { border-bottom: 0; }
.li:hover { background: var(--surface-c); }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 500; line-height: 1.3; }
.li .s { font-size: 13px; color: var(--on-surface-variant); margin-top: 2px; }
.code {
  min-width: 58px; height: 36px; padding: 0 8px; border-radius: 10px; flex: none;
  background: var(--secondary-container); color: var(--on-secondary-container);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums;
}
.code.big { height: 48px; min-width: 76px; font-size: 22px; border-radius: 14px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  height: 40px; padding: 0 24px; border-radius: 20px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 14px; letter-spacing: .1px; text-decoration: none; white-space: nowrap;
  background: var(--primary); color: var(--on-primary); position: relative; overflow: hidden;
}
.btn:disabled { opacity: .38; cursor: default; }
.btn .ic { width: 18px; height: 18px; }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.outlined { background: transparent; color: var(--primary); border: 1px solid var(--outline); }
.btn.text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn.danger { background: var(--error); color: #fff; }
.btn.lg { height: 56px; border-radius: 28px; font-size: 16px; padding: 0 28px; }
.btn.block { width: 100%; }
.btn.done { background: var(--brand); color: #fff; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--outline); background: transparent;
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: var(--on-surface-variant); text-decoration: none;
}
.chip.on { background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent; }
.chip .ic { width: 18px; height: 18px; }
.chip.link { color: var(--primary); border-color: var(--outline-variant); background: var(--surface-c-lowest); }

/* segmented button */
.seg { display: inline-flex; border: 1px solid var(--outline); border-radius: 20px; overflow: hidden; height: 40px; flex: none; }
.seg button {
  border: 0; background: transparent; padding: 0 18px; font-weight: 700; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 6px;
  color: var(--on-surface);
}
.seg button + button { border-left: 1px solid var(--outline); }
.seg button.on { background: var(--secondary-container); color: var(--on-secondary-container); }

/* search bar */
.search {
  display: flex; align-items: center; gap: 4px; height: 56px; border-radius: 28px; background: var(--surface-c-high);
  padding: 0 8px 0 16px; flex: 1; min-width: 0;
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; height: 100%; }
.search .ic { color: var(--on-surface-variant); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
@media (max-width: 599px) { .toolbar .search { flex-basis: 100%; } }

/* fields */
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px 4px; color: var(--on-surface-variant); }
.field input, .field select {
  width: 100%; height: 56px; border-radius: 4px; border: 1px solid var(--outline); background: transparent;
  padding: 0 16px; font-size: 16px; outline: none;
}
.field input:focus, .field select:focus { border: 2px solid var(--primary); padding: 0 15px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.err { background: var(--error-container); color: var(--on-error-container); padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 16px; font-size: 14px; }
.ok { background: var(--tertiary-container); color: var(--on-tertiary-container); padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 16px; font-size: 14px; }

/* ------------------------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; background: var(--brand); padding-top: var(--sat); }
.login-hero { display: flex; justify-content: center; align-items: center; padding: 48px 16px 32px; }
.login-hero img { width: min(260px, 70vw); }
.login-card {
  flex: 1; background: var(--surface); border-radius: 28px 28px 0 0; padding: 32px 20px calc(32px + var(--sab));
}
.login-card form { max-width: 420px; margin: 0 auto; }
@media (min-width: 600px) {
  .login-wrap { align-items: center; justify-content: center; }
  .login-card { flex: none; width: 460px; border-radius: 28px; margin-bottom: 64px; }
}
.foot-note { font-size: 12px; color: var(--on-surface-variant); text-align: center; margin-top: 24px; }

/* ------------------------------------------------------------------ content items */
.items { display: flex; flex-direction: column; gap: 8px; }
.it { display: flex; gap: 10px; align-items: flex-start; }
.it .mk { flex: none; width: 20px; height: 22px; display: flex; align-items: center; justify-content: center; color: var(--primary); }
.it .mk svg { width: 14px; height: 14px; fill: currentColor; }
.it .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.it.lvl1 { padding-left: 24px; }
.it.note .mk, .it.remind .mk { color: #b26a00; }
.it.note .tx { font-size: 15px; }
.it.bullet .mk svg { width: 9px; height: 9px; }
.it.dash { padding-left: 24px; }
.it.dash .mk { width: 12px; color: var(--on-surface-variant); }
.it.text .mk { display: none; }
.it.h { font-weight: 700; color: var(--primary); margin-top: 12px; }
.it.h .mk { display: none; }
.tx strong { font-weight: 700; }
.tx sup { font-size: .7em; }
img.pict { height: 1.5em; width: auto; vertical-align: middle; border-radius: 4px; margin: 0 2px; background: #fff; }
.refs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ref {
  height: 28px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-c-lowest); color: var(--primary); border: 1px solid var(--outline-variant); text-decoration: none; cursor: pointer;
}
.box { border-radius: var(--radius-m); padding: 12px 14px; border: 1px solid var(--outline-variant); background: var(--surface-c-lowest); }
.box.situation { background: var(--situation); border-color: var(--situation-border); color: var(--on-situation); }

/* ------------------------------------------------------------------ fiche */
.fiche-head { display: flex; gap: 14px; align-items: flex-start; }
.fiche-head .ttl { font-size: 21px; line-height: 1.3; font-weight: 700; }
.sev {
  display: inline-flex; align-items: center; gap: 10px; border-radius: 12px; padding: 8px 14px 8px 8px; margin-top: 12px;
  background: var(--surface-c-lowest); border: 1px solid var(--outline-variant);
}
.sev svg { width: 34px; height: 34px; flex: none; }
.sev b { display: block; font-size: 14px; }
.sev span { font-size: 13px; color: var(--on-surface-variant); }
.sev.g4 { border-color: #d32f2f; }
.sev.g3 { border-color: #e53935; }
.sev.g2 { border-color: #ef8a17; }
.sev.g1 { border-color: #c9b000; }
.sev-mini { width: 28px; height: 28px; flex: none; }
.panel { border-radius: var(--radius-m); padding: 12px 14px; background: var(--surface-c); margin-top: 12px; }
.panel .label { margin-bottom: 6px; }
.instr { font-style: italic; font-weight: 600; }

.flow { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.hist {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-m);
  background: var(--surface-c-low); color: var(--on-surface-variant); cursor: pointer; font-size: 14px; border: 1px dashed var(--outline-variant);
}
.hist .ic { color: var(--brand); width: 20px; height: 20px; }
.hist.choice { background: var(--situation); color: var(--on-situation); border: 1px solid var(--situation-border); }
.hist .tx { flex: 1; }
.step {
  background: var(--surface-c-lowest); border-radius: var(--radius-l); box-shadow: var(--shadow-2); padding: 18px 16px 16px;
  border-left: 5px solid var(--brand); animation: pop .22s ease-out;
}
.step .label { color: var(--brand); margin-bottom: 10px; }
.step .actions { margin-top: 18px; }
.q { margin: 18px 2px 10px; font-weight: 700; font-size: 17px; }
.choices { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 640px) { .choices.two { display: grid; grid-template-columns: 1fr 1fr; } }
.choice {
  text-align: left; border-radius: 14px; border: 2px solid var(--situation-border); background: var(--situation); color: var(--on-situation);
  padding: 14px 16px; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 60px;
  position: relative; overflow: hidden;
}
.choice .tx { flex: 1; }
.endcard { border-radius: var(--radius-l); padding: 18px; display: flex; gap: 14px; align-items: center; font-weight: 700; font-size: 18px; animation: pop .22s ease-out; }
.endcard.ok { background: var(--done); color: var(--on-done); }
.endcard.neutral { background: var(--surface-c-high); color: var(--on-surface); font-size: 16px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ procedure */
.progress { height: 6px; border-radius: 3px; background: var(--surface-c-highest); overflow: hidden; margin: 12px 0 4px; }
.progress > div { height: 100%; background: var(--brand); border-radius: 3px; transition: width .3s; }
.phase { margin-top: 24px; }
.phase-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.phase-h .num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; flex: none;
}
.phase-h .num.ok { background: #2e7d32; }
.phase-h .t { font-weight: 700; font-size: 17px; }
.sec-h { font-size: 13px; font-weight: 800; letter-spacing: .4px; color: var(--primary); margin: 16px 4px 8px; text-transform: uppercase; }
.sub-h { font-size: 14px; font-weight: 700; margin: 12px 4px 6px; color: var(--on-surface-variant); }
.pstep {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius-m); margin-bottom: 8px;
  background: var(--surface-c-low); border: 1px solid var(--outline-variant); transition: background .2s, opacity .2s;
}
.pstep .body { flex: 1; min-width: 0; }
.pstep .tick {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--outline); flex: none; display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.pstep.cur { background: var(--surface-c-lowest); border: 2px solid var(--brand); box-shadow: var(--shadow-2); padding: 13px; }
.pstep.cur .tick { border-color: var(--brand); }
.pstep.ok { background: transparent; opacity: .72; }
.pstep.ok .tick { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.pstep.ok .tick .ic { width: 18px; height: 18px; }
.pstep.todo { opacity: .6; }
.pstep.skip { opacity: .5; background: transparent; border-style: dashed; }
.pstep .actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.pstep.cond { flex-direction: column; gap: 10px; }
.pstep.cond .cq { display: flex; gap: 10px; align-items: center; }
.cond-label { background: var(--situation); color: var(--on-situation); border: 1px solid var(--situation-border); border-radius: 10px; padding: 8px 12px; font-weight: 700; flex: 1; }
.inner { margin-left: 14px; padding-left: 12px; border-left: 3px solid var(--situation-border); }
.banner-done { display: flex; align-items: center; gap: 12px; background: var(--done); color: var(--on-done); padding: 16px; border-radius: var(--radius-l); font-weight: 700; margin-top: 20px; }

/* ------------------------------------------------------------------ pages viewer */
.viewer { position: fixed; inset: 0; z-index: 60; background: #111; display: flex; flex-direction: column; color: #fff; padding-top: var(--sat); }
.viewer .bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: rgba(0,0,0,.6); }
.viewer .bar .t { flex: 1; font-weight: 600; }
.viewer .img { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; touch-action: pan-x pan-y pinch-zoom; }
.viewer .img img { width: 100%; max-width: 900px; background: #fff; }
.viewer .img.zoom img { width: 200%; max-width: none; }
.viewer .nav { display: flex; justify-content: center; gap: 12px; padding: 8px 8px calc(8px + var(--sab)); background: rgba(0,0,0,.6); }
.thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0; }
.thumbs button { border: 1px solid var(--outline-variant); padding: 0; background: #fff; border-radius: 8px; overflow: hidden; cursor: pointer; flex: none; width: 92px; }
.thumbs img { display: block; width: 100%; }

/* ------------------------------------------------------------------ dialogs / snack */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@media (min-width: 640px) { .scrim { align-items: center; } }
.sheet {
  background: var(--surface-c-low); width: 100%; max-width: 720px; max-height: 88vh; overflow: auto; border-radius: 28px 28px 0 0;
  padding: 12px 20px calc(24px + var(--sab)); animation: up .25s ease-out;
}
@media (min-width: 640px) { .sheet { border-radius: 28px; } }
.sheet .grab { width: 32px; height: 4px; border-radius: 2px; background: var(--outline); margin: 4px auto 14px; opacity: .5; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.snack {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--sab)); z-index: 70;
  background: var(--on-surface); color: var(--surface); padding: 14px 18px; border-radius: 6px; box-shadow: var(--shadow-2); font-size: 14px; max-width: calc(100% - 32px);
}
.empty { text-align: center; padding: 40px 16px; color: var(--on-surface-variant); }
.loading { display: flex; justify-content: center; padding: 48px; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--primary-container); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.disclaimer { font-size: 12px; color: var(--on-surface-variant); margin-top: 28px; text-align: center; }
mark { background: color-mix(in srgb, var(--brand) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users td, table.users th { padding: 10px 8px; border-bottom: 1px solid var(--outline-variant); text-align: left; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--secondary-container); color: var(--on-secondary-container); }
.badge.off { background: var(--error-container); color: var(--on-error-container); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }


/* ================================================================== Material : états, ripple, mouvement */
.btn, .tile, .li, .chip, .choice, .icon-btn, .seg button, .hist, .ref, .tick, .thumbs button,
.navbar a .pill, .rail a .pill { position: relative; overflow: hidden; isolation: isolate; }
.btn::before, .tile::before, .li::before, .chip::before, .choice::before, .icon-btn::before, .seg button::before,
.hist::before, .ref::before, .tick::before, .thumbs button::before, .navbar a .pill::before, .rail a .pill::before {
  content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; pointer-events: none; z-index: -1;
  transition: opacity 150ms cubic-bezier(.2, 0, 0, 1); border-radius: inherit;
}
@media (hover: hover) {
  .btn:hover::before, .tile:hover::before, .li:hover::before, .chip:hover::before, .choice:hover::before, .icon-btn:hover::before,
  .seg button:hover::before, .hist:hover::before, .ref:hover::before, .tick:hover::before, .thumbs button:hover::before,
  .navbar a:hover .pill::before, .rail a:hover .pill::before { opacity: .08; }
}
.btn:focus-visible::before, .tile:focus-visible::before, .li:focus-visible::before, .chip:focus-visible::before, .choice:focus-visible::before,
.icon-btn:focus-visible::before, .seg button:focus-visible::before, .tick:focus-visible::before { opacity: .1; }
.btn:active::before, .tile:active::before, .li:active::before, .chip:active::before, .choice:active::before, .icon-btn:active::before,
.seg button:active::before, .hist:active::before, .ref:active::before, .tick:active::before { opacity: .1; }
.icon-btn:hover, .icon-btn:active { background: transparent; }
.tile:hover, .li:hover, .tile:active { background: inherit; }
.tile:hover { background: var(--surface-c-low); }
.tile.hero:hover { background: var(--primary-container); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }
.icon-btn:focus-visible { outline-offset: -3px; }
.search:focus-within { box-shadow: 0 0 0 2px var(--brand) inset; background: var(--surface-c-highest); }
.search { transition: background 150ms, box-shadow 150ms; }

.ripple {
  position: absolute; border-radius: 50%; background: currentColor; opacity: .14; pointer-events: none; z-index: -1;
  transform: scale(0); animation: ripple-in 450ms cubic-bezier(.2, 0, 0, 1) forwards;
}
.ripple.out { animation: ripple-in 450ms cubic-bezier(.2, 0, 0, 1) forwards, ripple-out 350ms 80ms linear forwards; }
@keyframes ripple-in { to { transform: scale(1); } }
@keyframes ripple-out { to { opacity: 0; } }

/* boutons pleins : élévation au survol, enfoncement à l'appui */
.btn { transition: box-shadow 200ms cubic-bezier(.2, 0, 0, 1), transform 120ms cubic-bezier(.2, 0, 0, 1); }
@media (hover: hover) { .btn:not(.text):not(.outlined):not(.tonal):hover { box-shadow: var(--shadow); } }
.btn:active { transform: scale(.98); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.chip { transition: background 150ms, border-color 150ms, color 150ms; }
.chip.on::after { content: none; }
.choice { transition: transform 120ms cubic-bezier(.2, 0, 0, 1), box-shadow 200ms; }
.choice:active { transform: scale(.985); }
@media (hover: hover) { .choice:hover { box-shadow: var(--shadow); } }

/* indicateur de navigation : s'étire depuis le centre (M3) */
.navbar a .pill, .rail a .pill { background: transparent !important; }
.navbar a .pill::after, .rail a .pill::after {
  content: ""; position: absolute; inset: 0; border-radius: 16px; background: var(--secondary-container); z-index: -2;
  transform: scaleX(.3); opacity: 0; transition: transform 250ms cubic-bezier(.2, 0, 0, 1), opacity 150ms;
}
.navbar a.on .pill::after, .rail a.on .pill::after { transform: scaleX(1); opacity: 1; }
.navbar a.on .pill, .rail a.on .pill { color: var(--on-secondary-container); }
.navbar a .ic, .rail a .ic { transition: transform 200ms cubic-bezier(.2, 0, 0, 1); }
.navbar a:active .ic, .rail a:active .ic { transform: scale(.9); }

/* transitions de page : fondu enchaîné */
main.enter > * { animation: fade-through 260ms cubic-bezier(.2, 0, 0, 1) both; }
main.enter > *:nth-child(2) { animation-delay: 25ms; }
main.enter > *:nth-child(3) { animation-delay: 50ms; }
main.enter > *:nth-child(n+4) { animation-delay: 70ms; }
@keyframes fade-through { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* barre de progression linéaire indéterminée sous l'app bar */
.lin { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; overflow: hidden; background: rgba(255, 255, 255, .25); }
.lin > div { position: absolute; top: 0; bottom: 0; background: #fff; border-radius: 2px; animation: lin 1.6s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes lin { 0% { left: -35%; right: 100%; } 60% { left: 100%; right: -90%; } 100% { left: 100%; right: -90%; } }
.appbar { position: sticky; }

/* indicateur circulaire indéterminé M3 */
.cprog { width: 44px; height: 44px; animation: cp-rot 1.4s linear infinite; }
.cprog circle { fill: none; stroke: var(--brand); stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: 1 200; stroke-dashoffset: 0; animation: cp-dash 1.4s ease-in-out infinite; }
@keyframes cp-rot { to { transform: rotate(360deg); } }
@keyframes cp-dash { 0% { stroke-dasharray: 1 200; stroke-dashoffset: 0; } 50% { stroke-dasharray: 90 200; stroke-dashoffset: -30; } 100% { stroke-dasharray: 90 200; stroke-dashoffset: -124; } }
.snack { animation: snack-in 250ms cubic-bezier(.2, 0, 0, 1); }
@keyframes snack-in { from { opacity: 0; transform: translate(-50%, 16px); } }

/* ================================================================== mise en page compacte */
.bar-actions { display: flex; }
.section-title { margin: 22px 4px 8px; }
.lic { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-container); color: var(--on-primary-container); display: flex; align-items: center; justify-content: center; flex: none; }
.li { min-height: 56px; padding: 8px 16px; }
.ptiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 600px) { .ptiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.ptile { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; min-height: 112px; position: relative; }
.ptile .avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 14px; }
.ptile .t { font-size: 15px; line-height: 1.25; }
.ptile .badge { position: absolute; top: 12px; right: 12px; }
.ptiles .ptile:first-child { grid-column: span 2; }
@media (min-width: 600px) { .ptiles .ptile:first-child { grid-column: auto; } }

.fiche-card { padding: 14px; }
.fiche-head { align-items: center; gap: 12px; }
.fiche-head .ttl { font-size: 18px; line-height: 1.3; }
.code.big { height: 44px; min-width: 64px; font-size: 19px; border-radius: 12px; }
.sev-ic svg { width: 36px; height: 36px; display: block; }
.sev { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; padding: 6px 10px; margin-top: 10px; border-radius: 8px; border-width: 0 0 0 4px; border-style: solid; background: var(--surface-c); }
.sev b { display: inline; font-size: 13px; }
.sev span { font-size: 13px; }
.panel { padding: 10px 12px; margin-top: 8px; }
.panel .label { margin-bottom: 2px; font-size: 11px; }
.flow { margin-top: 14px; gap: 8px; }
.step { padding: 14px 14px 12px; }
.step .label { margin-bottom: 8px; }
.step .actions { margin-top: 14px; }
.btn.done { height: 44px; padding: 0 22px; border-radius: 22px; font-size: 15px; }
.q { margin: 12px 2px 8px; font-size: 16px; }
.choice { min-height: 52px; padding: 12px 14px; font-size: 15px; }
.hist { padding: 8px 10px; font-size: 13px; }
.endcard { padding: 14px 16px; font-size: 16px; }

.split { display: block; }
@media (min-width: 1000px) {
  .split { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
  .split-side { position: sticky; top: calc(84px + var(--sat)); }
  .split .flow { margin-top: 0; }
}

.pbar { position: sticky; top: calc(64px + var(--sat)); z-index: 5; display: flex; align-items: center; gap: 12px; margin: -16px -16px 0; padding: 10px 16px; background: var(--surface); }
@media (min-width: 600px) { .pbar { margin: -20px -24px 0; padding: 10px 24px; } }
.pbar .pcount { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 44px; }
.pbar .progress { flex: 1; margin: 0; }
.phase { margin-top: 16px; }
.sec-h { margin: 12px 4px 6px; }
.pstep { padding: 10px 12px; margin-bottom: 6px; gap: 10px; }
.pstep.cur { padding: 12px; }
.pstep .tick { cursor: pointer; background: transparent; padding: 0; transition: background 200ms, border-color 200ms, transform 150ms; }
.pstep .tick:active { transform: scale(.9); }
.pstep.ok .tick .ic { animation: tick-in 250ms cubic-bezier(.2, 0, 0, 1.4); }
@keyframes tick-in { from { transform: scale(0); } }
.pstep.todo { opacity: .7; }
.pstep .actions { margin-top: 10px; }
.pstep.cond { padding: 12px; }

.doc-title { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; }
.doc .thumbs { margin-top: 14px; }

/* tablette / iPad */
@media (min-width: 600px) {
  main { max-width: 1100px; }
  .viewer .img img { max-width: 1100px; }
}
@media (min-width: 840px) {
  .list.cols { columns: 2; column-gap: 12px; }
  .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 599px) {
  .ptiles .ptile:first-child { flex-direction: row; align-items: center; min-height: 0; }
}

/* planche « Désignation et emplacement des appareils » intégrée à la fiche */
.diag { margin-top: 12px; padding: 0; overflow: hidden; }
.diag summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; font-weight: 600; position: relative; }
.diag summary::-webkit-details-marker { display: none; }
.diag summary .grow { flex: 1; }
.diag summary .chev { display: flex; transition: transform 200ms cubic-bezier(.2, 0, 0, 1); color: var(--on-surface-variant); }
.diag[open] summary .chev { transform: rotate(90deg); }
.diag summary::before { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity 150ms; }
@media (hover: hover) { .diag summary:hover::before { opacity: .06; } }
.diag-img { display: block; width: 100%; border: 0; padding: 0; background: #fff; cursor: zoom-in; border-top: 1px solid var(--outline-variant); }
.diag-img img { display: block; width: 100%; }
.diag[open] .diag-img { animation: fade-through 220ms cubic-bezier(.2, 0, 0, 1); }
.diag-hint { display: flex; align-items: center; gap: 6px; padding: 8px 14px; }
.seg-3 { width: 100%; }
.seg-3 button { flex: 1; justify-content: center; }
@media (min-width: 1000px) {
  .split-side { max-height: calc(100vh - 100px - var(--sat)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; border-radius: var(--radius-m); }
}

/* écran d'accueil Dépannage */
.dep-home { max-width: 720px; margin: 0 auto; padding-top: 6vh; }
.search-hero { height: 60px; border-radius: 30px; box-shadow: var(--shadow); background: var(--surface-c-lowest); }
.search-hero input { font-size: 17px; }
.cat-grid { display: grid; gap: 10px; margin-top: 20px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .cat-grid { grid-template-columns: 1fr 1fr; gap: 12px; } }
.tile.cat { padding: 14px; gap: 12px; }
.tile.cat .grow { display: flex; flex-direction: column; }
.tile.cat .t { font-size: 16px; }
.tile.cat .s { font-size: 13px; }
.li-head { min-height: 36px; cursor: default; background: var(--surface-c); }
.li-head::before { display: none; }
.chips.scroll .chip { flex: none; }
.chip { min-width: max-content; }
.chip .ic { width: 18px; height: 18px; margin-left: -4px; }
.sev-chips { margin-top: 8px; }
.chip-sev { width: 20px; height: 20px; display: inline-flex; margin-left: -6px; }
.chip-sev svg { width: 20px; height: 20px; }

/* rangée de filtres : catégories + gravité */
.chips.scroll { margin: 0 -16px; padding: 2px 16px; row-gap: 8px; }
.chips.scroll.sev-chips { margin-top: 10px; }
@media (min-width: 600px) {
  .chips.scroll { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
}

.ptile { min-height: 92px; }
.diag-img { position: relative; }
.zoom-badge { position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 16px; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; }
.dlg-scrim { align-items: center; padding: 24px; }
.dlg { background: var(--surface-c-high); border-radius: 28px; padding: 24px 24px 16px; width: 100%; max-width: 360px; box-shadow: var(--shadow-2); animation: dlg-in 220ms cubic-bezier(.2, 0, 0, 1); }
.dlg .headline { font-size: 22px; margin-bottom: 12px; }
.dlg p { margin: 0 0 20px; font-size: 14px; }
.scrim.out { opacity: 0; transition: opacity 150ms; }
@keyframes dlg-in { from { opacity: 0; transform: scale(.92); } }

/* champs : jamais sous 16 px (évite le zoom automatique d'iOS) */
input, select, textarea { font-size: max(16px, 1em); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* visionneuse : 3 niveaux de zoom */
.viewer .img.z2 img { width: 175%; max-width: none; }
.viewer .img.z3 img { width: 260%; max-width: none; }
.viewer .zl { min-width: 44px; font-weight: 700; font-size: 13px; }
.doc-seg { width: 100%; max-width: 360px; margin: 0 0 12px; }

/* tableaux et schémas extraits des documents */
.tbl-wrap { overflow-x: auto; margin: 4px 0; border: 1px solid var(--outline-variant); border-radius: var(--radius-s); }
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid var(--outline-variant); text-align: left; vertical-align: top; }
.tbl th { background: var(--surface-c-high); font-weight: 700; position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td + td, .tbl th + th { border-left: 1px solid var(--outline-variant); }
.tbl td:first-child { font-weight: 600; white-space: nowrap; }
.fig { display: block; position: relative; padding: 0; border: 1px solid var(--outline-variant); border-radius: var(--radius-s); background: #fff; overflow: hidden; cursor: zoom-in; margin: 6px 0; width: 100%; }
.fig img { display: block; width: 100%; height: auto; }
