/* Casa Vergara — live chart cards (header, trend chip, range switch, pulse) */
.cvr-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 0.9rem;
  margin-bottom: 0.85rem;
}
.cvr-chart-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.7rem; min-width: 0; }
.cvr-trend {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; line-height: 1.3; white-space: nowrap;
  transition: background-color 0.3s, color 0.3s;
}
.cvr-trend.is-up   { color: #167a52; background: rgba(31, 157, 107, 0.14); }
.cvr-trend.is-down { color: #b6303a; background: rgba(214, 69, 80, 0.14); }
.cvr-trend.is-flat { color: #5b6b7b; background: rgba(91, 107, 123, 0.12); }
html[data-theme="dark"] .cvr-trend.is-up   { color: #55d6a0; background: rgba(31, 157, 107, 0.2); }
html[data-theme="dark"] .cvr-trend.is-down { color: #ff8a93; background: rgba(214, 69, 80, 0.2); }
html[data-theme="dark"] .cvr-trend.is-flat { color: #9fb2c4; background: rgba(159, 178, 196, 0.14); }

.cvr-range { flex: 0 1 auto; max-width: 100%; }
.cvr-range-btn {
  border: 1px solid rgba(12, 59, 93, 0.18);
  color: #0c3b5d; background: transparent;
  font-size: 0.74rem; font-weight: 600; padding: 0.25rem 0.6rem;
}
.cvr-range-btn:hover { background: rgba(50, 139, 195, 0.1); color: #0c3b5d; }
.cvr-range-btn.active, .cvr-range-btn.active:hover { background: #0c3b5d; border-color: #0c3b5d; color: #fff; }
html[data-theme="dark"] .cvr-range-btn { color: #cfe3f4; border-color: rgba(255, 255, 255, 0.18); }
html[data-theme="dark"] .cvr-range-btn.active { background: #5aa9dc; border-color: #5aa9dc; color: #0b1620; }

.cvr-live-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 600; color: #167a52;
}
.cvr-live-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #1f9d6b;
  box-shadow: 0 0 0 0 rgba(31, 157, 107, 0.6); animation: cvr-live 2s infinite;
}
@keyframes cvr-live {
  0% { box-shadow: 0 0 0 0 rgba(31, 157, 107, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(31, 157, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 157, 107, 0); }
}

/* brief glow when fresh data arrives */
.admin-chart-card.cvr-pulse { animation: cvr-card-pulse 1.1s ease-out; }
@keyframes cvr-card-pulse {
  0% { box-shadow: 0 0 0 0 rgba(50, 139, 195, 0.45); }
  100% { box-shadow: 0 0 0 14px rgba(50, 139, 195, 0); }
}

/* canvases scale with the card on every screen */
.admin-chart-card canvas { max-width: 100%; }
@media (max-width: 767.98px) {
  .admin-chart-card > div[style*="height"] { height: 250px !important; }
  .cvr-range { width: 100%; }
  .cvr-range .btn { flex: 1 1 0; padding-left: 0.3rem; padding-right: 0.3rem; }
}
@media (max-width: 399.98px) {
  .admin-chart-card > div[style*="height"] { height: 220px !important; }
  .cvr-range-btn { font-size: 0.68rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cvr-live-dot, .admin-chart-card.cvr-pulse { animation: none; }
}
