/* Listados y encabezados de pantalla. */

h2 {
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--font-size-md);
  color: var(--color-text-muted);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.page-header h1 {
  margin: 0;
}

.page-header .button {
  white-space: nowrap;
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.list li + li {
  border-top: 1px solid var(--color-border);
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.5rem;
  padding: var(--space-3) var(--space-4);
  color: inherit;
  text-decoration: none;
}

.list-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.list-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Una línea extra bajo el subtítulo, como la próxima fecha de un recurrente. */
.list-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.list-note-warning {
  color: var(--color-danger);
}

/* Montos: cifras de igual ancho para que se alineen en columna. */
.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-negative {
  color: var(--color-expense);
}

.amount-positive {
  color: var(--color-income);
}

.list-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Filtros plegables del listado de movimientos. */
.filters {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.filters summary {
  cursor: pointer;
  font-weight: 600;
}

.filters[open] summary {
  margin-bottom: var(--space-4);
}

.filters .form {
  margin-bottom: 0;
}

/* Saldo total del panel. */
.total {
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.total-amount {
  font-size: var(--font-size-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Disponible y deudas, lado a lado bajo el saldo total. */
.total-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: var(--space-3) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}

.total-breakdown div {
  display: flex;
  flex-direction: column;
}

.total-breakdown dd {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: 600;
}

/* --category-color lo pone el código con el color de cada categoría. */
.category-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--category-color, var(--color-border)) 22%, transparent);
  box-shadow: inset 0 0 0 2px var(--category-color, var(--color-border));
  font-size: 1.125rem;
}

/* Un cambio pendiente: qué es, su estado y qué se puede hacer con él. */
.pending-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
}

.pending-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
