/* Tablas (estilo "Market" de la referencia) con vista de tarjetas en móvil */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.toolbar__count { margin-left: auto; color: var(--muted); font-size: .82rem; font-weight: 600; }

.table-wrap { width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
  padding: 12px 16px;
  color: var(--subtle);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-align: left;
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background-color .2s; }
.table tbody tr:hover { background: #fafbfd; }
.table tr.is-inactive td { color: var(--subtle); }
.table tr.is-inactive .avatar { opacity: .55; }

.cell-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-user > div { min-width: 0; }
.cell-user strong { display: block; font-size: .9rem; }
.cell-user small { display: block; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.cell-user--sm { gap: 8px; }

.tag-self { margin-left: 4px; padding: 1px 7px; border-radius: 6px; background: var(--ink); color: #fff; font-size: .66rem; vertical-align: 2px; }

.cell-actions { width: 1%; white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--on { color: var(--mint-ink); }
.status--pending { color: var(--cream-ink); }
.status--off { color: var(--subtle); }

/* Detalle de cambios de la bitácora */
.log-detail td { padding: 0 16px 16px; border-top: 0; background: #fafbfd; }
.diff { width: 100%; border-collapse: collapse; font-size: .82rem; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
.diff th, .diff td { padding: 9px 12px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.diff thead th { border-top: 0; color: var(--subtle); font-size: .7rem; }
.diff tbody th { width: 28%; font-weight: 700; }
.diff__old { color: var(--coral-ink); text-decoration: line-through; text-decoration-color: rgba(184, 50, 31, .4); }
.diff__new { color: var(--mint-ink); font-weight: 600; }

/* Paginación */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 16px; border-top: 1px solid var(--line); }
.pagination__btn {
  display: inline-grid;
  place-items: center;
  min-width: 36px; height: 36px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: .84rem;
  font-weight: 700;
}
.pagination__btn:hover { background: var(--surface-3); }
.pagination__btn.is-current { background: var(--ink); color: #fff; }
.pagination__btn .ico { width: 16px; height: 16px; }
.pagination__info { margin-left: auto; color: var(--muted); font-size: .8rem; }

/* ---- Móvil: cada fila se vuelve una tarjeta ---- */
@media (max-width: 899.98px) {
  .table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tbody tr { position: relative; padding: 14px 16px; border-top: 1px solid var(--line); }
  .table--cards tbody tr:first-child { border-top: 0; }
  .table--cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .table--cards td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    color: var(--subtle);
    font-size: .72rem;
    font-weight: 700;
    text-align: left;
  }
  .table--cards td:first-child { padding-right: 0; text-align: left; }
  .table--cards td:first-child::before { display: none; }
  .table--cards td:first-child .cell-user { padding-right: 0; }
  .table--cards .cell-actions { width: auto; padding-top: 10px; }
  .table--cards .row-actions { justify-content: flex-start; }
  .table--cards .log-detail { padding-top: 0; }
  .table--cards .log-detail td { display: block; padding: 0; background: none; text-align: left; }
  .table--log td:first-child { text-align: left; }
}

@media (min-width: 900px) {
  .table-wrap { overflow-x: auto; }
  .table--cards td:first-child { min-width: 250px; }
  .table th:first-child, .table td:first-child { padding-left: 22px; }
  .table th:last-child, .table td:last-child { padding-right: 22px; }
}
