/* Espace Bureau UDPS 28 — styles (clair / sombre automatique)
   Charte ANPS : Bleu #002B6B · Rouge #E30613 · Blanc #FFFFFF · Montserrat (titres) · Arial (textes) */
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat.woff2") format("woff2-variations"), url("/fonts/montserrat.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-blue: #002B6B;
  --brand-red: #E30613;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #1b1f24;
  --muted: #5c6670;
  --border: #e2e5e9;
  --primary: #002B6B;
  --primary-contrast: #ffffff;
  --primary-soft: #e6ecf5;
  --accent: #E30613;
  --danger: #C70511;
  --danger-soft: #fdecee;
  --warn: #b35c00;
  --warn-soft: #fff4e5;
  --ok: #2b8a3e;
  --ok-soft: #ebfbee;
  --info: #1864ab;
  --info-soft: #e7f1fb;
  --neutral-soft: #eef0f3;
  --p-urgente: #E30613;
  --p-haute: #e8590c;
  --p-normale: #4c7bd9;
  --p-basse: #adb5bd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: Arial, Helvetica, sans-serif;
  --font-title: "Montserrat", Arial, Helvetica, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #182029;
    --surface-2: #1d2631;
    --text: #e6e9ee;
    --muted: #9aa5b1;
    --border: #2c3642;
    --primary: #8fb4e3;
    --primary-contrast: #0f1419;
    --primary-soft: #1f2f45;
    --accent: #E30613;
    --danger: #ff6b6b;
    --danger-soft: #3a1d22;
    --warn: #ffb35c;
    --warn-soft: #3a2a15;
    --ok: #69db7c;
    --ok-soft: #173322;
    --info: #74c0fc;
    --info-soft: #182c40;
    --neutral-soft: #26303b;
    --p-basse: #6c757d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, .tile .n, .brand-sub, .dlg-head h2, .day-label { font-family: var(--font-title); }
h1 { font-weight: 700; }
a { color: var(--primary); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.loading, .empty { color: var(--muted); padding: 24px 4px; text-align: center; }
.empty { font-size: 14px; padding: 16px 4px; }

/* ---------- Boutons & champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.task-row:focus-visible, .nav a:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
}
.field textarea { min-height: 96px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Structure ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--brand-blue); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
/* Logo officiel : version blanche sur le bleu (menu, barre), version couleur sur fond clair (connexion) */
.logo { display: block; height: 38px; width: auto; }
.brand-sub { font-size: 13px; font-weight: 600; opacity: .9; }
.topbar .spacer { flex: 1; }
.topbar .btn-ghost { color: #fff; min-height: 36px; padding: 0 10px; }

main#view { padding: 16px 16px 110px; max-width: 1100px; margin: 0 auto; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px;
  font-size: 11px; color: var(--muted); text-decoration: none;
}
.tabbar a.active { color: var(--primary); font-weight: 700; }
.tabbar svg.i { width: 22px; height: 22px; }

.fab {
  position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 11;
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
  display: flex; align-items: center; justify-content: center;
}
.fab svg.i { width: 26px; height: 26px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; }
  .topbar, .tabbar, .fab { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh;
    padding: 18px 14px; background: var(--brand-blue); color: #fff;
  }
  .sidebar .brand { flex-direction: column; align-items: stretch; gap: 8px; padding: 4px 4px 18px; text-align: center; }
  .sidebar .logo { height: auto; width: 100%; max-width: 210px; margin: 0 auto; }
  .sidebar .btn-new { margin: 0 4px 14px; background: var(--accent); border-color: var(--accent); color: #fff; }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 500;
  }
  .nav a:hover { background: rgba(255, 255, 255, .08); }
  .nav a.active { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 700; }
  .sidebar .me { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, .15); font-size: 13px; }
  .sidebar .me strong { display: block; font-size: 14px; }
  .sidebar .me .btn { margin-top: 10px; width: 100%; background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
  main#view { padding: 28px 32px 48px; }
}

/* ---------- En-têtes de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; line-height: 1.2; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Cartes & tuiles ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card h2 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h2 .count { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); }

.since {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px;
  background: var(--primary-soft); border-color: transparent;
}
.since svg.i { width: 22px; height: 22px; color: var(--primary); margin-top: 2px; }
.since p { margin: 0; }
.since .when { font-size: 13px; color: var(--muted); margin-top: 2px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: block; text-decoration: none; color: inherit; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--primary); }
.tile .n { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 13px; color: var(--muted); }
.tile.is-alert .n { color: var(--danger); }

.dash-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.stack { display: grid; gap: 16px; }

/* ---------- Tâches ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 12px 12px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; overflow: hidden;
}
.card .task-row { background: var(--surface-2); }
.task-row:hover { border-color: var(--primary); }
.prio-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--p-normale); }
.prio-urgente .prio-bar { background: var(--p-urgente); }
.prio-haute .prio-bar { background: var(--p-haute); }
.prio-basse .prio-bar { background: var(--p-basse); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.prio-label { font-size: 12px; font-weight: 700; color: var(--p-haute); }
.prio-urgente .prio-label { color: var(--p-urgente); }

.pill, .chip, .due, .badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill { background: var(--neutral-soft); color: var(--muted); }
.pill.s-en_cours { background: var(--info-soft); color: var(--info); }
.pill.s-en_attente { background: var(--warn-soft); color: var(--warn); }
.pill.s-terminee { background: var(--ok-soft); color: var(--ok); }
.chip { background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 500; }
.chip.muted { color: var(--muted); border-style: dashed; }
.chip em { font-style: normal; color: var(--warn); font-weight: 600; }
.due { color: var(--muted); padding-left: 2px; }
.due svg.i { width: 14px; height: 14px; }
.due.late { color: var(--danger); background: var(--danger-soft); padding-left: 8px; }
.due.soon { color: var(--warn); }
.badge { background: var(--primary-soft); color: var(--primary); }
.badge.off { background: var(--neutral-soft); color: var(--muted); }

/* ---------- Filtres ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters .search { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters { grid-template-columns: 2fr repeat(4, 1fr); } .filters .search { grid-column: auto; } }
.filters .field label { font-size: 12px; }
.result-count { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

/* ---------- Activité ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed .avatar { width: 28px; height: 28px; font-size: 11px; }
.feed time { display: block; font-size: 12px; color: var(--muted); }
.feed .ia { background: #7048e8; }
.day-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 16px 0 4px; }

.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-contrast); font-weight: 700; font-size: 13px;
}

/* ---------- Mails à trier ---------- */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.config-status { margin-bottom: 14px; font-size: 14px; }
.config-status p { margin: 0 0 4px; }
.config-status svg.i { width: 15px; height: 15px; color: var(--ok); vertical-align: -2px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--neutral-soft); border-radius: 12px; max-width: 100%; overflow-x: auto; }
.seg-btn { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.mail-list { display: grid; gap: 12px; }
.mail-card { display: flex; flex-direction: column; gap: 10px; border-left: 4px solid var(--border); }
.mail-card.is-urgent { border-left-color: var(--accent); }
.mail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.mail-from { font-weight: 700; }
.mail-head time { color: var(--muted); margin-left: auto; }
.badge.urgent { background: var(--danger-soft); color: var(--danger); }
.mail-subject { margin: 0; font-weight: 600; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.mail-summary { margin: 0; overflow-wrap: anywhere; }
.proposal { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); }
.proposal-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--primary); }
.proposal-label svg.i { width: 14px; height: 14px; }
.events { list-style: none; margin: 0; padding: 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.events svg.i { width: 14px; height: 14px; vertical-align: -2px; color: var(--muted); }
.mail-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.error-text { color: var(--danger); }
.mail-alert { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; border-left: 4px solid var(--accent); }
.mail-alert > svg.i { width: 26px; height: 26px; color: var(--accent); }
.mail-alert small { display: block; color: var(--muted); font-size: 13px; }
.mail-alert em { color: var(--danger); font-style: normal; font-weight: 700; }
.mail-alert:hover { border-color: var(--accent); }
.mail-meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.mail-meta dt { font-weight: 700; color: var(--muted); }
.mail-meta dd { margin: 0; overflow-wrap: anywhere; }
.mail-meta svg.i { width: 14px; height: 14px; vertical-align: -2px; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.5 var(--font); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0; max-height: 50vh; overflow: auto; }
.checks { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.checks legend { font-weight: 700; font-size: 14px; margin-bottom: 6px; padding: 0; width: 100%; }
.checks legend .hint { font-weight: 400; }
.check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; cursor: pointer; background: var(--surface); }
.check:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.check:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.check input { accent-color: var(--primary); margin: 0; width: 16px; height: 16px; flex: none; }
/* Page publique : demande initiale */
body.public { background: var(--bg); }
.public-head { background: var(--brand-blue); color: #fff; display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  font-family: var(--font-title); font-weight: 700; font-size: 15px; }
.public-head .logo { height: 46px; width: auto; }
.public-main { max-width: 860px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.public-main h1 { font-family: var(--font-title); color: var(--primary); margin: 0 0 8px; font-size: 22px; }
.public-section h2 { font-family: var(--font-title); color: var(--primary); font-size: 17px; margin: 0 0 12px;
  padding-bottom: 6px; border-bottom: 3px solid var(--accent); }
.public-section .section-body { gap: 4px 16px; }
.public-section .checks, .public-section .check.wide, .public-section .add-day, .public-section .day-group, .public-section .hint { grid-column: 1 / -1; }
.public-section .day-group[hidden], .public-section .add-day[hidden] { display: none; }
.check.wide { border-radius: 10px; margin: 4px 0; }
.req { color: var(--danger); }
.field.invalid input { border-color: var(--danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 25%, transparent); }
.ai-note { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border-left: 4px solid var(--primary); padding: 10px 12px; border-radius: 8px; }
.sign-zone { display: grid; gap: 8px; margin-top: 12px; }
.sign-label { margin: 6px 0 0; font-weight: 700; }
.sig-pad { width: 100%; max-width: 600px; aspect-ratio: 600 / 220; height: auto; border: 2px dashed var(--primary); border-radius: 10px;
  background: #fff; touch-action: none; cursor: crosshair; }
.public-submit { display: flex; justify-content: center; padding: 8px 0 24px; }
.btn-lg { font-size: 17px; padding: 14px 26px; }
.public-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 16px 16px 32px; }
.dps-form-box { display: grid; gap: 8px; }
.dps-form-box p { margin: 0; }
.form-preview { display: grid; gap: 4px 16px; grid-template-columns: minmax(140px, 1fr) 2fr; font-size: 14px; margin: 0; }
.form-preview dt { color: var(--muted); }
.form-preview dd { margin: 0; }
.form-preview .sec { grid-column: 1 / -1; font-weight: 700; color: var(--primary); margin-top: 8px; }

/* Postes de secours */
.dps-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.dps-card { display: grid; gap: 8px; text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.dps-card:hover { border-color: var(--primary); }
.dps-card.is-urgent { border-left: 4px solid var(--accent); }
.dps-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-family: var(--font-title); font-size: 16px; }
.dps-next { font-size: 14px; }
.badge.ok { background: color-mix(in srgb, #1a7f37 15%, transparent); color: #1a7f37; }
.dps-progress { width: 100%; height: 8px; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-2); appearance: none; }
.dps-progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
.dps-progress::-webkit-progress-value { background: var(--primary); border-radius: 99px; }
.dps-progress::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
.dps-steps { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 2px; }
.dps-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; position: relative; }
.dps-steps li:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 32px; bottom: -6px; width: 2px; background: var(--border); }
.dps-steps li.done:not(:last-child)::after { background: var(--primary); }
.dps-steps .dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  border: 2px solid var(--border); background: var(--surface); color: var(--muted); position: relative; z-index: 1; }
.dps-steps .dot svg.i { width: 16px; height: 16px; }
.dps-steps li.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.dps-steps li.current .dot { border-color: var(--accent); color: var(--accent); }
.dps-steps li.current .lbl { font-weight: 700; color: var(--accent); }
.dps-steps li.todo .lbl { color: var(--muted); }
.dps-steps .lbl { padding-top: 4px; font-size: 14px; }
.dps-steps .lbl small { display: block; color: var(--muted); font-weight: 400; }
.dps-action { border: 2px solid var(--primary); display: grid; gap: 10px; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.doc-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.doc-list select { font: inherit; font-size: 13px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: inherit; }
.doc-list svg.i { width: 14px; height: 14px; }
.dps-action p { margin: 0; }
.mail-meta .pre { white-space: pre-wrap; }
.topbar a.avatar { text-decoration: none; }
.thread { display: grid; gap: 8px; }
.thread-msg { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; background: var(--surface); }
.thread-msg.is-bureau { border-left: 4px solid var(--primary); }
.thread-msg summary { cursor: pointer; font-size: 14px; }
.thread-msg .mail-body { margin-top: 8px; max-height: 35vh; }
.field textarea.tall { min-height: 200px; }
.dlg-body .hint svg.i { width: 14px; height: 14px; vertical-align: -2px; color: var(--primary); }

/* ---------- Équipe ---------- */
.team { display: grid; gap: 10px; }
@media (min-width: 700px) { .team { grid-template-columns: repeat(2, 1fr); } }
.member { display: flex; gap: 12px; align-items: center; }
.member .info { flex: 1; min-width: 0; }
.member .info strong { display: block; }
.member .info span { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.member.inactive { opacity: .6; }

/* ---------- Fenêtre (dialog) ---------- */
.dialog {
  width: min(680px, 100vw); max-height: 92vh; padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.dialog::backdrop { background: rgba(10, 15, 25, .5); }
@media (max-width: 640px) {
  .dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
}
.dlg-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.dlg-head h2 { margin: 0; font-size: 17px; flex: 1; }
.dlg-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.dlg-foot { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 4px; }
.dlg-foot .left { margin-right: auto; }
.meta-line { font-size: 13px; color: var(--muted); margin: 0; }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.banner p { margin: 0; flex: 1; min-width: 180px; }
.section-title { font-size: 14px; font-weight: 700; margin: 8px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.comment header { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.comment header strong { color: var(--text); }
.comment p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
details.history summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--brand-blue); }
.login .card { width: min(440px, 100%); padding: 28px 24px; }
.login .brand { flex-direction: column; color: var(--muted); margin-bottom: 18px; }
.login .logo { height: auto; width: 100%; max-width: 280px; margin: 0 auto; }
.login .brand-sub { font-size: 15px; }
.login h1 { font-size: 20px; margin: 0 0 6px; }
.login .accounts { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.login .account { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.login .account:hover { border-color: var(--primary); background: var(--surface-2); }
.login .account > span:not(.avatar) { flex: 1; }
.login .account small { display: block; color: var(--muted); }
.btn-ms { width: 100%; min-height: 46px; margin-top: 12px; }
.login .btn-ms + .hint { text-align: center; margin-top: 8px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 0; font-size: 12.5px; color: var(--muted); }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.test-note { margin-top: 18px; font-size: 12.5px; color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #1b1f24; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
