/* ── Reportes de Ventas — UI v5 ─────────────────────────────────────────── */
/* IMPORTANTE: NO sobreescribir font-family — heredar del app global */

@keyframes rv-fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes rv-count {
  from { opacity: 0; transform: scale(.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes rv-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

#repVentasRoot {
  /* Sin font-family: hereda la del app para consistencia visual */
  min-height: 400px;
  animation: rv-fadeUp .3s ease;
}

/* ── Header ── */
.rv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
  gap: 10px;
  flex-wrap: wrap;
}
.rv-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rv-titulo {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1d4ed8;          /* color sólido — siempre visible */
  letter-spacing: -0.2px;
}

.rv-info-btn {
  background: none;
  border: 1.5px solid #c7d2fe;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  cursor: pointer;
  color: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}
.rv-info-btn:hover { background: #eef2ff; border-color: #6366f1; }

/* ── Filtros ── */
.rv-filtros {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 20px;
  flex-wrap: wrap;
}
.rv-label {
  font-size: 13px;
  color: #4b5563;
  font-weight: 600;
}
.rv-date-input {
  padding: 6px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #111827;
  outline: none;
  transition: border-color .15s;
  background: #fff;
  font-family: inherit;
}
.rv-date-input:focus { border-color: #6366f1; }
.rv-buscar-btn {
  padding: 7px 16px;
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background .15s, transform .1s;
}
.rv-buscar-btn:hover  { background: #1e40af; }
.rv-buscar-btn:active { transform: scale(.97); }

/* ── KPI cards ── */
.rv-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
  padding: 12px 20px;
}
.rv-kpi-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  border-left: 4px solid var(--rv-c, #1d4ed8);
  animation: rv-fadeUp .4s ease both;
  transition: box-shadow .2s, transform .15s;
}
.rv-kpi-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.rv-kpi-label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.rv-kpi-total {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--rv-c, #1d4ed8);
  animation: rv-count .4s ease;
}
.rv-kpi-sub {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

/* Skeleton */
.rv-skel {
  height: 74px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e9eaeb 50%, #f3f4f6 75%);
  background-size: 400px 100%;
  animation: rv-shimmer 1.2s infinite;
  border-radius: 12px;
}

/* ── Tabs ── */
.rv-tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  border-bottom: 2px solid #e5e7eb;
  flex-wrap: wrap;
  margin-top: 4px;
}
.rv-tab-btn {
  padding: 9px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  position: relative;
  transition: color .15s, background .15s;
  font-family: inherit;
}
.rv-tab-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 8px;
  right: 8px;
  height: 2px;
  background: #1d4ed8;
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform .2s;
}
.rv-tab-btn:hover { color: #1d4ed8; background: #f0f4ff; }
.rv-tab-btn.rv-activo {
  color: #1d4ed8;
  font-weight: 700;
  background: #f0f4ff;
}
.rv-tab-btn.rv-activo::after { transform: scaleX(1); }

/* ── Tabla ── */
.rv-tabla-wrap {
  padding: 14px 20px 20px;
  overflow-x: auto;
  animation: rv-fadeUp .25s ease;
}
.rv-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rv-tabla thead th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid #e5e7eb;
  background: #fafafa;
  white-space: nowrap;
}
.rv-tabla tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background .1s;
}
.rv-tabla tbody tr:hover { background: #f5f7ff; }
.rv-tabla tbody td { padding: 9px 12px; vertical-align: middle; }
.rv-num   { font-weight: 700; color: #1d4ed8; font-size: 12px; letter-spacing: .3px; }
.rv-monto { font-weight: 700; color: #111827; text-align: right; white-space: nowrap; }
.rv-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.rv-empty {
  padding: 48px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}
.rv-empty.rv-error { color: #ef4444; }
.rv-count-lbl {
  margin-top: 8px;
  font-size: 12px;
  color: #9ca3af;
  text-align: right;
}

/* ── Modal info ── */
.rv-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: rv-fadeUp .2s ease;
}
.rv-modal {
  background: #fff;
  border-radius: 16px;
  padding: 26px;
  max-width: 480px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.rv-modal-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.rv-modal-titulo {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: #1d4ed8;
}
.rv-close-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #9ca3af;
  line-height: 1;
}
.rv-dl {
  display: grid;
  gap: 14px;
}
.rv-dl-item { display: grid; gap: 3px; }
.rv-dl dt {
  font-weight: 700;
  font-size: 11px;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.rv-dl dd {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.55;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .rv-kpis { grid-template-columns: 1fr 1fr; }
  .rv-tabla thead th:nth-child(4) { display: none; }
  .rv-tabla tbody td:nth-child(4) { display: none; }
  .rv-header { padding: 14px 12px 0; }
  .rv-filtros { padding: 10px 12px; }
  .rv-tabs    { padding: 0 12px; }
  .rv-tabla-wrap { padding: 12px 12px 16px; }
}

/* ── Tab DIAN (v6): documentos electrónicos ── */
/* ── DIAN: summary banner ── */
.rv-dian-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 14px;
  color: #fff;
  flex-wrap: wrap;
}
.rv-ds-main {
  display: flex;
  flex-direction: column;
  min-width: 80px;
}
.rv-ds-total {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}
.rv-ds-label {
  font-size: 11px;
  opacity: .75;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 3px;
}
.rv-ds-stats {
  display: flex;
  gap: 16px;
  flex: 1;
  flex-wrap: wrap;
}
.rv-ds-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 8px 14px;
  min-width: 68px;
}
.rv-ds-n {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}
.rv-ds-ok .rv-ds-n  { color: #86efac; }
.rv-ds-pend .rv-ds-n { color: #fcd34d; }
.rv-ds-err .rv-ds-n  { color: #fca5a5; }
.rv-ds-l {
  font-size: 10px;
  opacity: .8;
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
}
.rv-ds-progress {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,.2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
  order: 10;
}
.rv-ds-bar {
  height: 100%;
  background: #86efac;
  border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
  min-width: 2px;
}

/* ── DIAN: chips de filtro ── */
.rv-dian-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.rv-ds-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.rv-ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s, background .15s, border-color .15s, box-shadow .15s;
}
.rv-ds-chip:hover {
  border-color: #6366f1;
  color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(99,102,241,.15);
}
.rv-ds-chip-on {
  background: var(--chip-c, #1d4ed8);
  border-color: var(--chip-c, #1d4ed8);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.rv-ds-cnt {
  background: rgba(255,255,255,.25);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 11px;
}
.rv-ds-chip-on .rv-ds-cnt { background: rgba(255,255,255,.3); }
.rv-ds-chip:not(.rv-ds-chip-on) .rv-ds-cnt {
  background: #f3f4f6;
  color: #374151;
}

.rv-cufe {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #6b7280;
  cursor: help;
}
@media (max-width: 600px) {
  .rv-dian-summary { flex-direction: column; align-items: flex-start; gap: 12px; }
  .rv-ds-stats { gap: 8px; }
}

/* ── Impresión: botón en tabla ── */
.rv-td-print {
  width: 36px;
  padding: 0 4px !important;
  text-align: center;
}
.rv-print-btn {
  background: none;
  border: 1.5px solid #e5e7eb;
  border-radius: 7px;
  width: 30px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
}
.rv-print-btn:hover {
  background: #eff6ff;
  border-color: #1d4ed8;
  color: #1d4ed8;
}

/* ── Modal de impresión ── */
.rv-print-modal {
  max-width: 420px;
}
.rv-print-fmt-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.rv-print-fmt-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  background: #f8fafc;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: #374151;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  line-height: 1.3;
}
.rv-print-fmt-btn span {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
}
.rv-print-fmt-btn:hover {
  background: #eff6ff;
  border-color: #1d4ed8;
  color: #1d4ed8;
  transform: translateY(-2px);
}
.rv-print-fmt-btn:hover span { color: #6366f1; }
.rv-print-fmt-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
.rv-print-fmt-dian {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}
.rv-print-fmt-dian span { color: #16a34a; }
.rv-print-fmt-dian:hover {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
  transform: translateY(-2px);
}
.rv-print-fmt-dian:hover span { color: #166534; }

/* ── Historial de impresiones ── */
.rv-print-hist {
  border-top: 1.5px solid #f3f4f6;
  padding-top: 14px;
}
.rv-print-hist-title {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 8px;
}
.rv-print-hist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f9fafb;
  font-size: 12px;
}
.rv-print-hist-fmt {
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.rv-print-hist-usr {
  font-weight: 600;
  color: #374151;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rv-print-hist-ts {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}
.rv-print-hist-empty {
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
  padding: 10px 0;
}
