/*
  tables.css — Nium Portal Table System
  ──────────────────────────────────────
  Link after tokens.css and typography.css.

  <link rel="stylesheet" href="tables.css">

  CANONICAL PATTERN:
    <div class="table-wrap">
      <div class="table-toolbar">
        <div class="table-toolbar__left">...</div>
        <div class="table-toolbar__right">
          <input class="table-search" placeholder="Search..." />
        </div>
      </div>
      <table class="data-table">
        <thead>
          <tr>
            <th class="col-check">...</th>
            <th class="sort-th">Column <span class="sort-icon">↕</span></th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>...</td>
          </tr>
        </tbody>
      </table>
      <div class="table-footer">
        <span class="table-count">Showing 1–10 of 248</span>
        <div class="table-pagination">...</div>
      </div>
    </div>

  STANDARD SIZES:
    Data tables (payouts, transactions, beneficiaries): 13.5px — T2 input tier
    Compact tables (statement mini, card history):       13px
    Small tables (scheduled loads, sl-table):            12px

  NOTE: Page-specific column widths and layout props stay in page <style> blocks.
  This file defines only the shared structural and typographic properties.
*/

/* ── Wrapper ───────────────────────────────────────────────────────────── */

.table-wrap {
  background: var(--color-bg-primary);
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ── Toolbar ───────────────────────────────────────────────────────────── */

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}

.table-toolbar__left  { display: flex; align-items: center; gap: 8px; flex: 1; }
.table-toolbar__right { display: flex; align-items: center; gap: 8px; }

/* ── Table base ────────────────────────────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui-size, 13.5px);
  font-weight: var(--text-ui-weight, 400);
  color: var(--color-text-primary);
}

.data-table--compact { font-size: var(--text-small-size, 13px); }
.data-table--small   { font-size: var(--text-caption-size, 12px); }

/* ── Header ────────────────────────────────────────────────────────────── */

.data-table thead tr {
  border-bottom: 0.5px solid var(--color-border-tertiary);
}

.data-table thead th {
  padding: 10px 14px;
  font-size: var(--text-overline-size, 11px);
  font-weight: var(--text-overline-weight, 600);
  color: var(--color-text-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
  background: var(--color-bg-primary);
}

/* ── Body ──────────────────────────────────────────────────────────────── */

.data-table tbody tr {
  border-bottom: 0.5px solid var(--color-border-tertiary);
  transition: background 0.1s;
}

.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody tr:hover { background: var(--color-bg-hover); }

.data-table tbody tr.row-selected { background: var(--color-bg-brand-pale); }

.data-table td {
  padding: 13px 14px;
  vertical-align: middle;
  color: var(--color-text-primary);
}

/* ── Column types ──────────────────────────────────────────────────────── */

.col-check {
  width: 36px;
  padding-left: 16px !important;
  padding-right: 0 !important;
}

.col-num,
.col-amount,
.col-balance {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.col-amount  { color: var(--color-text-secondary); }
.col-balance { color: var(--color-text-primary); font-weight: 500; }

.col-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary);
}

.col-time {
  color: var(--color-text-tertiary);
  font-size: var(--text-caption-size, 12px);
  font-variant-numeric: tabular-nums;
}

.col-link {
  color: var(--color-brand-navy);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.col-link:hover { text-decoration: underline; }

.col-actions {
  white-space: nowrap;
  text-align: right;
}

/* ── Sortable columns ──────────────────────────────────────────────────── */

.sort-th {
  cursor: pointer;
  user-select: none;
}

.sort-th:hover { color: var(--color-text-primary); }

.sort-th-inner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sort-icon {
  font-size: 10px;
  color: var(--color-text-muted);
  transition: color 0.1s;
}

.sort-th:hover .sort-icon,
.sort-th.sort-asc .sort-icon,
.sort-th.sort-desc .sort-icon { color: var(--color-brand-navy); }

/* ── Table search ──────────────────────────────────────────────────────── */

.table-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: var(--text-ui-size, 13.5px);
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--radius-md);
  outline: none;
  width: 220px;
}

.table-search:focus { border-color: var(--color-focus-ring); }
.table-search::placeholder { color: var(--color-text-placeholder); }

/* ── Footer ────────────────────────────────────────────────────────────── */

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 0.5px solid var(--color-border-tertiary);
  background: var(--color-bg-primary);
}

.table-count {
  font-size: var(--text-micro-size, 11px);
  color: var(--color-text-tertiary);
}

/* ── Pagination ────────────────────────────────────────────────────────── */

.table-pagination {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pager-btn {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-micro-size, 11px);
  font-family: inherit;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0 4px;
  transition: background 0.1s, color 0.1s;
}

.pager-btn:hover    { background: #222; color: #fff; }
.pager-btn.active,
.pager-btn[aria-current="page"] {
  background: #000;
  color: #fff;
}
.pager-btn:disabled { opacity: 0.35; cursor: default; }

/* ── Per-page select ───────────────────────────────────────────────────── */

.per-page-select {
  font-size: var(--text-small-size, 13px);
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}

.per-page-select:focus { border-color: var(--color-focus-ring); }

/* ── Empty state ───────────────────────────────────────────────────────── */

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: var(--text-small-size, 13px);
}

.table-empty__icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.table-empty__title {
  font-size: var(--text-body-strong-size, 14px);
  font-weight: var(--text-body-strong-weight, 500);
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

/* ── Skeleton loader ───────────────────────────────────────────────────── */

.skel-row {
  height: 44px;
  background: linear-gradient(
    90deg,
    var(--color-bg-secondary) 0%,
    var(--color-bg-tertiary) 50%,
    var(--color-bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skel-rows { display: flex; flex-direction: column; gap: 2px; }

@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
