/* ==========================================================================
   Panel principal
   KPIs, graficos, filtros, leyendas y tablas modernas
   ========================================================================== */

:root {
  --jc-bg: #f4f7fb;
  --jc-surface: #ffffff;
  --jc-surface-soft: #fbfdff;
  --jc-line: #e9edf3;
  --jc-line-soft: #eef2f7;
  --jc-title: #111827;
  --jc-text: #334155;
  --jc-muted: #64748b;
  --jc-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  --jc-shadow-hover: 0 14px 30px rgba(15, 23, 42, 0.10);
  --jc-radius: 8px;
  --jc-blue: #2563eb;
  --jc-blue-soft: #eff6ff;
  --jc-blue-hover: #dbeafe;
  --jc-green: #16a34a;
  --jc-green-soft: #f0fdf4;
  --jc-red: #dc2626;
  --jc-red-soft: #fef2f2;
  --jc-teal: #0f766e;
  --jc-teal-soft: #ecfdf5;
  --jc-orange: #ea580c;
  --jc-orange-soft: #fff7ed;
  --jc-purple: #7c3aed;
  --jc-purple-soft: #f5f3ff;
}

/* ==========================
   KPIs
   ========================== */

.kpi-row {
  margin-bottom: 5px;
}

.kpi-card {
  min-height: 138px;
  background: var(--jc-surface);
  border: 1px solid var(--jc-line);
  border-radius: var(--jc-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: var(--jc-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: #d7dee9;
  box-shadow: var(--jc-shadow-hover);
}

.kpi-info {
  min-width: 0;
  padding-right: 12px;
}

.kpi-label {
  display: block;
  margin-bottom: 8px;
  color: var(--jc-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kpi-info h3 {
  margin: 0;
  color: var(--jc-title);
  font-size: 36px;
  font-weight: 800;
  line-height: 1.05;
  word-break: break-word;
}

.kpi-info small {
  display: block;
  margin-top: 8px;
  color: #6b7280;
  font-size: 13px;
}

.kpi-icon {
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.kpi-blue,
.jc-blue {
  color: var(--jc-blue);
  background: var(--jc-blue-soft);
}

.kpi-red {
  color: var(--jc-red);
  background: var(--jc-red-soft);
}

.kpi-green,
.jc-green {
  color: var(--jc-green);
  background: var(--jc-green-soft);
}

.kpi-teal,
.jc-teal {
  color: var(--jc-teal);
  background: var(--jc-teal-soft);
}

.kpi-orange {
  color: var(--jc-orange);
  background: var(--jc-orange-soft);
}

.jc-purple {
  color: var(--jc-purple);
  background: var(--jc-purple-soft);
}


.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.kpi-value-row h3 {
  margin: 0;
}

.kpi-offline {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1;
}

.kpi-offline-sep {
  color: var(--jc-line);
  font-size: 30px;
  font-weight: 300;
}

.kpi-offline-num {
  color: var(--jc-red);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-offline-text {
  color: var(--jc-red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.kpi-year {
  color: var(--jc-muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}


/* ==========================
   Paneles y graficos
   ========================== */

.dashboard-grid {
  margin-top: 5px;
}

.jc-panel-card {
  background: var(--jc-surface);
  border: 1px solid var(--jc-line);
  border-radius: var(--jc-radius);
  box-shadow: var(--jc-shadow);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.jc-panel-card:hover {
  border-color: #d7dee9;
  box-shadow: var(--jc-shadow-hover);
}

.jc-panel-header {
  background: transparent;
  border-bottom: 1px solid var(--jc-line);
  padding: 16px 20px;
}


.jc-panel-body {
  padding: 20px;
}

.jc-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.jc-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.jc-title-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.jc-title-icon.jc-blue {
  color: var(--jc-blue);
  background: var(--jc-blue-soft);
}

.jc-title-icon.jc-green {
  color: var(--jc-green);
  background: var(--jc-green-soft);
}

.jc-title-icon.jc-purple {
  color: #7c3aed;
  background: #efe9fe;
}

.jc-title-icon.jc-teal {
  color: #0d9488;
  background: #ccfbf1;
}


.jc-panel-header .card-title {
  color: var(--jc-title);
  font-size: 16px;
  font-weight: 700;
}

.jc-card-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--jc-muted);
  font-size: 12px;
  font-weight: 600;
}

.jc-filtros {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jc-select {
  height: 34px;
  border: 1px solid var(--jc-line);
  border-radius: 9px;
  background: #fff;
  color: var(--jc-title);
  font-size: 13px;
  font-weight: 600;
  padding: 0 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jc-select:focus {
  outline: none;
  border-color: var(--jc-blue);
  box-shadow: 0 0 0 3px var(--jc-blue-soft);
}

.jc-btn-reload {
  width: 34px;
  height: 34px;
  border: 1px solid var(--jc-line);
  border-radius: 9px;
  background: #fff;
  color: var(--jc-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.jc-btn-reload:hover {
  background: var(--jc-blue-soft);
  color: var(--jc-blue);
  border-color: var(--jc-blue);
}

.jc-btn-reload.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.jc-btn-reload.is-loading i {
  animation: jc-spin 0.8s linear infinite;
}

@keyframes jc-spin {
  to {
    transform: rotate(360deg);
  }
}

.jc-metric {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}

.jc-metric-value {
  color: var(--jc-title);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.jc-metric-label {
  color: var(--jc-muted);
  font-size: 13px;
  font-weight: 600;
}

.jc-chart-wrap {
  min-height: 200px;
}

.jc-chart-loading,
.jc-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--jc-muted);
  font-size: 14px;
  font-weight: 600;
}

.jc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.jc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--jc-line);
  border-radius: 999px;
  background: #fafbfc;
  color: var(--jc-title);
  font-size: 12px;
  font-weight: 600;
}

.jc-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

/* ==========================
   Tablas modernas
   ========================== */
/* ===== Tabla body ===== */
.jc-table-body {
  padding: 8px 8px 12px;
}

/* ===== Tabla moderna ===== */
.table-modern {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table-modern thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafbfc;
  color: var(--jc-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 11px 14px;
  border: none;
  border-bottom: 1px solid var(--jc-line);
  white-space: nowrap;
}

.table-modern tbody td {
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid #f1f4f8;
  color: var(--jc-title);
  font-size: 13px;
  vertical-align: middle;
}

.table-modern tbody tr {
  transition: background 0.12s ease;
}

.table-modern tbody tr:hover {
  background: var(--jc-blue-soft);
}

.table-modern tbody tr:last-child td {
  border-bottom: none;
}

/* Primera celda (fecha + hora) */
.table-modern tbody td strong {
  color: var(--jc-title);
  font-weight: 700;
}

.table-modern tbody td small.text-muted {
  font-size: 11px;
}

/* ===== Badges ===== */
.table-modern .badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.4;
}

.table-modern .badge-success {
  color: var(--jc-green);
  background: var(--jc-green-soft);
}

.table-modern .badge-secondary {
  color: #64748b;
  background: #eef1f5;
}

.table-modern .badge-warning {
  background: #fff4e5;
  color: #f59e0b;
}

.table-modern .badge-danger {
  background: #fde8e8;
  color: #ef4444;
}

/* ===== Scroll suave dentro de tablas largas ===== */
.jc-table-body.table-responsive {
  max-height: 420px;
  overflow-y: auto;
}

.jc-table-body::-webkit-scrollbar {
  width: 8px;
}

.jc-table-body::-webkit-scrollbar-thumb {
  background: #d7dee9;
  border-radius: 999px;
}

.jc-table-body::-webkit-scrollbar-track {
  background: transparent;
}

.jc-mini-card { height: 100%; }

.jc-mini-body {
  padding: 16px;
  height: 240px;
  position: relative;
}

.jc-mini-body canvas {
  max-height: 100%;
}




/***************************
PAGINACION
***************************/
.jc-pagination-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.jc-page {
  padding: 6px 10px;
  border-radius: 8px;
  background: #f3f6fb;
  color: #334155;
  font-size: 13px;
  text-decoration: none;
  transition: .15s;
}

.jc-page:hover {
  background: #e2e8f0;
}

.jc-page.active {
  background: var(--jc-blue);
  color: #fff;
}

.jc-page.disabled {
  opacity: .4;
  pointer-events: none;
}





#jc-chart-tooltip {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  --arrow-left: 50%;
  /* antes: transform: translate(-50%, -100%) translateY(-6px) scale(0.96); */
  transform: translateY(-100%) translateY(-6px) scale(0.96);
  transition: opacity 0.16s ease, transform 0.16s ease;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
  overflow: visible;
  font-family: inherit;
}

#jc-chart-tooltip.is-visible {
  opacity: 1;
  /* antes: transform: translate(-50%, -100%) translateY(-14px) scale(1); */
  transform: translateY(-100%) translateY(-14px) scale(1);
}


/* Flecha apuntando hacia abajo, al punto */
#jc-chart-tooltip::after {
  content: "";
  position: absolute;
  left: var(--arrow-left, 50%);   /* ← ahora dinámico */
  bottom: -7px;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-right: 1px solid rgba(226, 232, 240, 0.9);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  rotate: 45deg;
  border-bottom-right-radius: 3px;
}

/* Header */
#jc-chart-tooltip .tt-head {
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 12px 16px 10px;
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
}

#jc-chart-tooltip .tt-head .tt-day {
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

#jc-chart-tooltip .tt-head .tt-num {
  color: #c7d2fe;
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
}

/* Body */
#jc-chart-tooltip .tt-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#jc-chart-tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 12.5px;
  transition: background 0.1s ease;
}

#jc-chart-tooltip .tt-row.is-active {
  background: #f1f5f9;
}

#jc-chart-tooltip .tt-bar {
  width: 4px;
  height: 18px;
  border-radius: 999px;
  flex-shrink: 0;
}

#jc-chart-tooltip .tt-name {
  color: #475569;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#jc-chart-tooltip .tt-row.is-active .tt-name {
  color: #0f172a;
}

#jc-chart-tooltip .tt-val {
  color: #0f172a;
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#jc-chart-tooltip .tt-empty {
  padding: 6px 8px;
  color: #94a3b8;
  font-size: 12.5px;
  font-style: italic;
}











.jc-legend-wrap {
  position: relative;
  margin-top: auto;
}

.jc-legend-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 4px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.jc-legend-scroll::-webkit-scrollbar {
  display: none;
}

.jc-legend-scroll .jc-legend-item {
  flex-shrink: 0;
}

/* Botones de navegación (comparten estilo) */
.jc-legend-nav {
  position: absolute;
  top: 50%;
  transform: translateY(calc(-50% - 2px));
  width: 30px;
  height: 30px;
  border: 1px solid var(--jc-line);
  border-radius: 50%;
  background: #fff;
  color: var(--jc-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.15s ease, color 0.15s ease;
  z-index: 2;
}

.jc-legend-nav:hover {
  background: var(--jc-blue-soft);
  color: var(--jc-blue);
}

.jc-legend-prev {
  left: 0;
  box-shadow: 8px 0 12px -4px rgba(255,255,255,.95);
}

.jc-legend-next {
  right: 0;
  box-shadow: -8px 0 12px -4px rgba(255,255,255,.95);
}

.jc-legend-nav.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Degradados a cada lado */
.jc-legend-wrap::before,
.jc-legend-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 4px;
  width: 48px;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1;
}

.jc-legend-wrap::before {
  left: 0;
  background: linear-gradient(90deg, var(--jc-surface) 30%, transparent);
  opacity: 0;            /* oculto al inicio */
}

.jc-legend-wrap::after {
  right: 0;
  background: linear-gradient(90deg, transparent, var(--jc-surface) 70%);
  opacity: 1;
}

.jc-legend-wrap.is-start::before { opacity: 0; }
.jc-legend-wrap.is-scrolled::before { opacity: 1; }
.jc-legend-wrap.is-end::after { opacity: 0; }




/* ==========================
   Responsive
   ========================== */

@media (max-width: 767px) {
  .jc-card-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .jc-filtros {
    width: 100%;
  }

  .jc-select {
    flex: 1;
    min-width: 0;
  }

  .jc-metric {
    display: block;
  }

  .jc-metric-label {
    display: block;
    margin-top: 6px;
  }
}

@media (max-width: 575px) {
  .kpi-card {
    min-height: 120px;
    padding: 16px;
  }

  .kpi-info h3 {
    font-size: 30px;
  }

  .kpi-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    font-size: 20px;
  }
}