/* ContactSol — charte Muntadaacom : navy #1d3766, orange #f47a20, gris #444545. */
:root {
  --navy: #1d3766;
  --navy-2: #2a4a85;
  --orange: #f47a20;
  --orange-fonce: #c75b0c;
  --gris: #444545;
  --texte: #1c2333;
  --texte-2: #5b6474;
  --fond: #f4f6fa;
  --carte: #ffffff;
  --bord: #dfe4ec;
  --ok: #157f3b;
  --ok-fond: #e6f4ea;
  --alerte: #a15c00;
  --alerte-fond: #fff4e0;
  --erreur: #b3261e;
  --erreur-fond: #fdecea;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-2); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; color: var(--navy); }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* En-tête */
.entete {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; padding-top: calc(.7rem + env(safe-area-inset-top));
}
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: 1.05rem; letter-spacing: .2px; }
.logo b { color: var(--orange); font-weight: 600; }
.logo svg { width: 28px; height: 28px; flex: none; }
.entete .droite { margin-left: auto; display: flex; gap: .4rem; }
.btn-icone { background: transparent; border: 0; color: inherit; padding: .4rem; border-radius: 10px; cursor: pointer; display: inline-flex; }
.btn-icone:hover { background: rgba(255,255,255,.12); }
.btn-icone svg { width: 22px; height: 22px; }

main { max-width: 760px; margin: 0 auto; padding: 1rem; }

/* Navigation basse (2 écrans + QR) */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--carte); border-top: 1px solid var(--bord);
  display: grid; grid-template-columns: repeat(3, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  border: 0; background: none; padding: .55rem .25rem .6rem; display: flex; flex-direction: column; align-items: center; gap: .15rem;
  font-size: .75rem; color: var(--texte-2); cursor: pointer;
}
.nav button svg { width: 24px; height: 24px; }
.nav button[aria-current="page"] { color: var(--navy); font-weight: 600; }
.nav button[aria-current="page"] svg { color: var(--orange); }

/* Blocs */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 1rem; margin-bottom: 1rem; }
.carte > h2:first-child { display: flex; align-items: center; gap: .4rem; }
.grille { display: grid; gap: .75rem; }
@media (min-width: 560px) { .grille.deux { grid-template-columns: 1fr 1fr; } }
.ligne { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.pousse { margin-left: auto; }
.discret { color: var(--texte-2); font-size: .87rem; }

/* Champs */
label.champ { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 500; color: var(--gris); }
label.champ .etiq { display: flex; align-items: center; gap: .4rem; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=password], input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid var(--bord); border-radius: 10px; background: #fff; font-size: 16px; font-weight: 400; color: var(--texte);
}
textarea { min-height: 120px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(244, 122, 32, .55); outline-offset: 1px; }
.a-verifier input, .a-verifier textarea { border-color: #e9a24f; background: #fffaf3; }
.badge { display: inline-block; font-size: .7rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; background: var(--alerte-fond); color: var(--alerte); }
.badge.ok { background: var(--ok-fond); color: var(--ok); }
.badge.neutre { background: #eef1f6; color: var(--texte-2); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1rem;
  border-radius: 12px; border: 1px solid var(--bord); background: #fff; color: var(--navy); font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:hover { border-color: #c4ccd8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primaire { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primaire:hover { background: var(--navy-2); }
.btn.action { background: var(--orange); border-color: var(--orange); color: #1d1d1d; }
.btn.action:hover { background: #ff8a33; }
.btn.danger { color: var(--erreur); }
.btn.lien { border: 0; background: none; padding: .4rem; min-height: 0; text-decoration: underline; font-weight: 500; }
.btn.plein { width: 100%; }
.btn.geant { min-height: 64px; font-size: 1.05rem; border-radius: 16px; }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; }

/* Scan */
.scan-zone { display: grid; gap: .6rem; }
.apercu-carte { width: 100%; max-height: 260px; object-fit: contain; border-radius: 12px; background: #0f172a; }
.vignettes { display: flex; gap: .5rem; flex-wrap: wrap; }
.vignettes img { width: 120px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--bord); cursor: zoom-in; background: #eee; }
.progression { display: flex; align-items: center; gap: .7rem; padding: .9rem; border-radius: 12px; background: #eef2fa; color: var(--navy); font-weight: 500; }
.rouet { width: 22px; height: 22px; border: 3px solid rgba(29,55,102,.2); border-top-color: var(--orange); border-radius: 50%; animation: tourne .8s linear infinite; flex: none; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rouet { animation-duration: 2.5s; } }

/* Messages */
.msg { padding: .7rem .85rem; border-radius: 10px; font-size: .9rem; margin: .5rem 0; }
.msg.ok { background: var(--ok-fond); color: var(--ok); }
.msg.alerte { background: var(--alerte-fond); color: var(--alerte); }
.msg.erreur { background: var(--erreur-fond); color: var(--erreur); }
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: #1c2333; color: #fff; padding: .65rem 1rem; border-radius: 12px; max-width: calc(100% - 32px); box-shadow: var(--ombre); pointer-events: none;
}

/* Liste de contacts */
.filtres { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .filtres { grid-template-columns: 2fr 1.3fr 1fr 1fr; } }
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.liste li button {
  width: 100%; text-align: left; display: flex; gap: .75rem; align-items: center; padding: .7rem; background: var(--carte);
  border: 1px solid var(--bord); border-radius: 12px; cursor: pointer;
}
.liste li button:hover { border-color: #c4ccd8; }
.avatar { width: 46px; height: 46px; border-radius: 12px; background: #e8edf6; color: var(--navy); display: grid; place-items: center; font-weight: 600; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.liste .infos { min-width: 0; flex: 1; }
.liste .nom { font-weight: 600; color: var(--texte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .sous { font-size: .82rem; color: var(--texte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Fiche / historique */
.histo { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.histo li { padding: .55rem .7rem; border-radius: 10px; background: #f6f8fb; font-size: .9rem; }
dl.fiche { display: grid; grid-template-columns: 110px 1fr; gap: .35rem .75rem; margin: 0; font-size: .92rem; }
dl.fiche dt { color: var(--texte-2); }
dl.fiche dd { margin: 0; word-break: break-word; }

/* Dialogue */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .55); }
dialog .corps { padding: 1.1rem; overflow: auto; max-height: calc(100vh - 140px); }
dialog .pied { padding: .8rem 1.1rem; border-top: 1px solid var(--bord); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
dialog img.zoom { width: 100%; border-radius: 10px; }

/* QR */
.qr-bloc { text-align: center; }
.qr-cadre { background: #fff; border-radius: 18px; padding: 14px; display: inline-block; border: 1px solid var(--bord); width: min(300px, 80vw); }
.qr-cadre svg { width: 100%; height: auto; display: block; }
.qr-nom { font-size: 1.25rem; font-weight: 600; color: var(--navy); margin-top: .8rem; }
.qr-sous { color: var(--texte-2); }
.url { font-size: .8rem; color: var(--texte-2); word-break: break-all; }

/* Connexion */
.connexion { max-width: 420px; margin: 8vh auto 0; padding: 0 16px; }
.connexion .marque { text-align: center; margin-bottom: 1.2rem; }
.connexion .marque svg { width: 56px; height: 56px; }
.codes { font-family: ui-monospace, Menlo, Consolas, monospace; display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; background: #f6f8fb; padding: .7rem; border-radius: 10px; }
.qr-mfa { display: block; margin: .5rem auto; width: 200px; height: 200px; }
code.secret { word-break: break-all; font-size: .8rem; }
