/* Tabelas de dados (com edição inline) */

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

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-weight: 500;
}

.data-table thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--table-header-text);
  padding: 12px 14px;
  border-bottom: 2px solid var(--table-header-accent);
  background: var(--table-header-bg);
  white-space: nowrap;
}

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

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

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

.data-table .num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: right;
  white-space: nowrap;
}

.data-table .date {
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

/* Células editáveis inline (contenteditable) */
.data-table [contenteditable='true'] {
  border-radius: 6px;
  padding: 3px 6px;
  margin: -3px -6px;
  outline: none;
  cursor: text;
  transition: background var(--transition), box-shadow var(--transition);
}

.data-table [contenteditable='true']:hover {
  background: var(--surface-2);
}

.data-table [contenteditable='true']:focus {
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--color-blue);
}

/* Ações de linha */
.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0.35;
  transition: opacity var(--transition);
}

.data-table tr:hover .row-actions {
  opacity: 1;
}

/* Rodapé de totais */
.data-table tfoot td {
  padding: 12px 14px;
  font-weight: 700;
  border-top: 1px solid var(--border-strong);
  background: var(--surface-2);
}

.table-footer-info {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.financial-table-pagination {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.financial-table {
  min-width: 980px;
}

.financial-table > thead th:nth-child(2),
.financial-table > tbody > tr > td:nth-child(2) {
  position: sticky;
  left: 46px;
  z-index: 1;
  min-width: 180px;
  background: var(--surface);
}

.financial-table > thead .financial-bulk-select-cell,
.financial-table > tbody > tr > .financial-bulk-select-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  padding-left: 14px;
  padding-right: 10px;
  text-align: center;
  background: var(--surface);
}

.financial-table .financial-bulk-select-cell input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-blue);
  cursor: pointer;
}

.financial-table .financial-bulk-select-cell input:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.financial-table > thead th:nth-child(2),
.financial-table > thead .financial-bulk-select-cell {
  z-index: 2;
  background: var(--table-header-bg);
}

.financial-table > tbody > tr:hover > td:nth-child(2),
.financial-table > tbody > tr:hover > .financial-bulk-select-cell {
  background: var(--hover);
}

.financial-classification-summary strong,
.financial-classification-summary span,
.financial-classification-summary small {
  display: block;
}

.financial-classification-summary span,
.financial-classification-summary small {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.financial-detail-row > td {
  padding: 0 14px 12px;
  background: var(--surface-2);
}

.financial-detail-panel {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.financial-detail-scroll {
  overflow-x: auto;
}

.financial-details-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.financial-details-table th,
.financial-details-table td {
  padding: 7px 10px;
  text-align: left;
}

.financial-details-table th {
  color: var(--text-muted);
  font-size: 12px;
}

.financial-detail-notes {
  padding: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.financial-bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.financial-bulk-actions[hidden] {
  display: none;
}

.financial-bulk-actions span {
  flex: 1;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .financial-bulk-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.financial-balance small {
  display: block;
  margin-top: 3px;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 12px;
}

.realization-table {
  min-width: 640px;
}

@media (max-width: 768px) {
  .row-actions {
    opacity: 1;
  }

  .financial-table-wrap {
    border-radius: var(--radius-sm);
  }
}
