
/* ============================================================
   ENHANCED DASHBOARD STYLES
   ============================================================ */

/* KPI card top row (icon + trend) */
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.kpi-trend { font-size: .72rem; font-weight: 700; color: var(--green-500); padding: 2px 8px; border-radius: var(--r-full); background: rgba(16,185,129,.1); }

/* Small KPI row */
.kpi-grid-small { grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-card-mini { display: flex; flex-direction: column; align-items: center; padding: 14px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); gap: 4px; }
.kpi-card-mini svg { width: 20px; height: 20px; color: var(--text-muted); }
.kpi-mini-val { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.kpi-mini-label { font-size: .72rem; color: var(--text-muted); text-align: center; }

@media (max-width: 768px) { .kpi-grid-small { grid-template-columns: repeat(2, 1fr); } }

/* Page header actions */
.page-header-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { .page-header-actions { flex-wrap: wrap; } .page-header-actions .btn { font-size: .8rem; } }

/* Card header with badge */
.card-header .badge { margin-left: auto; }
.card-badge { font-size: .7rem; color: var(--text-muted); }

/* Dash grid */
.dash-grid-2col { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .dash-grid-2col { grid-template-columns: 1fr; } }

/* Breakdown chart bars */
.breakdown-chart { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; }
.breakdown-row { display: grid; grid-template-columns: 100px 1fr 30px 40px; align-items: center; gap: 8px; font-size: .82rem; }
.breakdown-label { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breakdown-bar-wrap { height: 8px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.breakdown-bar { height: 100%; border-radius: var(--r-full); transition: width .4s ease; }
.breakdown-val { font-weight: 700; text-align: center; }
.breakdown-pct { color: var(--text-muted); font-size: .75rem; text-align: right; }

@media (max-width: 640px) {
  .breakdown-row { grid-template-columns: 80px 1fr 30px; }
  .breakdown-pct { display: none; }
}

/* Category breakdown */
.category-breakdown { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; }

/* Department workload grid */
.dept-workload-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding-top: 10px; }
.dept-workload-card { padding: 12px; background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--border); }
.dw-name { font-weight: 700; font-size: .82rem; margin-bottom: 6px; }
.dw-numbers { display: flex; gap: 10px; font-size: .75rem; margin-bottom: 8px; }
.dw-total { color: var(--text-muted); }
.dw-open { color: var(--blue-500); font-weight: 600; }
.dw-bar { height: 6px; background: var(--surface); border-radius: var(--r-full); overflow: hidden; margin-bottom: 4px; }
.dw-bar-fill { height: 100%; border-radius: var(--r-full); transition: width .4s ease; }
.dw-pct { font-size: .72rem; color: var(--green-500); font-weight: 600; }

/* SLA risk table on dashboard */
.dash-card-alert { border-color: rgba(239,68,68,.2); }
.sla-risk-table { display: flex; flex-direction: column; gap: 6px; }
.sla-risk-row { display: grid; grid-template-columns: 90px 1fr 80px 70px; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; font-size: .82rem; transition: background var(--dur-fast); }
.sla-risk-row:hover { background: var(--surface-2); }
.sla-risk-id { font-family: monospace; font-size: .78rem; color: var(--text-muted); }
.sla-risk-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sla-risk-dept { font-size: .75rem; font-weight: 600; }
.sla-risk-time { font-weight: 700; text-align: right; font-size: .78rem; }

@media (max-width: 640px) {
  .sla-risk-row { grid-template-columns: 80px 1fr 60px; }
  .sla-risk-dept { display: none; }
}

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; gap: 12px; padding: 10px 0; }
.activity-item { display: flex; gap: 10px; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--text-muted); }
.activity-dot.escalated, .activity-dot.escalate { background: #ef4444; }
.activity-dot.created { background: #3b82f6; }
.activity-dot.resolved, .activity-dot.closed { background: #10b981; }
.activity-dot.updated, .activity-dot.assigned { background: #f59e0b; }
.activity-dot.ai_routed, .activity-dot.ai { background: #8b5cf6; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: .82rem; line-height: 1.4; }
.activity-text strong { font-weight: 700; }
.activity-meta { display: flex; gap: 8px; margin-top: 3px; font-size: .72rem; color: var(--text-muted); }
.activity-ticket { font-family: monospace; }

/* AI insights card */
.dash-card-ai { border-color: rgba(139,92,246,.2); }
.ai-insight { padding: 12px; border-radius: var(--r-sm); margin-bottom: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.ai-insight-title { font-weight: 700; font-size: .85rem; margin-bottom: 4px; }
.ai-insight-detail { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

/* Trend chart legend */
.chart-legend { display: flex; gap: 16px; justify-content: center; padding-top: 8px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.blue { background: #3b82f6; }
.legend-dot.green { background: #10b981; }

/* Empty mini */
.empty-mini { text-align: center; padding: 20px; color: var(--text-muted); font-size: .85rem; }

/* Dashboard trend chart container */
.trend-chart { min-height: 200px; }
.trend-svg { width: 100%; height: 200px; }
