/* Shared controls come last so that field padding, modal grids and local checkbox
   sizes cannot distort a switch or turn a radio into a full-width text field. */
input[type='checkbox'][role='switch'] {
  --track: 46px;
  --thumb: 20px;
  box-sizing: border-box;
  inline-size: var(--track);
  min-inline-size: var(--track);
  max-inline-size: var(--track);
  block-size: 28px;
  min-block-size: 28px;
  max-block-size: 28px;
  flex: 0 0 var(--track);
  align-self: center;
  margin: 0;
  padding: 0;
  border: 1px solid #879bb8;
  border-radius: 999px;
  background: #9baec7;
  vertical-align: middle;
}
input[type='checkbox'][role='switch']::before {
  top: 3px;
  left: 3px;
  width: var(--thumb);
  height: var(--thumb);
  background: white;
  box-shadow: 0 1px 3px #17314b38;
  transition: transform 140ms ease-out;
}
input[type='checkbox'][role='switch']:checked {
  border-color: var(--blue);
  background: var(--primary);
}
input[type='checkbox'][role='switch']:checked::before {
  transform: translateX(18px);
}
input[type='checkbox'][role='switch']:disabled {
  opacity: 1;
  border-color: #c5cfdd;
  background: #d8e0eb;
  cursor: not-allowed;
}
input[type='checkbox'][role='switch']:checked:disabled {
  border-color: #88a2cb;
  background: #8fa9d3;
}
input:is([type='checkbox']:not([role='switch']), [type='radio']) {
  box-sizing: border-box;
  inline-size: 19px;
  min-inline-size: 19px;
  max-inline-size: 19px;
  block-size: 19px;
  min-block-size: 19px;
  max-block-size: 19px;
  flex: 0 0 19px;
  padding: 0;
  accent-color: var(--primary);
}
.config-editor-fields > label:is(.check, .ent-choice, .op-check),
.config-editor-fields > label.tool-switch {
  display: flex;
  flex-direction: row;
  align-items: center;
}
.stack label.check > input,
.stack label.tool-switch > input {
  margin-block: 0;
}
:where(.check, .ent-choice, .op-check, .tool-switch) input:disabled {
  cursor: not-allowed;
}
.config-editor-fields :where(label, fieldset, .field-pair > *) {
  min-width: 0;
}
.config-editor-fields :where(input:not([type='checkbox']):not([type='radio']), select, textarea) {
  max-width: 100%;
}
:where(button, summary, [role='combobox'], a, input, textarea, select):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
button .icon,
summary > .chevron {
  flex-shrink: 0;
}
.op-location-note {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.cfg-location-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.cfg-location-note strong {
  color: #174fb4;
  font-weight: 700;
}
.config-editor header:has(.cfg-location-note) {
  display: block;
}
.config-editor header .cfg-location-note {
  margin: 5px 0 0;
}
.cfg-located {
  outline: 2px solid #376edf;
  outline-offset: 4px;
  border-radius: 8px;
  scroll-margin-block: 20px;
}
@media (prefers-reduced-motion: reduce) {
  input[type='checkbox'][role='switch']::before {
    transition: none;
  }
}
@media (forced-colors: active) {
  input[type='checkbox'][role='switch'] {
    appearance: auto;
    forced-color-adjust: auto;
  }
  input[type='checkbox'][role='switch']::before {
    content: none;
  }
  .cfg-located {
    outline-color: Highlight;
  }
}

.config-editor-fields > .op-check:has([role='switch']) {
  min-height: 44px;
  gap: 16px;
  justify-content: space-between;
}
.op-check > [role='switch'] {
  order: 1;
}
label.cfg-located,
.tool-switch.cfg-located,
.route-picker.cfg-located,
fieldset.cfg-located {
  outline: 0;
  background-color: #edf4ff;
  box-shadow: 0 0 0 4px #edf4ff;
}
input:not([type='checkbox']):not([type='radio']):disabled,
textarea:disabled,
select:disabled {
  color: #5c6e89;
  background-color: #f1f4f8;
  border-color: #cfdae6;
  cursor: not-allowed;
}
::selection {
  color: #122144;
  background: #c8dcff;
}
@media (max-width: 600px) {
  .op-types label,
  .op-search-row .op-check {
    min-height: 40px;
  }
}
