/* status-badge.js: color + forma distinta por estado — nunca solo color
   (paso 8.73). */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--review_required {
  background: var(--warning-surface);
  color: var(--warning);
}

.badge--approved {
  background: var(--success-surface);
  color: var(--success);
}

.badge--rejected {
  background: var(--danger-surface);
  color: var(--danger);
}

.badge--reopened {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

/* Bloque 12: estado de ExportBatch — prefijo badge--export-* (no
   badge--pending/badge--running a secas) para no colisionar nunca con un
   futuro estado de factura del mismo nombre. */
.badge--export-pending {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.badge--export-running {
  background: var(--warning-surface);
  color: var(--warning);
}

.badge--export-succeeded {
  background: var(--success-surface);
  color: var(--success);
}

.badge--export-failed {
  background: var(--danger-surface);
  color: var(--danger);
}

.badge--export-cancelled {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

/* Botón con aspecto de enlace — acción auxiliar (no una acción principal
   como Guardar/Aprobar), reutilizado por Review ("Copiar de Sociedad") y
   Exportaciones ("Reintentar"). */
.link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--brand-primary);
  font-size: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover:not(:disabled) {
  color: var(--brand-primary-hover);
}

/* Movido aquí desde pages/invoices.css (Bloque 12): genérico, sin nada
   específico de facturas — reutilizado tal cual por pages/exports.css. */
.pagination {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3);
}

/* toast.js */
.toast {
  background: var(--surface);
  border-left: 4px solid var(--brand-secondary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
}

.toast--error {
  border-left-color: var(--danger);
}

.toast--success {
  border-left-color: var(--success);
}

.toast--info {
  border-left-color: var(--brand-primary);
}

/* spinner.js */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--surface-border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spinner-rotate 0.7s linear infinite;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

/* modal.js — <dialog> nativo, solo estilo de contenido */
.modal-title {
  margin-bottom: var(--space-2);
}

.modal-message {
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

/* autocomplete (proveedor, invoice-review.js) */
.autocomplete {
  position: relative;
}

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.autocomplete-results li button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  padding: var(--space-2) var(--space-3);
}

.autocomplete-results li button:hover,
.autocomplete-results li button:focus-visible {
  background: var(--surface-alt);
}

.autocomplete-results li button.autocomplete-create-new {
  color: var(--brand-primary);
  border-top: 1px solid var(--surface-border);
}

/* Bloque 12: cabecera con varias acciones (Exportar + Subir facturas) —
   genérico, no específico de ninguna pantalla. */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Menú desplegable simple (p. ej. "Exportar ▾") — mismo patrón visual que
   .autocomplete-results, pero anclado a un botón en vez de a un input. */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  margin: 2px 0 0;
  padding: var(--space-1) 0;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  padding: var(--space-2) var(--space-3);
}

.dropdown-menu button:hover,
.dropdown-menu button:focus-visible {
  background: var(--surface-alt);
}

/* tabla genérica (bandeja/upload) */
.data-table-wrapper {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.data-table-wrapper tr[data-clickable] {
  cursor: pointer;
}

.data-table-wrapper tr[data-clickable]:hover {
  background: var(--surface-alt);
}

.confidence {
  color: var(--text-secondary);
  font-size: 12px;
}

.field-confidence {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-secondary);
}

.validation-item {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
  padding: var(--space-1) 0;
  font-size: 13px;
}

.validation-item--failed {
  color: var(--danger);
}

.validation-item--passed {
  color: var(--success);
}

.empty-state {
  color: var(--text-secondary);
  padding: var(--space-5);
  text-align: center;
}
