/* ==========================================================================
   Reports — report switcher, bar chart, heatmap and breakdown rows
   ========================================================================== */

.report-nav { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.report-nav::-webkit-scrollbar { display: none; }
.report-nav__link {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; height: 38px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.report-nav__link .icon { color: var(--muted); }
.report-nav__link:hover { color: var(--text); border-color: rgba(var(--brand-rgb), .35); }
.report-nav__link.is-active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(var(--brand-rgb), .22); }
.report-nav__link.is-active .icon { color: #fff; }

.report-filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 18px; }
.report-filters form { margin: 0; }

.report-body { display: flex; flex-direction: column; gap: 18px; }
.report-body > .kpis, .report-body .card { margin-bottom: 0; }
.report-body > .grid { margin: 0; }
.rpt-card .card__body { padding-top: 4px; }
.rpt-split small { font-family: "Inter", sans-serif; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.rpt-table td, .rpt-table th { white-space: nowrap; }
.rpt-more { margin: 0; padding: 12px 22px; font-size: 13px; }
.rpt-legend { margin-bottom: 14px; }

/* Bar chart: one column per day/month, one or more bars per column, segments stacked bottom-up */
.rpt-chart { display: flex; align-items: stretch; gap: 10px; height: 220px; }
.rpt-chart--dense { gap: 3px; }
.rpt-chart__col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rpt-chart__col:hover .rpt-chart__bar span { filter: brightness(.92); }
.rpt-chart__bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--border); }
.rpt-chart__bar { flex: 1; max-width: 34px; height: 100%; display: flex; flex-direction: column-reverse; gap: 1px; }
.rpt-chart__bar span { display: block; width: 100%; min-height: 2px; border-radius: 4px; }
.rpt-chart__col small { height: 14px; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; }
.rpt-chart--dense .rpt-chart__bar span { border-radius: 2px; }

/* Label · bar · value rows */
.rpt-rows { display: flex; flex-direction: column; gap: 14px; }
.rpt-rows__row { display: grid; grid-template-columns: minmax(150px, 1.2fr) 2fr minmax(70px, auto); align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); }
.rpt-rows__row > strong { text-align: right; color: var(--text); font-family: var(--display); }
.rpt-rows__row--stack { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
.rpt-rows__row--stack .rpt-rows__bar { grid-column: 1 / -1; grid-row: 2; }
.rpt-rows__bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.rpt-rows__bar span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.rpt-age--running { background: var(--blue) !important; }
.rpt-age--recent { background: var(--amber) !important; }
.rpt-age--older { background: var(--orange) !important; }
.rpt-age--oldest { background: var(--red) !important; }

.rpt-meter { display: inline-block; width: 90px; height: 6px; margin-right: 6px; vertical-align: middle; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.rpt-meter span { display: block; height: 100%; background: var(--green); }
.rpt-inline-bar { display: inline-block; width: 50px; height: 6px; margin-right: 8px; vertical-align: middle; border-radius: 99px; background: linear-gradient(90deg, var(--brand) var(--w), var(--surface-3) var(--w)); }

/* Weekday × hour heatmap */
.heatmap { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 11px; }
.heatmap th { font-weight: 600; color: var(--muted); text-align: center; padding: 2px 4px; }
.heatmap tbody th { text-align: left; padding-right: 8px; }
.heatmap td {
  min-width: 26px; height: 28px; border-radius: 6px; text-align: center; font-weight: 600;
  background: color-mix(in srgb, var(--brand) calc(var(--heat, 0) * 85%), var(--surface-2));
  color: var(--text);
}
.heatmap td.is-hot { color: #fff; }
.heatmap td.num { background: none; text-align: right; }

@media (max-width: 700px) {
  .report-filters { padding: 12px; }
  .rpt-chart { height: 180px; gap: 4px; }
  .rpt-rows__row { grid-template-columns: minmax(0, 1fr) auto; }
  .rpt-rows__row .rpt-rows__bar { grid-column: 1 / -1; grid-row: 2; }
}

@media print {
  .report-nav, .report-filters { display: none; }
  .rpt-chart__bar span { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .heatmap td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
