/* Component and reference styles load on demand. Keep the focus treatment
   consistent in dialogs, popovers and the main workspace. */
@layer workbench-focus {
  :root {
    --control-focus: #838383;
    --control-edge: #d4d4d4;
  }
  :root.dark {
    --control-focus: #aaa;
    --control-edge: #606060;
  }
  @media (forced-colors: active) {
    :root, :root.dark { --control-focus: Highlight; --control-edge: ButtonBorder; }
  }
  :where(button, a[href], input, textarea, select, summary, [role], [tabindex], [contenteditable="true"]):not(:where(dialog, [role="dialog"], [role="alertdialog"])):focus-visible,
  .vp-select:has(select:focus-visible) button,
  .invoice-options-row label:has(:focus-visible),
  .project-card:has(.wk-project-name:focus-visible) {
    outline: 2px solid var(--control-focus) !important;
    outline-offset: 1px;
    box-shadow: none !important;
  }
  :where(input, textarea, select, [contenteditable="true"]):focus {
    border-color: var(--control-edge) !important;
  }
  /* Browsers also match :focus-visible on text fields clicked with a mouse. */
  :root[data-pointer-focus] :where(button, a[href], input, textarea, select, summary, [role], [tabindex], [contenteditable="true"]):not(:where(dialog, [role="dialog"], [role="alertdialog"])):focus,
  :root[data-pointer-focus] :is(.vp-select:focus-within button, .invoice-options-row label:focus-within,
                               .project-card:has(.wk-project-name:focus)) {
    outline: none !important;
    box-shadow: none !important;
  }
}
