/* =====================================================================
   Tablas de listados.
   Texto alineado a la izquierda, números y fechas con cifras tabulares,
   importes a la derecha, cabecera fija al hacer scroll.
   ===================================================================== */

.ui-table-wrap {
  overflow-x: auto;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
.ui-table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
  color: var(--c-ink);
}
.ui-table thead th {
  position: sticky; top: 0; z-index: 2;
  height: 36px;
  padding: 0 var(--sp-3);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-line);
  color: var(--c-ink-3);
  font-size: var(--fs-xs); font-weight: 500;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
.ui-table tbody td,
.ui-table tbody th {
  height: var(--row-h);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--c-line);
  font-weight: 400;
  text-align: left;
  vertical-align: middle;
}
.ui-table tbody tr:last-child > * { border-bottom: 0; }
.ui-table tbody tr:hover > * { background: #FAFBF9; }
.ui-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.ui-table .is-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-table .is-actions { width: 1%; white-space: nowrap; text-align: right; }
.ui-table .is-id { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-table .is-id a { color: var(--c-ink) !important; }
.ui-table .is-id a:hover { color: var(--c-brand) !important; text-decoration: underline !important; }

/* Celda con dos líneas: dato principal y secundario */
.ui-cell-main { display: block; font-weight: 500; color: var(--c-ink); }
.ui-cell-sub { display: block; color: var(--c-ink-3); font-size: var(--fs-xs); }
.ui-cell-clip {
  display: block; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ui-cell-note { max-width: 220px; color: var(--c-ink-2); }
.ui-table .ui-dash { color: var(--c-line-strong); }

.ui-row-actions { display: inline-flex; align-items: center; gap: var(--sp-1); }

@media (max-width: 991.98px) {
  .ui-table-wrap { max-height: none; }
}

/* Celdas en una sola línea: la tabla hace scroll horizontal y la columna
   de acciones queda fija a la derecha para que siempre esté a mano. */
.ui-table tbody td { white-space: nowrap; }
.ui-table thead th.is-actions,
.ui-table tbody td.is-actions {
  position: sticky; right: 0;
  background: var(--c-surface);
  box-shadow: inset 1px 0 0 var(--c-line);
}
.ui-table thead th.is-actions { background: var(--c-surface-2); z-index: 3; }
.ui-table tbody tr:hover > td.is-actions { background: #FAFBF9; }
/* La celda con el menú abierto queda por encima de las filas siguientes */
.ui-table td.is-actions:has(.dropdown-menu.show) { z-index: 4; }

/* Columna de selección */
.ui-table .is-check { width: 1%; padding-right: 0; }
.ui-check {
  width: 16px; height: 16px;
  margin: 0; vertical-align: middle;
  accent-color: var(--c-brand);
  cursor: pointer;
}
.ui-check:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 3px; }
