/* components/historico/historico.css
   Estilos de la pantalla "Histórico" (captura de órdenes pasadas).
   Prefijo hist-. El acento ámbar distingue el "modo histórico" del
   azul del flujo vivo. Tokens ámbar propios, theme-aware. */

.hist-component {
  /* Ámbar por defecto (tema claro). */
  --hist-amber-bg: rgba(245, 158, 11, 0.10);
  --hist-amber-border: rgba(245, 158, 11, 0.40);
  --hist-amber-text: #92400E;
  --hist-amber-strong: #B45309;
  --hist-ok-bg: rgba(16, 185, 129, 0.12);
  --hist-ok-text: #047857;
}
@media (prefers-color-scheme: dark) {
  .hist-component {
    --hist-amber-text: #FCD34D;
    --hist-amber-strong: #FBBF24;
    --hist-ok-text: #6EE7B7;
  }
}
:root[data-theme="light"] .hist-component {
  --hist-amber-text: #92400E; --hist-amber-strong: #B45309; --hist-ok-text: #047857;
}
:root[data-theme="dark"] .hist-component {
  --hist-amber-text: #FCD34D; --hist-amber-strong: #FBBF24; --hist-ok-text: #6EE7B7;
}

/* ── Banner de modo histórico ─────────────────────────────────── */
.hist-banner {
  display: flex; align-items: flex-start; gap: 0.75rem;
  background: var(--hist-amber-bg);
  border: 1px solid var(--hist-amber-border);
  border-radius: 0.625rem;
  padding: 0.75rem 1rem; margin-bottom: 1.125rem;
}
.hist-banner-icon { color: var(--hist-amber-strong); font-size: 1.375rem; flex-shrink: 0; margin-top: 0.0625rem; }
.hist-banner-title { font-size: 0.875rem; font-weight: 600; color: var(--hist-amber-strong); }
.hist-banner-sub { font-size: 0.78125rem; color: var(--hist-amber-text); margin-top: 0.125rem; line-height: 1.45; }
.hist-banner-sub strong { color: var(--hist-amber-strong); }

/* ── Aviso de éxito tras guardar ──────────────────────────────── */
.hist-exito {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--hist-ok-bg); color: var(--hist-ok-text);
  border-radius: 0.5rem; padding: 0.625rem 0.875rem; margin-bottom: 0.875rem;
  font-size: 0.8125rem;
}
.hist-exito i { font-size: 1.0625rem; }

/* ── Cabecera de la orden ─────────────────────────────────────── */
.hist-cab-grid {
  display: grid;
  grid-template-columns: 12rem 1fr 12rem;
  gap: 0.75rem; align-items: start;
}

/* ── Renglones tipo hoja ──────────────────────────────────────── */
.hist-row {
  display: grid;
  grid-template-columns: 2fr 0.7fr 1.6fr 0.9fr 0.9fr 0.85fr 2rem;
  gap: 0.5rem; align-items: center;
  padding: 0.375rem 0;
}
.hist-row-head {
  padding-bottom: 0.25rem; margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
.hist-row-head span {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); text-transform: uppercase;
}
.hist-cell { min-width: 0; } /* deja que el autocomplete se encoja en la celda */
.hist-row .crud-input { padding-top: 0.4375rem; padding-bottom: 0.4375rem; }
.hist-in-cant, .hist-in-compra, .hist-in-venta { text-align: right; }

/* ── Pie: cobro + total ───────────────────────────────────────── */
.hist-foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.25rem; align-items: start;
}
.hist-cobro-toggle { display: flex; gap: 1.25rem; margin-bottom: 0.75rem; }
.hist-radio { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; color: var(--text); cursor: pointer; }
.hist-radio input { accent-color: var(--hist-amber-strong); }
.hist-cobro-fields { display: flex; gap: 0.75rem; max-width: 26rem; }
.hist-cobro-fields .crud-field { flex: 1; }

.hist-total-box {
  min-width: 13rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 0.5rem; padding: 0.75rem 0.875rem;
}
.hist-total-line { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--muted); padding: 0.1875rem 0; }
.hist-total-grand { font-size: 0.9375rem; font-weight: 700; color: var(--text); border-top: 1px solid var(--border); margin-top: 0.25rem; padding-top: 0.4375rem; }

/* ── Responsive: apila en pantallas angostas ──────────────────── */
@media (max-width: 860px) {
  .hist-cab-grid { grid-template-columns: 1fr; }
  .hist-row-head { display: none; }
  .hist-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    border: 1px solid var(--border); border-radius: 0.5rem;
    padding: 0.625rem; margin-bottom: 0.5rem;
  }
  .hist-row .hist-cell { grid-column: 1 / -1; }
  .hist-foot { grid-template-columns: 1fr; }
  .hist-total-box { min-width: 0; }
}
