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

:root {
  --vert: #2d6a4f;
  --vert-clair: #40916c;
  --ok: #2d9e44;
  --a-verifier: #e8830c;
  --a-remplir: #d62828;
  --fond: #f4f6f4;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
}

body { display: flex; flex-direction: column; }

header {
  background: var(--vert);
  color: white;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.marque { display: flex; align-items: center; gap: 10px; min-width: 0; }
#logo {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: white;
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
}
header h1 { font-size: 1.1rem; line-height: 1.2; }
header h1 span { display: block; font-size: 0.75rem; font-weight: normal; opacity: 0.85; }
.header-actions { display: flex; gap: 6px; }
.header-actions button {
  background: rgba(255,255,255,0.15);
  border: none; color: white;
  font-size: 1.2rem;
  width: 40px; height: 40px;
  border-radius: 8px;
  cursor: pointer;
}
.header-actions button.actif { background: #ffd166; }

#filtres {
  display: flex; gap: 6px;
  padding: 8px 10px;
  background: white;
  border-bottom: 1px solid #ddd;
  overflow-x: auto;
}
.filtre {
  border: 1px solid #ccc;
  background: white;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.filtre.actif { background: var(--vert); color: white; border-color: var(--vert); }
.compte { opacity: 0.7; font-size: 0.75rem; }

#bandeau-admin {
  background: #ffd166;
  padding: 8px 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#bandeau-admin button {
  border: none; background: rgba(0,0,0,0.15);
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
}

main { flex: 1; display: flex; min-height: 0; position: relative; }
#carte { flex: 1; min-height: 0; }

#liste {
  width: 100%;
  overflow-y: auto;
  background: white;
}
#liste table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
#liste th, #liste td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #eee; }
#liste th { background: #fafafa; position: sticky; top: 0; font-size: 0.8rem; color: #555; }
#liste tr { cursor: pointer; }
#liste tr:hover { background: #f0f7f2; }
#liste-vide { padding: 24px; text-align: center; color: #777; }
.btn-voir-carte { border: none; background: #eee; border-radius: 6px; padding: 4px 8px; cursor: pointer; }

.pastille {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  color: white;
  font-size: 0.78rem;
  white-space: nowrap;
}
.pastille.ok { background: var(--ok); }
.pastille.a_verifier { background: var(--a-verifier); }
.pastille.a_remplir { background: var(--a-remplir); }

#onglets { display: none; }

/* Marqueurs */
.marqueur { background: transparent; border: none; }
.marqueur div {
  width: 26px; height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.marqueur.ok div { background: var(--ok); }
.marqueur.a_verifier div { background: var(--a-verifier); }
.marqueur.a_remplir div { background: var(--a-remplir); }

/* Panneaux */
.panneau {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2000;
}
.panneau-contenu {
  background: white;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  position: relative;
}
@media (min-width: 700px) {
  .panneau { align-items: center; }
  .panneau-contenu { border-radius: 16px; }
}
.fermer {
  position: absolute; top: 10px; right: 10px;
  border: none; background: #eee;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 1rem; cursor: pointer;
}
.panneau h2 { margin-bottom: 8px; padding-right: 36px; }
.panneau h3 { margin: 16px 0 8px; font-size: 0.95rem; }
.panneau label { display: block; margin: 12px 0; font-size: 0.9rem; font-weight: 600; }
.panneau input, .panneau textarea, .panneau select {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.panneau textarea { min-height: 70px; resize: vertical; }
.rangee-coords { display: flex; gap: 10px; }
.rangee-coords label { flex: 1; }
.discret { color: #777; font-size: 0.85rem; margin: 8px 0; }
.erreur { color: var(--a-remplir); font-size: 0.9rem; margin: 8px 0; }

.principal {
  width: 100%;
  background: var(--vert);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 12px;
}
.principal:hover { background: var(--vert-clair); }

.actions-statut { margin-top: 14px; }
.boutons-statut { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.btn-statut {
  flex: 1;
  border: none;
  color: white;
  padding: 12px 8px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-statut.ok { background: var(--ok); }
.btn-statut.a_verifier { background: var(--a-verifier); }
.btn-statut.a_remplir { background: var(--a-remplir); }
.actions-statut input { margin-top: 8px; }

#fiche-admin { margin-top: 14px; }
#fiche-admin hr { border: none; border-top: 1px solid #eee; margin-bottom: 12px; }
#fiche-admin button {
  border: 1px solid #ccc;
  background: white;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin: 0 6px 6px 0;
  font-size: 0.9rem;
}
#fiche-admin button.danger { color: var(--a-remplir); border-color: var(--a-remplir); }

#fiche-historique { list-style: none; }
#fiche-historique li {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.85rem;
  color: #444;
}
#fiche-historique li .date { color: #999; font-size: 0.78rem; }
#fiche-itineraire { margin-top: 14px; }
#fiche-itineraire a { color: var(--vert); font-weight: 600; }

#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 0.9rem;
  z-index: 3000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  max-width: 90%;
  text-align: center;
}

.cache { display: none !important; }

/* Mobile : onglets carte / liste */
@media (max-width: 699px) {
  #onglets {
    display: flex;
    background: white;
    border-top: 1px solid #ddd;
  }
  #onglets button {
    flex: 1;
    border: none;
    background: white;
    padding: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    color: #666;
  }
  #onglets button.actif { color: var(--vert); font-weight: 700; border-top: 2px solid var(--vert); }
  #liste { position: absolute; inset: 0; z-index: 1500; }
  #liste.cache-mobile { display: none; }
}

/* Bureau : carte + liste côte à côte */
@media (min-width: 700px) {
  #liste { width: 420px; border-left: 1px solid #ddd; }
  #liste.cache-mobile { display: block; }
}
