@charset "UTF-8";
/* reports.css — Reports: report cards, report pages, charts.
   Loaded in order by templates/partials/styles.html. */

/* ================================ Reports ================================= */
/* the Reports page: a section title, its cards (as the dashboard's stat tiles) */
/* compact: small cards, tight rows and sections — more reports on one screen */
.content:has(> .rgroup) {
  gap: var(--s-3);
}
.rgroup {
  margin-top: 0;
}
.rgroup[hidden],
.rcard[hidden] {
  display: none;
}
.rgroup__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
}
.rgroup__title ion-icon {
  color: var(--primary-600);
}
.rgrid {
  /* four across on a laptop: wide enough that a long name stays on one line */
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--s-2);
}
.rcard {
  gap: var(--s-2);
  padding: 7px var(--s-3);
  border-radius: var(--r-md);
  box-shadow: none;
  color: inherit;
  text-decoration: none;
}
.rcard:hover {
  border-color: var(--primary-300, var(--border-strong));
}
.rcard .stat__icon {
  width: 26px;
  height: 26px;
  font-size: 0.95rem;
  border-radius: var(--r-sm);
}
.rcard__title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  /* one line a card, so every row stays as short as the shortest */
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* a long name (over 30 letters): smaller, on up to two tight lines — the
   whole name shows, and the card keeps the same height as the rest */
.rcard__title--long {
  font-size: 11.5px;
  line-height: 1.2;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
/* a card: the report's name and its icon, on one line */
.rcard .stat__top {
  align-items: center;
}
@media (max-width: 640px) {
  .rgrid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* a report: how it counts, over the table */
.rnote {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0;
  padding: var(--s-2) var(--s-5);
  font-size: var(--fs-sm);
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
/* the Total row stays under the rows, tinted like the invoice totals */
.rtable tfoot td {
  background: var(--surface-2);
  border-top: 2px solid var(--border-strong);
  position: sticky;
  bottom: 0;
}
.rtable td .link-btn {
  text-align: left;
  white-space: nowrap;    /* a voucher no. never breaks: INV/26-27/0015 */
}

/* Sales man progress: target (light) and achieved bars, a row each */
.rchart {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  /* many sales men: the chart scrolls by itself, so the table under it
     (on a one-screen report page) stays in view */
  flex: none;
  max-height: 40vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
/* the chart alone (Sales Man Progress Chart): it fills the panel and
   scrolls inside it — the page stays put (the one-screen rules, .rchart--only) */
.rchart--only {
  border-bottom: none;
}
.rchart .rchart__legend {
  position: sticky;
  top: calc(-1 * var(--s-4));
  z-index: 1;
  margin: calc(-1 * var(--s-4)) 0 0;
  padding: var(--s-4) 0 var(--s-1);
  background: var(--surface);
}
.rchart__legend {
  display: flex;
  gap: var(--s-4);
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.rchart__legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rchart__key {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.rchart__key--target,
.rchart__bar--target {
  background: var(--surface-3);
  background: color-mix(in srgb, var(--primary-500) 18%, transparent);
}
.rchart__key--done,
.rchart__bar--done {
  background: var(--primary-500);
}
.rchart__row {
  display: grid;
  grid-template-columns: minmax(90px, 180px) minmax(0, 1fr) 64px;
  align-items: center;
  gap: var(--s-3);
}
.rchart__label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--fs-sm);
  font-weight: 500;
}
.rchart__bars {
  display: grid;
  gap: 3px;
}
.rchart__bar {
  height: 10px;
  min-width: 2px;
  border-radius: 5px;
}
.rchart__bar--achieved {
  background: var(--success, #16a34a);
}
.rchart__bar--behind {
  background: var(--danger);
}
.rchart__value {
  text-align: right;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
/* a report's long text (receipt details, mode · reference, reason …) wraps,
   so the amounts after it stay on screen */
.rtable td.rwrap {
  white-space: normal;
  min-width: 160px;
  max-width: 300px;
}
/* amounts and dates never break; text and headings wrap when the screen is
   narrow, so the last column (Balance, Status) stays in view */
.rtable td.num,
.rtable td:nth-child(2) {
  white-space: nowrap;
}
.rtable th .th-sort {
  white-space: normal;
  text-align: inherit;
}
/* the item's picture in a report (Stock Summary) */
.rtable .rimg {
  width: 48px;
  padding-right: 0;
}
.rtable .rimg .item-thumb {
  width: 36px;
  height: 36px;
}
.toolbar__date[hidden] {
  display: none;
}
/* report tables: a little less side padding, so wide reports fit the screen */
.rtable.table--mini thead th,
.rtable.table--mini tbody td,
.rtable.table--mini tfoot td {
  padding-inline: 8px;
}
/* a negative quantity / amount (stock gone below nil, a minus balance) */
.rtable td.num.down {
  color: var(--danger);
}
