* {
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #1d2a35;
}

.page {
  max-width: 100%;
  margin: 0;
  padding: 24px 32px;
}

.header {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

h1 {
  margin: 0 0 6px 0;
  font-size: 24px;
}

.subtitle {
  margin: 0;
  color: #5b6b7b;
  font-size: 14px;
}

.range {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
  min-width: 320px;
}

.range-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.range-buttons button,
.range-custom button {
  background: #f0f3f7;
  border: 1px solid #d9e1ea;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.ti-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1f6feb;
  color: #fff;
  border: 1px solid #1f6feb;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
}

.range-buttons button.active {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
}

.range-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.range-custom input {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d9e1ea;
}

.range-label {
  margin-top: 8px;
  font-size: 12px;
  color: #5b6b7b;
}

.range-mode {
  margin-top: 4px;
  font-size: 12px;
  color: #1f6feb;
}

.range-note {
  margin-top: 4px;
  font-size: 12px;
  color: #8a4b00;
}

form.range-buttons,
form.range-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.kpis-exec {
  margin-top: 16px;
}

.kpis-section-title {
  margin: 20px 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: #5b6b7b;
}

.audit-row--critical {
  background: #fde7e7 !important;
}

.audit-row--warn {
  background: #fff4e5 !important;
}

.audit-row--low {
  background: #f0f6ff !important;
}

.cell-motivo {
  white-space: normal;
  max-width: 280px;
}

.severity-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.severity-pill.severity-high {
  background: #fde7e7;
  color: #b42318;
}

.severity-pill.severity-medium {
  background: #fff4e5;
  color: #8a4b00;
}

.severity-pill.severity-low {
  background: #eef4fc;
  color: #1f4f8f;
}

.severity-pill.severity-none {
  background: #f0f3f7;
  color: #6b7c8c;
}

.kpis,
.risk {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}

.kpi-link {
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.kpi-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.label {
  font-size: 12px;
  color: #6b7c8c;
  display: flex;
  align-items: center;
  gap: 6px;
}

.value {
  font-size: 20px;
  font-weight: 600;
  margin-top: 6px;
}

.meta {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7c8c;
}

.grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}

/* Contenedor estándar para charts */
.chart-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chart-header {
  padding-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-body {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 260px;
}

/* Alturas por tipo de gráfica */
.chart-wrap {
  height: 280px; /* línea / barra simple */
}

.chart-wrap-large {
  height: 320px; /* valor por defecto, se puede sobreescribir por JS */
}

.chart-wrap canvas,
.chart-wrap-large canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.panel.full {
  grid-column: 1 / -1;
}

.panel.wide {
  grid-column: span 2;
}

.panel h2 {
  margin: 0 0 12px 0;
  font-size: 16px;
}

#chartEstatus {
  max-height: 320px;
}

.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e8eef5;
  color: #1d2a35;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  border: 1px solid #d9e1ea;
  padding: 0;
  position: relative;
}

.tabs {
  margin-top: 24px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}

.tabs-header {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tab-btn {
  background: #f0f3f7;
  border: 1px solid #d9e1ea;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.tab-btn.active {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-note {
  margin: 8px 0 0 0;
  font-size: 12px;
  color: #6b7c8c;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 10px 8px;
  border-bottom: 1px solid #eef2f6;
  text-align: left;
  white-space: nowrap;
}

.table thead th {
  font-weight: 600;
  color: #5b6b7b;
  background: #f9fbfd;
}

.cell-warn {
  background: #fff4e5;
  color: #8a4b00;
  font-weight: 600;
}

.status-cancelada {
  color: #b42318;
  background: #fde7e7;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 6px;
  display: inline-block;
}

.row-cancelada {
  background: #fde7e7;
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.filter-label {
  font-size: 12px;
  color: #5b6b7b;
}

.filter-select {
  padding: 6px 10px;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #fff;
}

.help::after {
  content: attr(data-help-text);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #1d2a35;
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.3;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.help::before {
  content: "";
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #1d2a35 transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.help:hover::after,
.help:focus::after,
.help:hover::before,
.help:focus::before {
  opacity: 1;
}
