.history-editable-item {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.history-editable-item:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.28);
}

.history-editable-item.is-cancelled {
  opacity: 0.72;
  background: rgba(239, 68, 68, 0.04);
}

.history-item-side {
  min-width: 130px;
  text-align: right;
}

.history-item-side small {
  display: block;
  margin-top: 7px;
  color: #0f766e;
  font-weight: 900;
}

.history-status.is-partial {
  background: rgba(56, 189, 248, 0.12);
  color: #0369a1;
}

.history-status.is-cancelled {
  background: rgba(239, 68, 68, 0.11);
  color: #b91c1c;
}

.sale-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  align-items: end;
  padding: 18px;
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(9px);
}

.sale-editor-card {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  margin: 0 auto;
  padding: 21px;
  border-radius: 30px 30px 22px 22px;
  background: var(--surface-solid, #ffffff);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.32);
}

.sale-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.sale-editor-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sale-editor-header h3 {
  margin: 5px 0 0;
  font-size: 1.7rem;
  letter-spacing: -0.055em;
}

.editor-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.editor-preview-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(15, 118, 110, 0.08);
}

.editor-preview-card span,
.editor-preview-card strong,
.editor-preview-card small {
  display: block;
}

.editor-preview-card span {
  color: var(--muted);
  font-weight: 850;
}

.editor-preview-card strong {
  margin-top: 5px;
  color: #0f766e;
  font-size: 1.85rem;
  letter-spacing: -0.055em;
}

.editor-preview-card small {
  margin-top: 5px;
  color: var(--muted);
}

.editor-danger-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 18px;
}

.editor-cancelled-warning {
  margin-bottom: 16px;
  padding: 13px;
  border-radius: 18px;
  background: rgba(239, 68, 68, 0.09);
  color: #b91c1c;
  font-weight: 850;
  line-height: 1.4;
}

.editor-history-panel {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

.editor-history-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 900;
}

.editor-history-panel > p {
  color: var(--muted);
}

.editor-history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.editor-history-list article {
  padding: 11px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.82);
}

.editor-history-list strong,
.editor-history-list span {
  display: block;
}

.editor-history-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

#editor-amount-field.is-muted {
  opacity: 0.68;
}

@media (max-width: 560px) {
  .sale-editor-backdrop {
    padding: 0;
  }

  .sale-editor-card {
    border-radius: 30px 30px 0 0;
  }

  .editor-date-grid {
    grid-template-columns: 1fr;
  }

  .history-item-side {
    min-width: 0;
  }
}

/* v15.16C — Cobros coherentes en subventas */
.editor-component-payment-grid {
  align-items: end;
}

.editor-component-payment-grid
  [data-component-paid-field][hidden] {
  display: none !important;
}

.editor-component-payment-grid
  [data-component-paid-amount] {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .editor-component-payment-grid {
    grid-template-columns: 1fr;
  }
}