/*
 * HENDAR UALL-Y — acceptance recovery.
 *
 * This layer owns only surfaces that must have an explicit scroll owner.
 * It deliberately uses a dedicated finance viewport so broad legacy
 * `.table-card { overflow: visible !important; }` rules cannot leak rows into
 * the following workspace empty-state.
 */

#workspaceTable.finance-special-panel-hidden,
#workspaceTable.hidden {
  display: none !important;
}

#companyFinanceTable {
  height: auto !important;
  max-height: none !important;
  overflow: clip !important;
  scrollbar-gutter: auto !important;
}

#companyFinanceTable .company-finance-scroll-viewport {
  position: relative;
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  block-size: auto;
  max-block-size: none;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
}

#companyFinanceTable.is-scrollable .company-finance-scroll-viewport {
  block-size: clamp(460px, 60dvh, 650px) !important;
  max-block-size: clamp(460px, 60dvh, 650px) !important;
  overflow: auto !important;
  scrollbar-width: auto;
  scrollbar-color: var(--company-primary, #0b3452) #e7edf2;
}

#companyFinanceTable .company-finance-scroll-viewport::-webkit-scrollbar {
  inline-size: 13px;
  block-size: 13px;
}

#companyFinanceTable .company-finance-scroll-viewport::-webkit-scrollbar-track {
  background: #e7edf2;
  border-radius: 999px;
}

#companyFinanceTable .company-finance-scroll-viewport::-webkit-scrollbar-thumb {
  min-block-size: 48px;
  border: 3px solid #e7edf2;
  border-radius: 999px;
  background: var(--company-primary, #0b3452);
}

#companyFinanceTable .company-finance-scroll-viewport > table {
  inline-size: 100%;
  min-inline-size: 1420px;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto !important;
}

#companyFinanceTable .company-finance-scroll-viewport > table > thead > tr > th {
  position: sticky !important;
  inset-block-start: 0 !important;
  z-index: 8;
}

#companyFinanceTable .company-finance-row-actions {
  display: flex !important;
  flex-flow: row nowrap !important;
  gap: 6px;
  min-inline-size: 236px;
  white-space: nowrap !important;
}

#companyFinanceTable .company-finance-row-actions .row-action,
#companyFinanceTable .company-financial-entry-receipts {
  min-inline-size: 70px !important;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
  writing-mode: horizontal-tb !important;
}

/* Normal pages use the document as their only vertical scroll owner. */
html[data-auth-surface="app"],
html[data-auth-surface="app"] body,
body.hendar-authenticated {
  block-size: auto !important;
  min-block-size: 100% !important;
  max-block-size: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
}

html[data-auth-surface="app"] .app-shell:not(.hidden),
body.hendar-authenticated .app-shell:not(.hidden),
html[data-auth-surface="app"] .main-content,
body.hendar-authenticated .main-content {
  block-size: auto !important;
  min-block-size: 100dvh !important;
  max-block-size: none !important;
  overflow: visible !important;
}

html[data-auth-surface="app"] .main-content > .view.active:not([hidden]),
body.hendar-authenticated .main-content > .view.active:not([hidden]) {
  block-size: auto !important;
  min-block-size: calc(100dvh - 72px) !important;
  max-block-size: none !important;
  overflow: visible !important;
  touch-action: pan-y !important;
}

/* Desktop navigation remains anchored; its menu is the only sidebar scroller. */
@media (min-width: 981px) {
  .app-shell:not(.hidden) > .sidebar {
    position: fixed !important;
    inset-block: 0 !important;
    inset-inline-start: 0 !important;
    block-size: 100dvh !important;
    max-block-size: 100dvh !important;
    overflow: hidden !important;
    transform: none !important;
  }

  .app-shell:not(.hidden) > .sidebar .main-nav {
    min-block-size: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
}

/* Chart fill always starts from the RTL (right) edge. */
.finance-chart-track {
  direction: rtl !important;
}

.finance-chart-track::after {
  inset-inline-start: 0 !important;
  inset-inline-end: auto !important;
  transform-origin: right center !important;
}

@media (max-width: 680px) {
  #companyFinanceTable.is-scrollable .company-finance-scroll-viewport {
    block-size: max(380px, 56dvh) !important;
    max-block-size: max(380px, 56dvh) !important;
  }
}

@media print {
  #companyFinanceTable,
  #companyFinanceTable.is-scrollable,
  #companyFinanceTable .company-finance-scroll-viewport,
  #companyFinanceTable.is-scrollable .company-finance-scroll-viewport {
    block-size: auto !important;
    max-block-size: none !important;
    overflow: visible !important;
  }
}
