/* ==========================================================================
   OrNsoft theme — Reports (reports.html pattern)
   admin/reports/sales, leads, expenses, expenses_vs_income, timesheets,
   knowledge_base_articles. Tokens only.
   ========================================================================== */

body.admin.reports .content {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* --------------------------------------------------------------------------
   1. Report selectors — the three chooser columns become cards
   -------------------------------------------------------------------------- */

body.admin.reports .ons-rep-head-icon {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  flex: none;
  color: var(--fg-muted);
}

body.admin.reports ul.reports {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.admin.reports ul.reports li {
  list-style: none;
}

/* The anchors keep the platform's utility classes (JS flips data-active on
   them); only the resting rhythm is normalised here. */
body.admin.reports ul.reports > li > a {
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-decoration: none !important;
}

body.admin.reports ul.reports > li > a[data-active="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 45%, transparent);
  color: var(--accent-soft-fg);
  font-weight: var(--fw-semibold);
}

body.admin.reports ul.reports > li > a[data-active="true"] svg,
body.admin.reports ul.reports > li > a[data-active="true"] i {
  color: var(--accent-text);
}

body.admin.reports ul.reports > li > a svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* --------------------------------------------------------------------------
   2. Period / currency filters
   -------------------------------------------------------------------------- */

body.admin.reports .ons-card__body > .form-group,
body.admin.reports .ons-card__body > div > .form-group {
  margin-bottom: 12px;
}

body.admin.reports .ons-card__body label,
body.admin.reports .ons-card__body .control-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--fg);
}

body.admin.reports #date-range .input-group-addon {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--fg-muted);
}

/* --------------------------------------------------------------------------
   3. KPI row
   The report partials print their headline figures as `.tw-text-2xl`-ish
   blocks inside panels; the .ons-kpi tokens are applied where the module
   views emit them, and the platform summaries below are aligned with them.
   -------------------------------------------------------------------------- */

body.admin.reports .ons-rep-kpis {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  body.admin.reports .ons-rep-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body.admin.reports .ons-rep-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   4. Chart cards
   -------------------------------------------------------------------------- */

body.admin.reports .ons-rep-charts {
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;
}

@media (max-width: 1100px) {
  body.admin.reports .ons-rep-charts {
    grid-template-columns: minmax(0, 1fr);
  }
}

body.admin.reports canvas.chart,
body.admin.reports .chart-container canvas {
  max-width: 100%;
}

body.admin.reports .ons-card__body > canvas {
  display: block;
}

/* Chart.js legends rendered in the markup. */
body.admin.reports .ons-legend i {
  background: var(--c, var(--chart-1));
}

/* --------------------------------------------------------------------------
   5. Generated report area
   `#report` is toggled by the platform script; it must keep `hide`.
   -------------------------------------------------------------------------- */

body.admin.reports #report > h4 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-h3);
  color: var(--fg);
  margin: 0 0 12px;
}

/* Report totals rows come from the partials as `.bold` / `<th>` footers. */
body.admin.reports #report table tfoot th,
body.admin.reports #report table tfoot td {
  background: var(--bg-subtle);
  font-weight: var(--fw-bold);
  color: var(--fg);
  border-top: 1px solid var(--border);
}

body.admin.reports #report table td.text-right,
body.admin.reports #report table th.text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   6. Breakdown bars (expenses / leads reports)
   -------------------------------------------------------------------------- */

body.admin.reports .ons-bar__track > span {
  background: var(--chart-1);
}

body.admin.reports .ons-bar:nth-child(even) .ons-bar__track > span {
  background: var(--chart-2);
}

/* --------------------------------------------------------------------------
   7. Warnings
   -------------------------------------------------------------------------- */

body.admin.reports .text-danger {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   8. Chart blocks
   The chart wrappers are the elements the report script shows and hides, so
   the card lives on the wrapper itself rather than around it.
   -------------------------------------------------------------------------- */

body.admin.reports #report .ons-card {
  margin-bottom: var(--gap);
}

body.admin.reports #report .ons-card:last-child {
  margin-bottom: 0;
}

body.admin.reports #report .ons-card__body {
  padding: var(--card-pad);
}

body.admin.reports #report .ons-card canvas {
  max-width: 100%;
}

/* The generated report area holds cards of its own, so it is not a card. */
body.admin.reports #report > section.ons-card--flush:has(.ons-card) {
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   9. Report selector lists
   -------------------------------------------------------------------------- */

body.admin.reports ul.reports > li > a:hover,
body.admin.reports ul.reports > li > a:focus {
  background: var(--bg-hover);
  color: var(--fg);
}

body.admin.reports ul.reports > li > a:hover svg,
body.admin.reports ul.reports > li > a:focus svg {
  color: var(--fg);
}

body.admin.reports ul.reports > li > a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* An empty report table reads as an empty state, like every other list. */
body.admin.reports .dataTables_wrapper td.dataTables_empty {
  padding: 44px 24px 48px;
  text-align: center !important;
  color: var(--fg-muted);
  font-size: var(--fs-sm);
}

body.admin.reports .dataTables_wrapper td.dataTables_empty::before {
  content: "\f080";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  border-radius: var(--r-lg);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 20px;
}
