
/* PROVA GEMBA QUALITY V1.0 */
/* Diseño adaptable a laptop y celular */

:root {
  --azul: #142b49;
  --azul-claro: #244a76;
  --fondo: #f3f6fa;
  --blanco: #ffffff;
  --texto: #263548;
  --gris: #718096;
  --borde: #e1e7ef;
  --verde: #16845b;
  --rojo: #d64545;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
}

/* ENCABEZADO */

.header {
  background: var(--azul);
  color: white;
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 23px;
  letter-spacing: 0.5px;
}

.brand h1 span {
  color: #83b8e8;
  font-weight: 400;
}

.brand p {
  margin: 5px 0 0;
  font-size: 12px;
  color: #c4d3e4;
}

.warehouse {
  background: rgba(255,255,255,0.12);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

/* ESTRUCTURA */

.layout {
  display: flex;
  min-height: calc(100vh - 80px);
}

.sidebar {
  width: 245px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid var(--borde);
  padding: 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar button {
  border: none;
  background: transparent;
  color: var(--texto);
  text-align: left;
  padding: 14px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.sidebar button:hover,
.sidebar button.selected {
  background: #e8f0fa;
  color: var(--azul);
}

.content {
  flex: 1;
  min-width: 0;
  padding: 30px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

h2 {
  margin: 0 0 24px;
  font-size: 24px;
  color: var(--azul);
}

/* INDICADORES */

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.card {
  background: white;
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--borde);
  box-shadow: 0 3px 12px rgba(0,0,0,0.035);
}

.card h3 {
  margin: 0 0 16px;
  color: var(--gris);
  font-size: 13px;
  font-weight: 500;
}

.card strong {
  display: block;
  font-size: 34px;
  color: var(--azul);
}

/* FORMULARIOS */

form {
  max-width: 760px;
  background: white;
  padding: 26px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccd5e1;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: white;
  color: var(--texto);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #a9c9ed;
  border-color: var(--azul-claro);
}

.primary {
  margin-top: 15px;
  background: var(--azul);
  color: white;
  padding: 14px 18px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.primary:hover {
  background: var(--azul-claro);
}

#listaHallazgos {
  margin-top: 24px;
}

/* TABLET */

@media (max-width: 1000px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    width: 205px;
  }

  .content {
    padding: 22px;
  }
}

/* CELULAR */

@media (max-width: 650px) {
  .header {
    padding: 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .brand h1 {
    font-size: 20px;
  }

  .warehouse {
    font-size: 11px;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
    gap: 8px;
    border-right: none;
    border-bottom: 1px solid var(--borde);
  }

  .sidebar button {
    flex-shrink: 0;
    padding: 11px 13px;
    font-size: 12px;
    white-space: nowrap;
  }

  .content {
    padding: 18px 14px;
  }

  h2 {
    font-size: 20px;
  }

  .cards {
    gap: 10px;
  }

  .card {
    padding: 16px;
  }

  .card h3 {
    font-size: 12px;
    min-height: 30px;
  }

  .card strong {
    font-size: 28px;
  }

  form {
    padding: 17px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

/* PROVA GEMBA QUALITY V1.2 */

.subtitulo {
  margin-top: 32px;
  font-size: 19px;
}

.riesgo-bajo {
  border-left: 5px solid #16845b;
}

.riesgo-medio {
  border-left: 5px solid #d6a12b;
}

.riesgo-alto {
  border-left: 5px solid #e16b35;
}

.riesgo-critico {
  border-left: 5px solid #b42332;
}

.panel-filtros {
  background: #fff;
  padding: 22px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  margin-top: 28px;
}

.panel-filtros h3 {
  margin-top: 0;
  color: var(--azul);
}

.filtros-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.filtros-grid label {
  display: block;
  margin-bottom: 7px;
}

#limpiarFiltros {
  margin-top: 18px;
  padding: 11px 16px;
  border: 1px solid var(--borde);
  background: #f3f6fa;
  border-radius: 8px;
  cursor: pointer;
}

@media (max-width: 650px) {
  .filtros-grid {
    grid-template-columns: 1fr;
  }

  .panel-filtros {
    padding: 16px;
  }
}

/* ==========================================
   PROVA GEMBA QUALITY V1.4
   EXECUTIVE INTELLIGENCE
========================================== */

:root {
  --exec-navy: #092c47;
  --exec-blue: #1166a5;
  --exec-bg: #f2f6fb;
  --exec-green: #16845b;
  --exec-red: #d64545;
  --exec-amber: #e0a020;
}

body {
  background: var(--exec-bg);
}

.header {
  background: #ffffff;
  color: var(--exec-navy);
  border-bottom: 1px solid #dce5ef;
}

.brand h1 {
  color: var(--exec-navy);
}

.brand h1 span {
  color: var(--exec-blue);
}

.brand p {
  color: #64748b;
}

.warehouse {
  background: #eaf2fa;
  color: var(--exec-navy);
}

.sidebar {
  background: linear-gradient(180deg, #073553, #082740);
  border-right: none;
}

.sidebar button {
  color: #dcebf5;
  font-weight: 500;
}

.sidebar button:hover,
.sidebar button.selected {
  background: #176b9d;
  color: white;
}

.content {
  padding: 25px;
}

.exec-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 22px;
}

.exec-heading h2 {
  margin: 0 0 5px;
  font-size: 27px;
}

.exec-heading p {
  margin: 0;
  color: #718096;
  font-size: 13px;
}

.exec-tag {
  background: #e4eff9;
  color: #155d91;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
}

.exec-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  background: white;
  border: 1px solid #dce5ef;
  padding: 18px;
  border-radius: 13px;
  margin-bottom: 20px;
}

.exec-filters label {
  display: block;
  margin: 0 0 7px;
}

.exec-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 15px;
}

.exec-kpi {
  min-width: 0;
  background: white;
  border: 1px solid #dce5ef;
  border-top: 4px solid var(--exec-blue);
  border-radius: 12px;
  padding: 19px 15px;
  box-shadow: 0 3px 10px rgba(0,0,0,.035);
}

.exec-kpi.green { border-top-color: var(--exec-green); }
.exec-kpi.red { border-top-color: var(--exec-red); }
.exec-kpi.amber { border-top-color: var(--exec-amber); }
.exec-kpi.blue { border-top-color: var(--exec-blue); }

.exec-kpi-label {
  font-size: 12px;
  color: #52657a;
  font-weight: 650;
  min-height: 32px;
}

.exec-kpi strong {
  display: block;
  font-size: clamp(24px, 2.5vw, 35px);
  color: var(--exec-navy);
  margin: 9px 0;
}

.exec-kpi.red strong { color: var(--exec-red); }
.exec-kpi.green strong { color: var(--exec-green); }

.exec-kpi small {
  display: block;
  color: #8290a0;
  font-size: 11px;
  line-height: 1.4;
}

.exec-mini-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.exec-mini-kpis div {
  background: white;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 12px;
  color: #52657a;
}

.exec-mini-kpis b {
  color: var(--exec-navy);
  margin-left: 6px;
}

.exec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.exec-panel {
  min-width: 0;
  background: white;
  border: 1px solid #dce5ef;
  border-radius: 13px;
  padding: 20px;
  box-shadow: 0 3px 12px rgba(0,0,0,.035);
}

.exec-panel-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.exec-panel-title h3 {
  margin: 0;
  font-size: 15px;
  color: var(--exec-navy);
}

.exec-panel-title span {
  color: #8290a0;
  font-size: 11px;
  text-align: right;
}

.exec-chart {
  min-height: 190px;
}

.exec-bar-row {
  display: grid;
  grid-template-columns: 115px minmax(0,1fr) 35px;
  gap: 10px;
  align-items: center;
  margin: 13px 0;
}

.exec-bar-label {
  font-size: 12px;
  color: #52657a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exec-bar-track {
  background: #e9eff5;
  border-radius: 8px;
  height: 13px;
  overflow: hidden;
}

.exec-bar-fill {
  height: 100%;
  background: #1678b8;
  border-radius: 8px;
}

.exec-bar-value {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.exec-month-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 10px;
  height: 190px;
  padding-top: 20px;
}

.exec-month {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 7px;
}

.exec-month-bar {
  width: 65%;
  max-width: 45px;
  min-height: 3px;
  background: linear-gradient(180deg,#2496d0,#1166a5);
  border-radius: 5px 5px 0 0;
}

.exec-month-label,
.exec-month-value {
  font-size: 11px;
  color: #64748b;
}

.exec-alert {
  padding: 12px;
  border-left: 4px solid #d64545;
  background: #fff5f5;
  border-radius: 6px;
  margin-bottom: 10px;
}

.exec-alert.warning {
  background: #fffaf0;
  border-left-color: #e0a020;
}

.exec-alert strong {
  display: block;
  font-size: 12px;
  color: #263548;
}

.exec-alert small {
  display: block;
  color: #718096;
  margin-top: 5px;
  line-height: 1.5;
}

.exec-empty {
  color: #8290a0;
  font-size: 13px;
  padding: 18px 0;
}

.exec-table-wrap {
  overflow-x: auto;
}

.exec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.exec-table th {
  background: #eaf1f8;
  color: #34506a;
  text-align: left;
  padding: 12px 9px;
}

.exec-table td {
  padding: 13px 9px;
  border-bottom: 1px solid #e8edf3;
}

@media (max-width: 1200px) {
  .exec-kpis {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
}

@media (max-width: 900px) {
  .exec-grid,
  .exec-filters {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 650px) {
  .content {
    padding: 15px;
  }

  .exec-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .exec-heading h2 {
    font-size: 22px;
  }

  .exec-filters,
  .exec-grid {
    grid-template-columns: 1fr;
  }

  .exec-kpis {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .exec-kpi {
    padding: 14px;
  }

  .exec-kpi strong {
    font-size: 27px;
  }

  .exec-panel {
    padding: 15px;
  }

  .exec-bar-row {
    grid-template-columns: 90px minmax(0,1fr) 30px;
    gap: 6px;
  }
}

/* BOTONES DE CONSULTA GERENCIAL */

.exec-detail-button {
  background: #1166a5;
  color: white;
  border: none;
  padding: 9px 13px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.exec-detail-button:hover {
  background: #084c80;
}

#detalleHallazgo p {
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px solid #e8edf3;
  line-height: 1.6;
}

#detalleHallazgo strong {
  color: #092c47;
}

/* HISTORIAL GERENCIAL SIMPLIFICADO */

.historial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.historial-header h3 {
  margin: 0;
  color: #092c47;
}

.historial-header input {
  width: 340px;
  max-width: 100%;
}

@media (max-width: 650px) {
  .historial-header {
    flex-direction: column;
    align-items: stretch;
  }

  .historial-header input {
    width: 100%;
  }
}

/* VISUALIZACIÓN DE EVIDENCIAS */

.evidencia-imagen {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 650px;
  object-fit: contain;
  margin: 20px auto;
  border-radius: 10px;
  border: 1px solid #e1e7ef;
}

#detalleHallazgo {
  text-align: left;
}

/* DESCRIPCIÓN EN HISTORIAL DE HALLAZGOS */

#tablaPendientes td:nth-child(4) {
  min-width: 240px;
  max-width: 340px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

#tablaPendientes td {
  vertical-align: middle;
}

.exec-table-wrap {
  overflow-x: auto;
}

/* ==========================================
   SEMÁFORO DE ESTADOS
   PROVA GEMBA QUALITY
========================================== */

.estado-badge {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  min-width: 85px;
  text-align: center;
}

/* ABIERTO - AZUL */
.estado-abierto {
  background: #e5f1fb;
  color: #1166a5;
  border: 1px solid #b9d8f0;
}

/* VENCIDO - ROJO */
.estado-vencido {
  background: #fde8e8;
  color: #c62828;
  border: 1px solid #f5b7b7;
}

/* CERRADO - VERDE */
.estado-cerrado {
  background: #e4f6ed;
  color: #16845b;
  border: 1px solid #a9dfc3;
}

/* COLORES DE INDICADORES SUPERIORES */

#porAtender {
  color: #1166a5;
}

#enProceso {
  color: #d64545;
}

#porValidar {
  color: #16845b;
}

/* BOTÓN CIERRE DE HALLAZGOS */

.exec-close-button {
  background: #16845b;
  color: #ffffff;
  border: none;
  border-radius: 7px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 8px;
  margin-top: 5px;
  transition: background 0.2s;
}

.exec-close-button:hover {
  background: #116b49;
}

.exec-close-button:disabled {
  background: #aab4bf;
  cursor: not-allowed;
}

/* GESTIÓN DE CALIDAD - PESTAÑAS */

.calidad-tabs {
  display: flex;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.calidad-tab {
  padding: 13px 22px;
  border: 1px solid #d7e1ed;
  border-radius: 8px;
  background: #ffffff;
  color: #163c5c;
  font-weight: 700;
  cursor: pointer;
}

.calidad-tab.activo {
  background: #1166a5;
  color: #ffffff;
  border-color: #1166a5;
}

/* BUSCADOR DE FOLIOS */

.cierre-buscador {
  display: flex;
  gap: 12px;
  margin: 22px 0;
  flex-wrap: wrap;
}

.cierre-buscador input {
  flex: 1;
  min-width: 230px;
}

/* EVIDENCIAS DE CIERRE */

#resultadoBusquedaCierre {
  margin: 20px 0;
}

#formCierreHallazgo {
  margin-top: 22px;
}

#vistaPreviaCierre {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}

#vistaPreviaCierre img {
  width: 180px;
  height: 150px;
  object-fit: contain;
  border: 1px solid #d7e1ed;
  border-radius: 8px;
  background: #f5f8fc;
}

#confirmarCierre:disabled {
  background: #aab4bf;
  cursor: not-allowed;
}
