/* operaciones/saldos.css */

#saldosScreen {
  position: relative;
}

#saldosScreen .grid-panel {
  background: linear-gradient(180deg, #1d3a6e 0%, #0f2f5d 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(12, 33, 69, 0.18);
  overflow: hidden;
}

#saldosScreen .grid-container {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

#saldosScreen .table-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 24px 24px;
  scrollbar-gutter: stable;
}

#saldosScreen .grid-footer {
  margin-top: auto;
  padding: 8px 24px;
  background: rgba(255, 255, 255, 0.05);
  border-top: none;
  font-size: 0.875rem;
  color: var(--muted);
}

#saldosScreen .hidden {
  display: none !important;
}

/* Estilos para la barra de herramientas */
#saldosScreen .grid-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

/* Estilos para el título */
#saldosScreen .toolbar-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
}

/* Estilos para los botones de acción */
#saldosScreen .toolbar-actions {
  display: flex;
  gap: 12px;
}

#saldosScreen .toolbar-actions button {
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
  transition: transform 0.15s ease, background 0.15s ease;
}

#saldosScreen .toolbar-actions .primary {
  background: #4a6fa5;
}

#saldosScreen .toolbar-actions .primary:hover {
  background: #3d5f8f;
  transform: translateY(-1px);
}

#saldosScreen .toolbar-actions .danger {
  background: #c47a7a;
}

#saldosScreen .toolbar-actions .danger:hover {
  background: #b06a6a;
  transform: translateY(-1px);
}

#saldosScreen .toolbar-actions .danger.disabled {
  background: #6c757d;
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Estilos para el filtro */
#saldosScreen .grid-actions-row {
  padding: 16px 24px 0;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#saldosScreen .grid-actions-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

#saldosScreen .filter-select {
  background: rgba(244, 247, 255, 0.92);
  border: 1px solid rgba(15, 42, 98, 0.12);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 140px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

#saldosScreen .btn-add-fecha {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #4a6fa5;
  color: #fff;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, transform 0.15s ease;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  font-size: 0;
}

#saldosScreen .btn-add-fecha::before {
  content: '+';
  position: absolute;
  top: calc(50% - 4px);
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  color: #7cb342;
}

#saldosScreen .btn-add-fecha:hover {
  background: #3d5f8f;
  transform: translateY(-1px);
}

#saldosScreen .grid-actions-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
}

#saldosScreen .grid-actions-row .search-label {
  width: 300px;
}

#saldosScreen .grid-actions-row label {
  color: #ffffff;
  font-weight: 500;
}

#saldosScreen .grid-actions-row input {
  width: 100%;
  max-width: 300px;
  background: rgba(244, 247, 255, 0.92);
  border: 1px solid rgba(15, 42, 98, 0.12);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
}

/* Estilos para la tabla */
#saldosScreen .data-grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

#saldosScreen .data-grid th,
#saldosScreen .data-grid td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#saldosScreen .data-grid th {
  position: sticky;
  top: 0;
  background: #1d3a6e;
  color: #f7fbff;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  user-select: none;
  z-index: 10;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

#saldosScreen .data-grid th:last-child {
  border-right: none;
}

#saldosScreen .data-grid td {
  color: #f4f7ff;
  line-height: 1.2;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

#saldosScreen .data-grid td:last-child {
  border-right: none;
}



#saldosScreen .data-grid td {
  color: #f4f7ff;
  line-height: 1.2;
}

/* Resaltado de fila al pasar el mouse */
#saldosScreen .data-grid tbody tr {
  transition: background 0.16s ease;
  background: transparent;
}

#saldosScreen .data-grid tbody tr:hover {
  background: rgba(100, 140, 200, 0.25);
}

/* Estilos para celdas de solo lectura */
#saldosScreen .data-grid td.readonly-cell,
#saldosScreen .data-grid td[data-field="CuentaFinancieraID"] {
  color: #b0c4d8;
}

/* Estilos para las celdas editables */
#saldosScreen td[contenteditable="true"]:focus {
  outline: 2px solid rgba(0, 101, 213, 0.45);
  outline-offset: -2px;
  background: rgba(255, 255, 255, 0.08);
}

/* Estilos para saldos negativos */
#saldosScreen td.negative-saldo {
  color: #ff6b6b;
  font-weight: 600;
}

/* Ajustes para montos */
#saldosScreen td[data-field="SaldoInicio"],
#saldosScreen td[data-field="SaldoFin"] {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  font-size: 0.8rem;
}

/* Columna de selección */
#saldosScreen .data-grid td.select-col,
#saldosScreen .data-grid th.select-col {
  width: 40px;
  text-align: center;
  padding: 16px 8px;
}

#saldosScreen .data-grid td.select-col input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Estilos responsivos */
@media (max-width: 768px) {
  #saldosScreen .grid-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  #saldosScreen .toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  #saldosScreen .table-wrapper {
    overflow-x: auto;
  }
  
  #saldosScreen .data-grid {
    min-width: 600px;
  }
}

/* --- Subtotal rows --- */
#saldosScreen .data-grid tr.subtotal-row td,
#saldosScreen .data-grid tr.moneda-subtotal-row td {
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  border-top: 2px solid rgba(255, 255, 255, 0.15);
}

#saldosScreen .data-grid tr.subtotal-row td {
  background: rgba(74, 111, 165, 0.15);
}

#saldosScreen .data-grid tr.subtotal-row td:first-child {
  padding-left: 22px;
}

#saldosScreen .data-grid tr.moneda-subtotal-row td {
  background: rgba(100, 140, 200, 0.3);
  border-top: 2px solid rgba(100, 140, 200, 0.5);
}

#saldosScreen .collapse-toggle {
  display: inline-block;
  width: 1.2em;
  text-align: center;
  font-weight: 700;
  user-select: none;
}

#saldosScreen .collapse-toggle.expanded {
  color: #ff6b6b;
}

#saldosScreen .collapse-toggle.collapsed {
  color: #7cb342;
}

/* --- Detail rows --- */
#saldosScreen .data-grid tr.detail-row.hidden {
  display: none;
}

/* --- Monto cells --- */
#saldosScreen .data-grid td.monto-cell {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  font-size: 0.8rem;
}

#saldosScreen .data-grid td.monto-cell.negative {
  color: #ff6b6b;
}

/* --- Hidden utility --- */
#saldosScreen .hidden {
  display: none !important;
}
