/* Griot — mobile-first, dark mode par défaut */
:root {
  --bg: #16120e;
  --bg2: #221c15;
  --bg3: #2e261c;
  --texte: #f2ece3;
  --texte2: #b8ad9c;
  --accent: #d98e32;
  --accent-fonce: #a96a1e;
  --vert: #3fae5a;
  --jaune: #e3c229;
  --orange: #e07b2f;
  --gris: #8a8a8a;
  --rouge: #d9534f;
  --bord: #3a3127;
  --ombre: rgba(0, 0, 0, 0.4);
  --radius: 14px;
}

[data-theme='light'] {
  --bg: #faf6ef;
  --bg2: #ffffff;
  --bg3: #f0e8da;
  --texte: #2a2118;
  --texte2: #6e6354;
  --accent: #b56f1a;
  --accent-fonce: #8f5510;
  --bord: #ddd2c0;
  --ombre: rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100%;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ---------- En-tête ---------- */
header.barre {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--bord);
}
header.barre h1 {
  font-size: 1.25rem;
  color: var(--accent);
  letter-spacing: 0.5px;
}
header.barre .actions { display: flex; gap: 8px; align-items: center; }

.statut-reseau {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--bg3);
  color: var(--texte2);
}
.statut-reseau.en-ligne { color: var(--vert); }
.statut-reseau.hors-ligne { color: var(--orange); }

/* ---------- Navigation basse ---------- */
nav.onglets {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  background: var(--bg2);
  border-top: 1px solid var(--bord);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.onglets button {
  flex: 1;
  min-height: 60px;
  background: none;
  border: none;
  color: var(--texte2);
  font-size: 0.68rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
}
nav.onglets button .ico { font-size: 1.45rem; line-height: 1; }
nav.onglets button.actif { color: var(--accent); }
nav.onglets button .badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 22px);
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--rouge);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ---------- Contenu ---------- */
main { padding: 16px; }
.section-titre {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--texte2);
  margin: 18px 0 10px;
}

.carte {
  background: var(--bg2);
  border: 1px solid var(--bord);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.carte .titre { font-weight: 600; margin-bottom: 4px; }
.carte .sous { color: var(--texte2); font-size: 0.85rem; }

.ligne { display: flex; align-items: center; gap: 10px; }
.ligne .pousse { margin-left: auto; }

/* ---------- Boutons ---------- */
button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #1a1206;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
button.btn:active { background: var(--accent-fonce); }
button.btn.secondaire {
  background: var(--bg3);
  color: var(--texte);
  border: 1px solid var(--bord);
}
button.btn.danger { background: var(--rouge); color: #fff; }
button.btn.vert { background: var(--vert); color: #fff; }
button.btn.large { width: 100%; }
button.btn:disabled { opacity: 0.5; }

.btn-icone {
  min-width: 48px;
  min-height: 48px;
  border: none;
  background: var(--bg3);
  color: var(--texte);
  border-radius: 12px;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ---------- Bouton flottant ---------- */
.flottant {
  position: fixed;
  right: 16px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 25;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #1a1206;
  font-size: 1.9rem;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--ombre);
  cursor: pointer;
}

/* ---------- Formulaires ---------- */
label.champ { display: block; margin-bottom: 14px; }
label.champ span.nom {
  display: block;
  font-size: 0.82rem;
  color: var(--texte2);
  margin-bottom: 6px;
}
input[type='text'], input[type='email'], input[type='password'],
input[type='tel'], input[type='number'], textarea, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--bord);
  border-radius: 12px;
  color: var(--texte);
  font-size: 1rem;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

/* Puces sélectionnables (catégories, types) */
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--bord);
  background: var(--bg2);
  color: var(--texte);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.puce.actif {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1206;
  font-weight: 700;
}
.puce.mini { min-height: 28px; padding: 3px 10px; font-size: 0.75rem; cursor: default; }

/* ---------- Confiance ---------- */
.pastille {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pastille.vert { background: var(--vert); }
.pastille.jaune { background: var(--jaune); }
.pastille.orange { background: var(--orange); }
.pastille.gris { background: var(--gris); }

/* ---------- Statuts ---------- */
.etiquette {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
}
.etiquette.active   { background: rgba(63, 174, 90, 0.18); color: var(--vert); }
.etiquette.en_attente { background: rgba(227, 194, 41, 0.18); color: #e3c229; }
.etiquette.etablie  { background: rgba(63, 174, 90, 0.18); color: var(--vert); }
.etiquette.aboutie  { background: rgba(63, 174, 90, 0.18); color: var(--vert); }
.etiquette.refusee  { background: rgba(138, 138, 138, 0.18); color: var(--gris); }
.etiquette.expiree  { background: rgba(138, 138, 138, 0.18); color: var(--gris); }
.etiquette.offre    { background: rgba(217, 142, 50, 0.18); color: var(--accent); }

/* ---------- Écran connexion ---------- */
.ecran-auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  max-width: 420px;
  margin: 0 auto;
}
.ecran-auth .logo {
  text-align: center;
  margin-bottom: 28px;
}
.ecran-auth .logo .embleme { font-size: 3.2rem; }
.ecran-auth .logo h1 { color: var(--accent); font-size: 2rem; letter-spacing: 1px; }
.ecran-auth .logo p { color: var(--texte2); font-size: 0.9rem; margin-top: 6px; }

/* ---------- Modale ---------- */
.voile {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modale {
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.modale h2 { margin-bottom: 16px; font-size: 1.15rem; }

/* ---------- Étoiles ---------- */
.etoiles { display: flex; gap: 6px; font-size: 2rem; }
.etoiles button { background: none; border: none; cursor: pointer; font-size: inherit; filter: grayscale(1); }
.etoiles button.actif { filter: none; }

/* ---------- Divers ---------- */
.vide {
  text-align: center;
  color: var(--texte2);
  padding: 36px 16px;
  font-size: 0.95rem;
}
.vide .ico { font-size: 2.4rem; display: block; margin-bottom: 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  background: var(--bg3);
  color: var(--texte);
  border: 1px solid var(--bord);
  padding: 12px 20px;
  border-radius: 99px;
  box-shadow: 0 4px 16px var(--ombre);
  font-size: 0.9rem;
  max-width: 92vw;
  text-align: center;
}

.stat-grille {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--bg2);
  border: 1px solid var(--bord);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat .valeur { font-size: 1.7rem; font-weight: 800; color: var(--accent); }
.stat .nom { font-size: 0.75rem; color: var(--texte2); margin-top: 4px; }

@media (min-width: 700px) {
  main, header.barre { max-width: 640px; margin-left: auto; margin-right: auto; }
  nav.onglets { max-width: 640px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
}
