/*
 * Accounting Overlay & Interaction Hardening 2026
 * Prevents stale white dropdown layers, clipped popovers and decorative layers
 * from covering actionable content.
 */

/* Interactive content must always stay above its own decorative background. */
.accounting-app :is(
  .ui-btn,
  .cd26-btn,
  .ui-section-link,
  .ui-quick-link,
  .app-quick-trigger,
  .app-icon-btn,
  .app-account-trigger,
  .app-nav-link,
  .ui-operation-card
) {
  position: relative;
  isolation: isolate;
}

.accounting-app :is(
  .ui-btn,
  .cd26-btn,
  .ui-section-link,
  .ui-quick-link,
  .app-quick-trigger,
  .app-icon-btn,
  .app-account-trigger,
  .app-nav-link,
  .ui-operation-card
) > :is(span, strong, small, svg, i) {
  position: relative;
  z-index: 2;
  opacity: 1 !important;
  visibility: visible !important;
}

.accounting-app :is(
  .ui-btn,
  .cd26-btn,
  .ui-section-link,
  .ui-quick-link,
  .app-quick-trigger,
  .app-icon-btn,
  .app-account-trigger,
  .app-nav-link,
  .ui-operation-card
)::before,
.accounting-app :is(
  .ui-btn,
  .cd26-btn,
  .ui-section-link,
  .ui-quick-link,
  .app-quick-trigger,
  .app-icon-btn,
  .app-account-trigger,
  .app-nav-link,
  .ui-operation-card
)::after {
  pointer-events: none !important;
}

/* Dashboard hero actions: keep text/icons visible above gradients and glass layers. */
.accounting-app .cd26-hero__actions,
.accounting-app .ui-dashboard-hero-actions {
  position: relative;
  z-index: 4;
}

.accounting-app .cd26-btn {
  overflow: hidden;
  color: var(--cd26-ink, #10203a);
}

.accounting-app .cd26-btn--primary {
  color: #fff !important;
}

.accounting-app :is(
  [data-ui-page-header],
  .ui-page-header,
  .ui-dashboard-hero,
  .cd26-hero
)::before,
.accounting-app :is(
  [data-ui-page-header],
  .ui-page-header,
  .ui-dashboard-hero,
  .cd26-hero
)::after {
  pointer-events: none !important;
}

/* --------------------------------------------------------------------------
   Choices.js and searchable selects
   -------------------------------------------------------------------------- */
.accounting-app .choices {
  min-width: 0;
  max-width: 100%;
}

.accounting-app .choices.is-open,
.accounting-app .choices.ui-choices-layer-open {
  z-index: 10020 !important;
}

.accounting-app .choices__list--dropdown,
.accounting-app .choices__list[aria-expanded] {
  height: auto !important;
  min-height: 0 !important;
  max-height: min(360px, calc(100dvh - 32px)) !important;
  background: var(--ui-surface, #fff) !important;
  color: var(--ui-text, #0f172a) !important;
}

.accounting-app .choices__list--dropdown.ui-choices-floating,
.accounting-app .choices__list[aria-expanded].ui-choices-floating {
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: var(--ui-choices-max-height, 320px) !important;
  overflow: hidden !important;
}

.accounting-app .choices__list--dropdown.ui-choices-floating > .choices__list,
.accounting-app .choices__list[aria-expanded].ui-choices-floating > .choices__list {
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(var(--ui-choices-max-height, 320px) - 58px) !important;
  flex: 0 1 auto !important;
  overflow-y: auto !important;
}

/* Closed/stale dropdowns must not remain as transparent or white blockers. */
.accounting-app .choices__list--dropdown:not(.is-active),
.accounting-app .choices__list[aria-expanded="false"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.accounting-app .choices__list--dropdown.is-active,
.accounting-app .choices__list[aria-expanded="true"] {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.accounting-app .choices__item--choice {
  min-height: 42px;
  background: transparent !important;
}

.accounting-app .choices__item--choice.is-highlighted {
  background: var(--ui-blue-50, #eff6ff) !important;
}

html.dark .accounting-app .choices__item--choice.is-highlighted {
  background: #142b47 !important;
}

/* Native select fallback: avoid invisible white-on-white options. */
.accounting-app select option,
.accounting-app select optgroup {
  color: #111827;
  background-color: #fff;
}

html.dark .accounting-app select option,
html.dark .accounting-app select optgroup {
  color: #f8fafc;
  background-color: #0f172a;
}

/* Financial operation dynamic selects. */
.accounting-app [data-financial-operation-select] {
  min-width: 0;
  max-width: 100%;
}

.accounting-app [data-select-empty-note] {
  margin-top: 6px;
  color: #b45309;
  font-size: 11px;
  line-height: 1.65;
}

/* Popovers/dropdowns only interact while explicitly open. */
.accounting-app [data-app-popover][hidden],
.accounting-app [data-dropdown][hidden],
.accounting-app [data-modal][hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.accounting-app [data-app-popover]:not([hidden]),
.accounting-app [data-dropdown]:not([hidden]),
.accounting-app [data-modal]:not([hidden]) {
  visibility: visible;
}

@media (max-width: 767px) {
  .accounting-app .choices__list--dropdown,
  .accounting-app .choices__list[aria-expanded] {
    max-height: min(300px, calc(100dvh - 24px)) !important;
  }
}
