body {
      margin: 0;
      font-family: Arial, sans-serif;
      background: #0f172a;
      color: #e5e7eb;
    }

    header {
      padding: 18px 28px;
      background: #020617;
      border-bottom: 1px solid #1e293b;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 20px;
    }

    header h1 {
      margin: 0;
      font-size: 24px;
    }

    header p {
      margin: 5px 0 0;
      color: #94a3b8;
      font-size: 13px;
    }

    .estado {
      text-align: right;
      color: #94a3b8;
      font-size: 13px;
    }

    .container {
      padding: 22px;
    }

    .section-title {
      font-size: 20px;
      margin: 28px 0 14px;
      color: #f8fafc;
    }

    .cards {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
      gap: 16px;
      margin-bottom: 20px;
    }

    .card {
      background: #1e293b;
      padding: 18px;
      border-radius: 14px;
      box-shadow: 0 10px 20px rgba(0,0,0,0.25);
    }

    .card-title {
      color: #94a3b8;
      font-size: 13px;
      margin-bottom: 8px;
    }

    .card-value {
      font-size: 26px;
      font-weight: bold;
    }

    .alerta {
      color: #fbbf24;
      font-weight: bold;
    }

    .positivo {
      color: #86efac;
      font-weight: bold;
    }

    .grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 18px;
      margin-bottom: 18px;
    }

    .panel {
      background: #1e293b;
      border-radius: 14px;
      padding: 18px;
      box-shadow: 0 10px 20px rgba(0,0,0,0.25);
    }

    .panel h2 {
      margin-top: 0;
      font-size: 17px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
    }

    th, td {
      padding: 9px;
      border-bottom: 1px solid #334155;
      text-align: left;
      vertical-align: top;
    }

    th {
      color: #94a3b8;
      font-weight: normal;
    }

    canvas {
      max-height: 330px;
    }
.vendedores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.vendedor-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}

.vendedor-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.vendedor-name {
  font-size: 17px;
  font-weight: bold;
}

.vendedor-sub {
  color: #94a3b8;
  font-size: 13px;
  margin-top: 4px;
}

.rank {
  background: #334155;
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: bold;
  white-space: nowrap;
}

.tendencia-up {
  color: #86efac;
  font-weight: bold;
}

.tendencia-down {
  color: #fca5a5;
  font-weight: bold;
}

.tendencia-neutral {
  color: #e5e7eb;
  font-weight: bold;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.mini-kpi {
  background: #0f172a;
  border-radius: 10px;
  padding: 10px;
}

.mini-kpi-title {
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 5px;
}

.mini-kpi-value {
  font-size: 18px;
  font-weight: bold;
}

    .badge {
      display: inline-block;
      padding: 3px 8px;
      border-radius: 999px;
      font-size: 11px;
      background: #334155;
      color: #e5e7eb;
    }

    @media (max-width: 900px) {
      .grid {
        grid-template-columns: 1fr;
      }

      header {
        display: block;
      }

      .estado {
        text-align: left;
        margin-top: 10px;
      }
    }


/* Glosario de indicadores */
.glosario-indicadores {
  margin-top: 28px;
  margin-bottom: 28px;
  opacity: 0.95;
}

.glosario-indicadores h2 {
  margin-bottom: 14px;
}

.glosario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px 18px;
  font-size: 13px;
  line-height: 1.35;
}

.glosario-grid div {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.glosario-grid strong {
  font-weight: 700;
}


.mini-kpi-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mini-kpi-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.modal-clientes {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.62);
}

.modal-clientes.oculto {
  display: none;
}

.modal-clientes-contenido {
  width: min(760px, 96vw);
  max-height: 86vh;
  overflow: hidden;
  border-radius: 18px;
  padding: 20px;
  background: #111827;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.modal-clientes-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.modal-clientes-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-clientes-resumen {
  margin-top: 5px;
  opacity: 0.75;
  font-size: 13px;
}

.modal-clientes-cerrar {
  border: 0;
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
}

.modal-clientes-lista {
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.modal-cliente-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.modal-cliente-numero {
  opacity: 0.7;
  font-size: 13px;
}

.modal-cliente-nombre {
  font-weight: 700;
}

.modal-cliente-rut {
  margin-top: 3px;
  opacity: 0.7;
  font-size: 12px;
}

.modal-cliente-vacio {
  padding: 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}


.modal-clientes-definicion {
  margin-top: 6px;
  max-width: 620px;
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.9;
}

.modal-clientes-total {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.75;
}


.origen-ventas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.origen-venta-card {
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.origen-venta-titulo {
  font-size: 13px;
  opacity: 0.75;
  margin-bottom: 8px;
}

.origen-venta-monto {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.origen-venta-detalle {
  font-size: 13px;
  opacity: 0.8;
}


.mini-kpi-origen-detalle {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  opacity: 0.72;
  font-weight: 500;
}

.mini-kpi-origen-detalle div + div {
  margin-top: 2px;
}


.card-origen-detalle {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.72;
  font-weight: 500;
}

.card-origen-detalle div + div {
  margin-top: 2px;
}


.top-clientes-origen {
  margin-top: 18px;
}

.top-clientes-titulo {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 800;
}

.top-clientes-tabla {
  display: grid;
  gap: 6px;
}

.top-clientes-row {
  display: grid;
  grid-template-columns: 34px minmax(220px, 1fr) 120px 80px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  font-size: 13px;
}

.top-clientes-header {
  background: rgba(255, 255, 255, 0.10);
  font-weight: 800;
  opacity: 0.9;
}

.top-cliente-nombre {
  font-weight: 700;
}

.top-cliente-rut {
  margin-top: 2px;
  font-size: 11px;
  opacity: 0.65;
}

.top-clientes-vacio {
  padding: 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  font-size: 13px;
  opacity: 0.75;
}

@media (max-width: 700px) {
  .top-clientes-row {
    grid-template-columns: 28px minmax(140px, 1fr);
  }

  .top-clientes-row > div:nth-child(3),
  .top-clientes-row > div:nth-child(4) {
    grid-column: 2;
  }
}

.card-clickable {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.card-clickable:hover {
  transform: translateY(-2px);
}

.card-clickable:focus {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 3px;
}

.modal-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.modal-tab-button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
}

.modal-tab-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.modal-tab-button.activo {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
}

.comparativo-header {
  flex: 1;
  text-align: center;
  color: #f8fafc;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .comparativo-header {
    text-align: left;
    margin-top: 10px;
    font-size: 16px;
    white-space: normal;
  }
}

.section-subtitle {
  margin-top: -8px;
  margin-bottom: 14px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.35;
}

/* Modal Clientes inactivos - versión compacta y ordenada */
.modal-clientes-wide .modal-clientes-contenido {
  width: min(1120px, 96vw);
}

.modal-clientes-wide .modal-clientes-resumen {
  opacity: 1;
}

.resumen-inactivos-compacto {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  line-height: 1.4;
}

.resumen-inactivos-principal {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.resumen-inactivos-principal span {
  color: #cbd5e1;
}

.resumen-inactivos-principal strong {
  font-size: 22px;
  color: #f8fafc;
}

.resumen-inactivos-detalle {
  margin-top: 4px;
  color: #cbd5e1;
}

.tabs-inactivos {
  margin-top: 8px;
}

.definicion-inactivos {
  max-width: 940px;
  margin-bottom: 8px;
}

.inactivos-tabla-scroll {
  overflow-x: auto;
  padding-bottom: 2px;
}

.clientes-inactivos-row {
  min-width: 900px;
}

.clientes-inactivos-row-5 {
  grid-template-columns: 40px minmax(280px, 1fr) 150px 150px minmax(150px, 0.7fr);
}

.clientes-inactivos-row-4 {
  grid-template-columns: 40px minmax(340px, 1fr) 160px minmax(170px, 0.7fr);
}

.clientes-inactivos-row-4-rut {
  grid-template-columns: 40px minmax(340px, 1fr) 150px minmax(170px, 0.7fr);
}

.monto-cell {
  text-align: right;
}

@media (max-width: 700px) {
  .modal-clientes-wide .modal-clientes-contenido {
    width: 96vw;
  }

  .clientes-inactivos-row {
    min-width: 860px;
  }
}
/* VISTA ESPEJO VENDEDOR DESDE GERENCIA 2026-07-20 */
[hidden] {
  display: none !important;
}

.section-title-row-vendedores {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 28px;
  margin-bottom: 14px;
}

.section-title-row-vendedores .section-title {
  margin: 0;
}

.boton-vista-vendedor-gerencia,
.boton-volver-gerencia,
.boton-secundario-vista-vendedor {
  border-radius: 9px;
  padding: 9px 14px;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.boton-vista-vendedor-gerencia {
  border: 1px solid #0284c7;
  background: #0284c7;
}

.boton-vista-vendedor-gerencia:hover {
  background: #0369a1;
}

.boton-volver-gerencia {
  border: 1px solid #475569;
  background: #334155;
}

.boton-volver-gerencia:hover,
.boton-secundario-vista-vendedor:hover {
  background: #475569;
}

.boton-secundario-vista-vendedor {
  border: 1px solid #475569;
  background: #1e293b;
}

body.modo-vista-vendedor-gerencia > #encabezadoDashboardGerencia,
body.modo-vista-vendedor-gerencia > #contenidoDashboardGerencia,
body.modo-vista-vendedor-gerencia > #glosarioIndicadores {
  display: none !important;
}

.vista-espejo-vendedor-gerencia {
  min-height: 100vh;
}

.encabezado-vista-espejo-vendedor {
  display: flex;
}

.botones-vista-vendedor-gerencia {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.tablero-vendedor-gerencia-individual {
  grid-template-columns: minmax(300px, 760px);
}

.selector-vendedor-gerencia {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 6, 23, 0.82);
}

.selector-vendedor-gerencia-panel {
  width: min(480px, 96vw);
  padding: 22px;
  border: 1px solid #334155;
  border-radius: 16px;
  background: #0f172a;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.selector-vendedor-gerencia-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.selector-vendedor-gerencia-header h2 {
  margin: 0;
  font-size: 21px;
}

.selector-vendedor-gerencia-header p {
  margin: 7px 0 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.45;
}

.selector-vendedor-gerencia-cerrar {
  border: 0;
  border-radius: 9px;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  font-size: 24px;
  cursor: pointer;
}

.selector-vendedor-gerencia-panel label {
  display: block;
  margin-bottom: 7px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 800;
}

.selector-vendedor-gerencia-panel select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #475569;
  border-radius: 10px;
  background: #020617;
  color: #f8fafc;
  font: inherit;
}

.mensaje-selector-vendedor-gerencia {
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid #7f1d1d;
  border-radius: 9px;
  background: rgba(127, 29, 29, 0.24);
  color: #fecaca;
  font-size: 13px;
}

.selector-vendedor-gerencia-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

body.selector-vendedor-gerencia-abierto {
  overflow: hidden;
}

@media (max-width: 900px) {
  .section-title-row-vendedores {
    align-items: flex-start;
    flex-direction: column;
  }

  .encabezado-vista-espejo-vendedor {
    display: block;
  }

  .acciones-vista-vendedor-gerencia {
    text-align: left;
  }

  .botones-vista-vendedor-gerencia {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* LOGIN GERENCIAL HIBRIDO ETAPA 1 2026-07-20 */
.acceso-gerencia-pantalla {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at top,
      #1e3a5f 0,
      #0f172a 42%,
      #020617 100%
    );
}

.acceso-gerencia-panel {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid #334155;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.97);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.acceso-gerencia-cargando {
  text-align: center;
}

.acceso-gerencia-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 18px;
  border: 4px solid rgba(148, 163, 184, 0.28);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: acceso-gerencia-girar 0.8s linear infinite;
}

@keyframes acceso-gerencia-girar {
  to {
    transform: rotate(360deg);
  }
}

.acceso-gerencia-marca {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  background: #e5e7eb;
  color: #0f172a;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.acceso-gerencia-panel h1 {
  margin: 22px 0 8px;
  color: #f8fafc;
  font-size: 25px;
}

.acceso-gerencia-subtitulo {
  margin: 0 0 24px;
  color: #94a3b8;
  line-height: 1.5;
}

.acceso-gerencia-panel label {
  display: block;
  margin: 14px 0 7px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
}

.acceso-gerencia-panel input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #475569;
  border-radius: 10px;
  background: #020617;
  color: #f8fafc;
  font: inherit;
  outline: none;
}

.acceso-gerencia-panel input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.acceso-gerencia-boton {
  width: 100%;
  margin-top: 20px;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: #0284c7;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.acceso-gerencia-boton:hover {
  background: #0369a1;
}

.acceso-gerencia-boton:disabled {
  cursor: wait;
  opacity: 0.65;
}

.acceso-gerencia-mensaje {
  margin: 0 0 18px;
  padding: 11px 12px;
  border: 1px solid #7f1d1d;
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.45;
}

.usuario-sesion-gerencia {
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 12px;
}

.boton-cerrar-sesion-gerencia {
  margin-top: 10px;
  padding: 8px 13px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #1e293b;
  color: #f8fafc;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.boton-cerrar-sesion-gerencia:hover {
  background: #334155;
}

