* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, sans-serif; }

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 48px;
  padding: 0 1rem;
  background: #1d6fa5;
  color: white;
}
.app-header h1 { font-size: 1.1rem; margin: 0; }
.app-header nav { display: flex; align-items: center; }
.app-header nav button { margin-left: 0.5rem; }

.filtre-wrapper { position: relative; display: inline-block; }
.dropdown-panel {
  position: absolute;
  top: 130%;
  right: 0;
  background: white;
  color: #333;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: 0.75rem;
  width: 220px;
  z-index: 1500;
}
button.secondary { background: #888; }

#map { position: absolute; top: 48px; bottom: 0; left: 0; right: 0; }

button {
  cursor: pointer;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  background: #1d6fa5;
  color: white;
}
button.danger { background: #c0392b; }

.hidden { display: none !important; }

.panel {
  position: absolute;
  top: 48px;
  right: 0;
  bottom: 0;
  width: 320px;
  background: white;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
  padding: 1rem;
  overflow-y: auto;
  z-index: 1000;
}
.panel-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  color: #333;
  font-size: 1.2rem;
  padding: 0.1rem 0.5rem;
}
.panel label,
.modal-content label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; }
.panel input[type="text"],
.panel textarea,
.modal-content input[type="text"],
.modal-content input[type="password"] {
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.25rem;
  font-family: inherit;
}
.login-status { margin-left: 0.5rem; font-size: 0.85rem; color: #e2eef7; }
.error { color: #c0392b; font-size: 0.85rem; }
.form-actions { display: flex; justify-content: space-between; margin-top: 1rem; }

.field-group { margin-bottom: 0.75rem; }
.field-label { display: block; font-size: 0.9rem; margin-bottom: 0.25rem; }
.checkbox-list {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 0.4rem;
}
.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: normal;
  margin: 0;
}
.checkbox-list input[type="checkbox"] { width: auto; margin: 0; }
.checkbox-list .hint { margin: 0; }
.inline-add { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.inline-add input { flex: 1; padding: 0.3rem; font-size: 0.85rem; }
.inline-add button { font-size: 0.8rem; padding: 0.3rem 0.5rem; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal-content {
  position: relative;
  background: white;
  padding: 1.5rem;
  border-radius: 6px;
  width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}
.modal .hint { font-size: 0.85rem; color: #555; }
#form-mot-cle { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
#form-mot-cle input { flex: 1; padding: 0.4rem; }

#liste-mots-cles { list-style: none; padding: 0; }
#liste-mots-cles li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
}
#liste-mots-cles li span { flex: 1; padding: 0.2rem; }

#form-nouvel-utilisateur { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
#form-nouvel-utilisateur input[type="text"],
#form-nouvel-utilisateur input[type="password"] { flex: 1; min-width: 120px; padding: 0.4rem; }

#liste-utilisateurs { list-style: none; padding: 0; }
.utilisateur-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}
.utilisateur-nom { flex: 1; min-width: 80px; padding: 0.2rem; }
.utilisateur-reset-input { width: 130px; padding: 0.3rem; font-size: 0.85rem; }

#import-resultat {
  background: #f5f5f5;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* Couleur selon le type de témoignage : bleu pour un point, vert pour une
   zone (polygone/multipolygone) — cf. .popup-temoignage[data-type] plus bas
   et les couleurs de tracé assorties dans map.js. */
.popup-temoignage {
  --popup-accent: #1d6fa5;
  --popup-accent-bg: #e0eef7;
  width: 100%;
  min-width: 600px;
  border-top: 5px solid var(--popup-accent);
  padding-top: 0.75rem;
  margin-top: -0.5rem;
}
.popup-temoignage[data-type="zone"] {
  --popup-accent: #2e8b57;
  --popup-accent-bg: #e2f2e8;
}
.popup-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--popup-accent);
  background: var(--popup-accent-bg);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  margin-bottom: 0.4rem;
}
.popup-tabs { display: flex; gap: 0.25rem; margin-bottom: 0.5rem; }
.tab-btn {
  flex: 1;
  background: #eee;
  color: #333;
  font-size: 0.8rem;
  padding: 0.3rem;
}
.tab-btn.active { background: var(--popup-accent); color: white; }
.popup-tab-content { min-height: 120px; }
.mots-cles-tags { margin-top: 0.5rem; }
.tag {
  display: inline-block;
  background: var(--popup-accent-bg);
  color: var(--popup-accent);
  border-radius: 10px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  margin: 0.1rem;
}
.media-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  max-height: 340px;
  overflow-y: auto;
}
.media-item img, .media-item video { max-width: 100%; border-radius: 4px; display: block; }
.media-item audio { width: 100%; }
.media-item { position: relative; }
.media-delete { display: block; margin-top: 0.2rem; font-size: 0.75rem; padding: 0.2rem 0.5rem; }
.media-upload {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  background: #eee;
  color: #333;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}
.media-upload input { display: none; }
.popup-actions { display: flex; justify-content: space-between; margin-top: 0.5rem; }
.popup-actions .btn-edit { background: var(--popup-accent); }

.person-marker-icon { background: transparent; border: none; }
