/* =========================================
   INVENTARIO / PRODUCCIÓN TRACE UI
========================================= */
.inventario-available-line {
  color: var(--lj-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.inventario-expired-strike {
  text-decoration: line-through;
  text-decoration-color: var(--lj-danger);
  text-decoration-thickness: 2px;
  text-decoration-skip-ink: none;
  color: var(--lj-accent) !important;
  opacity: 0.85;
  display: inline-block;
}

/* La unidad (Kg.) va en su propio span sin strike: queda visible y "normal".
   Le bajamos el color para que igual se vea "secundaria" cuando hay vencimiento. */
.inventario-hero-value:has(.inventario-expired-strike) .inventario-hero-unit-suffix {
  color: var(--lj-accent);
  margin-left: 4px;
}

.inventario-trace-row td {
  background: var(--lj-surface-2) !important;
  border-top: 1px dashed var(--lj-danger) !important;
  color: var(--lj-danger);
  font-size: 0.82rem;
}

.inventario-resolution-row td {
  background: var(--lj-accent-soft) !important;
  border-top: 1px dashed var(--lj-accent) !important;
  color: var(--lj-brand);
  font-size: 0.82rem;
}

.inventario-internal-use-row td {
  background: var(--lj-warning-soft) !important;
  border-top: 1px dashed var(--lj-warning) !important;
  font-size: 0.82rem;
}

#copyIngredientIdBtn {
  border-radius: 0 var(--lj-radius-lg) var(--lj-radius-lg) 0 !important;
}

/* Tabla de salidas: alineación estándar (texto a la izquierda, acciones a la derecha). */
.produccion-dispatch-table-center th,
.produccion-dispatch-table-center td {
  vertical-align: middle;
}

.produccion-dispatch-table-center .inventario-trace-row td,
.produccion-dispatch-table-center .inventario-internal-use-row td {
  color: var(--lj-text);
}

.produccion-dispatch-table-center .inventario-dispatch-group-row td {
  background: var(--lj-surface-2) !important;
  border-top: 1px dashed var(--lj-border-strong) !important;
  color: var(--lj-accent);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
}

.produccion-dispatch-table-center .inventario-internal-use-row td {
  text-align: center;
}

.inventario-internal-meta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.inventario-internal-meta small {
  color: var(--lj-warning);
  font-weight: 600;
}

.inventario-internal-no-trace {
  color: var(--lj-warning);
  font-size: 0.74rem;
  font-weight: 600;
}

tr.inventario-row-tone:has(.inventario-expiry-days-badge.is-danger) > td {
  background: var(--lj-warning-soft) !important;
}

.inventario-expired-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--lj-danger);
  background: var(--lj-danger-soft);
  border: 1px solid color-mix(in srgb, var(--lj-danger) 35%, var(--lj-surface));
}

.inventario-expiry-days-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  margin-top: 2px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

/* Etiquetas suaves (fondo claro + texto del estado), como el resto de los tags. */
.inventario-expiry-days-badge.is-success { color: var(--lj-success); background: var(--lj-success-soft); border-color: color-mix(in srgb, var(--lj-success) 30%, transparent); }
.inventario-expiry-days-badge.is-warning { color: var(--lj-warning); background: var(--lj-warning-soft); border-color: color-mix(in srgb, var(--lj-warning) 30%, transparent); }
.inventario-expiry-days-badge.is-danger { color: var(--lj-danger); background: var(--lj-danger-soft); border-color: color-mix(in srgb, var(--lj-danger) 30%, transparent); }
.inventario-expiry-days-badge.is-neutral { color: var(--lj-muted); background: var(--lj-surface-2); border-color: var(--lj-border); }

.inventario-resolution-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--lj-accent);
  background: var(--lj-accent-soft);
  border: 1px solid var(--lj-border);
}

.produccion-lote-expired-help {
  grid-column: 1 / -1;
  color: var(--lj-danger);
  font-size: 0.82rem;
}

/* Nota neutral para lotes vencidos/posteriores en modo lote antiguo. */
.produccion-lote-neutral-help {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--lj-muted);
  font-size: 0.8rem;
}

.produccion-lote-neutral-help i {
  color: var(--lj-muted);
  flex-shrink: 0;
  margin-top: 1px;
}

.produccion-lote-expired-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Acciones para lotes bloqueados (future/expired): "Cambiar fecha" y
   "Producir sin trazabilidad este ingrediente". */
.produccion-lote-blocked-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.produccion-lote-blocked-actions sl-button[variant="warning"]::part(base) {
  background: var(--lj-warning-soft);
  color: var(--lj-warning);
  border-color: color-mix(in srgb, var(--lj-warning) 45%, var(--lj-surface));
  font-weight: 700;
}

.produccion-lote-blocked-actions sl-button[variant="warning"]::part(base):hover {
  background: color-mix(in srgb, var(--lj-warning) 18%, var(--lj-surface));
}

/* Card de ingrediente marcada como "sin trazabilidad". */
.produccion-lote-group.is-sin-traz {
  background: var(--lj-warning-soft);
  border-color: color-mix(in srgb, var(--lj-warning) 35%, var(--lj-surface));
}

.produccion-lote-sin-traz-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: 4px;
  background: var(--lj-warning-soft);
  color: var(--lj-warning);
  border: 1px solid var(--lj-warning);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.produccion-lote-sin-traz-badge i {
  font-size: 0.7rem;
  color: var(--lj-warning);
}

.produccion-lote-sin-traz-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin: 4px 0;
  background: var(--lj-warning-soft);
  border: 1px solid color-mix(in srgb, var(--lj-warning) 35%, var(--lj-surface));
  border-radius: var(--lj-radius-lg);
  font-size: 0.78rem;
  color: var(--lj-warning);
  flex-wrap: wrap;
}

.produccion-lote-sin-traz-note i {
  color: var(--lj-warning);
}

.produccion-lote-sin-traz-note strong {
  color: var(--lj-warning);
  font-weight: 700;
}

.produccion-lote-undo-skip {
  margin-left: 6px;
  padding: 2px 8px;
  background: var(--lj-surface);
  border: 1px solid var(--lj-warning);
  border-radius: 4px;
  color: var(--lj-warning);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s ease;
}

.produccion-lote-undo-skip:hover:not(:disabled) {
  background: var(--lj-warning-soft);
}

.produccion-lote-undo-skip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Alert "Hay ingredientes bloqueados": botones más anchos, texto no cortado. */
.produccion-blocked-alert .swal2-actions {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.produccion-blocked-alert .swal2-actions sl-button {
  flex: 0 1 auto;
  min-width: 140px;
  white-space: nowrap;
}

.produccion-resolve-qty-wrap {
  text-align: center;
}

.produccion-resolve-qty-wrap .swal2-input {
  margin-left: auto;
  margin-right: auto;
}

.inventario-trace-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inventario-trace-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--lj-border);
  background: var(--lj-surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.inventario-trace-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.inventario-trace-avatar .thumb-loading .meta-spinner-login {
  font-size: 16px;
}

.inventario-trace-label {
  font-weight: 700;
  color: var(--lj-accent);
}

.inventario-trace-relation {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--lj-accent);
  vertical-align: middle;
}

.inventario-trace-icon {
  width: 18px;
  height: 18px;
  color: var(--lj-accent);
  flex-shrink: 0;
}

.inventario-trace-kilos {
  color: var(--lj-danger) !important;
  font-weight: 800;
}

.inventario-available-line.is-zero {
  color: var(--lj-danger);
  text-decoration: line-through;
}

.produccion-visualizar-btn {
  background: var(--lj-accent-soft);
  color: var(--lj-accent);
  width: fit-content;
}

.produccion-recipe-history {
  border: 1px solid var(--lj-border);
  border-radius: var(--lj-radius-lg);
  padding: 10px;
  background: var(--lj-surface);
}

/* =========================================
   AJUSTES UX INVENTARIO/PRODUCCIÓN (REVISION)
========================================= */
.inventario-trace-toolbar {
  justify-content: flex-start;
}

.inventario-trace-toolbar .inventario-period-divider {
  margin-right: 2px;
}

.produccion-actions-row .produccion-visualizar-btn,
.produccion-visualizar-btn {
  width: fit-content;
  max-width: none;
}

.produccion-umbral-btn {
  width: fit-content;
  max-width: none;
  min-height: 40px;
  border-radius: var(--lj-radius-lg);
  border: 1px solid var(--lj-border);
  background: var(--lj-surface-2);
  color: var(--lj-text);
  font-size: 16px;
  font-weight: 700;
  padding: 8px 14px;
}

.produccion-umbral-btn i {
  color: var(--lj-muted);
}

.produccion-umbral-btn:hover {
  background: var(--lj-surface-2);
  color: var(--lj-text);
}

.produccion-actions-row .inventory-production-action-btn.is-threshold {
  width: fit-content;
}

.produccion-umbral-alert .swal2-html-container {
  text-align: center;
}

.produccion-umbral-alert .swal2-actions {
  justify-content: center;
}

.produccion-umbral-alert sl-input.swal2-input {
  margin-inline: auto;
}

.produccion-umbral-alert sl-input.swal2-input::part(input) {
  text-align: center;
}

.produccion-company-logo-preview-wrap {
  display: flex;
  justify-content: center;
}

.produccion-company-logo-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 1px solid var(--lj-border);
  background: var(--lj-accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--lj-accent);
  font-size: 1.8rem;
}

.produccion-company-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.produccion-company-logo-loading {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.produccion-company-logo-spinner {
  font-size: 42px;
}

.viewer-document {
  width: 100%;
  min-height: 72vh;
  border: 0;
  border-radius: var(--lj-radius-lg);
  background: var(--lj-surface);
}

.produccion-config-form {
  text-align: left;
}

.produccion-config-section {
  background: var(--lj-surface);
  padding: 0;
  overflow: hidden;
}

.produccion-config-section > .produccion-config-toggle {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.produccion-config-section > .step-content {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--lj-border);
}

.swal2-popup.produccion-umbral-alert .inventario-collapse-head-styled {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.swal2-popup.produccion-umbral-alert .produccion-config-toggle > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.swal2-popup.produccion-umbral-alert .inventario-collapse-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.produccion-config-actions {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0;
}

.produccion-rne-file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.produccion-rne-upload-loading {
  width: 48px;
  height: 48px;
  border-radius: var(--lj-radius-lg);
  border: 1px solid var(--lj-border);
  background: var(--lj-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.produccion-rne-history-wrap {
  margin-top: 12px;
  border-top: 1px dashed var(--lj-border);
  padding-top: 10px;
}

.produccion-rne-history {
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
}

.produccion-rne-history-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--lj-border);
  border-radius: var(--lj-radius-lg);
  padding: 10px;
  background: var(--lj-surface);
  margin-bottom: 8px;
}

.produccion-rne-history-item > div {
  flex: 1;
  text-align: left;
}

.produccion-rne-history-item p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--lj-accent);
}

.produccion-rne-history-empty {
  color: var(--lj-accent);
  margin: 0;
}

.produccion-trace-alert {
  background: var(--lj-surface);
}

.swal2-popup.produccion-trace-alert .swal2-html-container {
  margin: 0;
  padding: 0;
  overflow: visible;
  text-align: left;
}

.produccion-trace-apple-viewer {
  border: 1px solid var(--lj-border);
  border-radius: var(--lj-radius-lg);
  padding: 12px;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--lj-muted) 22%, transparent) 1px, transparent 0);
  background-size: 18px 18px;
  background-color: var(--lj-surface);
}

.produccion-trace-ingredient-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--lj-border);
  background: var(--lj-accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--lj-accent);
}

.produccion-trace-ingredient-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

