[v-cloak] {
  display: none !important;
}
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --danger: #ef4444;
  --header-bg: #0f172a;
  --primary: #0f172a;
  --libre: #22c55e;
  --occupe: #3b82f6;
  --alerte: #f59e0b;
  --abandon: #ef4444;
  --reserve: #a855f7;
}
/* Pastille GPS utilisateur */
.user-location-icon {
  background: transparent !important;
  border: none !important;
}

.pulse-point {
  width: 16px;
  height: 16px;
  background-color: #0284c7;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
  position: relative;
}

.pulse-point::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid #0284c7;
  animation: pulse-gps 1.8s infinite ease-out;
}

@keyframes pulse-gps {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}
/* Curseur en croix lors de la pose d'un objet */
.curseur-croix,
.curseur-croix .leaflet-grab,
.curseur-croix .leaflet-interactive,
.curseur-croix .leaflet-pane {
  cursor: crosshair !important;
}
* {
  box-sizing: border-box;
}
/* Supprime les coutures/lignes entre les tuiles OSM au déplacement */
.leaflet-tile {
  outline: 1px solid transparent;
}

.leaflet-tile-container img {
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.05);
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* EN-TÊTE ET BARRE D'OUTILS */
header {
  background: var(--header-bg);
  color: white;
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #1e293b;
  z-index: 600;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand h1 {
  font-size: 1.05rem;
  margin: 0;
  white-space: nowrap;
}

.badge-version, .badge-demo {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #334155;
  color: #e2e8f0;
  font-weight: 600;
}

.badge-demo {
  background: #f59e0b;
  color: #000;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* RECHERCHE */
.search-wrapper {
  position: relative;
}

.search-box {
  background: #1e293b;
  color: white;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  width: 230px;
}

.search-box:focus {
  outline: 2px solid var(--accent);
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 320px;
  background: white;
  color: var(--text);
  border-radius: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  border: 1px solid #cbd5e1;
  max-height: 300px;
  overflow-y: auto;
  z-index: 2000;
}

.search-result-item {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 0.8rem;
}

.search-result-item:hover {
  background: #eff6ff;
}

/* RUBAN DES COUCHES & SUPERPOSITION */
.features-Ribbon {
  background: #1e293b;
  color: white;
  padding: 6px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #334155;
  z-index: 550;
}

.ribbon-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.menu-ajout-contexte {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #334155;
}

.select-context {
  background: #0f172a;
  color: white;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.78rem;
}

.layer-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}

.layer-pill input[type="checkbox"] {
  cursor: pointer;
  width: auto;
  margin: 0;
}

/* BOUTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary.active {
  background: #dc2626;
  animation: pulse-btn 1.2s infinite;
}

.btn-edit {
  background: #334155;
  color: white;
}

.btn-edit.active {
  background: #f59e0b;
  color: #000;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-mini {
  background: #fef08a;
  border: 1px solid #eab308;
  color: #713f12;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-mini:hover {
  background: #fde047;
}

@keyframes pulse-btn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

/* PANNEAU FLOTTANT DE CALAGE GPS */
.calage-panel {
  position: absolute;
  top: 10px;
  left: 50px;
  right: 500px;
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  font-size: 0.8rem;
}

.calage-panel label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: #78350f;
}

.calage-panel input {
  padding: 4px 6px;
  border: 1px solid #d97706;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ESPACE DE TRAVAIL : CARTE + PANNEAU LATÉRAL */
.workspace {
  display: flex;
  flex-direction: row;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.map-area {
  flex: 1 1 0%;
  min-width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  padding: 0 !important;
}

#leaflet-map {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  background: #e2e8f0;
}

.side-panel {
  width: 460px;
  min-width: 360px;
  max-width: 45vw;
  flex-shrink: 0;
  height: 100%;
  background: var(--card);
  border-left: 2px solid #cbd5e1;
  padding: 14px 16px;
  overflow-y: auto;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 500;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.panel-header h2 {
  font-size: 1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* FORMULAIRES & ONGLETS DU PANNEAU */
.geo-box {
  background: #f1f5f9;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  border: 1px solid #cbd5e1;
}

.geo-box-title {
  font-size: 0.75rem;
  font-weight: bold;
  color: #1e293b;
  margin-bottom: 6px;
}

.tabs-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 6px;
}

.tabs-bar {
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1 1 30%;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 5px 4px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
}

.tab-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

label {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 3px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 0.82rem;
  background: white;
  color: var(--text);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

.doc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

/* ICÔNES ET POIGNÉES LEAFLET */
.custom-map-icon,
.poignee-drag-tombe,
.poignee-rotate-tombe {
  background: transparent !important;
  border: none !important;
  margin: 0 !important;
}

.leaflet-marker-draggable {
  cursor: grab !important;
}

.leaflet-marker-dragging {
  cursor: grabbing !important;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45)) scale(1.15);
  transition: transform 0.1s ease;
}

/* ÉTIQUETTE DE NUMÉRO (à cheval sur le bord haut de la tombe) */
.etiquette-tombe-icon {
  background: transparent !important;
  border: none !important;
  margin: 0 !important;
  pointer-events: none;
}

.etiquette-tombe {
  display: inline-block;
  white-space: nowrap;
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #0f172a;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transform-origin: center center;
}

.masquer-etiquettes .etiquette-tombe-icon {
  display: none;
}

/* TOOLTIP AVEC PHOTO */
.tooltip-tombe {
  text-align: center;
}

.tooltip-photo {
  display: block;
  max-width: 200px;
  max-height: 150px;
  margin: 6px auto 0;
  border-radius: 4px;
  object-fit: cover;
}

/* RESPONSIVE MOBILE / TABLETTE */
@media (max-width: 920px) {
  .calage-panel {
    left: 10px;
    right: 10px;
  }

  .side-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    max-height: 85vh;
    border-left: none;
    border-top: 3px solid var(--accent);
    border-radius: 16px 16px 0 0;
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
  }

  .side-panel.open-mobile {
    transform: translateY(0);
  }

  .panel-handle-bar {
    width: 48px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 3px;
    margin: 0 auto 10px auto;
    cursor: pointer;
  }
}

/* ===== COURRIERS, DIALOGUES, DOCUMENTS, IMPRESSION ===== */
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(40%);
}

input.modifie,
select.modifie,
textarea.modifie {
  background-color: #fef08a !important;
  border-color: #eab308 !important;
}

.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  backdrop-filter: blur(2px);
  padding: 12px;
}

.custom-modal-box {
  background: white;
  padding: 24px;
  border-radius: 12px;
  width: 460px;
  max-width: 96%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  border-top: 4px solid var(--accent);
}

.template-modal-box {
  background: white;
  padding: 20px;
  border-radius: 12px;
  width: 980px;
  max-width: 96vw;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
  border-top: 5px solid var(--accent);
  overflow-y: auto;
}

.tag-badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: monospace;
  font-weight: bold;
  cursor: pointer;
  display: inline-block;
}

.tag-badge:hover {
  background: #0284c7;
  color: white;
}

.age-badge {
  display: inline-flex;
  align-items: center;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
  margin-left: 6px;
}

.badge-alerte-hover {
  margin-top: 5px;
  font-size: 0.72rem;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 3px 6px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.docs-list {
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  padding: 6px;
  margin-bottom: 10px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3500;
  cursor: zoom-out;
}

.modal-content {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content img {
  max-width: 90vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  border: 3px solid #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: block;
}

.modal-close {
  position: absolute;
  top: -15px;
  right: -15px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-weight: bold;
  cursor: pointer;
}

@media (max-width: 920px) {
  .template-modal-box {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 12px;
  }

  .template-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ZONE D'IMPRESSION A4 (fiche officielle / courrier) */
#print-area {
  display: none;
}

@media print {
  html, body {
    overflow: visible !important;
    height: auto !important;
  }

  #app {
    display: block !important;
    height: auto !important;
  }

  #app > *:not(#print-area) {
    display: none !important;
  }

  #print-area {
    display: block !important;
    color: #000;
    background: #fff;
    padding: 20px;
  }
}

/* ===== CALAGE : PLAN + PHOTO ===== */
.calage-images {
  width: 100%;
  border-top: 1px dashed #f59e0b;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calage-images-ligne {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.calage-melange {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 260px;
  margin: 0;
}

.calage-melange input[type="range"] {
  flex: 1;
  padding: 0;
  border: none;
}

.calage-melange.inactif {
  opacity: 0.5;
}

.calage-images-info {
  font-size: 0.72rem;
  color: #78350f;
  line-height: 1.4;
}

/* ===== AJOUTS : LOGIN ET AUTHENTIFICATION ===== */
.custom-modal-box form .form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
  margin-top: 5px;
}

/* Affichage du signal critique animé (vanne fuyarde/bloquée) */
.custom-map-icon div {
  transition: transform 0.2s;
}

.custom-map-icon:hover div {
  transform: translate(-50%, -50%) scale(1.15) !important;
}