/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--accent-strong);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Slider — thin rail, thumb centered on the rail (not a fat pill).
   Hit target is control-h; the rail is a 2px hairline. */
.ui-slider {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 7rem;
  min-height: calc(var(--ui-space, 0.25rem) * 6);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.ui-slider.w-full {
  width: 100%;
}

.ui-slider__rail {
  position: relative;
  width: 100%;
  height: 2px;
  border-radius: 9999px;
  background: var(--bg-inset);
  box-shadow: 0 0 0 1px var(--border-subtle);
}

.ui-slider__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  background: hsl(var(--chrome-hue) 22% 42%);
  pointer-events: none;
}

.ui-slider__thumb {
  position: absolute;
  top: 50%;
  width: var(--space-3);
  height: var(--space-3);
  margin-top: calc(var(--space-3) / -2);
  margin-left: calc(var(--space-3) / -2);
  border-radius: 9999px;
  background: var(--text);
  border: 1px solid var(--border);
  box-sizing: border-box;
  pointer-events: none;
}

.btn.primary {
  /* Light accent fill + dark same-hue ink — white on mid-tone fails AA. */
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, black);
  border-color: color-mix(in srgb, var(--accent) 88%, black);
}

.btn.small {
  padding: var(--space-1) var(--space-2);
}

.btn.icon {
  padding: var(--space-1);
  width: var(--control-h);
  height: var(--control-h);
  justify-content: center;
}

.btn.icon-label {
  gap: var(--space-1);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}

.btn.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

.btn.danger.armed {
  background: color-mix(in srgb, var(--danger) 60%, black);
  border-color: color-mix(in srgb, var(--danger) 60%, black);
  color: #fff;
}

.btn.cursor-open .cursor-icon {
  display: block;
}

/* Segmented control */

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.segment {
  padding: var(--space-1) var(--space-4);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

.segment.active {
  background: var(--accent);
  color: white;
}

/* Form fields */

.search-input {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  color: var(--text-muted);
  max-width: var(--measure);
}

.field input:not(.confirm-field__control),
.field textarea:not(.confirm-field__control) {
  width: 100%;
  max-width: var(--measure);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
}

.field-error {
  margin: 0;
  color: var(--danger);
}

.field-label {
  display: block;
  color: var(--text-muted);
}

/* Dropzone — system file picker (drag / browse) */

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  padding: var(--space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-inset);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
  outline: none;
}

.dropzone:hover:not(.is-disabled),
.dropzone:focus-visible:not(.is-disabled) {
  border-color: var(--accent);
}

.dropzone.is-dragover {
  border-style: solid;
  border-color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-inset));
}

.dropzone.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.dropzone-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  pointer-events: none;
}

.dropzone-icon {
  display: inline-flex;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
}

.dropzone-preview {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.dropzone-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 28rem;
}

.dropzone-label {
  color: var(--text);
  font-weight: 500;
}

.dropzone-hint {
  font-weight: 400;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-muted);
}

