/* Input contrast only: no geometry, data, or decorative divider changes.
   Keep invalid borders and focus independently visible; outlines do not reflow. */
html:root body :is(input,textarea,select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Modal fields have a more specific legacy border rule than generic .f fields.
   Invalid styling and focused-field styling retain their own state colors. */
html:root .modal .f :is(input,select):not(:focus):not(.invalid):not([aria-invalid="true"]) {
  border-color: var(--input-border);
}
/* The goal fields scroll container clips outside rings at its left/right edge.
   An inset ring leaves the 1px error border distinct and keeps input geometry. */
html:root #goalmodal :is(input,select):focus-visible { outline-offset: -3px; }

/* Forced colors removes box shadows. Use the user's system palette and inset
   outlines so scroll containers cannot clip focus or change the layout. */
@media (forced-colors: active) {
  html:root body :is(button,a[href],input,textarea,select,[tabindex]):not(.rich-composer):focus-visible,
  html:root.editor-keyboard-focus body .rich-composer:focus-visible {
    outline: 2px solid Highlight !important;
    outline-offset: -3px !important;
  }
  /* A destination is different from keyboard focus. Keep both distinguishable
     when the OS replaces the selected background with Canvas. */
  html:root body :is(.nav button,.status button,.rail-item,.side-item)[aria-current="page"]:not(:focus-visible) {
    outline: 1px dashed CanvasText;
    outline-offset: -3px;
  }
}
