/* Voice Intelligence Redesign — v20260318
   All layout/component styles for the VOC dashboard.
   Extracted from inline <style> + new 5-tab layout. */

/* ========== Design Tokens ========== */
:root {
  --b-primary: #0f172a;
  --b-accent: #6366f1;
  --b-success: #22c55e;
  --b-warning: #f59e0b;
  --b-danger: #ef4444;
  --b-card-bg: #1e293b;
}

/* ========== 5-Tab Bar ========== */
.voc-tabs--5 {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  gap: 0;
}
.voc-tabs--5::-webkit-scrollbar { display: none; }

/* ========== Pipeline Health Widget ========== */
.voc-pipeline-health-widget { margin-bottom: 16px; }
.voc-pipeline-health-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 8px;
  background: var(--b-card-bg); font-size: 0.85rem;
  border-left: 4px solid var(--b-success); cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
}
.voc-pipeline-health-bar.status-stalled { border-left-color: var(--b-warning); }
.voc-pipeline-health-bar.status-failed { border-left-color: var(--b-danger); }
.voc-pipeline-health-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--b-success); flex-shrink: 0;
  animation: voc-pulse 2s ease-in-out infinite;
}
.voc-pipeline-health-bar.status-stalled .voc-pipeline-health-dot { background: var(--b-warning); animation: none; }
.voc-pipeline-health-bar.status-failed .voc-pipeline-health-dot { background: var(--b-danger); animation: none; }
@keyframes voc-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.voc-pipeline-health-text { flex: 1; color: #e2e8f0; }
.voc-pipeline-health-toggle {
  background: none; border: none; color: #94a3b8;
  cursor: pointer; font-size: 0.7rem; padding: 4px;
  transition: transform 0.2s;
}
.voc-pipeline-health-toggle.open { transform: rotate(180deg); }
.voc-pipeline-health-details {
  padding: 12px 16px; background: rgba(30,41,59,0.7);
  border-radius: 0 0 8px 8px; margin-top: -4px;
}
.voc-pipeline-health-progress {
  height: 6px; background: rgba(100,116,139,0.3);
  border-radius: 3px; overflow: hidden; margin-bottom: 10px;
}
.voc-pipeline-health-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--b-accent), var(--b-success));
  border-radius: 3px; transition: width 0.6s ease;
}
.voc-pipeline-health-breakdown {
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.78rem; color: #94a3b8;
}
.voc-pipeline-health-breakdown .ph-stat { display: flex; gap: 4px; align-items: center; }
.voc-pipeline-health-breakdown .ph-stat strong { color: #e2e8f0; }

/* ========== KPI Card Enhancements ========== */
.voc-kpi-card { position: relative; transition: transform 0.2s, box-shadow 0.2s; }
.voc-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.voc-kpi-card .voc-stat-value { transition: color 0.3s; }
.voc-kpi-card.kpi-green .voc-stat-value { color: var(--b-success); }
.voc-kpi-card.kpi-yellow .voc-stat-value { color: var(--b-warning); }
.voc-kpi-card.kpi-red .voc-stat-value { color: var(--b-danger); }
.voc-kpi-trend-arrow {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; font-weight: 600; margin-left: 6px;
}
.voc-kpi-trend-arrow.up { color: var(--b-success); }
.voc-kpi-trend-arrow.down { color: var(--b-danger); }
.voc-kpi-trend-arrow.flat { color: #94a3b8; }
.voc-kpi-sparkline-canvas { width: 100%; height: 32px; margin-top: 6px; display: block; }
.voc-kpi-tooltip {
  display: none; position: absolute; top: -8px; left: 50%; transform: translate(-50%, -100%);
  background: #0f172a; color: #e2e8f0; padding: 8px 12px; border-radius: 6px;
  font-size: 0.72rem; line-height: 1.4; max-width: 220px; z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4); pointer-events: none;
  font-family: 'Inter', system-ui, sans-serif;
}
.voc-kpi-card:hover .voc-kpi-tooltip { display: block; }

/* ========== Leaderboard Card Layout ========== */
.voc-leaderboard-filters {
  display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.voc-leaderboard-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}
.voc-csr-card {
  background: var(--b-card-bg); border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid rgba(100,116,139,0.15); cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: 'Inter', system-ui, sans-serif;
}
.voc-csr-card:hover { border-color: var(--b-accent); box-shadow: 0 4px 16px rgba(99,102,241,0.15); }
.voc-csr-card-top { display: flex; align-items: center; gap: 12px; }
.voc-csr-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0;
  font-family: 'Inter', system-ui, sans-serif;
}
.voc-csr-avatar.company-rlc { background: linear-gradient(135deg, #16a34a, #22c55e); }
.voc-csr-avatar.company-gx { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.voc-csr-avatar.company-ag { background: linear-gradient(135deg, #ea580c, #f97316); }
.voc-csr-avatar.company-default { background: linear-gradient(135deg, #6366f1, #818cf8); }
.voc-csr-card-info { flex: 1; min-width: 0; }
.voc-csr-card-name { font-weight: 600; font-size: 0.9rem; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voc-csr-card-meta { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
.voc-score-ring-wrap { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.voc-score-ring-wrap svg { width: 100%; height: 100%; }
.voc-score-ring-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 0.72rem; font-weight: 700; color: #f1f5f9;
}
.voc-csr-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.voc-coaching-badge {
  font-size: 0.68rem; padding: 2px 8px; border-radius: 10px;
  background: rgba(245,158,11,0.15); color: var(--b-warning);
  font-weight: 600;
}
.voc-csr-card-expand {
  display: none; padding-top: 10px; border-top: 1px solid rgba(100,116,139,0.15);
}
.voc-csr-card.expanded .voc-csr-card-expand { display: block; }
.voc-csr-card-radar { display: flex; justify-content: center; margin: 8px 0; }

/* CSR gap analysis callout */
.voc-csr-gap-callout {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(245,158,11,0.1);
  color: var(--b-warning);
  border-left: 3px solid var(--b-warning);
  line-height: 1.4;
}
.voc-csr-no-calls {
  color: #64748b;
  font-style: italic;
}

/* ========== Trend Range Toggle ========== */
.voc-trend-range-toggle { display: flex; gap: 4px; }
.voc-range-btn {
  padding: 4px 12px; border: 1px solid rgba(100,116,139,0.3);
  border-radius: 6px; background: transparent; color: #94a3b8;
  font-size: 0.75rem; cursor: pointer; transition: all 0.2s;
  font-family: 'Inter', system-ui, sans-serif;
}
.voc-range-btn.active { background: var(--b-accent); color: #fff; border-color: var(--b-accent); }
.voc-range-btn:hover:not(.active) { border-color: var(--b-accent); color: #c7d2fe; }

/* ========== Feedback Queue / Tab Badge ========== */
.voc-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--b-danger); color: #fff; font-size: 0.65rem;
  font-weight: 700; padding: 0 5px; margin-left: 6px;
  vertical-align: middle;
}
.voc-attention-priority-escalation { border-left: 3px solid var(--b-danger) !important; }
.voc-attention-priority-coaching { border-left: 3px solid var(--b-warning) !important; }
.voc-attention-priority-routine { border-left: 3px solid #64748b !important; }
.voc-queue-transcript-preview {
  font-size: 0.78rem; color: #94a3b8; font-style: italic;
  margin-top: 6px; line-height: 1.4; max-height: 3.2em; overflow: hidden;
}
.voc-queue-empty-state {
  text-align: center; padding: 32px 16px; color: #94a3b8;
}
.voc-queue-empty-state .voc-queue-check { font-size: 2.5rem; display: block; margin-bottom: 8px; }

/* ========== Attention Calls (redesigned rows) ========== */
.voc-attention-row {
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-default, #e2e8f0);
  margin-bottom: 10px;
  border-left: 4px solid #64748b;
  transition: box-shadow 0.2s;
}
.voc-attention-row:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.voc-attention-row.sentiment-negative { border-left-color: var(--b-danger); }
.voc-attention-row.sentiment-positive { border-left-color: var(--b-success); }
.voc-attention-row.sentiment-neutral  { border-left-color: var(--b-warning); }
.voc-attention-row-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.voc-attention-row-info {
  flex: 1;
  min-width: 0;
}
.voc-attention-caller {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary, #0f172a);
}
.voc-attention-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 4px;
}
.voc-attention-cat {
  font-weight: 600;
}
.voc-attention-csr {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 6px;
}
.voc-attention-preview {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-secondary, #334155);
  margin: 0;
}
.voc-attention-row-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Direction badges */
.voc-dir-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(100,116,139,0.1);
  color: #64748b;
}
.voc-dir-badge--in {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
}
.voc-dir-badge--out {
  background: rgba(99,102,241,0.1);
  color: #6366f1;
}

/* ========== CFI Drivers Grid ========== */
.voc-cfi-drivers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.voc-cfi-driver {
  padding: 12px;
  background: var(--bg-card, #fff);
  border-radius: 8px;
  border: 1px solid var(--border-default, #e2e8f0);
  text-align: center;
}
.voc-cfi-driver-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.voc-cfi-driver-value {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.voc-cfi-driver-detail {
  font-size: 0.73rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 640px) {
  .voc-leaderboard-cards { grid-template-columns: 1fr; }
  .voc-grid.stats { grid-template-columns: repeat(2, 1fr) !important; }
  .voc-cfi-drivers { grid-template-columns: 1fr; }
  .voc-attention-row-main { flex-direction: column; }
  .voc-attention-row-actions { flex-direction: row; align-items: center; }
  .voc-tabs--5 .voc-tab-button { font-size: 0.8rem; padding: 8px 12px; white-space: nowrap; }
}

@media (max-width: 480px) {
  .voc-grid.stats { grid-template-columns: 1fr !important; }
}

/* Charts: constrain on mobile */
@media (max-width: 640px) {
  .voc-volume-grid canvas,
  .voc-card canvas {
    max-height: 220px;
  }
}

/* ========== Embedded / iFrame Mode ========== */
/* When loaded inside the portal iframe, hide the inner page header
   (company select, period select, refresh button) — the outer portal provides those */
.voc-embedded #vocInnerPageHeader {
  display: none !important;
}
.voc-embedded .voc-shell {
  padding-top: 12px;
}
