/* =============================================================================
   APPLICATION LOCATAIRE — mise en forme
   Pensée pour un téléphone tenu d'une main, souvent en voiture devant le portail :
   gros boutons, contrastes forts, peu de texte. Thème clair et sombre automatiques.
   ============================================================================= */

:root {
  --fond: #f3f5f4;
  --carte: #ffffff;
  --texte: #16211b;
  --discret: #5b6b62;
  --bord: #dbe3de;
  --vert: #1d6b45;
  --vert-clair: #e3f1e9;
  --ambre: #9a5b00;
  --ambre-clair: #fff3df;
  --rouge: #b3261e;
  --rouge-clair: #fde8e6;
  --rayon: 16px;
  --ombre: 0 1px 2px rgb(0 0 0 / 6%), 0 2px 8px rgb(0 0 0 / 4%);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0f1512;
    --carte: #18211c;
    --texte: #e6eee9;
    --discret: #9aaba1;
    --bord: #2a3730;
    --vert: #4cc38a;
    --vert-clair: #173326;
    --ambre: #f0b44c;
    --ambre-clair: #33270f;
    --rouge: #ff8a80;
    --rouge-clair: #3a1715;
    --ombre: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.entete {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  font-weight: 650;
  font-size: 18px;
}

main { max-width: 560px; margin: 0 auto; padding: 0 16px 24px; }

h1 { font-size: 24px; margin: 8px 0 16px; line-height: 1.2; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); margin: 24px 0 8px; font-weight: 600; }
p { margin: 0 0 12px; }

.chargement { color: var(--discret); text-align: center; margin-top: 40vh; }
.discret { color: var(--discret); font-size: 15px; }
.centre { text-align: center; }

.bloc {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--ombre);
}

/* ---- Formulaires ---- */

label { display: block; font-weight: 600; margin-bottom: 6px; }

input {
  width: 100%;
  font: inherit;
  font-size: 20px;
  padding: 14px;
  border: 1.5px solid var(--bord);
  border-radius: 12px;
  background: var(--carte);
  color: var(--texte);
  margin-bottom: 12px;
}
input:focus { outline: 3px solid color-mix(in srgb, var(--vert) 35%, transparent); border-color: var(--vert); }
input.code { letter-spacing: .5em; text-align: center; font-size: 28px; font-variant-numeric: tabular-nums; }

button, .bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 650;
  border-radius: 12px;
  border: none;
  background: var(--vert);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) { button, .bouton { color: #08130d; } }
button:disabled { opacity: .5; cursor: default; }
button.secondaire, .bouton.secondaire { background: transparent; color: var(--vert); border: 1.5px solid var(--bord); }
button.danger { background: transparent; color: var(--rouge); border: 1.5px solid var(--bord); }
button.lien { background: none; color: var(--vert); min-height: 44px; width: auto; padding: 8px; font-weight: 600; }

.rangee { display: flex; gap: 8px; }
.rangee > * { flex: 1; }

.erreur { color: var(--rouge); font-weight: 600; }

/* ---- Boutons d'accès (écran Ouvrir) ---- */

.acces {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 84px;
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--rayon);
  border: 1px solid var(--bord);
  background: var(--carte);
  color: var(--texte);
  text-align: left;
  box-shadow: var(--ombre);
}
.acces .pastille {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--vert-clair);
  color: var(--vert);
}
.acces .pastille svg { width: 28px; height: 28px; }
.acces .titre { display: block; font-size: 19px; font-weight: 650; }
.acces .etat { display: block; font-size: 15px; font-weight: 500; color: var(--discret); }
.acces.delai .pastille { background: var(--ambre-clair); color: var(--ambre); }
.acces.delai .etat { color: var(--ambre); }
.acces.bloque .pastille { background: var(--rouge-clair); color: var(--rouge); }
.acces.bloque .etat { color: var(--rouge); }

/* ---- Bandeaux d'information ---- */

.bandeau { border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 16px; }
.bandeau.info { background: var(--vert-clair); }
.bandeau.alerte { background: var(--ambre-clair); }
.bandeau.grave { background: var(--rouge-clair); }
.bandeau strong { display: block; margin-bottom: 4px; }
.bandeau p:last-child { margin-bottom: 0; }

/* ---- Compte à rebours ---- */

.decompte { text-align: center; padding-top: 8px; }
.anneau { position: relative; width: 240px; height: 240px; margin: 8px auto 20px; }
.anneau svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anneau circle { fill: none; stroke-width: 12; }
.anneau .piste { stroke: var(--bord); }
.anneau .progression { stroke: var(--ambre); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.anneau.ok .progression { stroke: var(--vert); }
.anneau .centre-anneau {
  position: absolute; inset: 0;
  display: grid; place-content: center;
  font-variant-numeric: tabular-nums;
}
.anneau .temps { font-size: 56px; font-weight: 700; line-height: 1; }
.anneau .sous { color: var(--discret); font-size: 15px; margin-top: 6px; }
.anneau .symbole { font-size: 72px; line-height: 1; }

.tourne {
  width: 56px; height: 56px;
  border: 6px solid var(--bord);
  border-top-color: var(--vert);
  border-radius: 50%;
  animation: tourner 0.9s linear infinite;
}
@keyframes tourner { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tourne { animation-duration: 3s; } }

/* ---- Listes (compte, historique, invités) ---- */

.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--bord); }
.liste li:first-child { border-top: none; }
.liste .droite { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.montant { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }

.etiquette { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--vert-clair); color: var(--vert); }
.etiquette.alerte { background: var(--ambre-clair); color: var(--ambre); }
.etiquette.grave { background: var(--rouge-clair); color: var(--rouge); }
.etiquette.neutre { background: var(--fond); color: var(--discret); }

/* ---- Onglets du bas ---- */

.onglets {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--carte);
  border-top: 1px solid var(--bord);
  padding-bottom: env(safe-area-inset-bottom);
}
.onglets button {
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-height: 60px;
  border-radius: 0;
  background: none;
  color: var(--discret);
  font-size: 12px;
  font-weight: 600;
}
.onglets button svg { width: 24px; height: 24px; }
.onglets button[aria-current="page"] { color: var(--vert); }

/* ---- Utilisateurs : ligne d'un sous-utilisateur, code d'activation ---- */

.liste li.personne { display: block; }
.personne-haut { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.actions-personne { display: flex; flex-direction: column; align-items: flex-end; }
.code-activation { margin: 10px 0 0; }
.code-grand { font-size: 36px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
