/* ──────────────────────────────────────────────────────────────────────────
   EJMEvent — charte École Jeannine Manuel, même famille que Whozin.
   Fond ardoise clair, panneaux blancs posés, barre charbon, cramoisi EJM réservé
   à la signature de l'école. Le badge de poste est l'objet central côté équipes.
   ────────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Atkinson Hyperlegible Next Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Police des cartes de l'établissement (fournie par l'école) : réservée au badge de poste. */
@font-face {
  font-family: 'ClementePDai';
  font-display: swap;
  src: url('/fonts/ClementePDai-Regular.ttf') format('truetype');
}

:root {
  color-scheme: light;
  --font-sans: 'Atkinson Hyperlegible Next Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Atkinson Hyperlegible Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;

  --ground: #e8eaee;
  --ground-2: #dde0e5;
  --card: #ffffff;
  --card-2: #f5f6f8;
  --bar: #1b1c20;
  --bar-2: #2a2c32;
  --bar-ink: #f3f4f6;
  --bar-ink-2: #b4b8c1;

  --ink: #1a1b1f;
  --ink-2: #4f535c;
  --ink-3: #676b74;
  --rule: #d2d6dc;
  --rule-strong: #b3b8c1;

  --brand: #c8102e;
  --brand-deep: #9c0c24;

  --in: #17703f;
  --in-strong: #1f8a4c;
  --in-wash: #e1f2e7;
  --out: #b42318;
  --out-strong: #d0362a;
  --out-wash: #fbe4e1;
  --warn: #8f5400;
  --warn-strong: #c27a0e;
  --warn-wash: #fcefd5;
  --info: #22549c;
  --info-wash: #e2ebf8;
  --stamp-blend: multiply;
  --paper: #ffffff;

  --radius-card: 14px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 1px rgb(16 18 24 / .04), 0 2px 5px rgb(16 18 24 / .05), 0 14px 30px -16px rgb(16 18 24 / .3);
  --shadow-pop: 0 24px 60px -24px rgb(16 18 24 / .5), 0 4px 10px rgb(16 18 24 / .08);
  --shadow-inset: inset 0 1px 2px rgb(16 18 24 / .08);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --bar-height: 56px;
  --tabbar-height: 64px;
  --gutter: clamp(16px, 2.4vw, 32px);
  --max-width: 1480px;
}

/* Thème sombre à l'écran seulement (comme Whozin) ; le badge et l'impression restent sur papier clair. */
@media screen and (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #121316;
    --ground-2: #191b1f;
    --card: #1f2126;
    --card-2: #272a30;
    --bar: #0b0c0e;
    --bar-2: #1c1e23;
    --ink: #eceef1;
    --ink-2: #b0b4bd;
    --ink-3: #959aa4;
    --rule: #33363e;
    --rule-strong: #4a4e57;
    --brand: #e2334f;
    --brand-deep: #b3122b;
    --in: #5fd394;
    --in-strong: #34b56c;
    --in-wash: #143524;
    --out: #ff8a7d;
    --out-strong: #f0574a;
    --out-wash: #3d1b18;
    --warn: #f4bb5f;
    --warn-strong: #e09a2c;
    --warn-wash: #3a2b12;
    --info: #8db6f2;
    --info-wash: #182a45;
    --stamp-blend: normal;
    --paper: #e9e8e4;
    --shadow-card: 0 1px 1px rgb(0 0 0 / .3), 0 14px 30px -16px rgb(0 0 0 / .7);
    --shadow-pop: 0 24px 60px -20px rgb(0 0 0 / .8);
  }
}

/* ── Base ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--rule-strong) transparent;
  accent-color: var(--brand);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: color-mix(in oklab, var(--brand) 22%, transparent); color: var(--ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 750; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration-color: color-mix(in oklab, currentColor 35%, transparent); text-underline-offset: .18em; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
code { padding: 1px 6px; border-radius: 5px; background: var(--card-2); font-family: var(--font-mono); font-size: .9em; }
.mono, time, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.hint { font-size: .8125rem; color: var(--ink-2); }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.ell { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.loading { padding: 48px 0; color: var(--ink-2); text-align: center; }

/* ── Mise en page ─────────────────────────────────────────────────────── */

.page { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 28px var(--gutter) 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.page-head p { margin-top: 4px; color: var(--ink-2); }
.stack { display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row.end { justify-content: flex-end; }
.panel { padding: 20px; border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-card); }
.panel + .panel, .panel + .table-wrap, .table-wrap + .panel { margin-top: 16px; }
.panel > h2 + * { margin-top: 12px; }
.narrow { max-width: 560px; }
.search-sm { max-width: 260px; }
.ann-list { margin-top: 16px; }
.thread-head h2 { font-size: 1.05rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.grid2 > .panel { margin: 0; }
.split { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .split, .map-layout { grid-template-columns: 1fr; } }

/* ── Barre du haut (charbon) ──────────────────────────────────────────── */

.bar {
  position: sticky; top: 0; z-index: 1100;
  display: flex; align-items: center; gap: 20px;
  min-height: var(--bar-height);
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  background: var(--bar);
  color: var(--bar-ink);
}
.app-mark { flex: none; display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.app-mark svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; border: 0; border-radius: 8px; background: none;
  color: var(--bar-ink-2); font: inherit; font-weight: 650; font-size: .925rem; white-space: nowrap; cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.nav .ic { width: 17px; height: 17px; }
.nav button:hover { color: var(--bar-ink); background: var(--bar-2); }
.nav button[aria-current='page'] { color: var(--bar-ink); background: var(--bar-2); }
.nav button[aria-current='page']::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -9px;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--brand);
}
.bar :focus-visible { outline-color: var(--bar-ink); }
.tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.who { text-align: right; font-weight: 650; font-size: .925rem; line-height: 1.15; white-space: nowrap; }
.who small { display: block; color: var(--bar-ink-2); font-weight: 400; font-size: .75rem; }
.bar .bar-btn { --btn-ink: var(--bar-ink-2); }
.bar .bar-btn:hover { --btn-bg: var(--bar-2); --btn-ink: var(--bar-ink); }
.bar-select {
  width: auto; max-width: 260px; min-height: 36px; padding: 0 34px 0 12px;
  border-color: transparent; background-color: var(--bar-2); color: var(--bar-ink);
  box-shadow: none; font-size: .9rem; font-weight: 650;
}
.bar-select:hover { border-color: var(--rule-strong); }
.bar-select:focus { border-color: var(--bar-ink-2); box-shadow: none; }
@media (max-width: 1440px) { .bar-staff .who { display: none; } }
/* Sous 1400 px (portables 1366 px de l'école), les onglets passent sur une seconde ligne. */
@media (max-width: 1400px) {
  .bar-staff { flex-wrap: wrap; row-gap: 0; }
  .bar-staff .nav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 10px; }
  .bar-staff .nav button[aria-current='page']::after { bottom: -6px; }
}
/* Téléphone : barre non collante, sélecteur à pleine place, les 6 onglets visibles en grille. */
@media (max-width: 560px) {
  .bar-staff { position: relative; }
  .bar-staff .app-mark span { display: none; }
  .bar-staff .tools { flex: 1; min-width: 0; gap: 6px; }
  .bar-staff .bar-select { flex: 1; min-width: 0; max-width: none; }
  .bar-staff .nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; overflow: visible; padding: 4px var(--gutter) 12px; }
  .bar-staff .nav button { flex-direction: column; justify-content: center; gap: 3px; padding: 8px 4px; font-size: .78rem; white-space: normal; text-align: center; line-height: 1.15; }
  .bar-staff .nav .ic { width: 20px; height: 20px; }
  .bar-staff .nav .count { position: absolute; top: 4px; right: 8px; }
  .bar-staff .nav button[aria-current='page']::after { left: 30%; right: 30%; bottom: 0; }
}

/* Barre d'onglets du bas (équipes, sur téléphone) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: var(--bar);
  box-shadow: 0 -8px 24px -12px rgb(0 0 0 / .4);
}
.tabbar button {
  position: relative; display: grid; justify-items: center; gap: 3px;
  padding: 7px 2px 6px; border: 0; border-radius: 10px; background: none;
  color: var(--bar-ink-2); font: inherit; font-size: .78rem; font-weight: 650; cursor: pointer;
}
.tabbar .ic { width: 24px; height: 24px; }
.tabbar button[aria-current='page'] { color: var(--bar-ink); background: var(--bar-2); }
.tabbar button[aria-current='page']::before {
  content: ''; position: absolute; top: -6px; left: 30%; right: 30%;
  height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
}
.tabbar .sos { color: #ff8a7d; }
.tabbar .sos[aria-current='page'] { color: #fff; background: var(--out-strong); }
.tabbar .sos[aria-current='page']::before { display: none; }
.tabbar .count { position: absolute; top: 3px; left: calc(50% + 6px); }
.tabbar :focus-visible { outline-color: var(--bar-ink); }

/* ── Boutons ──────────────────────────────────────────────────────────── */

.btn {
  --btn-bg: var(--card); --btn-ink: var(--ink); --btn-border: var(--rule-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--btn-border); border-radius: var(--radius);
  background: var(--btn-bg); color: var(--btn-ink);
  font: inherit; font-weight: 650; font-size: .95rem; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn:hover { --btn-bg: var(--card-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; transform: none; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { --btn-bg: var(--ink); --btn-ink: var(--card); --btn-border: var(--ink); }
.btn-primary:hover { --btn-bg: color-mix(in oklab, var(--ink) 86%, var(--card)); }
.btn-in { --btn-bg: var(--in-strong); --btn-ink: #fff; --btn-border: var(--in-strong); }
.btn-in:hover { --btn-bg: color-mix(in oklab, var(--in-strong) 82%, #000); --btn-border: color-mix(in oklab, var(--in-strong) 82%, #000); }
.btn-out { --btn-bg: var(--out-strong); --btn-ink: #fff; --btn-border: var(--out-strong); }
.btn-out:hover { --btn-bg: color-mix(in oklab, var(--out-strong) 82%, #000); --btn-border: color-mix(in oklab, var(--out-strong) 82%, #000); }
.btn-danger { --btn-ink: var(--out); --btn-border: color-mix(in oklab, var(--out) 45%, var(--rule)); }
.btn-danger:hover { --btn-bg: var(--out-wash); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn-ghost:hover { --btn-bg: color-mix(in oklab, var(--ink) 7%, transparent); }
.btn-ghost.btn-danger:hover { --btn-bg: var(--out-wash); }
.btn-sm { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: .875rem; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { min-height: 56px; padding: 0 22px; font-size: 1.1rem; }
.btn-lg .ic { width: 22px; height: 22px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }

/* ── Formulaires ──────────────────────────────────────────────────────── */

.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .875rem; font-weight: 650; }
.field > label .muted, .field > label small { font-weight: 400; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font: inherit; font-size: 1rem;
  box-shadow: var(--shadow-inset); caret-color: var(--brand);
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ink) 16%, transparent); }
textarea { resize: vertical; }
select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23676b74' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; flex: none; box-shadow: none; }
input[type=file] { min-height: 0; padding: 0; border: 0; box-shadow: none; }
.checkbox { display: inline-flex; align-items: center; gap: 10px; font-size: .95rem; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px 18px; align-items: end; }
.form-grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.with-btn { display: flex; gap: 8px; }
details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ''; width: 9px; height: 9px; margin-left: auto; border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-2px, -2px); transition: transform 150ms var(--ease-out); }
details[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
details[open] > summary { margin-bottom: 16px; }

/* ── Contrôle segmenté ────────────────────────────────────────────────── */

.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 12px; background: var(--ground-2); box-shadow: var(--shadow-inset); }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink-2);
  font: inherit; font-weight: 650; font-size: .925rem; cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.segmented button:hover { color: var(--ink); }
.segmented [aria-pressed='true'] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgb(16 18 24 / .12); }
.segmented .ic { width: 16px; height: 16px; }
.segmented .add { color: var(--ink); }

/* ── Puces, compteurs, tampons ────────────────────────────────────────── */

.chip {
  --chip: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; background: color-mix(in oklab, var(--chip) 13%, transparent);
  color: color-mix(in oklab, var(--chip) 88%, var(--ink));
  font-size: .75rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap; vertical-align: middle;
}
.chip .ic { width: 13px; height: 13px; }
.chip-in { --chip: var(--in); } .chip-out { --chip: var(--out); } .chip-warn { --chip: var(--warn); }
.chip-info { --chip: var(--info); } .chip-brand { --chip: var(--brand); }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--info); color: #fff;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.count-out { background: var(--out-strong); }
.nav .count { margin-left: 2px; }

.stamp {
  --stamp: var(--ink-2);
  display: inline-grid; justify-items: center; gap: 1px; padding: 5px 12px 6px;
  border: 2.5px solid var(--stamp); border-radius: 7px; outline: 1px solid var(--stamp); outline-offset: 2px;
  background: color-mix(in oklab, var(--stamp) 6%, transparent); color: var(--stamp);
  font-family: var(--font-sans); font-weight: 800; font-size: .9rem; letter-spacing: .12em; text-transform: uppercase; line-height: 1.05;
  transform: rotate(-5deg); mix-blend-mode: var(--stamp-blend);
}
.stamp small { font-family: var(--font-mono); font-weight: 700; font-size: .78em; letter-spacing: .04em; }
.stamp-in { --stamp: var(--in-strong); } .stamp-out { --stamp: var(--out-strong); } .stamp-warn { --stamp: var(--warn-strong); }
.stamp.is-new { animation: stamp-down 260ms var(--ease-out) both; }
@keyframes stamp-down {
  from { opacity: 0; transform: scale(1.35) rotate(-10deg); filter: blur(3px); }
  to { opacity: 1; transform: scale(1) rotate(-5deg); filter: blur(0); }
}

/* ── Registres (tableaux) ─────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-card); }
.panel .table-wrap { margin: 0 -20px -20px; border-radius: 0 0 var(--radius-card) var(--radius-card); box-shadow: none; border-top: 1px solid var(--rule); }
.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th {
  padding: 10px 14px; border-bottom: 1px solid var(--rule); background: var(--card-2);
  color: var(--ink-2); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-align: left; white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in oklab, var(--ink) 3%, transparent); }
.table td small { display: block; color: var(--ink-2); font-size: .8125rem; }
.table tr.is-off td { color: var(--ink-3); }
.table .actions { text-align: right; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .check { width: 1%; }
/* Registre des postes sur téléphone : une ligne par poste, les absents dessous, sans défilement horizontal. */
@media (max-width: 560px) {
  .registry thead { display: none; }
  .registry tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
  .registry tbody tr:last-child { border-bottom: 0; }
  .registry td { padding: 0; border: 0; }
  .registry td:last-child { grid-column: 1 / -1; font-size: .875rem; }
}

/* ── Encarts ──────────────────────────────────────────────────────────── */

.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--info-wash); font-size: .925rem; }
.notice > .ic { color: var(--info); }
.notice > span { flex: 1; min-width: 200px; }
.notice-warn { background: var(--warn-wash); } .notice-warn > .ic { color: var(--warn); }
.notice-error { background: var(--out-wash); } .notice-error > .ic { color: var(--out); }
.notice-ok { background: var(--in-wash); } .notice-ok > .ic { color: var(--in); }
.page > .notice { margin-bottom: 16px; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; color: var(--ink-2); text-align: center; }
.empty .ic { width: 32px; height: 32px; color: var(--ink-3); }
.empty strong { color: var(--ink); font-size: 1.05rem; }
.empty-line { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.empty-line .ic { color: var(--in); }

/* ── Connexion ────────────────────────────────────────────────────────── */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; display: grid; gap: 20px; padding: 28px 24px; }
/* Le fichier officiel a une marge transparente à droite : on n'en montre que le logo. */
.login-logo { width: min(100%, 340px); height: auto; aspect-ratio: 340 / 85; object-fit: cover; object-position: left center; }
@media (prefers-color-scheme: dark) { .login-logo { padding: 10px 12px; border-radius: 10px; background: #fff; } }
.login-title { display: flex; align-items: center; gap: 12px; padding-top: 18px; border-top: 1px solid var(--rule); }
.login-title svg { width: 44px; height: 44px; flex: none; }
.login-title h1 { font-size: 1.6rem; }

/* ── Équipes : pages et badge de poste ────────────────────────────────── */

.pv { width: 100%; max-width: 620px; margin: 0 auto; padding: 20px 16px calc(var(--tabbar-height) + 40px + env(safe-area-inset-bottom)); display: grid; gap: 16px; align-content: start; }
.pv h1 { font-size: 1.6rem; }

.badge-card {
  /* Un badge reste un badge : papier clair et encres imprimées, quel que soit le thème. */
  --ink-soft: #756c71; --in-strong: #1f8a4c; --stamp-blend: multiply;
  position: relative; width: 100%; min-height: 200px;
  display: grid; padding: 32px 22px 16px;
  border-radius: 16px / 18px;
  background: var(--paper); color: #000; box-shadow: var(--shadow-pop);
  font-family: 'ClementePDai', var(--font-sans); isolation: isolate; overflow: hidden;
}
/* Bandeau de l'émetteur : la seule place du cramoisi EJM sur le badge. */
.badge-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 10px; background: #c8102e; }
.badge-poste { font-family: inherit; font-size: clamp(1.7rem, 8vw, 2.4rem); font-weight: 700; line-height: 1.02; text-transform: uppercase; letter-spacing: -.01em; overflow-wrap: anywhere; }
.badge-poste.is-waiting { color: #756c71; text-transform: none; font-size: 1.5rem; }
/* Quand le tampon est apposé, la liste se resserre pour lui laisser le coin droit. */
.badge-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-top: 14px; }
.badge-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 0; }
.badge-fields dt { color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; align-self: center; }
.badge-fields dd { margin: 0; font-size: 1.05rem; min-width: 0; overflow-wrap: anywhere; }
.badge-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 12px; border-top: 1px solid #e3e0e1; color: var(--ink-soft); font-size: .8rem; }
.badge-foot img { width: 78px; height: auto; }
.badge-foot span { text-align: right; line-height: 1.25; }
.stamp-slot { padding: 0 4px 4px 0; }
.stamp-slot .stamp { font-size: .82rem; }
.present-line { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; color: var(--ink-2); }

.desc { white-space: pre-wrap; font-size: 1.05rem; max-width: 65ch; }
.steps { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps img { width: 100%; border-radius: 10px; cursor: zoom-in; background: var(--card-2); }
.steps p { display: flex; gap: 10px; align-items: baseline; margin-top: 8px; font-size: 1.05rem; }
.step-n { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--card); font-size: .85rem; font-weight: 700; }

.alert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.alert-btn {
  display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 104px; padding: 14px 10px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-card); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.2; text-align: center; cursor: pointer;
  box-shadow: var(--shadow-card); transition: background-color 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.alert-btn .ic { width: 30px; height: 30px; color: var(--out); }
.alert-btn:hover { background: var(--out-wash); }
.alert-btn:active { transform: translateY(1px); }
.alert-btn.alert-urgence { grid-column: 1 / -1; min-height: 76px; grid-auto-flow: column; justify-content: center; border-color: var(--out-strong); background: var(--out-strong); color: #fff; font-size: 1.15rem; }
.alert-btn.alert-urgence .ic { color: #fff; }
.alert-btn.alert-urgence:hover { background: color-mix(in oklab, var(--out-strong) 82%, #000); }

/* ── Messages ─────────────────────────────────────────────────────────── */

.feed { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: min(92%, 560px); padding: 12px 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow-card); }
.msg header { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 4px; font-size: .85rem; }
.msg header time { margin-left: auto; color: var(--ink-3); font-size: .8rem; }
.msg-in { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-out { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--ground-2); box-shadow: none; }
.msg > time, .msg-meta { display: block; margin-top: 4px; color: var(--ink-3); font-size: .78rem; }
.msg-out > time, .msg-out .msg-meta { text-align: right; }
.msg-actions { margin-top: 8px; }
.msg-alert { background: var(--out-wash); }
.msg-flag { display: flex; align-items: center; gap: 8px; color: var(--out); font-weight: 700; }
.msg-flag .ic { width: 18px; height: 18px; }
.msg .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem; }
.msg blockquote { margin: 0 0 6px; padding: 4px 10px; border-radius: 6px; background: color-mix(in oklab, var(--ink) 6%, transparent); color: var(--ink-2); font-size: .85rem; white-space: pre-wrap; }
.msg.is-new { box-shadow: var(--shadow-card), 0 0 0 2px var(--info); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick .btn { min-height: 40px; }
.answered { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--in); font-size: .875rem; font-weight: 650; }
.answered .ic { width: 16px; height: 16px; }
.composer { display: flex; align-items: flex-end; gap: 8px; }
/* Zone de réponse qui grandit avec le texte, sans poignée de redimensionnement du navigateur. */
.composer textarea { flex: 1; min-height: 48px; max-height: 40vh; resize: none; overflow-y: auto; }
.composer .btn { min-height: 48px; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--rule); }
.thread .feed { max-height: 56vh; overflow: auto; padding: 4px 4px 12px; }
.thread .composer { margin-top: 12px; }
.thread .msg-out { background: var(--info-wash); }
.threads { padding: 6px; max-height: 75vh; overflow: auto; }
.thr { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.thr + .thr { margin-top: 2px; }
.thr:hover { background: color-mix(in oklab, var(--ink) 4%, transparent); }
.thr[aria-current='true'] { background: var(--card-2); }
.thr-top { display: flex; align-items: center; gap: 6px; }
.thr-top .ell { flex: 1; min-width: 0; }
.thr .ell { color: var(--ink-2); font-size: .875rem; }
.ann + .ann { margin-top: 12px; }
.ann .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 8px; color: var(--ink-2); font-size: .85rem; }
.ann .meta .ic { width: 16px; height: 16px; }
.ann .txt { white-space: pre-wrap; font-size: 1.05rem; max-width: 75ch; }
.reach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.meter { width: 120px; height: 6px; border-radius: 99px; background: var(--ground-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--in-strong); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); }
.cols h3 { margin-bottom: 6px; font-size: .875rem; }
.cols ul { margin: 0; padding-left: 18px; }

/* ── Tableau de bord ──────────────────────────────────────────────────── */

.lede { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 750; line-height: 1.15; letter-spacing: -.02em; max-width: 30ch; text-wrap: balance; }
.lede .num { font-weight: 700; }
.lede-sub { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; color: var(--ink-2); }
.lede-sub span { display: inline-flex; align-items: center; gap: 6px; }
.lede-sub .ic { width: 17px; height: 17px; }
.lede-sub .is-hot { color: var(--out); font-weight: 650; }
.dash-head { margin-bottom: 28px; }
.notice + .notice, .notice + .dash-head { margin-top: 16px; }
.alert-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--out-wash); }
.alert-row + .alert-row { margin-top: 8px; }
.alert-row > .ic { width: 22px; height: 22px; margin-top: 1px; color: var(--out); }
.alert-row .grow { flex: 1 1 220px; }
.alert-row .txt { white-space: pre-wrap; margin-top: 2px; }
.alert-row time { display: block; margin-top: 2px; color: var(--ink-2); font-size: .8rem; }
.alert-row.is-urgent { background: var(--out-strong); color: #fff; }
.alert-row.is-urgent > .ic, .alert-row.is-urgent time { color: #fff; }

/* ── Postes et carte ──────────────────────────────────────────────────── */

.map { position: relative; height: 280px; border-radius: 12px; background: var(--ground-2); isolation: isolate; overflow: hidden; }
.map.big { height: min(66vh, 680px); min-height: 360px; border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.map .empty { height: 100%; align-content: center; }
.leaflet-container { font-family: var(--font-sans); background: var(--ground-2); }
.leaflet-bar a { color: var(--ink); }
.pin { width: 0; height: 0; }
.pin > div {
  position: absolute; transform: translate(-50%, calc(-100% - 9px));
  padding: 5px 9px; border-radius: 8px; background: #1b1c20; color: #fff;
  font: 700 13px/1.2 var(--font-sans); white-space: nowrap; box-shadow: 0 6px 14px -6px rgb(0 0 0 / .55); cursor: pointer;
}
.pin > div::after { content: ''; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 8px solid transparent; border-top-color: #1b1c20; border-bottom: 0; }
.pin.sel > div { background: var(--info); } .pin.sel > div::after { border-top-color: var(--info); }
.pin.me > div { padding: 7px 12px; font-size: 15px; outline: 2px solid #fff; }
.plan-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.plan-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.push { margin-left: auto; }
.map-settings { display: grid; gap: 18px; margin-top: 16px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; }
#geores:empty { display: none; }
#geores { display: grid; gap: 4px; }
.geo-results { display: grid; gap: 2px; margin: 0 -8px; }
.pl.geo { display: flex; align-items: center; gap: 8px; padding: 8px; }
.pl.geo .ic { width: 16px; height: 16px; flex: none; color: var(--ink-2); }
.map-settings-foot { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--rule); }
.poste-list { display: grid; gap: 4px; max-height: 40vh; overflow: auto; margin: 0 -8px; padding: 0 8px; }
.pl { display: grid; gap: 2px; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pl:hover { background: color-mix(in oklab, var(--ink) 4%, transparent); }
.pl[aria-current='true'] { background: var(--card-2); }
.pl small { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--ink-2); font-size: .8125rem; }
.checklist { max-height: 260px; overflow: auto; margin: 8px 0 12px; border: 1px solid var(--rule); border-radius: var(--radius); }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.checklist label:last-child { border-bottom: 0; }
.checklist label:hover { background: var(--card-2); }
.checklist small { margin-left: auto; color: var(--ink-2); text-align: right; font-size: .8rem; line-height: 1.2; }
.editor h3 { margin: 22px 0 8px; }
.steps.edit { gap: 10px; }
.steps.edit li { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.steps.edit img { width: 84px; height: 64px; object-fit: cover; }
.photo-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-add input { flex: 1; min-width: 200px; }

/* ── Fenêtres, notifications ──────────────────────────────────────────── */

dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: rgb(16 18 24 / .55); }
.dlg { display: grid; gap: 16px; padding: 22px; }
.dlg .row:last-child { justify-content: flex-end; margin-top: 4px; }
.dlg .choice { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); }
dialog.photo { width: auto; max-width: 96vw; background: transparent; box-shadow: none; }
dialog.photo img { max-width: 96vw; max-height: 90vh; border-radius: 12px; }
#toast {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-height) + 24px + env(safe-area-inset-bottom)); z-index: 3000;
  display: flex; align-items: center; gap: 10px; width: fit-content; max-width: calc(100% - 32px); margin: 0 auto; padding: 12px 16px;
  border-radius: 12px; background: var(--bar); color: var(--bar-ink); box-shadow: var(--shadow-pop);
  font-weight: 650; opacity: 0; pointer-events: none; transform: translateY(16px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
#toast .ic { color: #5fd394; }
#toast.show { opacity: 1; transform: none; }
#toast.err { background: var(--out-strong); color: #fff; }
#toast.err .ic { color: #fff; }
body.is-staff #toast { bottom: 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* ── Fiches imprimées ─────────────────────────────────────────────────── */

#print { display: none; }
/* ── Prêt pour le jour J, bilan ─────────────────────────────────────────── */

.ready-list { margin: 0; padding: 0; list-style: none; }
.ready-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.ready-list li:first-child { border-top: 0; padding-top: 0; }
.ready-list > li > .ic { color: var(--warn-strong); }
.ready-list small { display: block; color: var(--ink-2); font-size: .8125rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 16px 20px; border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-card); }
.kpi b { display: block; font-size: 1.75rem; line-height: 1.1; }
.kpi span { color: var(--ink-2); font-size: .875rem; }

/* ── Bandeau de présentation (base de démonstration uniquement) ───────── */

.demo-bar {
  display: flex; align-items: center; gap: 8px 16px;
  padding: 8px var(--gutter);
  background: var(--info-wash); color: var(--info);
  border-bottom: 1px solid color-mix(in oklab, var(--info) 25%, transparent);
}
.demo-label { flex: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 750; font-size: .875rem; line-height: 1.15; }
.demo-label small { display: block; font-weight: 400; font-size: .75rem; }
.demo-who { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.demo-who::-webkit-scrollbar { display: none; }
.demo-who button {
  flex: none; display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 5px 12px;
  border: 1px solid color-mix(in oklab, var(--info) 30%, transparent); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font: inherit; font-size: .8125rem; line-height: 1.2; text-align: left; cursor: pointer;
}
.demo-who button small { display: block; color: var(--ink-2); font-size: .72rem; }
.demo-who .demo-phone { flex-direction: row; align-items: center; gap: 6px; }
.demo-who button:hover { border-color: var(--info); }
.demo-who button[aria-current] { background: var(--info); border-color: var(--info); color: var(--info-wash); }
.demo-who button[aria-current] small { color: inherit; opacity: .8; }
.demo-who .ic { width: 16px; height: 16px; }
.demo-qr { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.demo-qr figure { margin: 0; text-align: center; font-size: .875rem; line-height: 1.3; }
.demo-qr svg { width: 100%; max-width: 170px; margin: 0 auto 8px; border-radius: 8px; }

@media print {
  @page { margin: 14mm; }
  :root { --ground: #fff; }
  body { background: #fff; color: #000; }
  #app, #toast, dialog, .demo-bar { display: none !important; }
  /* Bilan imprimé : encre noire sur papier blanc, même en thème sombre. */
  #print .report * { color: #000 !important; background: none !important; box-shadow: none !important; border-color: #999 !important; }
  #print .report .panel, #print .report .kpi { padding: 0; margin: 12pt 0 0; }
  #print .report .table-wrap { margin: 6pt 0 0; overflow: visible; }
  #print .report .table { font-size: 9.5pt; }
  #print .report tr { break-inside: avoid; }
  #print { display: block; }
}
.sheet { color: #000; font-size: 12pt; }
.sheet + .sheet { break-before: page; }
.sheet header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16pt; padding-bottom: 8pt; margin-bottom: 16pt; border-bottom: 3pt solid #c8102e; }
.sheet header img { width: 230pt; height: auto; aspect-ratio: 340 / 85; object-fit: cover; object-position: left center; }
.sheet header p { text-align: right; font-size: 10pt; line-height: 1.3; }
.sheet h1 { font-family: 'ClementePDai', var(--font-sans); font-size: 26pt; font-weight: 700; text-transform: uppercase; }
.sheet h2 { margin-top: 16pt; font-size: 15pt; }
.sheet-login { display: flex; align-items: center; gap: 16pt; margin: 14pt 0; padding: 12pt; border: 1pt solid #888; border-radius: 10pt; }
.qr svg { display: block; width: 130pt; height: 130pt; }
.steps.print { grid-template-columns: repeat(3, 1fr); gap: 8pt; }
.steps.print img { max-height: 150pt; object-fit: cover; }
.steps.print p { font-size: 10pt; }
.steps.print .step-n { background: #000; color: #fff; }
