/* Ventana de gráfico ampliado y su detalle. */

.chart-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(17, 24, 39, .48);
  backdrop-filter: blur(4px);
}

.chart-modal-overlay[hidden] { display: none; }

.chart-modal {
  width: min(1240px, 100%);
  max-height: min(88vh, 860px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .25);
  padding: 22px;
  animation: confirmIn .22s ease both;
}

.chart-modal-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 12px;
}

.chart-modal h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  color: var(--text);
}

.chart-modal p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.chart-modal-close {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  justify-content: center;
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: none;
  font-size: 22px;
  line-height: 1;
}

.chart-modal-close:hover {
  background: #a52f2f;
  border-color: #a52f2f;
  color: #fff;
  box-shadow: none;
  transform: none;
}

.chart-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  min-height: 0;
  align-items: stretch;
}

.chart-modal-body.no-details { grid-template-columns: minmax(0, 1fr); }

.chart-modal-canvas {
  position: relative;
  width: 100%;
  height: min(64vh, 620px);
  min-height: 430px;
  margin-top: 0;
}

.chart-modal-canvas canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.chart-modal-details {
  min-height: 0;
  max-height: min(64vh, 620px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
}

.chart-detail-kicker {
  margin: 0 0 10px;
  color: #475467;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.chart-detail-grid {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
}

.chart-detail-card {
  border: 1px solid #e5e7eb;
  border-left: 4px solid #94a3b8;
  border-radius: 10px;
  background: #fff;
  padding: 10px 11px;
}

.chart-detail-card.is-good { border-left-color: #16a34a; }
.chart-detail-card.is-bad { border-left-color: #dc2626; }

.chart-detail-label {
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.chart-detail-value {
  margin-top: 3px;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}

.chart-detail-card.is-good .chart-detail-value { color: #15803d; }
.chart-detail-card.is-bad .chart-detail-value { color: #b91c1c; }

.chart-detail-meta {
  margin-top: 4px;
  color: #667085;
  font-size: 11px;
  line-height: 1.3;
}

.chart-detail-table-wrap {
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.chart-detail-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 12px;
}

.chart-detail-table th,
.chart-detail-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #edf0f3;
  text-align: right;
  white-space: nowrap;
}

.chart-detail-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  color: #475467;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.chart-detail-table th:first-child,
.chart-detail-table td:first-child {
  text-align: left;
}

.chart-detail-table tr:last-child td { border-bottom: 0; }

.chart-detail-note {
  margin: 10px 0 0;
  color: #667085;
  font-size: 11px;
  line-height: 1.4;
}
