/* list-page.css -- T+ 18.0 list page (UI-SPEC section 8, screenshot 10)
 *
 * Load after ui-kit.css. Tokens carry fallbacks because base.css is owned by
 * another developer. ASCII-only comments so no tool can corrupt the file.
 */

.tj-listpage {
  --tj-red: #e8483e;
  --tj-blue: #2b7de1;
  --tj-blue-hover: #1f6fd0;
  --text-1: #333333;
  --text-2: #666666;
  --text-3: #999999;
  --border: #e3e6ea;
  --border-strong: #d0d4da;
  --v-required-bg: #fdfbe8;

  --grid-th-bg: rgb(232, 232, 232);
  --grid-th-fs: 13px;
  --grid-td-fs: 13px;
  --grid-total-bg: rgb(245, 245, 245);
  --grid-total-fg: rgb(51, 51, 51);

  --font: Arial, "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Helvetica, sans-serif;

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  font-family: var(--font, Arial, "Microsoft YaHei", sans-serif);
  font-size: 12px;
  color: var(--text-1, #333333);
  background: #fff;
  box-sizing: border-box;
}

/* ==========================================================================
 * 1. Query bar
 * ========================================================================== */
.tj-lp-query {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e3e6ea);
  background: #fff;
  flex-wrap: wrap;
}

.tj-lp-query-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.tj-lp-qf {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tj-lp-qlabel {
  font-size: 12px;
  color: var(--text-1, #333333);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.tj-lp-req {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--tj-red, #e8483e);
  margin-right: 3px;
}

.tj-lp-input {
  height: 24px;
  line-height: 24px;
  padding: 0 4px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-1, #333333);
  border: 1px solid var(--border-strong, #d0d4da);
  background: #fff;
  box-sizing: border-box;
  outline: none;
  width: 110px;
}

.tj-lp-input:focus {
  border-color: var(--tj-blue, #2b7de1);
}

/* required query inputs use the pale yellow background, matching T+ */
.tj-lp-input.tj-lp-input-required {
  background: var(--v-required-bg, #fdfbe8);
}

.tj-lp-select {
  height: 24px;
  line-height: 22px;
  padding: 0 2px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-1, #333333);
  border: 1px solid var(--border-strong, #d0d4da);
  background: #fff;
  box-sizing: border-box;
  outline: none;
}

.tj-lp-range {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tj-lp-range .tj-lp-input {
  width: 92px;
}

.tj-lp-rangesep {
  color: var(--text-3, #999999);
  padding: 0 1px;
}

/* primary query button: blue */
.tj-lp-btn-primary {
  height: 24px;
  line-height: 24px;
  padding: 0 16px;
  font-size: 12px;
  font-family: inherit;
  color: #fff;
  background: var(--tj-blue, #2b7de1);
  border: 1px solid var(--tj-blue, #2b7de1);
  border-radius: 2px;
  cursor: pointer;
}

.tj-lp-btn-primary:hover {
  background: var(--tj-blue-hover, #1f6fd0);
}

.tj-lp-query-right {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  padding-top: 3px;
}

.tj-lp-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2, #666666);
  cursor: pointer;
  white-space: nowrap;
}

.tj-lp-more,
.tj-lp-density {
  font-size: 12px;
  color: var(--tj-blue, #2b7de1);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.tj-lp-more::after {
  content: ' \25BE';
  font-size: 9px;
}

.tj-lp-more.tj-open::after {
  content: ' \25B4';
}

.tj-lp-density {
  color: var(--text-2, #666666);
}

.tj-lp-density:hover {
  color: var(--tj-blue, #2b7de1);
}

/* ==========================================================================
 * 2. Mini tabs
 * ========================================================================== */
.tj-lp-tabs {
  display: flex;
  gap: 18px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border, #e3e6ea);
  background: #fff;
  height: 32px;
  align-items: flex-end;
}

.tj-lp-tab {
  position: relative;
  height: 30px;
  line-height: 30px;
  padding: 0 2px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-2, #666666);
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

.tj-lp-tab:hover {
  color: var(--tj-blue, #2b7de1);
}

.tj-lp-tab.tj-active {
  color: var(--tj-blue, #2b7de1);
  font-weight: 600;
}

.tj-lp-tab.tj-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--tj-blue, #2b7de1);
}

/* ==========================================================================
 * 3. Grid
 * ========================================================================== */
.tj-lp-gridwrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  position: relative;
}

/* Table frame.
 *
 * MUST be `separate`, not `collapse`. This is the ROOT CAUSE of three separate
 * conformance failures (verified 2026-11-06, see probe/conformance-report-1800):
 *   1. collapse merges adjacent cell borders, so every cell draws all four
 *      sides and `border-left: 0` cannot take effect
 *      -> th.borderLeftWidth measured 1px, expected 0px
 *   2. `border-spacing` is IGNORED in collapse mode (it stays at the initial
 *      value and does nothing), so inter-cell spacing is uncontrollable
 *   3. row-height arithmetic differs between the two modes, which is why the
 *      data row measured 24px instead of the expected 28px
 *
 * Real T+ uses `border-collapse: separate; border-spacing: 0` and builds column
 * separation from each cell's RIGHT border only. ui-kit.css (DataGrid) already
 * does this; list-page.css was the one left behind.
 */
.tj-lp-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--grid-td-fs, 13px);
  background: #fff;
}

/* Header cell.
 * Measured baseline (spec/ui-structure/grid.json):
 *   headerCell: fontSize 13px, fontWeight 700, height 30px,
 *               borderTop/Bottom/Right 1px solid rgb(204,204,204), borderLeft 0
 */
.tj-lp-th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--grid-th-bg, rgb(232, 232, 232));
  color: rgb(0, 0, 0);
  font-size: var(--grid-th-fs, 13px);
  /* 700, not normal: baseline headerCell.fontWeight = 700 */
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  border-top: 1px solid rgb(204, 204, 204);
  border-bottom: 1px solid rgb(204, 204, 204);
  border-right: 1px solid rgb(204, 204, 204);
  /* left border intentionally 0: the previous column's right border draws it */
  border-left: 0;
  /* header row height 30px (data rows are 28px -- they differ on purpose) */
  height: 30px;
  padding: 0 4px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tj-lp-th-sort {
  cursor: pointer;
  user-select: none;
}

.tj-lp-th-sort:hover {
  background: #dedede;
}

.tj-lp-sort {
  display: inline-block;
  margin-left: 3px;
  font-size: 10px;
  color: #666;
}

/* Data cell.
 * Measured baseline (spec/ui-structure/grid.json dataCell):
 *   fontSize 13px, height 28px, borderTop/Bottom/Right 1px rgb(204,204,204),
 *   borderLeft 0.
 * NOTE: when asserting height, measure a NON-MERGED cell -- voucher-level
 * columns use rowSpan, and getComputedStyle on a merged cell returns the whole
 * merged block height, not one row.
 */
/* token grid-th-bg applies to the header ROW, not only to th cells */
.tj-lp-host thead tr { background: rgb(232, 232, 232); }

.tj-lp-td {
  font-size: var(--grid-td-fs, 13px);
  color: rgb(0, 0, 0);
  text-align: left;
  padding-left: 5px;
  padding-right: 4px;
  border-top: 1px solid rgb(204, 204, 204);
  border-bottom: 1px solid rgb(204, 204, 204);
  border-right: 1px solid rgb(204, 204, 204);
  border-left: 0;
  height: 28px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* right align money columns */
.tj-lp-td.tj-r,
.tj-lp-th.tj-r {
  text-align: right;
  padding-right: 5px;
}

.tj-lp-th-check,
.tj-lp-th-no,
.tj-lp-td-check,
.tj-lp-td-no {
  text-align: center;
  padding-left: 0;
  padding-right: 0;
}

.tj-lp-td-no {
  color: var(--text-2, #666666);
}

/* group separator: subtle line between vouchers */
.tj-lp-row.tj-group-first > td {
  border-top: 1px solid var(--border-strong, #d0d4da);
}

/* T+ has NO row hover (states-applicable.css confirms tr:hover does not
   exist in the source). Zebra striping is applied by JS via .rowBgColor
   #fafafa; :nth-child(even) is visually equivalent. Authorized by lead
   2026-11-06 to align with base.css. */
.tj-lp-row:nth-child(even) > td {
  background: #fafafa;
}

/* merged (rowspan) voucher-level cells are visually distinct: pale backdrop
   so the user can tell they span several lines */
.tj-lp-td[rowspan] {
  background: #fcfcfc;
  vertical-align: middle;
}

.tj-lp-empty {
  text-align: center;
  color: var(--text-3, #999999);
  padding: 28px 0;
}

/* total row */
.tj-lp-total > td {
  background: var(--grid-total-bg, rgb(245, 245, 245));
  font-size: 14px;
  font-weight: 600;
  color: var(--grid-total-fg, rgb(51, 51, 51));
  height: 28px;
}

.tj-lp-td-total-label {
  text-align: left;
  padding-left: 6px;
}

/* compact density: shrink row height */
/* Compact density is an explicit user toggle, so it may override the measured
 * 28/30px heights. The default ("normal") must stay at the measured values.
 * If a conformance run ever reports 20/24px, check that data-density is not
 * stuck on "compact". */
.tj-listpage[data-density="compact"] .tj-lp-td {
  height: 20px;
  font-size: 12px;
}

.tj-listpage[data-density="compact"] .tj-lp-th {
  height: 24px;
}

/* ==========================================================================
 * 4. Footer
 * ========================================================================== */
.tj-lp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 34px;
  padding: 0 10px;
  border-top: 1px solid var(--border, #e3e6ea);
  background: #fff;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.tj-lp-footer-left,
.tj-lp-footer-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tj-lp-selinfo {
  font-size: 12px;
  color: var(--text-2, #666666);
}

.tj-lp-ftext {
  font-size: 12px;
  color: var(--text-2, #666666);
  white-space: nowrap;
}

.tj-lp-sel {
  height: 22px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border-strong, #d0d4da);
  background: #fff;
  box-sizing: border-box;
}

.tj-lp-jump {
  width: 44px;
  height: 22px;
  line-height: 22px;
  padding: 0 3px;
  font-size: 12px;
  font-family: inherit;
  text-align: center;
  border: 1px solid var(--border-strong, #d0d4da);
  box-sizing: border-box;
  outline: none;
}

.tj-lp-gobtn {
  height: 22px;
  line-height: 20px;
  padding: 0 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-1, #333333);
  background: #fff;
  border: 1px solid var(--border-strong, #d0d4da);
  border-radius: 2px;
  cursor: pointer;
}

.tj-lp-gobtn:hover {
  border-color: var(--tj-blue, #2b7de1);
  color: var(--tj-blue, #2b7de1);
}

.tj-lp-pager {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tj-lp-pg {
  min-width: 24px;
  height: 22px;
  line-height: 20px;
  padding: 0 5px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-1, #333333);
  background: #fff;
  border: 1px solid var(--border-strong, #d0d4da);
  border-radius: 2px;
  cursor: pointer;
}

.tj-lp-pg:hover:not(:disabled) {
  border-color: var(--tj-blue, #2b7de1);
  color: var(--tj-blue, #2b7de1);
}

.tj-lp-pg.tj-active {
  background: var(--tj-blue, #2b7de1);
  border-color: var(--tj-blue, #2b7de1);
  color: #fff;
}

.tj-lp-pg:disabled {
  color: var(--text-3, #999999);
  cursor: default;
  background: #fafafa;
}

/* checkbox sizing */
.tj-listpage input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}
