/*
 * VisaPath action contrast layer.
 * Load after the page/component stylesheets. Only controls that are already
 * presented as actions are styled here; ordinary navigation links are untouched.
 */
:root {
  --vp-action-solid-bg: #96351f;
  --vp-action-solid-hover: #762817;
  --vp-action-solid-fg: #ffffff;
  --vp-action-ghost-bg: #f4f0e6;
  --vp-action-ghost-hover: #e5eee8;
  --vp-action-ghost-fg: #23473d;
  --vp-action-ghost-border: #526e63;
  --vp-action-text: #174f43;
  --vp-action-text-bg: #f4f0e6;
  --vp-action-text-hover: #e5eee8;
  --vp-action-danger-bg: #922f26;
  --vp-action-danger-hover: #76251f;
  --vp-action-danger-fg: #ffffff;
  --vp-action-focus: #76510a;
}

/* Explicit theme hooks: html/body data-theme, data-color-scheme, and common
   dark-theme class conventions used by host pages and partner skins. */
:is(html, body):is([data-theme="dark"], [data-color-scheme="dark"], .dark, .dark-theme, .theme-dark) {
  --vp-action-solid-bg: #f0a184;
  --vp-action-solid-hover: #f6b69b;
  --vp-action-solid-fg: #30170f;
  --vp-action-ghost-bg: #203a34;
  --vp-action-ghost-hover: #2b4b42;
  --vp-action-ghost-fg: #f3f5ec;
  --vp-action-ghost-border: #a5c0b3;
  --vp-action-text: #b7e1ce;
  --vp-action-text-bg: #203a34;
  --vp-action-text-hover: #2b4b42;
  --vp-action-danger-bg: #f0a09a;
  --vp-action-danger-hover: #f5b6af;
  --vp-action-danger-fg: #32110f;
  --vp-action-focus: #f4ca70;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-color-scheme="light"]) {
    --vp-action-solid-bg: #f0a184;
    --vp-action-solid-hover: #f6b69b;
    --vp-action-solid-fg: #30170f;
    --vp-action-ghost-bg: #203a34;
    --vp-action-ghost-hover: #2b4b42;
    --vp-action-ghost-fg: #f3f5ec;
    --vp-action-ghost-border: #a5c0b3;
    --vp-action-text: #b7e1ce;
    --vp-action-text-bg: #203a34;
    --vp-action-text-hover: #2b4b42;
    --vp-action-danger-bg: #f0a09a;
    --vp-action-danger-hover: #f5b6af;
    --vp-action-danger-fg: #32110f;
    --vp-action-focus: #f4ca70;
  }
}

:is(html, body):is([data-theme="light"], [data-color-scheme="light"]) {
  --vp-action-solid-bg: #96351f;
  --vp-action-solid-hover: #762817;
  --vp-action-solid-fg: #ffffff;
  --vp-action-ghost-bg: #f4f0e6;
  --vp-action-ghost-hover: #e5eee8;
  --vp-action-ghost-fg: #23473d;
  --vp-action-ghost-border: #526e63;
  --vp-action-text: #174f43;
  --vp-action-text-bg: #f4f0e6;
  --vp-action-text-hover: #e5eee8;
  --vp-action-danger-bg: #922f26;
  --vp-action-danger-hover: #76251f;
  --vp-action-danger-fg: #ffffff;
  --vp-action-focus: #76510a;
}

/* Safe default for unclassified native controls, including browser-inserted
   retry controls and staff help/menu buttons. Low specificity lets the named
   action families below retain their hierarchy. No geometry or state changes. */
body :where(button, input[type="button"], input[type="submit"], [role="button"], a[class*="button"], a[download]) {
  color: var(--vp-action-ghost-fg) !important;
  background-color: var(--vp-action-ghost-bg) !important;
  border-color: var(--vp-action-ghost-border) !important;
  opacity: 1 !important;
  filter: none !important;
}
body :where(button, input[type="button"], input[type="submit"], [role="button"], a[class*="button"], a[download]):where(:hover, :focus-visible) {
  background-color: var(--vp-action-ghost-hover) !important;
}
body :where(button, input[type="button"], input[type="submit"], [role="button"], a[class*="button"], a[download]):where(:disabled, [aria-disabled="true"]) {
  color: var(--vp-action-ghost-fg) !important;
  background-color: var(--vp-action-ghost-bg) !important;
  cursor: not-allowed;
}
body :where(button, input[type="button"], input[type="submit"], [role="button"], a[class*="button"], a[download], a.text-link):focus-visible {
  outline: 3px solid var(--vp-action-focus) !important;
  outline-offset: 3px;
}
/* Do not fade action text through a read-only transcription wrapper. The
   controls' actual readonly/disabled authorization state remains untouched. */
.transcription-field:has(button, [role="button"], a[class*="button"]) {
  opacity: 1 !important;
}
.staff-workflow-bin :is(small, span, strong, b) {
  color: inherit !important;
  background-color: transparent !important;
}
.wallet-state-tabs button span {
  color: var(--vp-action-ghost-fg) !important;
  background-color: var(--vp-action-ghost-bg) !important;
}

/* Primary/solid action vocabulary across public, client, payment, wizard,
   account, pack, partner and staff surfaces. Keep geometry owned by each page. */
:is(
  .brand-button,
  .primary-button,
  .btn-primary,
  .wallet-button:not(.secondary),
  .wl-button:not(.secondary):not(.danger),
  .lr-button:not(.secondary),
  .support-launcher,
  .support-submit,
  .support-composer button,
  .partner-entry button,
  .partner-entry .destination,
  .wallet-paid,
  .wallet-approve,
  .staff-destination-primary
) {
  color: var(--vp-action-solid-fg) !important;
  background-color: var(--vp-action-solid-bg) !important;
  border-color: var(--vp-action-solid-bg) !important;
  opacity: 1 !important;
  filter: none !important;
}

:is(
  .brand-button,
  .primary-button,
  .btn-primary,
  .wallet-button:not(.secondary),
  .wl-button:not(.secondary):not(.danger),
  .lr-button:not(.secondary),
  .support-launcher,
  .support-submit,
  .support-composer button,
  .partner-entry button,
  .partner-entry .destination,
  .wallet-paid,
  .wallet-approve,
  .staff-destination-primary
):is(:hover, :focus-visible) {
  color: var(--vp-action-solid-fg) !important;
  background-color: var(--vp-action-solid-hover) !important;
  border-color: var(--vp-action-solid-hover) !important;
}

/* Ghost and secondary actions are opaque even when placed on a pale card.
   This specifically fixes .ghost-button links such as “Open Your pack”. */
:is(
  .ghost-button,
  .wallet-button.secondary,
  .wl-button.secondary,
  .lr-button.secondary,
  .btn-outline,
  .button.secondary,
  .staff-contact-lookup-row button,
  .staff-recovery-action button,
  .wallet-actions button:not(.wallet-paid):not(.wallet-approve):not(.wallet-reject):not(.wallet-failed),
  .wallet-batch-actions button:not(.wallet-paid):not(.wallet-approve):not(.wallet-reject):not(.wallet-failed),
  .wallet-export button,
  .promo-actions button,
  .promo-batches button,
  .accounting-admin #promoPagination button,
  .document-summary .document-actions button,
  .document-actions button,
  .itinerary-remove,
  .uploaded-file-remove
) {
  color: var(--vp-action-ghost-fg) !important;
  background-color: var(--vp-action-ghost-bg) !important;
  border-color: var(--vp-action-ghost-border) !important;
  opacity: 1 !important;
  filter: none !important;
}

:is(
  .ghost-button,
  .wallet-button.secondary,
  .wl-button.secondary,
  .lr-button.secondary,
  .btn-outline,
  .button.secondary,
  .staff-contact-lookup-row button,
  .staff-recovery-action button,
  .wallet-actions button:not(.wallet-paid):not(.wallet-approve):not(.wallet-reject):not(.wallet-failed),
  .wallet-batch-actions button:not(.wallet-paid):not(.wallet-approve):not(.wallet-reject):not(.wallet-failed),
  .wallet-export button,
  .promo-actions button,
  .promo-batches button,
  .accounting-admin #promoPagination button,
  .document-summary .document-actions button,
  .document-actions button,
  .itinerary-remove,
  .uploaded-file-remove
):is(:hover, :focus-visible) {
  color: var(--vp-action-ghost-fg) !important;
  background-color: var(--vp-action-ghost-hover) !important;
  border-color: var(--vp-action-ghost-border) !important;
}

/* Inline/text actions retain their lower visual weight and underline cue. */
:is(.text-button, .text-link, .step-validation-link, .insurance-info-trigger, .clear-wizard-test-data) {
  color: var(--vp-action-text) !important;
  background-color: var(--vp-action-text-bg) !important;
  border-color: transparent !important;
  opacity: 1 !important;
  text-decoration-color: currentColor;
}

:is(.text-button, .text-link, .step-validation-link, .insurance-info-trigger, .clear-wizard-test-data):is(:hover, :focus-visible) {
  color: var(--vp-action-text) !important;
  background-color: var(--vp-action-text-hover) !important;
  border-color: transparent !important;
  text-decoration-thickness: 2px;
}

/* Destructive actions remain visually distinct from ordinary secondary actions. */
:is(
  .wl-button.danger,
  .wallet-reject,
  .wallet-failed,
  .text-button.remove-dependent,
  .text-button[data-remove-uk-record],
  .text-button[data-remove-financial-dependant],
  .text-button[data-usa-remove],
  .text-button[data-remove-uk-minor],
  .uploaded-file-remove
) {
  color: var(--vp-action-danger-fg) !important;
  background-color: var(--vp-action-danger-bg) !important;
  border-color: var(--vp-action-danger-bg) !important;
  opacity: 1 !important;
  filter: none !important;
}

:is(
  .wl-button.danger,
  .wallet-reject,
  .wallet-failed,
  .text-button.remove-dependent,
  .text-button[data-remove-uk-record],
  .text-button[data-remove-financial-dependant],
  .text-button[data-usa-remove],
  .text-button[data-remove-uk-minor],
  .uploaded-file-remove
):is(:hover, :focus-visible) {
  color: var(--vp-action-danger-fg) !important;
  background-color: var(--vp-action-danger-hover) !important;
  border-color: var(--vp-action-danger-hover) !important;
}

/* Focus is visible without relying on color alone. */
:is(
  .brand-button, .primary-button, .btn-primary, .ghost-button, .text-button,
  .primary-button, .wallet-button, .wl-button, .lr-button, .btn-outline,
  .button.secondary, .support-launcher, .support-submit, .support-composer button,
  .staff-contact-lookup-row button, .staff-recovery-action button,
  .wallet-paid, .wallet-approve, .wallet-reject, .wallet-failed,
  .wallet-actions button, .wallet-batch-actions button, .wallet-export button,
  .promo-actions button, .promo-batches button, .accounting-admin #promoPagination button,
  .document-summary .document-actions button, .document-actions button,
  .itinerary-remove, .uploaded-file-remove, .step-validation-link,
  .insurance-info-trigger, .clear-wizard-test-data
):focus-visible {
  outline: 3px solid var(--vp-action-focus) !important;
  outline-offset: 2px !important;
}

/* Disabled controls keep the same readable foreground/background pairing;
   reduced emphasis comes from cursor/state semantics, never opacity. */
:is(
  .brand-button, .primary-button, .btn-primary, .ghost-button, .text-button,
  .wallet-button, .wl-button, .lr-button, .btn-outline, .button.secondary,
  .support-launcher, .support-submit, .support-composer button,
  .staff-contact-lookup-row button, .staff-recovery-action button,
  .wallet-paid, .wallet-approve, .wallet-reject, .wallet-failed,
  .wallet-actions button, .wallet-batch-actions button, .wallet-export button,
  .promo-actions button, .promo-batches button, .accounting-admin #promoPagination button,
  .document-summary .document-actions button, .document-actions button,
  .itinerary-remove, .uploaded-file-remove
):is(:disabled, [aria-disabled="true"], .disabled) {
  opacity: 1 !important;
  filter: none !important;
  cursor: not-allowed;
}

:is(.brand-button, .primary-button, .btn-primary, .wallet-button:not(.secondary), .wl-button:not(.secondary):not(.danger), .lr-button:not(.secondary), .support-launcher, .support-submit, .support-composer button, .partner-entry button, .partner-entry .destination, .wallet-paid, .wallet-approve, .staff-destination-primary):is(:disabled, [aria-disabled="true"], .disabled) {
  color: var(--vp-action-solid-fg) !important;
  background-color: var(--vp-action-solid-bg) !important;
  border-color: var(--vp-action-solid-bg) !important;
}

:is(.ghost-button, .wallet-button.secondary, .wl-button.secondary, .lr-button.secondary, .btn-outline, .button.secondary, .staff-contact-lookup-row button, .staff-recovery-action button, .wallet-export button, .promo-actions button, .promo-batches button, .accounting-admin #promoPagination button, .document-summary .document-actions button, .document-actions button, .itinerary-remove, .uploaded-file-remove):is(:disabled, [aria-disabled="true"], .disabled) {
  color: var(--vp-action-ghost-fg) !important;
  background-color: var(--vp-action-ghost-bg) !important;
  border-color: var(--vp-action-ghost-border) !important;
}

:is(.wl-button.danger, .wallet-reject, .wallet-failed, .text-button.remove-dependent, .text-button[data-remove-uk-record], .text-button[data-remove-financial-dependant], .text-button[data-usa-remove], .text-button[data-remove-uk-minor]):is(:disabled, [aria-disabled="true"], .disabled) {
  color: var(--vp-action-danger-fg) !important;
  background-color: var(--vp-action-danger-bg) !important;
  border-color: var(--vp-action-danger-bg) !important;
}

/* Keep client primary/forward and secondary/back controls on the same
   contrast palette without changing staff workspace action styling. */
.client-portal-page :is(.brand-button, .primary-button, .btn-primary):not(:disabled):not([aria-disabled="true"]) {
  color: var(--vp-action-solid-fg) !important;
  background-color: var(--vp-action-solid-bg) !important;
  border-color: var(--vp-action-solid-bg) !important;
}

.client-portal-page :is(.brand-button, .primary-button, .btn-primary):not(:disabled):not([aria-disabled="true"]):is(:hover, :focus-visible) {
  color: var(--vp-action-solid-fg) !important;
  background-color: var(--vp-action-solid-hover) !important;
  border-color: var(--vp-action-solid-hover) !important;
}

.client-portal-page :is(.ghost-button, .btn-outline, .button.secondary):not(:disabled):not([aria-disabled="true"]) {
  color: var(--vp-action-ghost-fg) !important;
  background-color: var(--vp-action-ghost-bg) !important;
  border-color: var(--vp-action-ghost-border) !important;
}

.client-portal-page :is(.ghost-button, .btn-outline, .button.secondary):not(:disabled):not([aria-disabled="true"]):is(:hover, :focus-visible) {
  color: var(--vp-action-ghost-fg) !important;
  background-color: var(--vp-action-ghost-hover) !important;
  border-color: var(--vp-action-ghost-border) !important;
}
