/* ===== NovaLaser Reportes — rediseño 2026-08-02 =====
   Solo presentación visual. Nombres de clase preservados para
   no romper el HTML existente (card-kpi, ribbon-btn, btn-*...). */
:root {
  --navy: #0f2a4a;
  --navy-soft: #eef4fb;
  --success: #0e5c36;
  --success-bg: #e2f3ea;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --warn: #7a5200;
  --warn-bg: #fdf0dd;
  --radius-card: 10px;
  --radius-btn: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 3px 12px rgba(0,0,0,.07);
  --bg: #f4f6f9;
  --surface: #fff;
  --text: #1c2530;
  --muted: #5b6b7c;
  --border: #dde4ec;
}

* { box-sizing: border-box; }
body { font-family: 'Work Sans', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.5; }
h1,h2,h3,h4,h5,h6 { font-family: 'Work Sans', system-ui, sans-serif; font-weight: 700; }

/* Números con personalidad (serif) */
.valor, .card-kpi .valor, .resumen .item .valor {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  letter-spacing: -.01em;
}

/* ===== Cards ===== */
.card-kpi {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  border: none;
  min-width: 0;
}
.card-kpi .etiqueta { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; }
.card-kpi .valor { font-size: 1.625rem; overflow-wrap: anywhere; }

/* KPI destacada: VENTAS DE LA SEMANA (azul) */
.card-kpi.kpi-semana { background: var(--navy); color: #fff; }
.card-kpi.kpi-semana .etiqueta { color: #a8c3e2; }
.card-kpi.kpi-semana .valor { color: #e8f1fb; }
.card-kpi.kpi-semana .sub { color: #c9dcea; font-size: .875rem; margin-top: 6px; }
.delta { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: .875rem; }
.delta.up { color: #7ee2a8; }
.delta.down { color: #ffb3a7; }
.mini-chart { display: flex; align-items: flex-end; gap: 6px; height: 34px; margin-top: 8px; }
.mini-chart .bar { flex: 1; border-radius: 3px 3px 0 0; background: #c9d8ea; }
.mini-chart .bar.act { background: #e8f1fb; }

/* Meta mensual: sin relevancia visual */
.card-kpi.kpi-meta { opacity: .85; }
.card-kpi.kpi-meta .etiqueta { font-size: .68rem; }
.card-kpi.kpi-meta .valor { font-size: 1rem; }

/* ===== Botones (semánticos: verde = éxito, azul = acción, rojo = peligro) ===== */
.btn-verde, .btn-azul, .btn-eliminar {
  border: none;
  border-radius: var(--radius-btn);
  color: #fff;
  font-weight: 600;
  padding: 8px 16px;
  font-size: .875rem;
  transition: filter .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-verde { background: var(--success); }
.btn-azul { background: var(--navy); }
.btn-eliminar { background: var(--danger); }
.btn-verde:hover, .btn-azul:hover { filter: brightness(.92); color: #fff; }
.btn-eliminar:hover { filter: brightness(.92); color: #fff; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { max-width: 380px; width: 100%; border-radius: var(--radius-card); box-shadow: var(--shadow); background: var(--surface); }

/* ===== Tablas ===== */
table.table thead { background: var(--navy-soft); color: var(--navy); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; }
table.table thead th { border: none; padding: 10px 12px; }
table.table { border-radius: 10px; overflow: hidden; }
table.table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: .875rem; }
table.table tbody tr:hover { background: #f8fafd; }

/* Filas por umbral de meta diaria (requisito del negocio — misma lógica que table-success/table-danger) */
tr.fila-meta-ok td { background: var(--success-bg); }
tr.fila-meta-ok:hover td { background: #d3ebdd; }
tr.fila-meta-baja td { background: var(--danger-bg); }
tr.fila-meta-baja:hover td { background: #f9dcd8; }
/* Producción usa table-success/table-danger de Bootstrap — mismo color, contraste AA */
tr.table-success td { background: var(--success-bg) !important; color: var(--text) !important; }
tr.table-success:hover td { background: #d3ebdd !important; }
tr.table-danger td { background: var(--danger-bg) !important; color: var(--text) !important; }
tr.table-danger:hover td { background: #f9dcd8 !important; }
.legend { display: flex; gap: 16px; font-size: .78rem; color: var(--muted); flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ===== Badges ===== */
.badge-nueva { background: var(--success-bg); color: var(--success); border-radius: 6px; font-size: .7rem; font-weight: 700; }
.badge-reventa { background: var(--warn-bg); color: var(--warn); border-radius: 6px; font-size: .7rem; font-weight: 700; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Navegación (plana, sin pills) ===== */
.ribbon-btn, .ribbon-btn-ventas, .ribbon-btn-outline {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: rgba(255,255,255,.75);
  font-size: .875rem;
  font-weight: 500;
  padding: 11px 16px;
  text-decoration: none !important;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0;
}
.ribbon-btn:hover, .ribbon-btn-ventas:hover, .ribbon-btn-outline:hover { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); transform: none; }
.ribbon-btn.active, .ribbon-btn-ventas.active, .ribbon-btn-outline.active { background: transparent; color: #fff; border-bottom-color: #ffd166; font-weight: 600; box-shadow: none; }
.ribbon-btn.active:hover, .ribbon-btn-ventas.active:hover, .ribbon-btn-outline.active:hover { background: transparent; color: #fff; transform: none; }
.ribbon-btn-ventas { border: none; border-bottom: 3px solid transparent; color: #ffd166; font-weight: 600; }
.ribbon-btn-ventas.active { color: #fff; border-bottom-color: #ffd166; }

/* ===== Logout ===== */
.btn-logout {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 8px;
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  padding: 6px 14px;
  text-decoration: none;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-logout:hover { background: rgba(192,57,43,.55); border-color: var(--danger); color: #fff; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .navbar-brand span { display: none; }
  .card-kpi .valor { font-size: 1.125rem; }
  .ribbon-btn, .ribbon-btn-ventas, .ribbon-btn-outline { padding: 8px 12px; font-size: .8125rem; gap: 4px; }
  .card-kpi { padding: .75rem !important; }
  .login-card { margin: 0 12px; }
}

/* ============================================================
   Tablas legibles en móvil: en pantallas angostas cada fila se
   convierte en una ficha con sus etiquetas; en escritorio la
   tabla no cambia. La clase .tabla-ficha la pone footer.php.
   ============================================================ */
@media (max-width: 1024px) {
  .tabla-ficha { display: block; width: 100%; }
  .tabla-ficha thead { display: none; }
  .tabla-ficha tbody, .tabla-ficha tfoot { display: block; }
  .tabla-ficha tr {
    display: block; background: #fff; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 8px 10px; margin-bottom: 10px;
  }
  .tabla-ficha tfoot tr { background: #f8fafc; }
  .tabla-ficha td, .tabla-ficha th {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; border: 0 !important; padding: 4px 0 !important;
    white-space: normal !important; text-align: right; width: auto !important;
  }
  .tabla-ficha td::before {
    content: attr(data-label);
    font-size: .7rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: #64748b;
    flex: 0 0 38%; text-align: left; padding-top: 2px;
  }
  .tabla-ficha td:not([data-label])::before,
  .tabla-ficha td[data-label=""]::before { content: none; }
  .tabla-ficha td[colspan] { justify-content: flex-end; }
  .table-responsive { overflow-x: visible !important; }
}

@media (max-width: 767.98px) {
  .nv-logo { height: 36px !important; max-width: 190px !important; }
  .nv-barra { padding-top: 2px; }
}

/* ── SUPERNOVA BLACK SALE · bloque promocional en Reportes ───────────────── */
.nv-promo {
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #1f2937 0%, #374151 55%, #4b3a2f 100%);
  color: #f3f4f6;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .16);
}
.nv-promo-top {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 20px; flex-wrap: wrap;
  background: rgba(0, 0, 0, .22);
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.nv-promo-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nv-promo-flame { font-size: 1.55rem; line-height: 1; }
.nv-promo-kicker {
  display: block; font-size: .68rem; letter-spacing: 2.2px; text-transform: uppercase;
  font-weight: 700; color: #f59e0b;
}
.nv-promo-title { margin: 2px 0 0; font-size: 1.22rem; font-weight: 700; color: #fff; letter-spacing: -.2px; }
.nv-promo-toggle {
  border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff;
  border-radius: 40px; padding: 6px 16px; font-size: .78rem; font-weight: 600; cursor: pointer;
}
.nv-promo-toggle:hover { background: rgba(255, 255, 255, .12); }
.nv-promo-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px 20px 6px;
}
.nv-promo-card {
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 11px; padding: 16px 16px 12px;
}
.nv-promo-card header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.nv-promo-icon { font-size: 1.15rem; line-height: 1.1; flex-shrink: 0; }
.nv-promo-card h6,
.nv-promo-condicion h6 {
  margin: 0; font-size: .95rem; font-weight: 700; color: #fff; letter-spacing: .1px;
}
.nv-promo-fechas { margin: 3px 0 0; font-size: .78rem; color: #fbbf24; font-weight: 600; }
.nv-promo-texto { margin: 0 0 12px; font-size: .84rem; line-height: 1.5; color: #d7dbe2; }
.nv-premios { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.nv-premios li {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, .26); border-radius: 8px; padding: 7px 12px;
  font-size: .84rem; color: #eef1f5;
}
.nv-medalla { font-size: 1rem; }
.nv-lugar { flex: 1 1 auto; color: #cbd2dc; }
.nv-premios strong { font-size: 1rem; color: #ffd479; letter-spacing: .3px; }
.nv-promo-pie { margin: 0; font-size: .76rem; color: #aeb6c2; line-height: 1.45; }
.nv-promo-condicion {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 12px 20px 0; padding: 14px 16px;
  background: rgba(245, 158, 11, .1);
  border-left: 3px solid #f59e0b; border-radius: 8px;
}
.nv-promo-condicion p { margin: 4px 0 0; font-size: .82rem; line-height: 1.5; color: #e3e7ec; }
.nv-promo-condicion strong { color: #ffd479; }
.nv-promo-cierre {
  margin: 12px 20px 18px; font-size: .84rem; font-weight: 600; color: #fbbf24; line-height: 1.5;
}
@media (max-width: 767.98px) {
  .nv-promo-grid { grid-template-columns: 1fr; padding: 14px 14px 4px; gap: 12px; }
  .nv-promo-top { padding: 13px 14px; }
  .nv-promo-title { font-size: 1.05rem; }
  .nv-promo-condicion { margin: 10px 14px 0; }
  .nv-promo-cierre { margin: 10px 14px 15px; }
  .nv-promos li { font-size: .8rem; }
}

/* los emojis del bloque usan la fuente del sistema que sí los tenga */
.nv-promo-flame, .nv-promo-icon, .nv-medalla, .nv-promo-fechas {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

/* ── Regional · participantes por país ──────────────────────────────────── */
.nv-promo-badge {
  background: rgba(245, 158, 11, .16); color: #fbbf24; border: 1px solid rgba(245, 158, 11, .4);
  border-radius: 40px; padding: 5px 14px; font-size: .74rem; font-weight: 700; letter-spacing: .3px;
}
.nv-regional-paises { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; align-items: start; }
.nv-regional-pais { border: 1px solid #e6e9ef; border-radius: 9px; padding: 9px 11px; background: #fbfcfe; }
.nv-regional-pais-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.nv-regional-pais-head strong { font-size: .82rem; color: #1f2937; }
.nv-regional-count {
  background: #1f2937; color: #fff; border-radius: 20px; font-size: .68rem; font-weight: 700;
  padding: 1px 8px; min-width: 22px; text-align: center;
}
.nv-regional-vacio { margin: 0; font-size: .74rem; color: #9aa3b2; }
.nv-regional-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.nv-regional-lista li {
  display: flex; align-items: center; gap: 6px; font-size: .78rem; color: #334155;
  background: #fff; border: 1px solid #eef1f6; border-radius: 7px; padding: 4px 7px;
}
.nv-regional-lista li.inactiva { opacity: .55; }
.nv-regional-dato { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.nv-regional-nombre { font-weight: 600; color: #1f2937; overflow-wrap: anywhere; }
.nv-regional-tel { color: #8390a2; font-size: .7rem; margin-top: 1px; }
.nv-regional-on { color: #15803d; font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.nv-regional-off { color: #b91c1c; font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.nv-regional-form { margin: 0; }
.nv-regional-btn {
  border: 1px solid #e2e6ed; background: #fff; color: #64748b; border-radius: 6px;
  width: 20px; height: 20px; line-height: 1; font-size: .68rem; cursor: pointer; padding: 0;
}
.nv-regional-btn:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
@media (max-width: 575.98px) {
  .nv-regional-paises { grid-template-columns: 1fr; }
}

/* ── Regional · captura diaria y ganadores ──────────────────────────────── */
.nv-captura-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.nv-captura-pais { border: 1px solid #e6e9ef; border-radius: 9px; padding: 10px 11px; background: #fbfcfe; }
.nv-captura-head { font-size: .78rem; font-weight: 700; color: #1f2937; margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .5px; }
.nv-captura-fila { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .8rem;
  color: #334155; font-weight: 500; }
.nv-captura-fila > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.nv-captura-fila input { width: 108px; flex: 0 0 auto; text-align: right; }
.nv-tabs { gap: 6px; flex-wrap: wrap; }
.nv-tabs .nav-link { border-radius: 30px; font-size: .8rem; font-weight: 600; color: #475569;
  background: #f1f5f9; padding: 5px 14px; border: 0; }
.nv-tabs .nav-link.active { background: #1f2937; color: #fff; }
.nv-ganadores { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.nv-ganadores li { display: flex; align-items: center; gap: 9px; font-size: .85rem;
  background: #fbfcfe; border: 1px solid #e6e9ef; border-radius: 8px; padding: 8px 11px; }
.nv-ganadores li span { font-size: 1rem; }
.nv-ganadores li strong { color: #1f2937; }
.nv-ganadores li em { color: #94a3b8; font-style: normal; font-size: .75rem; flex: 1 1 auto; }
.nv-ganadores li b { color: #0f172a; }
@media (max-width: 575.98px) {
  .nv-captura-grid { grid-template-columns: 1fr; }
  .nv-captura-fila input { width: 96px; }
}

/* ── Regional · estado del reto y resultado final ───────────────────────── */
.nv-estado {
  font-size: .7rem; font-weight: 700; letter-spacing: .3px; border-radius: 30px; padding: 4px 12px;
  white-space: nowrap;
}
.nv-estado-abierto { background: rgba(34, 197, 94, .16); color: #86efac; border: 1px solid rgba(34, 197, 94, .4); }
.nv-estado-cerrado { background: rgba(251, 191, 36, .18); color: #fcd34d; border: 1px solid rgba(251, 191, 36, .45); }

.nv-final {
  border-radius: 14px; padding: 18px 20px 16px; color: #f8fafc;
  background: linear-gradient(135deg, #7c2d12 0%, #b45309 55%, #78350f 100%);
  box-shadow: 0 12px 28px rgba(120, 53, 15, .22);
}
.nv-final-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.nv-final-icon { font-size: 1.7rem; line-height: 1; }
.nv-final-kicker {
  display: block; font-size: .66rem; letter-spacing: 2px; text-transform: uppercase;
  font-weight: 700; color: #fde68a;
}
.nv-final-title { margin: 2px 0 0; font-size: 1.2rem; font-weight: 700; color: #fff; }
.nv-final-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nv-final-card {
  background: rgba(0, 0, 0, .22); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px; padding: 13px 15px; display: flex; flex-direction: column; gap: 3px;
}
.nv-final-etq { font-size: .72rem; color: #fde68a; font-weight: 700; letter-spacing: .4px; }
.nv-final-nombre { font-size: 1.15rem; color: #fff; line-height: 1.25; }
.nv-final-detalle { font-size: .8rem; color: #f3e0c7; }
.nv-final-nota { margin-top: 12px; font-size: .76rem; color: #f6e6d0; line-height: 1.5; }
@media (max-width: 575.98px) {
  .nv-final-grid { grid-template-columns: 1fr; }
  .nv-final { padding: 15px 15px 14px; }
  .nv-final-nombre { font-size: 1.05rem; }
  .nv-estado { font-size: .64rem; padding: 3px 9px; }
}

/* ── Regional · El Salvador automático (vendedoras del sistema) ─────────── */
.nv-regional-sistema {
  margin: -2px 0 6px; font-size: .66rem; text-transform: uppercase; letter-spacing: .5px;
  color: #0f5132; font-weight: 700;
}
.nv-regional-sis {
  background: #e7f5ec; color: #146c43; border: 1px solid #badbcc; border-radius: 20px;
  font-size: .6rem; font-weight: 700; text-transform: uppercase; padding: 1px 7px;
}
.nv-captura-sistema { background: #f4faf6; border-color: #cfe7d8; }
.nv-captura-sistema .nv-captura-head { color: #146c43; }
.nv-captura-fija { justify-content: space-between; }
.nv-captura-fija b { font-size: .8rem; color: #146c43; font-variant-numeric: tabular-nums; }
.nv-captura-total {
  margin-top: 8px; padding-top: 7px; border-top: 1px dashed #cfe7d8; font-size: .76rem;
  font-weight: 700; color: #146c43; display: flex; justify-content: space-between;
}
.nv-captura-nota { margin: 8px 0 0; font-size: .66rem; color: #6b7280; line-height: 1.4; }

.nv-estado-lectura { background: #eef2f7; color: #475569; border: 1px solid #d6dde7; }
.nv-estado-lectura { font-size: .7rem; font-weight: 700; border-radius: 30px; padding: 4px 12px; }

/* ── Regional · banderas dibujadas y color por país ──────────────────────── */
.nv-flag { border-radius: 2px; display: block; flex: 0 0 auto; }
.nv-top5-pos {
  width: 1.05rem; text-align: center; font-size: .78rem; font-weight: 700; color: #94a3b8;
  flex: 0 0 auto; font-variant-numeric: tabular-nums;
}
.nv-top5-primera .nv-top5-pos { color: #fbbf24; font-size: .92rem; }
.nv-top5-bandera { display: flex; align-items: center; flex: 0 0 auto; }
.nv-pais-bandera { display: flex; align-items: center; flex: 0 0 auto; }
.nv-pais-card { border-top: 3px solid var(--pc, #cbd5e1); }
.nv-pais-card .nv-pais-total { color: var(--pc, #0f172a); }
.nv-pais-lider { box-shadow: inset 0 0 0 1.5px var(--pc, #cbd5e1); background: #f8fbff; }
.nv-pais-card .nv-pais-nombre { font-weight: 700; }
@media (max-width: 575.98px) {
  .nv-flag { width: 20px; height: 13.6px; }
}

/* ── Regional · tarjetas de país con fecha propia ───────────────────────── */
.nv-captura-fecha { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.nv-captura-fecha input { width: 132px; }
.nv-captura-pais { border-top: 3px solid var(--pc, #e6e9ef); }
.nv-captura-head { color: var(--pc, #1f2937); }
.nv-captura-head .nv-flag { margin-right: 2px; }
.nv-captura-sistema { border-top-color: #16a34a; }
.nv-captura-sistema .nv-captura-head { color: #146c43; }
@media (max-width: 575.98px) {
  .nv-captura-fecha input { width: 100%; }
}