/* report-pages.css — Shared report page layout (PRD §4.5) */

.report-filters-card {
  margin-bottom: 1.25rem;
}

.report-filters-card .app-card-header {
  padding-bottom: 0.5rem;
}

.report-fy-readonly,
.report-fy-readonly.form-control,
.report-fy-readonly.form-select {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.45rem;
  background-color: var(--ecf-surface-muted, #f4f6f8);
  font-size: 0.75rem;
  line-height: 1.35;
  padding: 0.35rem 0.55rem;
  min-height: 0;
  height: auto;
  color: var(--text-primary, #1e293b);
  cursor: not-allowed;
  opacity: 0.85;
}

.report-fy-select,
.report-fy-select.form-select {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.45rem;
  background-color: #fff;
  font-size: 0.75rem;
  line-height: 1.35;
  padding: 0.35rem 1.75rem 0.35rem 0.55rem;
  min-height: 0;
  height: auto;
  color: var(--text-primary, #1e293b);
  cursor: pointer;
}

.report-date-warning {
  font-size: 0.8125rem;
  color: #b45309;
  margin-top: 0.35rem;
}

.report-generate-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ecf-border, #e2e8f0);
}

.report-preview-card {
  margin-bottom: 1.5rem;
}

.report-preview-header {
  border-bottom: 1px solid var(--ecf-border, #e2e8f0);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.report-preview-church {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.report-preview-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.report-preview-subtitle {
  margin-bottom: 0.35rem;
  color: var(--ecf-text-muted, #64748b);
}

.report-preview-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.35rem 1rem;
  font-size: 0.8125rem;
  color: var(--ecf-text-muted, #64748b);
}

.report-preview-meta strong {
  color: var(--ecf-text, #1e293b);
  font-weight: 500;
}

.report-preview-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.report-formatted-modal-body {
  background: #f3f5f4;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.report-formatted-modal-body > .report-export-content-selector,
.report-formatted-modal-body > [id$="ReportPrintable"] {
  width: 100%;
  min-width: 58rem;
  max-width: none;
  box-sizing: border-box;
}

.report-export-content-selector {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ecf-border, #dfe5e2);
  border-radius: 0.5rem;
  background: #ffffff;
}

.report-export-content-label {
  color: var(--ecf-text, #1e293b);
  font-size: 0.8125rem;
  font-weight: 700;
}

.report-export-content-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.report-formatted-modal-body .report-export-content-options .form-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.3rem;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  padding-left: 0;
}

.report-formatted-modal-body .report-export-content-options .form-check-input {
  float: none;
  flex: 0 0 auto;
  margin: 0.15rem 0 0;
}

.report-formatted-modal-body .report-export-content-options .form-check-label {
  min-width: 0;
  color: var(--ecf-text, #1e293b);
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.report-export-content-warning {
  grid-column: 1 / -1;
  margin: 0;
  color: #b45309;
  font-size: 0.75rem;
}

@media (max-width: 576px) {
  .report-export-content-selector {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }
}

.formatted-report-document {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  background: #ffffff;
  padding: 2.5rem;
  box-shadow: 0 0.4rem 1.25rem rgba(15, 23, 42, 0.12);
  color: #172033;
  font-size: 0.875rem;
  box-sizing: border-box;
}

.formatted-report-header {
  border-bottom: 2px solid #1b4332;
  padding-bottom: 1.1rem;
  margin-bottom: 0;
}

.formatted-report-letterhead {
  display: block;
  width: 100%;
}

.formatted-report-letterhead table {
  width: 100%;
}

.report-letterhead-church {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
}

.report-letterhead-church-text {
  flex: 1 1 auto;
  min-width: 0;
}

.report-letterhead-logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 3.25rem;
  height: 4rem;
  max-width: 11rem;
  padding: 0.2rem 0.35rem;
  border-radius: 0.5rem;
  background: #e8efeb;
}

.report-letterhead-logo img {
  max-height: 3.6rem;
  max-width: 10.5rem;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.report-letterhead-logo--placeholder {
  width: 3.25rem;
  max-width: 3.25rem;
  color: #1b4332;
  font-size: 1.35rem;
}

.report-letterhead-page-value::before {
  content: "—";
}

@media print {
  .report-letterhead-page-value::before {
    content: counter(page);
  }
}

.formatted-report-church {
  color: #1b4332;
  font-size: 1.125rem;
  font-weight: 700;
}

.formatted-report-title {
  margin-top: 0.45rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.formatted-report-generated {
  color: var(--ecf-text-muted, #52606d);
  font-size: 0.75rem;
  text-align: right;
}

.formatted-report-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 1rem 0;
  font-size: 0.75rem;
}

.formatted-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.formatted-report-table th,
.formatted-report-table td {
  padding: 0.625rem 0.7rem;
  border-bottom: 1px solid #dfe5e2;
  white-space: nowrap;
  vertical-align: top;
}

.formatted-report-table-scroll,
.formatted-account-table-scroll,
.formatted-donation-table-scroll {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.report-period-compare-banner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--ecf-border, #dfe5e2);
  border-radius: 0.55rem;
  background: linear-gradient(180deg, #f8fbf9 0%, #ffffff 100%);
}

.report-period-compare-item {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.report-period-compare-label {
  color: var(--ecf-text-muted, #64748b);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.report-period-compare-item strong {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
}

.report-period-compare-item--previous {
  padding-left: 0.75rem;
  border-left: 1px solid var(--ecf-border, #e2e8f0);
}

@media (max-width: 768px) {
  .report-period-compare-banner {
    grid-template-columns: 1fr;
  }

  .report-period-compare-item--previous {
    padding-left: 0;
    border-left: none;
    padding-top: 0.55rem;
    border-top: 1px solid var(--ecf-border, #e2e8f0);
  }
}

.formatted-report-table thead th {
  background: #e8efeb;
  color: #1b4332;
  text-align: left;
}

.formatted-report-table th:not(:first-child),
.formatted-report-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.formatted-account-report-document .formatted-report-table th {
  white-space: nowrap;
}

.formatted-account-table-scroll {
  overflow-x: auto;
}

.formatted-account-detail-table {
  min-width: 62rem;
}

.formatted-account-detail-table th,
.formatted-account-detail-table td {
  white-space: nowrap;
}

.formatted-account-detail-table td:nth-child(5) {
  min-width: 13rem;
}

/* §4.5.4 formatted preview — ledger columns left; amount column right */
.formatted-donation-report-document .formatted-donation-detail-table {
  min-width: 72rem;
}

.formatted-donation-report-document .formatted-donation-detail-table th,
.formatted-donation-report-document .formatted-donation-detail-table td {
  text-align: left !important;
  font-variant-numeric: normal;
}

.formatted-donation-report-document .formatted-donation-detail-table th.col-amount,
.formatted-donation-report-document .formatted-donation-detail-table td.col-amount {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.formatted-donation-report-document .formatted-donation-detail-table th:nth-child(7),
.formatted-donation-report-document .formatted-donation-detail-table td:nth-child(7) {
  white-space: normal;
  min-width: 11rem;
  max-width: 26rem;
}

.formatted-donation-report-document .formatted-donation-receipt-detail-table th,
.formatted-donation-report-document .formatted-donation-receipt-detail-table td {
  text-align: left !important;
  font-variant-numeric: normal;
}

.formatted-donation-report-document .formatted-donation-receipt-detail-table th:nth-child(5),
.formatted-donation-report-document .formatted-donation-receipt-detail-table td:nth-child(5) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.formatted-report-detail-heading {
  margin: 1.5rem 0 0.75rem;
  color: #172033;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
}

.formatted-report-subheading {
  margin: 0 0 0.5rem;
  color: #1b4332;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.35;
}

.formatted-report-subheading--spaced {
  margin-top: 1.125rem;
}

.audit-export-sample-section {
  margin-top: 0.25rem;
}

.audit-export-sample-note {
  margin: 0 0 0.5rem;
  color: var(--ecf-text-muted, #64748b);
  font-size: 0.75rem;
  line-height: 1.4;
}

.audit-export-page-sample-scroll {
  margin-bottom: 0.75rem;
}

.audit-export-page-sample-table th,
.audit-export-page-sample-table td {
  vertical-align: top;
  font-size: 0.8125rem;
  white-space: normal;
}

.report-outstanding-section {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid #f1d5a6;
  border-radius: 0.55rem;
  background: #fffaf1;
}

.report-outstanding-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.report-outstanding-heading .report-section-title {
  margin: 0 0 0.2rem;
}

.report-outstanding-note {
  margin: 0;
  color: #8a5a12;
  font-size: 0.75rem;
}

.report-outstanding-count {
  flex: 0 0 auto;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #f8e7c4;
  color: #7c4a03;
  font-size: 0.75rem;
  font-weight: 700;
}

.report-outstanding-table-scroll {
  max-height: 18rem;
  overflow: auto;
}

.report-outstanding-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff3dc;
  box-shadow: 0 1px 0 rgba(124, 74, 3, 0.12);
}

@media (max-width: 576px) {
  .report-outstanding-heading {
    flex-direction: column;
  }
}

.formatted-report-section th {
  padding-top: 0.7rem;
  background: #f3f7f5;
  color: #1b4332;
  text-align: left !important;
}

.formatted-report-section--expense th {
  background: #fff4f6;
  color: #9f1239;
}

.formatted-report-item {
  padding-left: 1.4rem !important;
}

.formatted-report-total th,
.formatted-report-total td {
  background: #eff7f2;
  font-weight: 700;
}

.formatted-report-total--expense th,
.formatted-report-total--expense td {
  background: #fff0f3;
  color: #9f1239;
}

.formatted-report-net th,
.formatted-report-net td {
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
}

.formatted-report-balance th,
.formatted-report-balance td {
  background: #f8fafc;
  font-weight: 700;
}

.report-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.report-summary-card {
  background: var(--ecf-surface-muted, #f8fafc);
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}

.report-summary-label {
  font-size: 0.75rem;
  color: var(--ecf-text-muted, #64748b);
  margin-bottom: 0.25rem;
}

.report-summary-value {
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.report-summary-value--income {
  color: #2d6a4f;
}

.report-summary-value--expense {
  color: #e11d48;
}

.report-summary-value--net {
  color: #7c3aed;
}

.report-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}

.report-section-title:first-child {
  margin-top: 0;
}

.report-fund-block {
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.report-fund-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--ecf-surface-muted, #f8fafc);
  cursor: pointer;
  user-select: none;
}

.report-fund-block-header:hover {
  background: #eef2f6;
}

.report-fund-block-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.report-fund-block-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.report-fund-block-body {
  padding: 0 1rem 0.75rem;
}

.report-fund-block-body.collapsed {
  display: none;
}

.fund-report-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.fund-report-card {
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-left: 4px solid #2d6a4f;
  border-radius: 0.55rem;
  padding: 0.7rem 0.85rem;
  background: linear-gradient(180deg, #f5fbf7 0%, #ffffff 100%);
}

.fund-report-card-name {
  color: #1b4332;
  font-size: 0.8125rem;
  font-weight: 700;
}

.fund-report-card-closing {
  margin: 0.35rem 0;
  color: #1b4332;
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fund-report-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--ecf-text-muted, #64748b);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.fund-report-charts {
  margin-bottom: 1.25rem;
}

.report-fund-detail-scroll {
  max-height: 18rem;
  overflow: auto;
  overscroll-behavior: contain;
}

.report-fund-detail-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--ecf-surface-muted, #f4f6f8);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.1);
}

.formatted-fund-detail-heading {
  margin: 1.75rem 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 700;
}

.formatted-fund-detail {
  margin-top: 1rem;
}

.formatted-fund-detail h3 {
  margin: 0;
  padding: 0.5rem 0.625rem;
  background: #f3f7f5;
  color: #1b4332;
  font-size: 0.8125rem;
  font-weight: 700;
}

.formatted-fund-no-data {
  margin: 0;
  padding: 0.5rem 0.625rem;
  color: var(--ecf-text-muted, #52606d);
  font-size: 0.75rem;
}

.report-account-grid {
  overflow-x: auto;
}

.report-account-grid table {
  min-width: 60rem;
}

.report-account-total-row th,
.report-account-total-row td {
  background: #eff7f2;
  color: #1b4332;
  font-weight: 700;
}

.report-account-picker {
  position: relative;
}

.report-account-picker-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-color, #d8e2dc);
  border-radius: 0.45rem;
  background: #fff;
  color: var(--text-primary, #1e293b);
  font-size: 0.8125rem;
  text-align: left;
}

.report-account-picker-toggle:hover,
.report-account-picker-toggle.is-open {
  border-color: #35825f;
  box-shadow: 0 0 0 0.15rem rgba(53, 130, 95, 0.12);
}

.report-account-picker-toggle .bi {
  transition: transform 0.15s ease;
}

.report-account-picker-toggle.is-open .bi {
  transform: rotate(180deg);
}

.report-account-picker-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.35rem);
  left: 0;
  width: min(42rem, calc(100vw - 3rem));
  padding: 0.75rem;
  border: 1px solid var(--border-color, #d8e2dc);
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 0.65rem 1.5rem rgba(15, 23, 42, 0.16);
}

.report-account-picker-panel .report-account-checkboxes {
  display: grid;
  grid-template-columns: 1fr;
  max-height: 20rem;
  overflow-y: auto;
  gap: 0.35rem 1rem;
  border: 0;
  padding: 0.15rem 0.2rem 0.15rem 0.05rem;
}

.report-account-picker-panel .form-check {
  margin: 0;
}

.report-account-picker-panel .form-check-label {
  font-size: 0.8125rem;
}

.report-account-option-meta,
.report-account-block-meta {
  display: block;
  color: var(--ecf-text-muted, #64748b);
  font-size: 0.6875rem;
}

.report-account-block-meta {
  display: inline;
  margin-left: 0.6rem;
}

.account-report-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(14rem, 0.55fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.account-report-chart-panel,
.account-report-closing-panel {
  min-width: 0;
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.75rem;
}

.account-report-chart-panel h3,
.account-report-closing-panel h3 {
  margin: 0 0 0.55rem;
  color: var(--ecf-text, #1e293b);
  font-size: 0.8125rem;
  font-weight: 700;
}

.account-report-chart-wrap {
  position: relative;
  height: 15rem;
}

.account-report-closing-panel {
  background: linear-gradient(180deg, #f7fbff 0%, #fff 100%);
}

.account-report-closing-list {
  display: grid;
  gap: 0.35rem;
  border-bottom: 1px solid var(--ecf-border, #e2e8f0);
  padding-bottom: 0.55rem;
}

.account-report-closing-list div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
}

.account-report-closing-list strong {
  font-variant-numeric: tabular-nums;
}

.account-report-donut-wrap {
  position: relative;
  height: 12rem;
  margin-top: 0.5rem;
}

.account-report-chart-data {
  display: none;
}

@media (max-width: 900px) {
  .account-report-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-report-closing-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 576px) {
  .report-account-picker-panel {
    width: calc(100vw - 2rem);
  }

  .report-account-picker-panel .report-account-checkboxes {
    grid-template-columns: 1fr;
  }

  .account-report-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .account-report-closing-panel {
    grid-column: auto;
  }
}

.report-compare-table th,
.report-compare-table td {
  font-variant-numeric: tabular-nums;
}

.report-compare-table .compare-pct--up {
  color: #2d6a4f;
}

.report-compare-table .compare-pct--down {
  color: #e11d48;
}

.report-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 1rem;
}

.report-filters-card .cat-filter-field--export-sections {
  flex: 1 1 100%;
  min-width: 0;
  max-width: none;
}

.report-filters-card .audit-export-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.35rem 1.25rem;
  width: 100%;
  min-width: 0;
}

.report-filters-card .audit-export-sections-grid .form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0;
  min-width: 0;
  padding-left: 0;
}

.report-filters-card .audit-export-sections-grid .form-check-input {
  float: none;
  flex: 0 0 auto;
  margin: 0.15rem 0 0;
}

.report-filters-card .audit-export-sections-grid .form-check-label {
  margin: 0;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-primary, #1e293b);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.report-checkbox-grid .form-check {
  margin-bottom: 0;
}

.report-fund-picker-field {
  min-width: 15rem;
}

.report-fund-picker {
  position: relative;
}

.report-fund-picker-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-color, #d8e2dc);
  border-radius: 0.45rem;
  background: #ffffff;
  color: var(--text-primary, #1e293b);
  font-size: 0.8125rem;
  text-align: left;
}

.report-fund-picker-toggle:hover,
.report-fund-picker-toggle.is-open {
  border-color: #35825f;
  box-shadow: 0 0 0 0.15rem rgba(53, 130, 95, 0.12);
}

.report-fund-picker-toggle .bi {
  transition: transform 0.15s ease;
}

.report-fund-picker-toggle.is-open .bi {
  transform: rotate(180deg);
}

.report-fund-picker-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.35rem);
  left: 0;
  width: min(31rem, calc(100vw - 3rem));
  padding: 0.75rem;
  border: 1px solid var(--border-color, #d8e2dc);
  border-radius: 0.55rem;
  background: #ffffff;
  box-shadow: 0 0.65rem 1.5rem rgba(15, 23, 42, 0.16);
}

.report-fund-picker-actions {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--ecf-border, #e2e8f0);
}

.report-fund-picker-actions .settings-btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
}

.report-fund-picker-panel .report-checkbox-grid {
  max-height: 14rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.report-fund-picker-panel .form-check-label {
  font-size: 0.8125rem;
}

.report-export-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.report-export-file-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--ecf-border, #e2e8f0);
  font-size: 0.875rem;
}

.report-export-file-list li:last-child {
  border-bottom: none;
}

.audit-export-summary-table th,
.audit-export-summary-table td {
  vertical-align: top;
  font-size: 0.8125rem;
}

.audit-export-row-count {
  width: 5rem;
  font-variant-numeric: tabular-nums;
}

.audit-export-columns-preview {
  min-width: 12rem;
  color: var(--ecf-text-muted, #64748b);
}

.audit-export-sample-preview {
  min-width: 14rem;
  max-width: 22rem;
}

.audit-export-summary-scroll {
  margin-bottom: 0.5rem;
}

.formatted-audit-export-document .audit-export-formatted-summary td:nth-child(3) {
  text-align: left !important;
  white-space: normal;
}

/* §4.5.6 modal preview — wide text worksheets (e.g. settings snapshot) */
.report-formatted-modal-body > #formattedAuditExportPrintable {
  min-width: 0;
}

.formatted-audit-export-document .audit-export-sample-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin-bottom: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.formatted-audit-export-document .audit-export-sample-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.formatted-audit-export-document .audit-export-sample-table th,
.formatted-audit-export-document .audit-export-sample-table td {
  text-align: left !important;
  white-space: normal !important;
  word-break: break-word;
  font-variant-numeric: normal;
  vertical-align: top;
}

.formatted-audit-export-document .audit-export-sample-table thead th {
  white-space: nowrap;
}

.report-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.report-kpi-card {
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.5rem;
  padding: 0.65rem 0.85rem;
  text-align: center;
}

.report-kpi-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.report-kpi-label {
  font-size: 0.75rem;
  color: var(--ecf-text-muted, #64748b);
}

.report-kpi-card--income .report-kpi-value {
  color: #2d6a4f;
}

.report-kpi-card--expense .report-kpi-value {
  color: #e11d48;
}

.report-kpi-card--surplus .report-kpi-value {
  color: #7c3aed;
}

.report-kpi-card--surplus-negative .report-kpi-value {
  color: #e11d48;
}

.report-kpi-card--opening .report-kpi-value,
.report-kpi-card--closing .report-kpi-value {
  color: #1e40af;
}

.report-kpi-sub {
  font-size: 0.6875rem;
  color: var(--ecf-text-muted, #94a3b8);
  margin-top: 0.15rem;
}

.report-charts-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.report-chart-panel {
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  min-width: 0;
}

.report-chart-title {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.report-chart-canvas-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}

.report-chart-legend {
  font-size: 0.78rem;
  color: var(--text-secondary, #64748b);
}

.report-chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.report-legend-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.report-legend-dot--income {
  background-color: #2d6a4f;
}

.report-legend-dot--expense {
  background-color: #e11d48;
}

.report-donut-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-donut-canvas-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}

.report-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 0 1.5rem;
}

.report-donut-center-label {
  font-size: 0.7rem;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

.report-donut-center-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}

.report-donut-legend li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  padding: 0.35rem 0;
}

.report-donut-legend-name {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-primary, #1e293b);
}

.report-donut-legend-meta {
  color: var(--text-muted, #64748b);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.report-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.report-category-panel {
  border-radius: 0.65rem;
  padding: 0.85rem 1rem 1rem;
  min-width: 0;
  border: 1px solid transparent;
}

.report-category-panel--income {
  background: linear-gradient(180deg, #f3faf6 0%, #ffffff 100%);
  border-color: rgba(45, 106, 79, 0.22);
  box-shadow: inset 4px 0 0 #2d6a4f;
}

.report-category-panel--expense {
  background: linear-gradient(180deg, #fff5f7 0%, #ffffff 100%);
  border-color: rgba(225, 29, 72, 0.18);
  box-shadow: inset 4px 0 0 #e11d48;
}

.report-category-panel-title {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.report-category-panel--income .report-category-panel-title {
  color: #1b4332;
}

.report-category-panel--expense .report-category-panel-title {
  color: #9f1239;
}

.report-category-panel--income .report-category-table thead th {
  background-color: rgba(45, 106, 79, 0.08);
  color: #1b4332;
}

.report-category-panel--expense .report-category-table thead th {
  background-color: rgba(225, 29, 72, 0.08);
  color: #9f1239;
}

.report-category-table-scroll,
.report-detail-table-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.report-category-table-scroll {
  max-height: 22rem;
}

.report-detail-table-scroll {
  max-height: 30rem;
}

.report-category-table-scroll thead th,
.report-detail-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-clip: padding-box;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.1);
}

.report-category-panel--income .report-category-table-scroll thead th {
  background-color: #e2f0e8;
}

.report-category-panel--expense .report-category-table-scroll thead th {
  background-color: #ffe4eb;
}

.report-detail-table-scroll thead th {
  background-color: var(--ecf-surface-muted, #f4f6f8);
}

.report-category-table th:nth-child(1) {
  min-width: 7rem;
}

.report-category-table th:nth-child(2),
.report-category-table td:nth-child(2) {
  min-width: 6.5rem;
  color: var(--ecf-text-muted, #64748b);
}

.report-category-table th:nth-child(3),
.report-category-table td:nth-child(3) {
  white-space: nowrap;
}

.report-amount--income {
  color: #2d6a4f;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.report-amount--expense {
  color: #e11d48;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 992px) {
  .report-category-grid {
    grid-template-columns: 1fr;
  }
}

.report-calc-note {
  font-size: 0.75rem;
  color: var(--ecf-text-muted, #64748b);
  border-top: 1px solid var(--ecf-border, #e2e8f0);
  margin-top: 1.25rem;
  padding-top: 0.75rem;
}

.report-calc-note ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

@media (max-width: 768px) {
  .report-charts-row {
    grid-template-columns: 1fr;
  }
}

.report-filters-card .cat-filter-field--inline {
  min-width: 12rem;
  max-width: none;
  flex: 1 1 14rem;
}

.report-filters-card .cat-filter-field--toggle-row {
  flex: 2 1 22rem;
  min-width: 18rem;
}

.report-filters-card .cat-filter-field--reset-period {
  flex: 0 0 auto;
  min-width: auto;
  align-self: end;
}

.report-filters-card .cat-filter-field--reset-period .cat-filter-reset {
  margin-left: 0;
  padding: 0.35rem 0;
  white-space: nowrap;
}

.report-filters-card .btn.report-reset-period-btn.settings-btn {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #7dd3fc !important;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  box-shadow: none;
}

.report-filters-card .btn.report-reset-period-btn.settings-btn:hover,
.report-filters-card .btn.report-reset-period-btn.settings-btn:focus {
  background-color: #bae6fd !important;
  color: #0c4a6e !important;
  border-color: #38bdf8 !important;
}

.report-generate-row .settings-btn-export {
  background-color: #ffffff;
  color: var(--primary-color, #2d6a4f);
  border: 1px solid var(--primary-color, #2d6a4f);
  font-weight: 600;
}

.report-generate-row .settings-btn-export:hover,
.report-generate-row .settings-btn-export:focus {
  background-color: #eef6f1;
  color: var(--primary-hover, #245a42);
  border-color: var(--primary-hover, #245a42);
}

.report-filter-toggle--combined {
  gap: 0.35rem 0.85rem;
}

.report-filter-toggle-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}

.report-filters-card .report-filter-donation-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0;
  padding-left: 0;
  border-left: 1px solid var(--ecf-border, #e2e8f0);
  padding-left: 0.85rem;
  margin-left: 0.15rem;
}

.report-filters-card .report-filter-donation-switch .form-check-input {
  width: 2.25rem;
  height: 1.2rem;
  margin: 0;
  float: none;
  flex-shrink: 0;
  cursor: pointer;
  background-color: #cbd5e1;
  border-color: #94a3b8;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  background-position: left center;
  background-size: contain;
  transition: background-color 0.15s ease, border-color 0.15s ease, background-position 0.15s ease;
}

.report-filters-card .report-filter-donation-switch .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(45, 106, 79, 0.2);
}

.report-filters-card .report-filter-donation-switch .form-check-input:checked {
  background-color: var(--primary-color, #2d6a4f);
  border-color: var(--primary-color, #2d6a4f);
  background-position: right center;
}

.report-filters-card .report-filter-donation-switch .form-check-label {
  font-size: 0.75rem;
  line-height: 1.35;
  margin: 0;
  cursor: pointer;
  color: var(--text-secondary, #64748b);
}

.report-filters-card .report-filter-donation-switch.report-donation-switch--on .form-check-label {
  color: var(--primary-color, #2d6a4f);
  font-weight: 600;
}

.report-filter-toggle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  min-height: calc(0.75rem * 1.35 + 0.7rem);
}

.report-filters-card .report-filter-toggle .form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0;
  min-height: 0;
  padding-left: 0;
}

.report-filters-card .report-filter-toggle .form-check-inline {
  margin-right: 0;
}

.report-filters-card .report-filter-toggle .form-check-input[type="radio"] {
  width: 0.85rem;
  height: 0.85rem;
  margin: 0;
  float: none;
  flex-shrink: 0;
  margin-top: 0;
}

.report-filters-card .report-filter-toggle .form-check-input[type="radio"]:checked {
  background-color: var(--primary-color, #2d6a4f);
  border-color: var(--primary-color, #2d6a4f);
}

.report-filters-card .report-filter-toggle .form-check-label {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-primary, #1e293b);
  margin: 0;
}

.report-filters-card .report-filter-toggle.form-switch {
  padding-left: 0;
}

.report-filters-card .report-filter-toggle.form-switch .form-check-input {
  width: 2rem;
  height: 1.05rem;
  margin-left: 0;
}

.report-account-checkboxes {
  max-height: 10rem;
  overflow-y: auto;
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
}

.report-account-check-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.report-account-check-actions button {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
}

.donation-report-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(12rem, 0.75fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.donation-report-chart-panel,
.donation-report-category-panel {
  min-width: 0;
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.75rem;
}

.donation-report-chart-panel h3,
.donation-report-category-panel h3,
.donation-report-matrix-panel h3,
.donation-report-receipt-panel h3 {
  margin: 0 0 0.55rem;
  color: var(--ecf-text, #1e293b);
  font-size: 0.8125rem;
  font-weight: 700;
}

.donation-report-chart-wrap {
  position: relative;
  height: 15rem;
}

.donation-report-category-panel {
  background: linear-gradient(180deg, #f7fbf8 0%, #fff 100%);
}

.donation-report-matrix-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(12rem, 0.55fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.donation-report-matrix-panel,
.donation-report-receipt-panel {
  min-width: 0;
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.75rem;
}

.donation-report-matrix-scroll {
  max-height: 22rem;
  overflow: auto;
}

.report-donation-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}

.report-donation-matrix-total-row th,
.report-donation-matrix-total-row td {
  background: #f3f7f5;
  font-weight: 700;
}

.donation-report-receipt-panel {
  background: linear-gradient(180deg, #f7fbff 0%, #fff 100%);
}

.donation-report-receipt-list {
  display: grid;
  gap: 0.65rem;
}

.donation-report-receipt-list div {
  display: grid;
  gap: 0.15rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--ecf-border, #e2e8f0);
}

.donation-report-receipt-list div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.donation-report-receipt-list span {
  font-size: 0.75rem;
  color: var(--ecf-text-muted, #64748b);
}

.donation-report-receipt-list strong {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.donation-report-receipt-list small {
  font-size: 0.72rem;
  color: var(--ecf-text-muted, #64748b);
}

.report-footnote {
  margin-top: 0.75rem;
  padding-left: 0.15rem;
}

@media (max-width: 992px) {
  .donation-report-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .donation-report-category-panel {
    grid-column: 1 / -1;
  }

  .donation-report-matrix-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .donation-report-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* §4.5.5 Year comparison dashboard */
.report-kpi-card--donation .report-kpi-value {
  color: #7c3aed;
}

.report-compare-year-grid {
  max-height: 12rem;
  overflow-y: auto;
  grid-template-columns: 1fr;
}

.year-compare-charts-row {
  margin-bottom: 1.25rem;
}

.year-compare-coverage-note {
  margin: -0.5rem 0 0.85rem;
  font-size: 0.75rem;
  color: var(--ecf-text-muted, #64748b);
}

.year-compare-coverage-note .bi {
  margin-right: 0.15rem;
}

.year-compare-table-panel {
  min-width: 0;
  border: 1px solid var(--ecf-border, #e2e8f0);
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.75rem;
}

.year-compare-table-scroll {
  overflow-x: auto;
}

.year-compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}

.year-compare-year-group {
  background: #eef5f1;
  color: #1b4332;
  text-align: center;
}

.year-compare-table thead tr:last-child th {
  text-align: center !important;
}

.year-compare-table thead th.text-center,
.year-compare-table thead th:not(:first-child) {
  text-align: center !important;
}

.year-compare-table tbody td:not(:first-child),
.year-compare-table tbody th:not(:first-child) {
  text-align: center !important;
}

.year-compare-table .year-compare-item-label,
.year-compare-table tbody th:first-child {
  text-align: left !important;
}

.year-compare-section-row th {
  background: #f3f7f5;
  color: #1b4332;
  font-weight: 700;
}

.year-compare-section-row--donation th {
  background: #f5f3ff;
  color: #6d28d9;
}

.year-compare-section-row--expense th {
  background: #fff4eb;
  color: #9a3412;
}

.year-compare-item-label {
  padding-left: 1.25rem !important;
}

.year-compare-total-row th,
.year-compare-total-row td {
  font-weight: 700;
}

.year-compare-total-row--income th,
.year-compare-total-row--income td {
  background: #edf7f0;
  color: #1b4332;
}

.year-compare-total-row--expense th,
.year-compare-total-row--expense td {
  background: #fff4eb;
  color: #9a3412;
}

.year-compare-total-row--surplus th,
.year-compare-total-row--surplus td {
  background: #eff6ff;
  color: #1d4ed8;
}

.year-compare-period-banner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.year-compare-range-block {
  display: grid;
  gap: 0.35rem;
  width: 100%;
}

.year-compare-range-line {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.year-compare-range-label {
  color: var(--ecf-text-muted, #64748b);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.year-compare-range-dates {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
}

.year-compare-range-note {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--ecf-text-muted, #64748b);
}

.year-compare-variance-note {
  margin-top: 0.65rem;
}

.report-formatted-modal-body > #formattedYearComparePrintable {
  min-width: 64rem;
}

.year-compare-formatted-table {
  table-layout: fixed;
}

.year-compare-formatted-table thead tr:last-child th:nth-child(even),
.year-compare-formatted-table tbody tr:not(.formatted-report-section) td:nth-child(2n + 1):not(:first-child) {
  border-right: 1px solid #dfe5e2;
}

.year-compare-formatted-summary th:not(:last-child),
.year-compare-formatted-summary td:not(:last-child) {
  border-right: 1px solid #dfe5e2;
}

.year-compare-formatted-table thead th:not(:first-child),
.year-compare-formatted-summary thead th:not(:first-child) {
  text-align: center !important;
}

.year-compare-formatted-table td:not(:first-child),
.year-compare-formatted-summary td:not(:first-child) {
  text-align: center !important;
}

.year-compare-formatted-summary th:first-child,
.year-compare-formatted-summary td:first-child,
.year-compare-formatted-table th:first-child,
.year-compare-formatted-table .formatted-report-item th,
.year-compare-formatted-table .formatted-report-total th,
.year-compare-formatted-table .formatted-report-net th {
  text-align: left !important;
}

.year-compare-formatted-ranges .year-compare-range-line {
  display: grid;
  gap: 0.125rem;
}

.year-compare-formatted-ranges .year-compare-range-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ecf-text-muted, #64748b);
}

.year-compare-formatted-ranges .year-compare-range-dates {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

/* §4.5.4 — donor ID column (align with §4.2.1) */
.donation-subject-donor-no {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-secondary, #4b5563);
  letter-spacing: 0.02em;
}
