/* The on/off switch (sys_design-system.md §14a): ONE switch, 40x22 (DS-31, DS-81). Own file so login.html and index.html never load it.
   `appearance:none` as well as `opacity:0`: opacity alone leaves the native box in layout. */
.pref-switch{position:relative; flex:0 0 auto; width:40px; height:22px; cursor:pointer; margin-top:1px;}

.pref-switch input[type="checkbox"]{
    appearance:none; -webkit-appearance:none;
    position:absolute; inset:0; width:100%; height:100%; margin:0; padding:0;
    border:none; background:none; box-shadow:none;
    opacity:0; cursor:pointer;
  }

.pref-switch .track{
    position:absolute; inset:0; border-radius:var(--a-r-pill, 999px);
    background:var(--panel-2); border:1px solid var(--border-strong);
    transition:background var(--dur-micro) linear, border-color var(--dur-micro) linear,
               box-shadow var(--dur-micro) linear;
  }

.pref-switch .knob{
    position:absolute; top:3px; left:3px; width:14px; height:14px; border-radius:50%;
    background:var(--text-faint); transition:transform var(--dur-micro) var(--ease-move), background var(--dur-micro) linear;
  }

/* The glow is a ring on the TRACK, not a filter, so it costs no compositing layer. */
.pref-switch input:checked ~ .track{
    background:var(--accent-soft); border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-soft);
  }

.pref-switch input:checked ~ .knob{transform:translateX(18px); background:var(--accent);}

/* The focus ring belongs to the track, because the input is invisible. Shared, so a switch is
   reachable and visibly focused on every page rather than on the two that remembered. */
.pref-switch input:focus-visible ~ .track{outline:var(--a-focus, 2px solid var(--focus-ring)); outline-offset:var(--a-focus-offset, 2px);}

/* A switch nobody may change still has to READ as off-limits rather than as merely off. */
.pref-switch input:disabled{cursor:not-allowed;}
.pref-switch:has(input:disabled){opacity:.55; cursor:not-allowed;}

/* THE SMALL VARIANT (32x18) IS RETIRED (DS-31, DS-81). A `.pref-switch.sm` in old markup is the one 40x22 switch, because
   no rule here answers `.sm` any more; switchHtml() ignores its `small` option for the same reason. */

/* Reduced motion: own copy because mobile.html does not load components.css. Duration
   only, never `transform` -- knob position is the switch's state, so zeroing it would show
   ON as OFF. `!important` for the reason recorded in CSS/components.css. */
@media (prefers-reduced-motion: reduce){
  .pref-switch .track,
  .pref-switch .knob{ transition-duration:1ms !important; }
}

/* A switch with its label beside it — sys_design-system.md §14a. The whole thing is a
   <label>, so the switch inside it is a <span>: nesting a label in a label gives the
   browser two candidates for one input. */
.switch-check{
    display:inline-flex; align-items:center; gap:10px;
    font-size:var(--a-fs-13); font-weight:400; line-height:var(--a-lh-ui); color:var(--text-dim); cursor:pointer; min-width:0;
  }
.switch-check > span:last-child{min-width:0;}
/* Stacked in a settings pane rather than sitting in a row of controls. */
.settings-row .switch-check{display:flex; margin-bottom:8px;}
