html,body,#map { height:100%; margin:0; }

.ctl {
  position:absolute; top:10px; left:10px; z-index:10;
  background:#fff; border-radius:10px; padding:8px 10px;
  box-shadow:0 2px 10px rgba(0,0,0,.15);
  font:14px/1.2 system-ui, -apple-system, Segoe UI, Roboto;
  width: 200px;
  transition: transform 0.25s ease;
}

.ctl-toggle {
  position:absolute;
  top:14px;
  left:220px;
  z-index:11;
  padding:4px 8px;
  border-radius:16px;
  border:1px solid #ccc;
  background:#fff;
  cursor:pointer;
  font-size:12px;
  box-shadow:0 2px 6px rgba(0,0,0,.15);
}

.ctl-toggle.is-left {
  left:10px;
}

.ctl.is-hidden {
  transform: translateX(-110%);
}

.ctl-section {
  margin: 6px 0 4px;
  padding: 4px 6px;
  background: #fff;
  border-radius: 6px;
}

.ctl-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
}

.legend {
  position:absolute; bottom:10px; left:10px; z-index:10;
  background:#fff; border-radius:10px; padding:8px 10px;
  box-shadow:0 2px 10px rgba(0,0,0,.15);
  font:12px/1.2 system-ui, -apple-system, Segoe UI, Roboto;
}

.maplibregl-popup-content {
  font: 13px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  padding: 10px 12px;
  border-radius: 8px;
  min-width: 500px;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
}

.popup-main-heading {
  font-weight: 700;
  font-size: 13px;
  margin: 4px 0;
}

.popup-table3 {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  table-layout: fixed;
}

.popup-table3 th,
.popup-table3 td {
  border: 1px solid #ddd;
  padding: 2px 4px;
  vertical-align: top;
}

.popup-col-section {
  width: 40px;
  font-weight: normal;
  background: #f7f7f7;
  font-size: 12px;
}

.popup-col-label {
  width: 80px;
  font-size: 12px;
}

.popup-col-value {
  width: 35%;
  font-size: 12px;
  text-align: right;
  word-break: break-word;
}

.popup-plant-list {
  max-height: 80px;
  overflow-y: auto;
  padding: 4px 6px;
  background: #fafafa;
  border-radius: 4px;
  border: 1px solid #eee;
  font-size: 12px;
  text-align: left;
}

/* Legend bars */
.legend-bar-irr {
  background: linear-gradient(90deg,#0d0d0d,#4b0082,#800080,#ff8c00,#ffe066);
}
.legend-bar-free {
  background: linear-gradient(90deg,#0d0d0d,#4b0082,#ff8c00,#ffffcc);
}
.legend-bar-score {
  background: linear-gradient(90deg,#1a1a1a,#e4e4e4ff,#ffd966);
}
.legend-bar-lst {
  background: linear-gradient(90deg,#0000ff,#00ffff,#00ff80,#ffff00,#ffcc00,#ff8000,#ff4000,#ff0000,#cc0000,#800000);
}
.legend-bar-used {
  background: linear-gradient(90deg,#b0b0b0,#ffd966);
}

.legend .bar {
  height:10px;
  width:200px;
  border-radius:4px;
  margin:6px 0;
}

.legend-title {
  font-weight: 600;
  font-size: 12px;
}

.legend .ticks { display:flex; justify-content:space-between; }
