/* Native inputs retain checked state, keyboard behavior, labels and form values.
   Selection uses squares by default; on/off settings opt into .control-switch. */
:root {
  --control-size: 18px;
  --control-gold: var(--gold, #c9a75f);
  --control-highlight: var(--gold-hi, #e6cf9a);
  --control-dark: #14161b;
  --control-border: #777064;
}
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  display: inline-grid;
  place-content: center;
  position: relative;
  flex: 0 0 auto;
  width: var(--control-size);
  min-width: var(--control-size);
  max-width: var(--control-size);
  height: var(--control-size);
  min-height: var(--control-size);
  margin: 0;
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 5px;
  background: var(--control-dark);
  color: #211b10;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 25%);
  vertical-align: middle;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform 160ms var(--ease, ease);
}
input[type="checkbox"]:checked,
input[type="checkbox"]:indeterminate {
  background: var(--control-gold);
  border-color: var(--control-gold);
}
input[type="checkbox"]:checked::before {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}
input[type="checkbox"]:indeterminate::before {
  height: 0;
  border-left: 0;
  transform: none;
}
input[type="checkbox"]:hover:not(:disabled) {
  border-color: var(--control-highlight);
  box-shadow: 0 0 0 3px var(--gold-soft, rgb(201 167 95 / 14%));
}
input[type="checkbox"]:active:not(:disabled) {
  box-shadow: 0 0 0 4px var(--gold-soft, rgb(201 167 95 / 14%));
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--control-highlight);
  outline-offset: 3px;
}
input[type="checkbox"]:disabled {
  opacity: .45;
  cursor: not-allowed;
}
input[type="checkbox"].control-switch {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  height: 24px;
  min-height: 24px;
  border-radius: 999px;
  background: #303239;
  display: inline-block;
}
input[type="checkbox"].control-switch::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #ddd7cd;
  box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
  transform: translateX(0);
}
input[type="checkbox"].control-switch:checked {
  background: var(--control-gold);
  border-color: var(--control-gold);
}
input[type="checkbox"].control-switch:checked::before {
  background: #211b10;
  transform: translateX(16px);
}
/* Text wraps beside the control, including long approval descriptions. */
.selection-row,
.field label.selection-row,
.field span.selection-row,
.chat-details label.selection-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding-block: 5px;
  color: var(--text, #ece8e1);
  font: 500 12px/1.6 var(--font-body, sans-serif);
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}
.chat-details label.selection-row { margin-block: 16px; }
.selection-row > span { min-width: 0; overflow-wrap: anywhere; }
.selection-row:has(input:disabled) { cursor: not-allowed; color: var(--muted, #9a948a); }
@media (pointer: coarse) {
  .selection-row, .chat-details label.selection-row { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  input[type="checkbox"], input[type="checkbox"]::before { transition: none; }
}
@media (forced-colors: active) {
  input[type="checkbox"] { border-color: ButtonText; background: Canvas; color: HighlightText; }
  input[type="checkbox"]:checked, input[type="checkbox"]:indeterminate { background: Highlight; border-color: Highlight; forced-color-adjust: none; }
  input[type="checkbox"].control-switch::before { background: ButtonText; }
  input[type="checkbox"].control-switch:checked::before { background: HighlightText; }
  input[type="checkbox"]:focus-visible { outline-color: Highlight; }
}
