/* Secours+ — mobile d'abord, fort contraste, aucune police externe (connexions faibles). */
:root {
  --red: #b91c1c;
  --red-dark: #991b1b;
  --ink: #111827;
  --muted: #4b5563;
  --line: #d1d5db;
  --bg: #ffffff;
  --soft: #f3f4f6;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.container { max-width: 42rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.35rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 1.25rem 0 0.5rem; }
a { color: var(--red-dark); }
.hero { font-size: 2.6rem; color: var(--red); margin-bottom: 0.25rem; }
.lead { font-size: 1.2rem; }
.strong { font-weight: 700; }
.hint { color: var(--muted); font-size: 0.9rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; background: var(--soft); padding: 0.5rem; border-radius: 0.5rem; }

.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; max-width: 42rem; margin: 0 auto; padding: 0.75rem 1rem; border-bottom: 3px solid var(--red); }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.4rem; color: #0b3a82; text-decoration: none; }
.brand img { display: block; width: 44px; height: 44px; }
.logo-hero { display: block; width: min(280px, 70vw); height: auto; margin: 0.5rem auto 1rem; }
.auth-logo { display: block; width: 96px; height: 96px; margin: 0.5rem auto 0; }
.center { text-align: center; }
.public-brand { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.5rem 1rem; font-weight: 800; font-size: 1.2rem; color: #0b3a82; }
.public-brand img { display: block; width: 40px; height: 40px; }
.stats { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.stats li { background: var(--soft); border-radius: 0.75rem; padding: 0.6rem 0.75rem; }
.stats strong { font-size: 1.5rem; display: block; color: var(--red); }
.topnav { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: center; }
.topnav a, .topnav .link-button { white-space: nowrap; }
.topnav a, .link-button { font: inherit; color: var(--ink); background: none; border: 0; padding: 0.5rem 0; cursor: pointer; text-decoration: underline; }
.inline { display: inline; margin: 0; }
.footer { color: var(--muted); font-size: 0.85rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 48px; padding: 0.6rem 1.2rem; border-radius: 0.75rem; border: 2px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--soft); }
.btn-small { min-height: 40px; padding: 0.3rem 0.8rem; font-size: 0.95rem; }
.btn-xl { min-height: 60px; font-size: 1.3rem; width: 100%; }
.btn-wide { width: 100%; justify-content: space-between; font-size: 1.1rem; }
.btn:focus-visible, .input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.actions form { margin: 0; }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack > label, label { display: block; font-weight: 600; }
.input { display: block; width: 100%; min-height: 48px; margin-top: 0.25rem; padding: 0.5rem 0.75rem; font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 2px solid #6b7280; border-radius: 0.75rem; }
textarea.input { min-height: 4.5rem; }
.field-error { display: block; color: var(--red-dark); font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.span-2 { grid-column: span 2; }
.fieldset { border: 2px solid var(--line); border-radius: 0.75rem; padding: 0.75rem 1rem; }
.fieldset legend { font-weight: 700; padding: 0 0.5rem; }
.check { display: flex; align-items: center; gap: 0.75rem; min-height: 44px; font-weight: 400; }
.check input { width: 1.5rem; height: 1.5rem; }
.inline-form { display: flex; gap: 0.5rem; align-items: stretch; }
.inline-form .input { margin: 0; }

.card { border: 2px solid var(--line); border-radius: 1rem; padding: 1rem 1.25rem; margin: 1rem 0; background: #fff; }
.rows, .plain, .checks, .biglist { list-style: none; margin: 0 0 1rem; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; margin-bottom: 0.5rem; background: var(--soft); border-radius: 0.75rem; }
.rows li.col { flex-direction: column; align-items: flex-start; }
.rows form { margin: 0; }
.plain li { padding: 0.15rem 0; }
.checks { list-style: disc; padding-left: 1.5rem; font-size: 1.1rem; }
.statusline { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.badge { display: inline-block; padding: 0.15rem 0.75rem; border-radius: 999px; font-weight: 700; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.flash { padding: 0.75rem 1rem; border-radius: 0.75rem; font-weight: 700; margin: 0 0 1rem; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: #fee2e2; color: #7f1d1d; }
.alert-box { background: #fee2e2; color: #7f1d1d; padding: 1rem; border-radius: 0.75rem; font-size: 1.1rem; }
details.danger { border: 2px solid #fca5a5; border-radius: 0.75rem; padding: 0.75rem; }
details.danger summary { cursor: pointer; font-weight: 700; color: #7f1d1d; }
.otp-qr svg { width: 220px; height: 220px; }

/* Page d'urgence publique */
.public .container { padding-top: 0.5rem; }
.banner { background: var(--red); color: #fff; padding: 1rem; border-radius: 0.75rem; font-size: 1.5rem; }
.banner-grey { background: #1f2937; }
.person { font-size: 2rem; font-weight: 800; margin: 0.5rem 0; }
.age { font-size: 1.2rem; font-weight: 600; }
.biglist { font-size: 1.35rem; list-style: disc; padding-left: 1.5rem; }
.biglist li { margin-bottom: 0.25rem; }

/* Carte imprimable */
.toolbar { max-width: 42rem; margin: 0 auto; padding: 1rem; }
.cards { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1rem; }
.idcard { width: 85.6mm; height: 54mm; border: 1px solid #000; border-radius: 3mm; overflow: hidden; background: #fff; font-size: 7.5pt; line-height: 1.3; page-break-inside: avoid; break-inside: avoid; }
.idcard-head, .banner, .badge, .btn-primary { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.idcard-head { background: var(--red); color: #fff; font-weight: 800; padding: 1.5mm 3mm; font-size: 8.5pt; }
.idcard-body { display: flex; gap: 3mm; padding: 3mm; align-items: center; }
.idcard-qr svg { width: 30mm; height: 30mm; display: block; }
.idcard-logo { display: block; width: 11mm; height: 11mm; margin-bottom: 1.5mm; }
.idcard-name { display: block; font-size: 12pt; }
.idcard-note { display: block; margin-top: 2mm; }
.idcard-list { list-style: none; margin: 0; padding: 3mm; }
.idcard-list li { margin-bottom: 1.2mm; }

@media (max-width: 30rem) {
  .topnav { flex: 1 1 100%; justify-content: space-between; gap: 0 0.5rem; font-size: 0.88rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; }
}
@media print {
  .noprint, .topbar, .footer { display: none !important; }
  body { font-size: 12pt; }
  @page { margin: 10mm; }
  .cards { padding: 0; gap: 5mm; align-items: flex-start; }
  .idcard { border-color: #000; }
}
