/* Business report: used on screen (Reports tab) and in the print / PDF window. */

.report-doc {
  --q-primary: #137b76;
  --q-soft: rgba(19, 123, 118, 0.1);
  --q-accent: #d39a36;
  --q-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
  max-width: 980px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #d9e5e2;
  border-radius: 12px;
  background: #fff;
  color: #1b2b2c;
  font-family: var(--q-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.report-doc *,
.report-doc *::before,
.report-doc *::after {
  box-sizing: border-box;
}

.report-doc h1,
.report-doc h2,
.report-doc p,
.report-doc ul {
  margin: 0;
}

.rp-bar-top {
  height: 8px;
  background: linear-gradient(90deg, var(--q-primary), var(--q-accent));
}

.rp-header {
  display: grid;
  gap: 24px;
  padding: 32px 36px 0;
}

.rp-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.rp-logo {
  display: block;
  max-width: 150px;
  max-height: 64px;
  object-fit: contain;
}

.rp-company {
  color: var(--q-primary);
  font-size: 19px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.rp-title {
  padding-top: 22px;
  border-top: 1px solid #e3ebeb;
}

.rp-title h1 {
  color: var(--q-primary);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.rp-title p {
  margin-top: 4px;
  font-size: 13.5px;
}

.rp-muted {
  color: #6a7c7d;
  font-size: 13px;
}

.rp-empty {
  padding: 40px 36px 48px;
  color: #6a7c7d;
}

.rp-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 26px 36px 8px;
}

.rp-kpi {
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  border: 1px solid #e3ebeb;
  border-radius: 12px;
  background: #f8fbfb;
}

.rp-kpi-label {
  color: #6a7c7d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rp-kpi strong {
  color: var(--q-primary);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.rp-kpi-note {
  color: #6a7c7d;
  font-size: 12.5px;
}

.rp-insights {
  margin: 18px 36px 4px;
  padding: 16px 20px;
  border-left: 3px solid var(--q-accent);
  border-radius: 0 12px 12px 0;
  background: var(--q-soft);
}

.rp-insights h2,
.rp-card h2 {
  margin-bottom: 12px;
  color: var(--q-primary);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.rp-insights h2 {
  margin-bottom: 8px;
}

.rp-insights ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
  font-size: 14px;
}

.rp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 36px 28px;
}

.rp-card {
  min-width: 0;
  padding: 18px 20px 20px;
  border: 1px solid #e3ebeb;
  border-radius: 12px;
}

.rp-wide {
  grid-column: 1 / -1;
}

.rp-bar-row {
  display: grid;
  grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
}

.rp-bar-label {
  overflow-wrap: anywhere;
}

.rp-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f0f0;
}

.rp-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--q-primary);
}

.rp-bar-value {
  min-width: 70px;
  color: #425655;
  font-size: 12.5px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.rp-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}

.rp-donut {
  display: grid;
  flex: 0 0 auto;
  width: 130px;
  height: 130px;
  place-items: center;
  border-radius: 50%;
}

.rp-donut > div {
  display: grid;
  width: 86px;
  height: 86px;
  place-content: center;
  border-radius: 50%;
  background: #fff;
  text-align: center;
}

.rp-donut strong {
  font-size: 24px;
  line-height: 1.1;
}

.rp-donut span {
  color: #6a7c7d;
  font-size: 11px;
}

.rp-legend {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
}

.rp-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rp-legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.rp-legend strong {
  margin-left: 6px;
}

.rp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rp-table th,
.rp-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e3ebeb;
  text-align: left;
}

.rp-table thead th {
  color: #7a8b8c;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rp-table tbody tr:nth-child(odd) {
  background: #f8fbfb;
}

.rp-overdue {
  color: #c4584a;
}

.rp-money td,
.rp-money tfoot th {
  white-space: nowrap;
}

.rp-money tbody th,
.rp-money tfoot th {
  font-weight: 650;
  white-space: nowrap;
}

.rp-money tfoot th,
.rp-money tfoot td {
  border-top: 2px solid #d9e5e2;
  border-bottom: 0;
  background: var(--q-soft);
}

.rp-sub {
  display: block;
  color: #7a8b8c;
  font-size: 11.5px;
  font-weight: 400;
}

.rp-table thead th.rp-slot-accepted { color: #1f8a5b; }
.rp-table thead th.rp-slot-declined { color: #c4584a; }
.rp-table thead th.rp-slot-pending { color: #b07d22; }

.rp-card > .rp-muted {
  margin-top: 10px;
}

.rp-card > .rp-stats + .rp-muted {
  margin: -4px 0 0;
}

.rp-more {
  margin-top: 10px;
}

.rp-more > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  color: var(--q-primary);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.rp-more > summary::-webkit-details-marker {
  display: none;
}

.rp-more > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.rp-more[open] > summary::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.rp-more-close,
.rp-more[open] .rp-more-open {
  display: none;
}

.rp-more[open] .rp-more-close {
  display: inline;
}

.rp-more > :not(summary) {
  margin-top: 8px;
}

.rp-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.rp-stat[data-slot="accepted"] strong { color: #1f8a5b; }
.rp-stat[data-slot="declined"] strong { color: #c4584a; }
.rp-stat[data-slot="pending"] strong { color: #b07d22; }

.rp-stat {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid #e3ebeb;
  border-radius: 10px;
  background: #f8fbfb;
}

.rp-stat span {
  color: #6a7c7d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rp-stat strong {
  color: var(--q-primary);
  font-size: 20px;
  line-height: 1.2;
}

.rp-stat em {
  color: #6a7c7d;
  font-size: 12px;
  font-style: normal;
}

.rp-subsection {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.rp-type-row {
  display: grid;
  grid-template-columns: minmax(120px, 30%) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f8fbfb;
  font-size: 13px;
}

.rp-diff {
  font-weight: 650;
  white-space: nowrap;
}

.rp-diff[data-tone="good"] { color: #1f8a5b; }
.rp-diff[data-tone="over"] { color: #c4584a; }
.rp-diff[data-tone="under"] { color: #b07d22; }

.rp-foot {
  padding: 14px 36px 22px;
  border-top: 1px solid #e3ebeb;
  color: #6a7c7d;
  font-size: 12px;
}

@media (max-width: 720px) {
  .rp-header,
  .rp-kpis,
  .rp-grid,
  .rp-foot {
    padding-left: 18px;
    padding-right: 18px;
  }

  .rp-insights {
    margin-left: 18px;
    margin-right: 18px;
  }

  .rp-kpis,
  .rp-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rp-stats {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .rp-stat {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    padding: 8px 12px;
  }

  .rp-stat span {
    grid-column: 1;
    font-size: 10.5px;
  }

  .rp-stat strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-size: 16px;
    text-align: right;
    white-space: nowrap;
  }

  .rp-stat em {
    grid-column: 1;
    font-size: 11.5px;
  }

  .rp-type-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .rp-type-row > span:nth-child(2) {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .rp-table {
    display: block;
    overflow-x: auto;
  }
}

.report-print {
  margin: 0;
  background: #fff;
}

.report-print .report-doc {
  max-width: none;
  border: 0;
  border-radius: 0;
}

@media print {
  @page {
    margin: 10mm;
  }

  .report-doc {
    font-size: 13px;
  }

  .rp-card,
  .rp-kpi,
  .rp-insights,
  .rp-table tr {
    break-inside: avoid;
  }
}
