/* ===========================================================================
   controls.css — mineral & energy lever deck (left pane): filter tabs,
   stage groups, lever cards (LIMITING / STRAIN states), range sliders.
   Slider columns adapt to the left pane's width via container queries.
   =========================================================================== */

.controls-deck {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.controls-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.filter-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.filter-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.filter-tab:hover {
  color: var(--text-main);
}

.filter-tab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

.sliders-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.lever-card {
  position: relative;
  padding: 9px 9px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.lever-card.is-global {
  border-color: var(--alarm);
  background: var(--alarm-bg);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.14);
}

.lever-card.is-strain {
  border-color: #fb7185;
  background: #fff1f2;
}

.lever-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.lever-id {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.el-chip {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  border: 1.5px solid transparent;
}

.lever-name-col {
  min-width: 0;
}

.lever-name {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lever-stages {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
}

.lever-val-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.lever-pct {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.lever-flag {
  display: none;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  /* sits on the card's top-right corner so names keep their room */
  position: absolute;
  top: -7px;
  right: 8px;
  margin: 0;
}

.lever-flag.global {
  display: inline-block;
  background: var(--alarm);
  color: #ffffff;
}

.lever-flag.strain {
  display: inline-block;
  background: #ffe4e6;
  color: #be123c;
}

.lever-role {
  font-size: 10.5px;
  color: var(--text-soft);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Accessible Touch-Friendly Range Sliders */
input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #cbd5e1;
  outline: none;
  cursor: pointer;
}

input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #0f172a;
  border: 2.5px solid #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
  transition: transform 0.1s ease, background-color 0.15s ease;
}

input[type="range"].slider::-moz-range-thumb {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #0f172a;
  border: 2.5px solid #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
  transition: transform 0.1s ease, background-color 0.15s ease;
}

input[type="range"].slider:hover::-webkit-slider-thumb {
  transform: scale(1.12);
}

input[type="range"].slider.is-alarm::-webkit-slider-thumb {
  background: var(--alarm);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}

input[type="range"].slider.is-alarm::-moz-range-thumb {
  background: var(--alarm);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}

/* ---- Stage groups ---- */
.lever-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-soft);
}

.lever-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lever-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lever-group[hidden] {
  display: none;
}

.lever-group-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.stage-num.sm {
  width: 24px;
  height: 24px;
  font-size: 12px;
  border-radius: 7px;
}

.lg-title-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.lg-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.lg-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
}

.lever-group-head .status-pill {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: 6px;
}

.lg-pct {
  flex-shrink: 0;
  padding-top: 3px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

/* ---- Slider columns follow the left pane's width ---- */
@container side (min-width: 600px) {
  .sliders-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container side (min-width: 780px) {
  .sliders-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
