/*
 * V114 shared UI brand palette. Existing --blue/--green remain unchanged:
 * they also color chart series, semantic statuses, signatures and documents.
 * Only interactive UI and active navigation are themed; print is untouched.
 * :where keeps specificity equal so danger, then disabled, always win.
 */
@media screen {
  :root {
    --of-action: #1e625b;
    --of-action-hover: #174f49;
    --of-action-soft: #edf5f3;
    --of-action-soft-hover: #dcece7;
    --of-action-border: #a9cbc4;
    --of-action-ring: #298b7d;
  }

  /* Secondary actions, including controls created after page load. */
  :where(
    button.btn, button.page-btn, button.back, button.of-link-action,
    button.auth-google, button.sidebar-toggle,
    #of-intake-v1 button, #onboardingBack,
    .mode button, .office-switch button, .top-index button,
    .preview-actions button, .accounting-module-nav button,
    .admin-tabs button, .personnel-tabs button,
    .of-manager-surface .manager-form button.primary
  ) {
    background: var(--of-action-soft) !important;
    color: var(--of-action) !important;
    border-color: var(--of-action-border) !important;
    box-shadow: none !important;
  }
  :where(
    button.btn:hover, button.page-btn:hover, button.back:hover,
    button.of-link-action:hover, button.auth-google:hover,
    button.sidebar-toggle:hover, #of-intake-v1 button:hover,
    #onboardingBack:hover, .mode button:hover,
    .office-switch button:hover, .top-index button:hover,
    .preview-actions button:hover, .accounting-module-nav button:hover,
    .admin-tabs button:hover, .personnel-tabs button:hover
  ) {
    background: var(--of-action-soft-hover) !important;
    border-color: var(--of-action) !important;
  }

  /* Primary actions use the exact existing homepage claims-entry green. */
  :where(
    button.btn-primary, button.primary, button.of-main-action,
    button.accounting-home-entry
  ) {
    background: var(--of-action) !important;
    color: #fff !important;
    border-color: var(--of-action) !important;
    box-shadow: none !important;
  }
  :where(
    button.btn-primary:hover, button.primary:hover,
    button.of-main-action:hover, button.accounting-home-entry:hover
  ) {
    background: var(--of-action-hover) !important;
    border-color: var(--of-action-hover) !important;
  }

  /* Navigation is scoped to app controls, never document/receipt content. */
  :where(
    .app > aside nav a.active, .app > aside nav a:hover,
    #nav button.active, #nav button:hover,
    .of-onboarding-surface .nav button.active,
    .of-onboarding-surface .nav button[aria-current],
    .of-onboarding-surface .nav button:hover,
    .mobile-nav button.active, .mobile-nav button[aria-current="page"],
    .top-index button.active, .mode button.active,
    .office-switch button.active, button.page-btn.active,
    .accounting-module-nav button[aria-current="page"],
    .admin-tabs button[aria-selected="true"],
    .personnel-tabs button[aria-selected="true"],
    #of-intake-v1 #of-steps button[aria-current="step"]
  ) {
    background: var(--of-action) !important;
    color: #fff !important;
    border-color: var(--of-action) !important;
    box-shadow: none !important;
  }
  :where(
    .mobile-nav button.active b,
    .mobile-nav button[aria-current="page"] b
  ) {
    color: inherit !important;
  }
  :where(
    #claims .ofc-tab.active, .ofs-tabs button[aria-selected="true"],
    .of-onboarding-surface .tabs button.active,
    .of-manager-surface .manager-pages .btn[aria-current="page"],
    .of-manager-surface .manager-queue-filters .btn[aria-pressed="true"]
  ) {
    background: var(--of-action-soft) !important;
    color: var(--of-action) !important;
    border-color: var(--of-action) !important;
  }
  :where(.of-onboarding-surface .step.active) {
    color: var(--of-action) !important;
    border-color: var(--of-action) !important;
  }
  :where(.of-onboarding-surface .step.active b) {
    background: var(--of-action) !important;
    color: #fff !important;
  }

  /* Brand focus and selected form controls, not input values or validation. */
  :where(
    button:focus-visible, .app > aside nav a:focus-visible,
    .of-onboarding-surface a:focus-visible,
    input.input:focus-visible, select.select:focus-visible,
    input.search:focus-visible,
    #of-intake-v1 input:focus-visible,
    #of-intake-v1 select:focus-visible,
    #of-intake-v1 textarea:focus-visible,
    .of-onboarding-surface input:focus-visible,
    .of-onboarding-surface select:focus-visible,
    .of-onboarding-surface textarea:focus-visible,
    #claims .ofc-input:focus-visible, #claims .ofc-drop:focus-within,
    #pettyCash .ofp-input:focus-visible
  ) {
    outline: 3px solid var(--of-action-ring) !important;
    outline-offset: 3px !important;
  }
  :where(
    #claims .ofc-input:focus,
    #claims .ofc-case-opt:hover, #claims .ofc-case-opt:focus-visible,
    #serviceFeesRoot .ofs-case:hover
  ) {
    border-color: var(--of-action) !important;
  }
  :where(
    #of-intake-v1 input[type="checkbox"],
    #of-intake-v1 input[type="radio"],
    .of-onboarding-surface .check input,
    .pure-land-check input, .account-review-check input
  ) {
    accent-color: var(--of-action) !important;
  }

  /*
   * Safety overrides include destructive controls historically styled as
   * ordinary .btn/.btn-ghost. Do not infer destructiveness from visible text.
   */
  :where(
    button.btn-danger, button.danger, button.fee-remove-x,
    button.item-remove-x, button.ofc-file-rm, button.of-remove,
    button.manager-end, button[data-qaction="delete"],
    button[data-qfile-remove], button[data-qasset-remove],
    button[data-advance-delete], button[data-advance-remove],
    button[data-party-action="remove"], button[data-ofms-action="remove"],
    #pettyCash button[data-remove], button[data-lifecycle-action="remove"],
    button[data-lifecycle-action="archive"],
    button[data-employee-action="deactivate"], button[data-clear],
    button[data-act^="remove-"],
    button#deletePersonalStampBtn, button#deleteOfficeStampBtn,
    button#deleteRevenueStampBtn
  ) {
    background: #ffe9e9 !important;
    color: #b53a36 !important;
    border-color: #dfaba8 !important;
    box-shadow: none !important;
  }

  /* Last by design: unavailable actions remain gray, including danger actions. */
  :where(button:disabled, button[aria-disabled="true"]) {
    background: #eef0f2 !important;
    color: #606974 !important;
    border-color: #d6dbe0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    cursor: not-allowed;
  }
}
