/* VIGIRISK · charte du CDC V5 (§ 4, § 4.1). Règles : DESIGN.md.
   Jetons clairs et sombres : design/tokens.css, chargé avant ce fichier.
   1re partie : reprise à l'identique de css/styles.css du prototype (en-tête, boutons, pastilles,
   cartes, toast). 2e partie : écrans de compte (connexion,
   équipe), absents du prototype, construits avec les mêmes jetons et mesures. */

/* ---------- 1. Prototype : base, en-tête ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
}
.gut {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding-block: 10px;
  background: var(--navy-deep);
  color: var(--on-navy);
  border-bottom: 3px solid var(--accent);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #ffffff;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.badge img {
  width: 36px;
  height: auto;
  display: block;
}
.wm {
  display: grid;
  line-height: 1.1;
}
.wm b {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--on-navy);
}
.wm b i {
  font-style: normal;
  color: #f47315;
}
.wm small {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--on-navy-muted);
}
.pf {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--on-navy-muted);
  min-width: 0;
}
.pf b {
  color: var(--on-navy);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40ch;
}
.tag {
  font-family: var(--font-data);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
[hidden] {
  display: none !important;
}

/* ---------- 1. Prototype : titres, textes, composants ---------- */
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.lead {
  font-size: 14px;
  color: var(--muted);
  max-width: 70ch;
  margin: 0;
}
.note {
  font-size: 12.5px;
  color: var(--fg);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 9px 11px;
  line-height: 1.45;
  margin: 0;
}
.note b {
  color: var(--accent-ink);
}
.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn:hover {
  border-color: var(--muted);
}
.btn.pri {
  background: var(--pri-bg);
  border-color: var(--pri-bg);
  color: var(--pri-fg);
}
.btn.pri:hover {
  filter: brightness(1.06);
}
.btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--fg);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.sm {
  font-size: 12px;
  padding: 4px 9px;
}
.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  font-size: 11.5px;
  border-radius: 10px;
  padding: 2px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.crit {
  background: var(--crit-soft);
  border-color: transparent;
  color: var(--crit);
  font-weight: 600;
}
.chip.ok {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok);
  font-weight: 600;
}
.chip.warn {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
  font-weight: 600;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 2000;
  max-width: calc(100% - 32px);
}
input[type="text"],
input[type="email"],
input[type="password"] {
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 8px;
  width: 100%;
  min-width: 0;
}

/* ---------- 2. Écrans de compte (hors prototype, mêmes jetons) ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 50;
  background: var(--surface);
  color: var(--fg);
  padding: 7px 12px;
  border-radius: 6px;
}
.skip:focus {
  top: 10px;
}
.compte {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.compte-main {
  flex: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding-block: 40px 48px;
  display: grid;
  align-content: start;
  gap: 18px;
}
.compte-main.is-wide {
  max-width: 860px;
}
.compte-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 24px 28px;
  display: grid;
  gap: 18px;
}
/* Titre d'écran (h1) du § 4.1 : Montserrat 800, 22 px ; chapô 14 px gris. */
.compte-panel h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
  color: var(--fg);
  text-wrap: balance;
}
.compte-panel .lead {
  margin-top: -10px;
  text-wrap: pretty;
}
.compte-panel form {
  display: grid;
  gap: 14px;
}
.field {
  display: grid;
  gap: 4px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.field .aide {
  font-size: 12px;
  color: var(--muted);
}
.compte-panel input[type="text"],
.compte-panel input[type="email"],
.compte-panel input[type="password"] {
  font-size: 14px;
  padding: 9px 10px;
  border-radius: 6px;
}
input[aria-invalid="true"] {
  border-color: var(--crit);
}
.code-saisie {
  font-family: var(--font-data);
  font-size: 18px;
  letter-spacing: 0.12em;
}
.btn.large {
  width: 100%;
  justify-content: center;
  min-height: 40px;
}
.compte-pied {
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  margin: 0;
  text-wrap: pretty;
}
.alerte {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--crit-soft);
  color: var(--fg);
  border-radius: 5px;
  padding: 9px 11px;
  font-size: 13px;
  margin: 0;
}
.alerte svg {
  color: var(--crit);
  flex: none;
  margin-top: 2px;
}
.note.is-locked {
  background: var(--warn-soft);
}
.note.is-locked b {
  color: var(--warn);
}
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  font-weight: 600;
}
.ariane {
  font-size: 12.5px;
  margin: 0;
}
.ariane a {
  color: var(--muted);
}
.etapes {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 18px;
}
.etapes li::marker {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent-ink);
}
.etapes p {
  margin: 0 0 10px;
}
.qr {
  margin: 0;
  display: grid;
  gap: 8px;
  justify-items: start;
}
.qr svg {
  display: block;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  max-width: 100%;
  height: auto;
}
.qr figcaption {
  color: var(--muted);
  font-size: 12.5px;
}
.cle {
  display: block;
  margin-top: 4px;
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--fg);
  overflow-wrap: anywhere;
  user-select: all;
}
.codes {
  list-style: none;
  margin: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  background: var(--bg);
  border-radius: 6px;
}
.codes code {
  font-family: var(--font-data);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.compagnies {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.compagnie {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.compagnie:hover {
  border-color: var(--muted);
}
.compagnie:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.compagnie input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: none;
}
.compagnie span {
  display: grid;
  gap: 4px;
  justify-items: start;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.nobr {
  white-space: nowrap;
}
/* Message bref affiché 3 secondes (§ 4.1), sans script. */
.compte .toast {
  margin: 0;
  animation: toast-sortie 0.3s ease 3s forwards;
}
@keyframes toast-sortie {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* Équipe */
.equipe {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.membre {
  scroll-margin-top: 24px;
  display: grid;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.membre:last-child {
  padding-bottom: 0;
}
.membre-qui {
  display: grid;
  gap: 2px;
  justify-items: start;
  min-width: 0;
}
.membre-nom {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.membre-nom small {
  font-weight: 400;
  color: var(--muted);
  font-size: inherit;
}
.membre-email {
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.membre-vide {
  color: var(--muted);
}
.roles {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.roles legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.roles legend span {
  font-weight: 400;
  margin-left: 6px;
}
/* Case à cocher rendue comme le bouton enfoncé du § 4.1 (fond orange pâle, bordure orange). */
.role {
  position: relative;
}
.role input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.role span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
}
.role:hover span {
  border-color: var(--muted);
}
.role input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.role input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.role svg {
  display: none;
  color: var(--accent-ink);
}
.role input:checked + span svg {
  display: block;
}
.retrait summary {
  list-style: none;
  cursor: pointer;
}
.retrait summary::-webkit-details-marker {
  display: none;
}
.retrait p {
  margin: 8px 0 10px;
  color: var(--muted);
  max-width: 52ch;
  text-wrap: pretty;
}
ul.chips {
  list-style: none;
  margin: 0;
  padding: 0;
}
.equipe-section {
  display: grid;
  gap: 8px;
}

@media (max-width: 560px) {
  .compte-main {
    padding-block: 20px 32px;
  }
  .compte-panel {
    padding: 18px 16px 22px;
  }
  .codes {
    grid-template-columns: 1fr;
  }
  .membre .btns,
  .membre .btns .btn,
  .retrait {
    width: 100%;
  }
  .membre .btns .btn {
    justify-content: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
