:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --border: #d9e2ec;
  --text: #1f2937;
  --muted: #6b7280;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --radius: 18px;
}

/* RESET */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

/* CONTENEDOR */
.app-shell {
  width: min(1500px, 94%);
  margin: 24px auto;
}

/* =========================
   TOPBAR
========================= */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.topbar-left h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
}

.topbar-left p {
  margin: 0;
  color: var(--muted);
}

/* BOTONES SUPERIORES */
.topbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* BOTONES PRINCIPALES */
button,
select {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
}

/* HOVER */
button {
  cursor: pointer;
  transition: all 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* =========================
   BOTONES NUEVO DE DIFERENTES DESCARGAS
========================= */

/* Excel */
.btn-excel {
  background: #16a34a;
  color: #fff;
  border: none;
}

.btn-excel:hover {
  background: #15803d;
}

/* Descargar */
.btn-download {
  background: #2563eb;
  color: #fff;
  border: none;
}

.btn-download:hover {
  background: #1d4ed8;
}

/* Compartir */
.btn-share {
  background: #9333ea;
  color: #fff;
  border: none;
}

.btn-share:hover {
  background: #7e22ce;
}

/* Facebook */
.btn-facebook {
  background: #1877f2;
  color: #fff;
  border: none;
}

.btn-facebook:hover {
  background: #155ec9;
}

/* =========================
   LAYOUT PRINCIPAL
========================= */
.main-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.15rem;
}

.panel label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

.panel select {
  width: 100%;
}

.status-box {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
  line-height: 1.5;
}

/* INFO PANEL */
.info-panel h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1rem;
}

.info-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

/* MAPA */
.map-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

#map {
  width: 100%;
  height: 760px;
  border-radius: 14px;
  overflow: hidden;
}

/* LEYENDA */
.legend {
  background: rgba(255, 255, 255, 0.96);
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
  font-size: 13px;
  line-height: 1.5;
}

.legend h4 {
  margin: 0 0 10px;
  font-size: 13px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* POPUP */
.leaflet-popup-content {
  line-height: 1.5;
}

/* RESPONSIVE */
@media (max-width: 1050px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  #map {
    height: 600px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}