/* ============================================================
   tables.css — таблицы, бейджи, кнопки-строки
   ============================================================ */

/* ---------- Обертка для таблицы (если нужен скролл) ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Базовые стили таблицы ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.table th {
  padding: 12px 18px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

/* Строки */
.table tbody tr {
  transition: background var(--t-fast);
}
.table tbody tr:hover {
  background: var(--bg-hover);
}
.table tbody tr:last-child td {
  border-bottom: none;
}

/* Кликабельная строка (для перехода в модалку заявки) */
.table-row-clickable {
  cursor: pointer;
}

/* ---------- Ячейки с числами (суммы, маржа) ---------- */
.table td.is-num,
.table th.is-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* ---------- Кнопки внутри таблицы (иконки действий) ---------- */
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.table-action:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.table-action.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- Бейджи (статусы) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1;
}

/* Цветовые вариации статусов */
.badge-new {
  background: var(--status-new-bg);
  color: var(--status-new-fg);
}

.badge-progress {
  background: var(--status-progress-bg);
  color: var(--status-progress-fg);
}

.badge-done {
  background: var(--status-done-bg);
  color: var(--status-done-fg);
}

.badge-cancel {
  background: var(--status-cancel-bg);
  color: var(--status-cancel-fg);
}

/* Нейтральный бейдж */
.badge-default {
  background: var(--bg-sunken);
  color: var(--text-muted);
}

/* ---------- Состояния загрузки и пустоты для таблиц ---------- */
.table-loading,
.table-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Пагинация (если понадобится) ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}