/* ==========================================================================
   QZONE OMS — TABLES
   Dense, ruled, tabular figures. Header is a small-caps rule, not a colored
   band. Rows are separated by hairlines only.

   Two responsive strategies, pick per table:
     .qz-table-wrap        horizontal scroll with a sticky first column
     .qz-table--stack      collapses to label/value cards under 768px
   ========================================================================== */

.qz-table-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--qz-r-lg);
  background: var(--qz-surface-2);
  box-shadow: var(--qz-ring);
}
/* When a table sits directly inside a surface, don't double the chrome. */
.qz-surface .qz-table-wrap,
.qz-surface__body--flush .qz-table-wrap { border-radius: 0; box-shadow: none; background: transparent; }

.qz-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--qz-fs-sm);
  font-variant-numeric: tabular-nums;
}

/* The vertical padding matters as much as the row height. `height` on a cell
   is a MINIMUM, so single-line rows still land on exactly --qz-row-h; the
   padding only does work once a cell holds something taller (a stacked name +
   sub-label, a wrapped note, a badge row), which is where the old zero-padding
   rule crushed content against the row rules. */
.qz-table th,
.qz-table td {
  padding: var(--qz-s-2) var(--qz-s-4);
  height: var(--qz-row-h);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.qz-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  background: var(--qz-surface-inset);
  border-bottom: 1px solid var(--qz-line);
  color: var(--qz-text-mute);
  font-size: var(--qz-fs-2xs);
  font-weight: 600;
  letter-spacing: var(--qz-track-label);
  text-transform: uppercase;
  white-space: nowrap;
}

.qz-table tbody td {
  border-bottom: 1px solid var(--qz-line-soft);
  color: var(--qz-text-dim);
}
.qz-table tbody tr:last-child td { border-bottom: 0; }

.qz-table tbody tr { transition: background-color var(--qz-dur-fast) var(--qz-ease); }
.qz-table tbody tr:hover td { background: var(--qz-surface-3); color: var(--qz-text); }

/* The first cell carries the row's identity, so it gets full-strength text. */
.qz-table tbody td:first-child { color: var(--qz-text); font-weight: 500; }

.qz-table tr.is-clickable { cursor: pointer; }
.qz-table tr.is-selected td { background: var(--qz-accent-weaker); }

/* Alignment + width helpers */
.qz-table .qz-num,
.qz-table .qz-t-right { text-align: right; font-family: var(--qz-font-mono); }
.qz-table .qz-t-center { text-align: center; }
.qz-table .qz-t-wrap { white-space: normal; min-width: 220px; }
.qz-table .qz-t-fit { width: 1%; }

/* Row actions — revealed on hover on pointer devices, always shown on touch */
.qz-table__actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
@media (hover: hover) and (pointer: fine) {
  .qz-table__actions { opacity: 0; transition: opacity var(--qz-dur-fast) var(--qz-ease); }
  .qz-table tbody tr:hover .qz-table__actions,
  .qz-table tbody tr:focus-within .qz-table__actions { opacity: 1; }
}

/* Sticky identity column for wide tables */
.qz-table--sticky thead th:first-child,
.qz-table--sticky tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--qz-surface-2);
}
.qz-table--sticky thead th:first-child { z-index: 3; background: var(--qz-surface-inset); }
.qz-table--sticky tbody tr:hover td:first-child { background: var(--qz-surface-3); }
/* A hairline marks where the frozen column ends */
.qz-table--sticky thead th:first-child::after,
.qz-table--sticky tbody td:first-child::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: var(--qz-line);
}

/* Compact / roomy variants. Both restate the vertical padding so they stay in
   proportion to the new default rather than inheriting it and drifting. */
.qz-table--compact th, .qz-table--compact td { height: 32px; padding: var(--qz-s-1) var(--qz-s-3); font-size: var(--qz-fs-xs); }
.qz-table--roomy th,   .qz-table--roomy td   { height: 52px; padding: var(--qz-s-3) var(--qz-s-4); }

/* Cell composites */
.qz-cell-id { font-family: var(--qz-font-mono); font-size: var(--qz-fs-xs); color: var(--qz-text-mute); }
.qz-cell-person { display: flex; align-items: center; gap: var(--qz-s-2); }
.qz-cell-person__name { font-weight: 500; color: var(--qz-text); }
.qz-cell-person__sub { font-size: var(--qz-fs-2xs); color: var(--qz-text-mute); }
/* The cell itself now carries the vertical padding, so the stack no longer
   adds its own — otherwise the two compound and stacked rows sit too tall. */
.qz-cell-stack { display: flex; flex-direction: column; line-height: 1.3; }
.qz-cell-stack__sub { font-size: var(--qz-fs-2xs); color: var(--qz-text-mute); }

/* Table footer / summary row */
.qz-table tfoot td {
  height: 34px;
  background: var(--qz-surface-inset);
  border-top: 1px solid var(--qz-line);
  color: var(--qz-text);
  font-weight: 600;
  font-family: var(--qz-font-mono);
}

/* Empty row */
.qz-table__empty td { height: auto; padding: 0; }

/* ==========================================================================
   STACKED TABLES — under 768px, rows become label/value cards.
   Requires each <td> to carry data-label="Column name".
   ========================================================================== */

@media (max-width: 767.98px) {
  .qz-table--stack { display: block; }
  .qz-table--stack thead { display: none; }
  .qz-table--stack tbody,
  .qz-table--stack tfoot { display: block; }

  .qz-table--stack tbody tr {
    display: block;
    margin-bottom: var(--qz-s-2);
    padding: var(--qz-s-1) 0;
    border-radius: var(--qz-r-lg);
    background: var(--qz-surface-2);
    box-shadow: var(--qz-ring);
  }
  .qz-table--stack tbody tr:hover td { background: transparent; }

  .qz-table--stack tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--qz-s-4);
    height: auto;
    min-height: 34px;
    padding: 7px var(--qz-s-3);
    border-bottom: 1px solid var(--qz-line-soft);
    white-space: normal;
    text-align: right;
  }
  .qz-table--stack tbody tr td:last-child { border-bottom: 0; }

  /* The column name comes from the cell's own data-label */
  .qz-table--stack tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: var(--qz-fs-2xs);
    font-weight: 600;
    letter-spacing: var(--qz-track-label);
    text-transform: uppercase;
    color: var(--qz-text-mute);
    text-align: left;
  }
  /* Cells with no label span the full width (action rows, etc.) */
  .qz-table--stack tbody td:not([data-label])::before { content: none; }
  .qz-table--stack tbody td:not([data-label]) { justify-content: flex-end; }

  /* The identity cell becomes the card's header */
  .qz-table--stack tbody td:first-child {
    background: var(--qz-surface-inset);
    border-radius: var(--qz-r-md) var(--qz-r-md) 0 0;
    font-weight: 600;
    font-size: var(--qz-fs-base);
  }

  .qz-table--stack .qz-table__actions { opacity: 1; width: 100%; justify-content: stretch; }
  .qz-table--stack .qz-table__actions > * { flex: 1 1 auto; }

  /* Stacked tables never need to scroll sideways */
  .qz-table-wrap:has(.qz-table--stack) { overflow-x: visible; background: transparent; box-shadow: none; border-radius: 0; }
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.qz-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--qz-s-3);
  flex-wrap: wrap;
  padding: var(--qz-s-3) var(--qz-s-4);
  border-top: 1px solid var(--qz-line-soft);
}
.qz-pagination__info { font-size: var(--qz-fs-xs); color: var(--qz-text-mute); font-variant-numeric: tabular-nums; }
.qz-pagination__pages { display: flex; align-items: center; gap: 3px; }
.qz-pagination__page {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--qz-r-pill);
  background: transparent;
  border: 0;
  color: var(--qz-text-dim);
  font-family: var(--qz-font-mono);
  font-size: var(--qz-fs-xs);
  cursor: pointer;
  transition: background-color var(--qz-dur-fast) var(--qz-ease), color var(--qz-dur-fast) var(--qz-ease);
}
.qz-pagination__page:hover { background: var(--qz-surface-3); color: var(--qz-text); }
.qz-pagination__page.is-active { background: var(--qz-accent); color: var(--qz-on-accent); font-weight: 700; }
.qz-pagination__page.is-disabled { color: var(--qz-text-faint); pointer-events: none; }

@media (max-width: 575.98px) {
  .qz-pagination { justify-content: center; }
  .qz-pagination__info { width: 100%; text-align: center; }
}
