/* ==============================================
   DASHBOARD CRM — Monitora Chat
   Estilo nativo Monitora (Tema Claro)
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Overlay & Container ── */
#monitora-dashboard-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9989;
  display: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#monitora-dashboard-overlay.active {
  display: flex;
}

#monitora-dashboard-board {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #f3f4f6;
  pointer-events: auto;
  overflow: hidden;
}

/* ── Header ── */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  min-height: 56px;
  flex-shrink: 0;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-header-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #0aa6a8, #0cc4c6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(10,166,168,0.25);
}

.dash-header-icon svg { width: 20px; height: 20px; color: #fff; }

.dash-header h1 {
  font-size: 1.2rem; font-weight: 700; color: #1f2937;
  margin: 0; letter-spacing: -0.02em;
}

.dash-header h1 small {
  display: block; font-size: 0.75rem; font-weight: 400;
  color: #9ca3af; letter-spacing: 0; margin-top: 1px;
}

.dash-header-actions {
  display: flex; align-items: center; gap: 8px;
}

/* ── Tabs ── */
.dash-tabs {
  display: flex; gap: 4px;
  background: #f3f4f6; border-radius: 8px; padding: 3px;
}

.dash-tab {
  padding: 6px 14px; border-radius: 6px; border: none;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.2s ease;
  background: transparent; color: #6b7280;
}

.dash-tab.active {
  background: #0aa6a8; color: #fff;
  box-shadow: 0 1px 4px rgba(10,166,168,0.3);
}

.dash-tab:not(.active):hover { background: #e5e7eb; color: #374151; }

/* ── Filter / Date ── */
.dash-filter-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid #e5e7eb; background: #fff;
  font-size: 0.78rem; font-weight: 500; color: #6b7280;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}

.dash-filter-btn:hover { border-color: #0aa6a8; color: #0aa6a8; }

.dash-filter-btn svg { width: 14px; height: 14px; }

.dash-date-range {
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid #e5e7eb; background: #fff;
  font-size: 0.78rem; font-weight: 500; color: #374151;
  cursor: pointer; font-family: inherit; display: flex;
  align-items: center; gap: 6px;
}

.dash-date-range svg { width: 14px; height: 14px; color: #9ca3af; }

/* ── Refresh Btn ── */
.dash-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 8px; border: none;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.2s ease;
}

.dash-btn-primary {
  background: #0aa6a8; color: #fff;
  box-shadow: 0 1px 4px rgba(10,166,168,0.25);
}

.dash-btn-primary:hover {
  background: #099496; box-shadow: 0 2px 8px rgba(10,166,168,0.3);
}

.dash-btn svg { width: 14px; height: 14px; }

.dash-btn.loading { opacity: 0.7; pointer-events: none; }
.dash-btn.loading svg { animation: spin 1s linear infinite; }

/* ── Main Content ── */
.dash-content {
  flex: 1; overflow-y: auto;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 20px;
}

.dash-content::-webkit-scrollbar { width: 6px; }
.dash-content::-webkit-scrollbar-track { background: transparent; }
.dash-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ── KPI Row ── */
.dash-kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}

/* ── KPI Card ── */
.dash-kpi-card {
  background: #fff; border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid #f0f0f0;
  transition: all 0.2s ease;
  position: relative;
}

.dash-kpi-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border-color: #e0e0e0;
}

.dash-kpi-card-header {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px;
}

.dash-kpi-card-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.dash-kpi-card-icon svg { width: 16px; height: 16px; }

.dash-kpi-card-icon.teal { background: #e6fafa; color: #0aa6a8; }
.dash-kpi-card-icon.purple { background: #f3e8ff; color: #a368fb; }
.dash-kpi-card-icon.orange { background: #fff4e5; color: #f59e0b; }
.dash-kpi-card-icon.green { background: #e6f9f0; color: #10b981; }
.dash-kpi-card-icon.blue { background: #e8f0fe; color: #3b82f6; }
.dash-kpi-card-icon.red { background: #fef2f2; color: #ef4444; }

.dash-kpi-card-title {
  font-size: 0.78rem; font-weight: 600; color: #374151;
  line-height: 1.3;
}

.dash-kpi-card-title small {
  display: block; font-size: 0.68rem; font-weight: 400;
  color: #9ca3af; margin-top: 1px;
}

.dash-kpi-card-value {
  font-size: 1.8rem; font-weight: 800; color: #1f2937;
  line-height: 1; margin-bottom: 8px; letter-spacing: -0.03em;
}

.dash-kpi-breakdown {
  display: flex; flex-direction: column; gap: 4px;
}

.dash-kpi-breakdown-item {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.72rem; color: #6b7280;
}

.dash-kpi-breakdown-item span:last-child {
  font-weight: 600; color: #374151;
}

.dash-kpi-change {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.68rem; font-weight: 600; padding: 2px 6px;
  border-radius: 4px;
}

.dash-kpi-change.up { background: #e6f9f0; color: #059669; }
.dash-kpi-change.down { background: #fef2f2; color: #dc2626; }
.dash-kpi-change.neutral { background: #f3f4f6; color: #6b7280; }

/* ── Section Card ── */
.dash-section-card {
  background: #fff; border-radius: 12px;
  border: 1px solid #f0f0f0;
  transition: all 0.2s ease;
  overflow: hidden;
}

.dash-section-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.dash-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
}

.dash-section-header-left {
  display: flex; align-items: center; gap: 10px;
}

.dash-section-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

.dash-section-icon svg { width: 14px; height: 14px; }

.dash-section-icon.teal { background: #e6fafa; color: #0aa6a8; }
.dash-section-icon.purple { background: #f3e8ff; color: #a368fb; }
.dash-section-icon.orange { background: #fff4e5; color: #f59e0b; }
.dash-section-icon.green { background: #e6f9f0; color: #10b981; }
.dash-section-icon.blue { background: #e8f0fe; color: #3b82f6; }

.dash-section-title {
  font-size: 0.85rem; font-weight: 700; color: #1f2937;
}

.dash-section-title small {
  display: block; font-size: 0.7rem; font-weight: 400;
  color: #9ca3af; margin-top: 1px;
}

.dash-section-body { padding: 0 20px 20px; }

/* ── Charts Row ── */
.dash-charts-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

.dash-three-col {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}

/* ── Timeline Area Chart ── */
.dash-timeline-peaks {
  display: flex; gap: 12px; margin-bottom: 16px;
}

.dash-peak-card {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 10px 18px;
  border-radius: 10px; border: 1px solid #f0f0f0;
  min-width: 100px; transition: all 0.2s ease;
}

.dash-peak-card:first-child {
  background: #fffbeb; border-color: #fde68a;
}

.dash-peak-card:nth-child(2) { background: #f8fafc; }
.dash-peak-card:nth-child(3) { background: #f8fafc; }

.dash-peak-label {
  font-size: 0.65rem; font-weight: 600; color: #9ca3af;
  margin-bottom: 4px;
}

.dash-peak-card:first-child .dash-peak-label { color: #b45309; }

.dash-peak-time {
  font-size: 1.1rem; font-weight: 800; color: #1f2937;
  letter-spacing: -0.02em;
}

.dash-peak-count {
  font-size: 0.68rem; color: #9ca3af; font-weight: 500;
}

.dash-area-chart {
  width: 100%; position: relative;
}

.dash-area-chart svg {
  width: 100%; display: block;
}

.dash-area-labels {
  display: flex; justify-content: space-between;
  margin-top: 4px;
}

.dash-area-labels span {
  font-size: 0.58rem; color: #9ca3af; font-weight: 500;
}

/* ── Ranking List ── */
.dash-ranking {
  display: flex; flex-direction: column; gap: 2px;
}

.dash-ranking-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f9fafb;
  transition: background 0.15s;
}

.dash-ranking-item:last-child { border-bottom: none; }

.dash-ranking-item:hover { background: #fafbfc; margin: 0 -20px; padding: 10px 20px; }

.dash-ranking-pos {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; flex-shrink: 0;
  color: #9ca3af; background: #f3f4f6;
}

.dash-ranking-item:nth-child(1) .dash-ranking-pos { background: #fef3c7; color: #b45309; }
.dash-ranking-item:nth-child(2) .dash-ranking-pos { background: #f1f5f9; color: #64748b; }
.dash-ranking-item:nth-child(3) .dash-ranking-pos { background: #fff1e6; color: #c2410c; }

.dash-ranking-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700; color: #fff; flex-shrink: 0;
}

.dash-ranking-info { flex: 1; min-width: 0; }

.dash-ranking-name {
  font-size: 0.82rem; font-weight: 600; color: #1f2937;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dash-ranking-sub {
  font-size: 0.68rem; color: #9ca3af; font-weight: 400;
}

.dash-ranking-value {
  font-size: 0.82rem; font-weight: 700; color: #374151;
  display: flex; align-items: center; gap: 4px;
}

.dash-ranking-badge {
  background: #e6fafa; color: #0aa6a8;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
}

/* ── Team Card (bottom row) ── */
.dash-team-card {
  background: #fff; border-radius: 12px;
  border: 1px solid #f0f0f0; padding: 18px 20px;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.dash-team-card.team-geral { border-left-color: #0aa6a8; }
.dash-team-card.team-ia { border-left-color: #a368fb; }
.dash-team-card.team-humana { border-left-color: #f59e0b; }

.dash-team-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.dash-team-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}

.dash-team-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

.dash-team-icon svg { width: 14px; height: 14px; }

.dash-team-icon.teal { background: #e6fafa; color: #0aa6a8; }
.dash-team-icon.purple { background: #f3e8ff; color: #a368fb; }
.dash-team-icon.orange { background: #fff4e5; color: #f59e0b; }

.dash-team-title {
  font-size: 0.82rem; font-weight: 700; color: #1f2937;
}

.dash-team-title small {
  display: block; font-size: 0.65rem; font-weight: 400;
  color: #9ca3af; margin-top: 1px;
}

.dash-team-value {
  font-size: 1.6rem; font-weight: 800; color: #1f2937;
  margin-bottom: 12px; letter-spacing: -0.03em;
}

.dash-team-stats {
  display: flex; flex-direction: column; gap: 6px;
}

.dash-team-stat {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.75rem;
}

.dash-team-stat-label { color: #6b7280; }

.dash-team-stat-value { font-weight: 600; color: #374151; }

.dash-team-stat-value.highlight { color: #0aa6a8; }

/* ── Status Badge ── */
.dash-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}

.dash-status-dot.running { background: #0aa6a8; }
.dash-status-dot.waiting { background: #f59e0b; }
.dash-status-dot.resolved { background: #10b981; }



/* ── Empty State ── */
.dash-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px; text-align: center; color: #9ca3af;
}

.dash-empty-state svg {
  width: 40px; height: 40px; color: #d1d5db; margin-bottom: 12px;
}

.dash-empty-state p {
  font-size: 0.82rem; font-weight: 500; color: #9ca3af;
  margin: 0; line-height: 1.5;
}

.dash-empty-state p:first-of-type {
  font-weight: 600; color: #6b7280; margin-bottom: 4px;
}

/* ── Channel Badge ── */
.dash-channel-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 500; color: #6b7280;
  padding: 2px 8px; border-radius: 4px; background: #f9fafb;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.dash-kpi-card, .dash-section-card, .dash-team-card {
  animation: fadeInUp 0.35s ease both;
}

.dash-kpi-row > :nth-child(1) { animation-delay: 0s; }
.dash-kpi-row > :nth-child(2) { animation-delay: 0.05s; }
.dash-kpi-row > :nth-child(3) { animation-delay: 0.1s; }
.dash-kpi-row > :nth-child(4) { animation-delay: 0.15s; }

.dash-charts-row > * { animation-delay: 0.15s; }
.dash-three-col > :nth-child(1) { animation-delay: 0.2s; }
.dash-three-col > :nth-child(2) { animation-delay: 0.25s; }
.dash-three-col > :nth-child(3) { animation-delay: 0.3s; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-three-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .dash-kpi-row { grid-template-columns: 1fr; }
  .dash-charts-row { grid-template-columns: 1fr; }
  .dash-header { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  .dash-content { padding: 16px; }
  .dash-header-actions { flex-wrap: wrap; width: 100%; }
}
