/* Tabelas — sticky header, zebra, mobile cards */

.data-table-wrap {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: auto;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-table-td);
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-secondary);
  color: var(--text-light);
  font-size: var(--text-table-th);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(241, 245, 249, 0.55);
}

.data-table tbody tr:hover td {
  background: rgba(37, 99, 235, 0.04);
}

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

.table-actions {
  display: inline-flex;
  gap: 8px;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-status--ok {
  background: rgba(5, 150, 105, 0.12);
  color: var(--success);
}

.badge-status--warn {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

@media (max-width: 720px) {
  .table-card-mobile table.data-table thead {
    display: none;
  }

  .table-card-mobile table.data-table tbody tr {
    display: block;
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .table-card-mobile table.data-table tbody td {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    border-bottom: 1px solid var(--border);
  }

  .table-card-mobile table.data-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-light);
    font-size: 11px;
    text-transform: uppercase;
  }
}

/* DRE — tabela larga (12 meses + total): rolagem horizontal dentro do card */
#aba-dre {
  min-width: 0;
  overflow: hidden;
}

.dre-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table.dre-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dre-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-secondary);
  white-space: nowrap;
}

.dre-table th:first-child,
.dre-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 200px;
  max-width: 320px;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.06);
}

.dre-table thead th:first-child {
  z-index: 3;
}

.dre-table td:first-child {
  background: inherit;
}

.dre-table th:not(:first-child),
.dre-table td:not(:first-child) {
  min-width: 76px;
  text-align: right;
  white-space: nowrap;
}

.dre-table th:last-child,
.dre-table td:last-child {
  min-width: 96px;
  font-weight: 700;
}
