/* Allow horizontal scroll within the financials report area */
.financials-review-page {
  overflow-x: visible !important;
  max-width: 100%;
}

.financials-review-page .review-section {
  min-width: 0;
  max-width: 100%;
}

.financials-review-page .review-section > * {
  min-width: 0;
  max-width: 100%;
}

.financials-review-page .report-section {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.financials-review-page .report-content {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

.financials-report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin-bottom: 1.25rem;
  color: #64748b;
  font-size: 0.9rem;
}

.financials-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.financials-summary-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.financials-summary-card.highlight {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
}

.financials-summary-card.warning {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
}

.financials-summary-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.financials-summary-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.financials-summary-sub {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: #475569;
}

.financials-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  scrollbar-gutter: stable;
}

.financials-table-scroll::after {
  content: 'Scroll horizontally for all columns →';
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #64748b;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.financials-report-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.financials-report-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #16a34a;
  color: #fff;
  padding: 0.7rem 0.55rem;
  text-align: right;
  white-space: nowrap;
  border: 1px solid #15803d;
  font-weight: 700;
}

.financials-report-table thead th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #16a34a;
}

.financials-report-table tbody td {
  padding: 0.65rem 0.55rem;
  text-align: right;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  color: #0f172a;
}

.financials-report-table tbody td:first-child {
  text-align: left;
  font-weight: 600;
  background: #f8fafc;
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 4px rgba(15, 23, 42, 0.06);
}

.financials-report-table tbody tr:nth-child(even) td:not(:first-child) {
  background: #fcfdff;
}

.financials-report-table tbody tr:hover td:not(:first-child) {
  background: #f0fdf4;
}

.financials-report-table tbody tr:hover td:first-child {
  background: #dcfce7;
}

.financials-report-table .metric-highlight {
  background: #dbeafe !important;
  font-weight: 600;
}

.financials-report-table .metric-profit {
  background: #dcfce7 !important;
  font-weight: 700;
}

.financials-report-table tr.totals-row td {
  background: #e5e7eb !important;
  font-weight: 700;
  border-top: 3px solid #9ca3af;
}

.financials-report-table tr.totals-row td:first-child {
  background: #d1d5db !important;
  position: sticky;
  left: 0;
  z-index: 2;
}

.financials-report-empty {
  padding: 2rem;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 0.75rem;
}

/* Stack filters above full-width report */
.financials-review-page .review-section {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 2rem;
}

.financials-review-page .report-section {
  grid-column: 1 / -1;
  width: 100%;
}

/* Prevent main layout from clipping the report scroll area */
.main-content:has(.financials-review-page .report-section) {
  overflow-x: auto;
}

@media (max-width: 768px) {
  .financials-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .financials-summary-value {
    font-size: 1.1rem;
  }
}
