/* --- Standard Form Groups --- */
.field,
.control-block,
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.slider-group {
  min-width: 0;
  border: 0;
  padding: 0;
}

.field span,
.control-label,
.slider-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.slider-title {
  width: 100%;
  padding: 0;
  margin: 0;
}

.label-with-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* --- Inputs & Selects --- */
input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
  color: #8b95a3;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

input.is-auto {
  background: var(--panel);
}

input.is-error,
select.is-error {
  border-color: var(--danger) !important;
  background: var(--danger-bg) !important;
  box-shadow: 0 0 0 3px rgba(200, 75, 49, 0.08);
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

/* --- Grid Layouts --- */
.position-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.position-note {
  margin-top: 2px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  min-height: 34px;
}

.action-row {
  display: flex;
  justify-content: flex-start;
}

.prediction-card {
  margin: 4px 0 12px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    var(--card),
    color-mix(in srgb, var(--card) 72%, var(--panel) 28%)
  );
  box-shadow: var(--shadow-sm);
}

.prediction-card.is-hidden {
  display: none;
}

.prediction-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.prediction-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.prediction-copy {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  margin-bottom: 10px;
}

.prediction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-bottom: 10px;
}

.prediction-item {
  min-width: 0;
}

.prediction-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prediction-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.prediction-neighbors {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prediction-neighbor {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* --- Buttons --- */
.ghost-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s ease;
}

.ghost-btn:hover {
  background: var(--panel);
  border-color: var(--accent);
}

.ghost-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --- FLATTENED SEGMENTED CONTROL (SIDE-BY-SIDE) --- */
.segmented-control {
  display: flex;
  gap: 8px; /* Space between chips */
  width: 100%;
  align-items: stretch;
}

.seg-chip {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center; /* Center icon and text */
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  color: var(--text);
  transition: all 0.18s ease;
  
  flex: 1; /* THIS FORCES THEM TO SHARE THE ROW EQUALLY */
  min-width: 0;
  text-align: center;
}

.seg-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Icon style inside chips */
.seg-chip i {
  width: 16px;
  height: 16px;
  stroke-width: 2.5px;
}

#dataLayerGroup .seg-chip {
  padding-left: 12px;
  padding-right: 12px;
  font-size: 12px;
}

/* Selection state */
.seg-chip:has(input:checked) {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.seg-chip:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

/* --- Checks & Filters --- */
.simple-check-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.simple-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
}

.simple-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.phase-filter-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phase-filter-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr;
  gap: 10px;
  align-items: center;
}

.phase-filter-check {
  font-weight: 600;
}

.phase-filter-name {
  color: var(--phase-accent, var(--text));
}

.phase-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phase-slider-readout,
.single-slider-readout {
  font-size: 12px;
  color: var(--muted);
}

.phase-filter-row .phase-slider-readout {
  color: color-mix(in srgb, var(--phase-accent, var(--muted)) 70%, #4a5564 30%);
  font-weight: 600;
}

.slider-help {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.advanced-subsection {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advanced-subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.advanced-subsection-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.advanced-subsection-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.slice-control-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.3fr);
  gap: 10px;
  align-items: end;
}

.compact-block,
.compact-slider {
  margin-bottom: 0;
}

.slice-summary {
  min-height: 18px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  outline: none;
}

.info-tip-button {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.info-tip-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(270px, 70vw);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 94%, transparent 6%);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 30;
}

.info-tip:hover .info-tip-popover,
.info-tip:focus .info-tip-popover,
.info-tip:focus-within .info-tip-popover {
  opacity: 1;
  transform: translateY(0);
}

.info-tip:focus-visible .info-tip-button {
  box-shadow: var(--focus-ring);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
