/* Fields, inputs and the on/off switch. */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 0.8125rem; font-weight: 600; color: var(--color-ink-muted); }

/* A bordered box holding an icon + input/select. */
.control {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: var(--control-height);
  padding: 0 14px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.control:focus-within { border-color: var(--color-primary); }
.control:focus-within :focus-visible { outline: none; }
.control .control__input {
  flex: 1; min-width: 0; height: 100%;
  padding: 0; border: 0; outline: none; background: transparent;
  font-size: 16px; /* 16px stops iOS zooming on focus */
}
.control--select .control__input { appearance: none; cursor: pointer; }
.control--select::after {
  content: "";
  position: absolute; right: 14px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--color-ink-muted);
  border-bottom: 2px solid var(--color-ink-muted);
  transform: rotate(45deg);
  pointer-events: none;
}

/* A plain input/select styled as a box on its own. */
.control__input.control--bordered {
  width: 100%;
  height: var(--control-height);
  padding: 0 14px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: 16px;
}
.control__input.control--bordered:focus { border-color: var(--color-primary); }

input::placeholder { color: #5B6B61; opacity: 1; }

/* ---- Switch -------------------------------------------------------------- */
.switch {
  position: relative;
  display: flex; align-items: center; gap: var(--space-2);
  height: var(--control-height);
  padding: 0 12px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  user-select: none;
}
.switch:has(.switch__input:checked) { border-color: var(--color-primary); }
.switch:has(.switch__input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.switch__input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.switch__state { flex: 1; font-size: 15px; }
.switch__on { display: none; }
.switch__input:checked ~ .switch__state .switch__on { display: inline; }
.switch__input:checked ~ .switch__state .switch__off { display: none; }

.switch__track {
  position: relative;
  width: 40px; height: 24px; flex-shrink: 0;
  border-radius: 12px;
  background: var(--color-switch-off);
  transition: background-color 0.15s;
}
.switch__track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--color-surface);
  transition: transform 0.15s;
}
.switch__input:checked ~ .switch__track { background: var(--color-primary); }
.switch__input:checked ~ .switch__track::after { transform: translateX(16px); }

@media (prefers-reduced-motion: reduce) {
  .switch__track, .switch__track::after { transition: none; }
}
