/* Shared controls: buttons, segmented pickers, switches, inputs, dropdowns. */
/* ---------- controls ---------- */
.btn {
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border-radius: 8px;
  border: 0;
  background: var(--panel-2);
  font-weight: 500;
  font-size: 12.5px;
  white-space: nowrap;
  transition:
    background 0.12s,
    color 0.12s,
    box-shadow 0.12s;
}
.btn:hover {
  background: var(--panel-3);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn svg.i {
  width: 15px;
  height: 15px;
}
.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.btn.primary:hover {
  background: var(--accent-2);
}
.btn.quiet {
  background: transparent;
  color: var(--text-2);
}
.btn.quiet:hover {
  background: var(--panel-2);
  color: var(--text);
}
.btn.full {
  width: 100%;
  height: 34px;
}
.ib {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  transition:
    background 0.12s,
    color 0.12s;
}
.ib:hover {
  background: var(--panel-2);
  color: var(--text);
}
.ib[aria-pressed='true'] {
  color: var(--accent-text);
  background: var(--accent-soft);
}
.ib.sm {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--panel-2);
}
.seg label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 6px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s;
}
.seg label:hover {
  color: var(--text);
}
.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg label:has(input:checked) {
  background: var(--seg-on);
  color: var(--text);
  box-shadow: var(--lift);
}
.seg label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
}
.num {
  height: 28px;
  width: 72px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--panel-2);
  font-family: var(--f-ui);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  text-align: right;
}
.num:hover {
  border-color: var(--line-2);
}
.num:focus {
  border-color: var(--accent);
  outline: none;
  background: var(--panel);
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--line-2);
  position: relative;
  cursor: pointer;
  margin: 0;
  transition: background 0.15s;
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.switch:checked {
  background: var(--accent);
}
.switch:checked::after {
  transform: translateX(12px);
}
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--panel-3);
}
input[type='range']::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--panel-3);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.2);
}
input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.2);
}
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text-2);
  box-shadow: inset 0 -1px 0 var(--line-2);
}
