:root{
  --bg:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --shadow:0 2px 6px rgba(0,0,0,0.08);
  --slider:#494949;
}

*{ box-sizing:border-box; }
html,body,#app{
  height:100%;
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Helvetica Neue,Arial,Noto Sans;
  color:var(--text);
  display:flex;
  flex-direction:column;
}

/* Header */
#ui{
  flex:0 0 10%;
  min-height:86px;
  background:var(--bg);
  box-shadow:var(--shadow);
  display:flex; align-items:center;
}
#map{ flex:1; min-height:0; }

/* 3 columnas */
.ui-inner{
  width:100%;
  max-width:1400px;
  margin:0 auto;
  padding:12px 20px;
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
}
.ui-left{ display:flex; justify-content:flex-start; }
.ui-center{ display:flex; justify-content:center; }
.ui-right{ display:flex; justify-content:flex-end; }

/* Tabs */
.tabs{ display:flex; gap:10px; }
.tab{
  border:1px solid #e5e7eb;
  background:#fff;
  color:#9ca3af;
  padding:8px 14px;
  border-radius:12px;
  font-weight:700;
  text-transform:uppercase;
  cursor:pointer;
}
.tab.is-active{
  background:#0a0f1a;
  color:#fff;
  border-color:#0a0f1a;
}

/* Leyenda */
.legend{ text-align:center; }
.legend-title{ margin:0 0 6px; font-size:15px; font-weight:700; }
.legend-grid{ display:grid; gap:4px; }
.legend-swatches,
.legend-labels{
  display:grid;
  grid-template-columns: repeat(8, auto);
  gap:2px 8px;
  justify-content:center;
  align-items:center;
}
.legend-swatches .sw{
  width:36px;
  height:12px;
  border-radius:2px;
  border:1px solid rgba(0,0,0,0.08);
}
.legend-labels span{
  font-size:12px;
  font-weight:600;
  color:#111;
  white-space:nowrap;
  text-align:center;
}

/* Slider */
.slider-wrap{ width:360px; max-width:32vw; }
#range{ margin:6px 0; }
.noUi-target{ border:none; box-shadow:none; background:#e5e7eb; }
.noUi-base, .noUi-connects{ border-radius:6px; }
.noUi-connect{ background:var(--slider); }
.noUi-handle{
  border:1px solid #d1d5db;
  background:#fff;
  box-shadow:0 1px 2px rgba(0,0,0,0.08);
}
.slider-labels{
  display:flex;
  justify-content:space-between;
  font-size:13px;
  font-weight:600;
  color:#111;
}

/* Popup */
.maplibregl-popup {
  max-width: 280px;
  font: 13px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Helvetica Neue, Arial, Noto Sans;
}
.maplibregl-popup-content {
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.pp{ font-size:13px; color:#111; }
.pp-title{
  margin:0 0 4px;
  font-size:15px;
  font-weight:700;
  line-height:1.3;
  color:#111;
}
.pp-sub{
  margin:0 0 8px;
  font-size:12px;
  color:#6b7280;
}
.pp-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.pp-badge{
  display:inline-block;
  font-size:11px;
  font-weight:600;
  padding:2px 6px;
  border-radius:6px;
  color:black;
  margin-bottom:2px;
}
.pp-badge--gas{ background:#01f3b3; }
.pp-badge--diesel{ background:#eaea40; }
.pp-price{
  font-size:15px;
  font-weight:700;
  color:#111;
}
.pp-footer{
  font-size:11px;
  color:#6b7280;
  margin-top:4px;
}

/* Responsive móvil */
@media (max-width: 900px){
  #ui{ flex:0 0 auto; }
  .ui-inner{
    grid-template-columns:1fr;
    row-gap:10px;
  }
  .ui-left, .ui-center, .ui-right{ justify-content:center; }
  .slider-wrap{ width:100%; max-width:100%; }

  /* Barra de colores en una fila completa */
  .legend-swatches, .legend-labels{
    grid-template-columns:repeat(8, 1fr);
    gap:4px 6px;
  }
  .legend-swatches .sw{ width:100%; }
}
