/* =========================================
   PANEL DASHBOARD · BASE
========================================= */
.glass-card {
  border: 1px solid #dfe7f7;
  background: #ffffff;
  border-radius: 22px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.panel-pill {
  border-radius: 999px;
  border: 1px solid #d8c9cc;
  background: #fff1f2;
  padding: 8px 14px;
  color: #b42338;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.panel-card {
  grid-column: span 6;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-card-wide { grid-column: span 12; }
.panel-summary-card { order: -2; min-height: auto; }

.panel-card-head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid #e6ecfa;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.panel-card-head h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #223863;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-card-body {
  padding: 12px;
  flex: 1;
}

.panel-spinner-wrap {
  min-height: 150px;
  display: grid;
  place-items: center;
}

.panel-spinner {
  width: 52px;
  height: 52px;
  animation: spin .9s linear infinite;
}

/* =========================================
   KPIS
========================================= */
.panel-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.panel-metric {
  border: 1px solid #e1e7f5;
  border-top-width: 4px;
  border-radius: 0 0 16px 16px;
  background: #fff;
  padding: 12px 12px 10px;
  min-width: 0;
}

.panel-metric strong {
  font-size: clamp(1.55rem, 2.7vw, 2.1rem);
  line-height: 1;
  display: block;
  font-weight: 900;
  font-family: 'Viga', 'Inter', sans-serif;
  letter-spacing: .02em;
}

.panel-metric span {
  margin-top: 7px;
  font-size: .84rem;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-weight: 700;
  color: #101828;
}

.panel-metric span i { color: #475467; }

.panel-metric-rne { border-top-color: #ef4444; }
.panel-metric-rnpa { border-top-color: #f59e0b; }
.panel-metric-transport { border-top-color: #10b981; }
.panel-metric-reports { border-top-color: #3b82f6; }
.panel-metric-rne strong { color:#cc3a3a; }
.panel-metric-rnpa strong { color:#cc6f00; }
.panel-metric-transport strong { color:#0f8d4a; }
.panel-metric-reports strong { color:#2b5fc4; }

/* =========================================
   LISTAS
========================================= */
.panel-marquee { max-height: 280px; overflow-y: auto; padding-right: 4px; }
.panel-marquee-track { display: grid; gap: 10px; }
.panel-marquee-track.is-animated { animation: panelTicker var(--panel-marquee-duration, 24s) linear infinite; }
.panel-marquee:hover .panel-marquee-track.is-animated { animation-play-state: paused; }
@keyframes panelTicker { 0% { transform: translateY(0); } 100% { transform: translateY(-50%); } }

.panel-list-card {
  border: 1px solid #d8e2f7;
  background: #ffffff;
  border-radius: 16px;
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.panel-avatar,
.panel-chart-avatar {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #d4def3;
  background: #edf2fd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5b45d6;
  font-weight: 800;
  flex-shrink: 0;
  position: relative;
}

.panel-chart-avatar { width: 42px; height: 42px; font-size: .9rem; }

.panel-avatar img,
.panel-chart-avatar img,
.panel-user-avatar .thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .2s ease;
}

.panel-avatar img.is-loaded,
.panel-chart-avatar img.is-loaded,
.panel-user-avatar .thumb-image.is-loaded { opacity: 1; }

.panel-avatar .panel-spinner,
.panel-chart-avatar .panel-spinner {
  width: 22px;
  height: 22px;
  position: absolute;
}

.panel-item-text strong { color: #2b3f6f; display: block; }
.panel-item-text small { color: #66779f; font-size: .76rem; }
.panel-status { margin-top: 3px; font-size: .76rem; font-weight: 700; }
.panel-status.is-danger { color: #c92a24; }
.panel-status.is-warning { color: #bf6f10; }

/* =========================================
   INFORME Y PRODUCCIÓN
========================================= */
.panel-report-age-chip {
  background: #eef4ff;
  border-color: #d4def6;
  color: #32549a;
}

.swal2-popup.panel-report-alert {
  border: 0 !important;
  box-shadow: none !important;
}

.panel-empty {
  min-height: 130px;
  border: 1px dashed #d2daef;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #6a7a9f;
  text-align: center;
  padding: 12px;
}

.panel-chart-wrap { display: grid; gap: 10px; }

.panel-chart-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 340px) 1fr auto;
  gap: 10px;
  align-items: center;
}

.panel-chart-rank {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #d8e3fa;
  background: #f4f7ff;
  color: #365087;
  font-size: .78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.panel-chart-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #344b7c;
  font-size: .96rem;
  font-weight: 700;
  min-width: 0;
}

.panel-chart-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-chart-bar {
  height: 12px;
  border-radius: 999px;
  background: #e8efff;
  overflow: hidden;
}

.panel-chart-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3f7eff, #53a7ff);
  transition: width .35s ease;
}

.panel-chart-value {
  font-size: .84rem;
  color: #37518c;
  font-weight: 800;
}

.panel-range-input { max-width: 260px; min-height: 40px; }

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 992px) {
  .panel-card,
  .panel-card-wide { grid-column: span 12; }

  #panelResumen .panel-card-body {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 14px;
  }

  .panel-kpi-row {
    display: flex;
    width: max-content;
    min-width: 100%;
  }

  .panel-metric {
    flex: 0 0 min(78vw, 260px);
  }

  .panel-chart-row {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "rank label"
      "bar bar"
      "value value";
  }

  .panel-chart-rank { grid-area: rank; }
  .panel-chart-label { grid-area: label; }
  .panel-chart-bar { grid-area: bar; }
  .panel-chart-value { grid-area: value; }
}
