/* ZAD report performance — page scroll first; nested Y-scroll only for huge TB grids */

/* Wide tables: horizontal scroll only — never trap mouse-wheel vertically */
.report-document .table-wrap,
.report-print-sheet .table-wrap,
.app-shell .table-wrap,
.app-shell .data-table-wrap,
.app-shell .ob-table-wrap,
.panel-card .table-wrap {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto !important;
  overflow-y: visible !important;
  max-height: none;
  max-width: 100%;
}

.table-wrap.report-scroll-y {
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Heavy trial-balance style grids only */
.table-wrap.acc-tb-scroll {
  max-height: min(68vh, 640px) !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border: 1px solid var(--bg-alt, #e8e0ec);
  border-radius: 12px;
}

.report-table tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 2.6rem;
}

.report-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card, #fff);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.theme-obsidian .report-table thead th,
body.theme-obsidian .report-table thead th {
  background: rgba(12, 20, 40, 0.96);
}

.report-show-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 0.75rem 0 0.25rem;
  padding: 0.65rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 120, 212, 0.06), transparent);
  border: 1px dashed rgba(0, 120, 212, 0.28);
}

.report-show-more .btn-secondary,
.report-show-more .btn-primary {
  min-height: 2.4rem;
  border-radius: 999px;
  font-weight: 650;
}

.report-show-more__meta {
  font-size: 0.85rem;
  color: var(--text-muted, #605e5c);
  font-weight: 600;
}

/* Global HTTP busy — slim top rail + corner chip (never blocks scroll/mouse) */
.http-busy-rail {
  position: fixed;
  inset: 0 auto auto 0;
  width: 100%;
  height: 0;
  z-index: 9000;
  pointer-events: none !important;
}

.http-busy-rail__track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent, #0078d4) 18%, transparent);
  pointer-events: none !important;
}

.http-busy-rail__bar {
  height: 100%;
  width: 38%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0078d4, #38bdf8, #0078d4);
  animation: http-busy-slide 1.05s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none !important;
}

.http-busy-rail__chip {
  position: fixed;
  bottom: 1.1rem;
  inset-inline-end: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text, #0f172a);
  background: color-mix(in srgb, var(--card, #fff) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #0078d4) 28%, transparent);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  pointer-events: none !important;
}

.theme-obsidian .http-busy-rail__chip,
body.theme-obsidian .http-busy-rail__chip {
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.92);
}

.http-busy-rail__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #0078d4;
  box-shadow: 0 0 0 0 rgba(0, 120, 212, 0.45);
  animation: http-busy-pulse 1s ease-out infinite;
}

.http-busy-rail__label {
  white-space: nowrap;
}

@keyframes http-busy-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

@keyframes http-busy-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 120, 212, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(0, 120, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 120, 212, 0); }
}

/* Instant nav switch — never leave previous screen visible under a new title */
.page-body--switching {
  cursor: progress;
}

.page-body-content--pending {
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
}

.page-nav-skeleton {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  padding: 0.35rem 0 1rem;
  pointer-events: none;
}

.page-nav-skeleton__bar {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #0078d4, transparent);
  background-size: 40% 100%;
  animation: http-busy-slide 1.05s linear infinite;
}

.page-nav-skeleton__card {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  align-self: center;
  margin-top: 2.5rem;
  padding: 0.85rem 1.25rem;
  border-radius: 16px;
  font-weight: 650;
  color: var(--text-muted, #605e5c);
  background: color-mix(in srgb, var(--card, #fff) 90%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent, #0078d4) 30%, transparent);
}

.page-nav-skeleton__pulse {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #0078d4;
  animation: http-busy-pulse 1s ease-out infinite;
}

.report-switch-skeleton {
  padding: 1rem 0.25rem 1.25rem;
  pointer-events: none;
}

.report-switch-skeleton__line {
  height: 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.65rem;
  background: linear-gradient(90deg, #e8eef5, #f7fafc, #e8eef5);
  background-size: 200% 100%;
  animation: report-skel-shine 1.2s ease-in-out infinite;
}

.report-switch-skeleton__line--short {
  width: 42%;
}

.report-switch-skeleton__table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin: 1rem 0;
}

.report-switch-skeleton__table > div {
  height: 2.4rem;
  border-radius: 10px;
  background: linear-gradient(90deg, #e8eef5, #f7fafc, #e8eef5);
  background-size: 200% 100%;
  animation: report-skel-shine 1.2s ease-in-out infinite;
}

.report-switch-skeleton__label {
  margin: 0.35rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--text-muted, #605e5c);
}

@keyframes report-skel-shine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media print {
  .page-nav-skeleton,
  .report-switch-skeleton,
  .page-body-content--pending {
    display: none !important;
  }
}

@media print {
  .table-wrap.report-scroll-y,
  .table-wrap.acc-tb-scroll {
    max-height: none !important;
    overflow: visible !important;
  }
  .report-table tbody tr {
    content-visibility: visible;
  }
  .report-show-more,
  .http-busy-rail,
  .http-busy-overlay {
    display: none !important;
  }
}

body.print-report .table-wrap.report-scroll-y,
body.print-report .table-wrap.acc-tb-scroll {
  max-height: none !important;
  overflow: visible !important;
}

body.print-report .report-show-more,
body.print-report .http-busy-rail,
body.print-report .http-busy-overlay {
  display: none !important;
}
