/* ==========================================================
   RIGHT PANEL WRAPPER — tab host for Coverage + Catchment
   ========================================================== */

#right-panel {
  width: 360px;
  min-width: 360px;
  background: #111520;
  border-left: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 4;
  color: #e2e8f4;
  font-family: system-ui,-apple-system,sans-serif;
}

.rp-tabbar {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.rp-tab {
  flex: 1;
  padding: 9px 0;
  background: none;
  border: none;
  color: rgba(226,232,244,.45);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.rp-tab.active {
  color: #e2e8f4;
  border-bottom-color: #60a5fa;
}

.rp-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rp-pane.hidden {
  display: none;
}

/* Mobile */
@media (max-width: 767px) {
  #right-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    min-width: unset;
    height: 46vh;
    border-left: none;
    border-top: 2px solid rgba(255,255,255,.1);
    z-index: 50;
    transform: translateY(0);
    transition: transform .3s ease;
  }
  #right-panel.collapsed {
    transform: translateY(calc(100% - 38px));
  }
}

/* ==========================================================
   CATCHMENT PANEL
   ========================================================== */

#catchment-panel {
  overflow-y: auto;
}

.kp-header {
  padding: 10px 14px 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.kp-scope-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.kp-scope-label {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f4;
}

.kp-var-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.kp-var-btn {
  padding: 3px 8px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 4px;
  color: rgba(226,232,244,.6);
  font-size: 11px;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.kp-var-btn.active {
  background: rgba(96,165,250,.18);
  border-color: rgba(96,165,250,.4);
  color: #93c5fd;
}

.kp-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.kp-meta-tag {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  color: rgba(226,232,244,.55);
}

.kp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.kp-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: rgba(226,232,244,.6);
}

.kp-legend-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.kp-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.kp-metric-note {
  padding: 5px 14px 2px;
  font-size: 11px;
  color: rgba(226,232,244,.45);
  font-style: italic;
}

.kp-loading, .kp-error, .kp-empty {
  padding: 24px 14px;
  font-size: 12px;
  color: rgba(226,232,244,.4);
  text-align: center;
}

.kp-error { color: #f87171; }

.kp-row {
  padding: 6px 14px;
}

.kp-row-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.kp-type-name {
  font-size: 12px;
  font-weight: 500;
  color: #e2e8f4;
}

.kp-type-area {
  font-size: 10px;
  color: rgba(226,232,244,.45);
  white-space: nowrap;
  margin-left: 6px;
}

.kp-bar-wrap {
  height: 10px;
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  overflow: hidden;
}

.kp-bar {
  display: flex;
  height: 100%;
}

.kp-seg {
  height: 100%;
  min-width: 0;
  transition: width .2s;
}
