/* 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: #b0bec5;
  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: #b0bec5;
}
.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: #b0bec5; }
.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: #b0bec5; 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: #b0bec5;
  font-size: 0.75rem; cursor: pointer; transition: all 0.2s;
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 44px;
}
.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-page canvas {
  max-width: 100% !important;
}
.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: #b0bec5; 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: #b0bec5;
}
.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;
}

/* ========== Voice Intelligence Center Shell ========== */
.voice-center-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.voice-center-shell__controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: end;
}

.voice-center-shell__control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-center-period-select {
  min-width: 180px;
}

.voice-center-shell__status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

@media (max-width: 900px) {
  .voice-center-shell__controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .voice-center-shell__control-group,
  .voice-center-shell__status,
  .voice-center-shell__controls select,
  .voice-center-shell__controls .company-toggle-container {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .voice-center-shell__status {
    align-self: stretch;
    align-items: flex-start;
  }
}

.voice-center-kpi-grid {
  margin: 0;
}

.voice-center-callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border-default, #e2e8f0);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.04), rgba(59, 130, 246, 0.08));
}

.voice-center-callout__title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #64748b);
  margin-bottom: 4px;
}

.voice-center-callout__copy {
  color: var(--text-primary, #0f172a);
  line-height: 1.5;
}

.voice-center-callout__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.voice-center-tab-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.voice-center-tab.is-active {
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

#voiceIntelligenceCenterPanels #vocQueueView .voc-filter-group--company,
#voiceIntelligenceCenterPanels #callharborCallsView .ch-filter-group:first-child {
  display: none;
}

@media (max-width: 760px) {
  .voice-center-callout {
    flex-direction: column;
    align-items: flex-start;
  }

  .voice-center-callout__actions {
    justify-content: flex-start;
  }
}

/* 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-section {
  display: grid !important;
  grid-template-columns: minmax(300px, 0.74fr) minmax(0, 1.26fr);
  gap: 12px;
  align-items: stretch;
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-left: 4px solid #22c55e;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(236, 253, 245, 0.78)),
    radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.14), transparent 36%);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
}

.voc-cfi-section[data-tone="watch"] {
  border-left-color: #f59e0b;
  background:
    linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(239, 246, 255, 0.74)),
    radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.15), transparent 36%);
}

.voc-cfi-section[data-tone="risk"] {
  border-left-color: #ef4444;
  background:
    linear-gradient(135deg, rgba(254, 242, 242, 0.98), rgba(248, 250, 252, 0.82)),
    radial-gradient(circle at 100% 0%, rgba(239, 68, 68, 0.13), transparent 36%);
}

.voc-cfi-gauge-card {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
}

.voc-cfi-label-top {
  align-self: end;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.voc-cfi-gauge-card .voc-section-desc {
  grid-column: 2;
  margin: 0;
  color: #64748b;
  font-size: 0.74rem;
  line-height: 1.25;
}

.voc-cfi-gauge {
  grid-row: 1 / span 2;
}

.voc-cfi-gauge svg {
  width: 120px;
  height: 76px;
}

.voc-cfi-section > .voc-alarm-strip:empty {
  display: none !important;
}

.voc-cfi-section > .voc-alarm-strip:not(:empty) {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.voc-cfi-drivers {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-self: stretch;
  min-width: 0;
}
.voc-cfi-driver {
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  justify-content: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  text-align: left;
}
.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.08rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.voc-cfi-driver-detail {
  font-size: 0.73rem;
  color: #64748b;
  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-section,
  .voc-cfi-drivers { grid-template-columns: 1fr; }
  .voc-cfi-gauge-card,
  .voc-cfi-drivers { grid-column: 1; grid-row: auto; }
  .voc-cfi-gauge-card .voc-section-desc { margin: 0; }
  .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;
}

@media (max-width: 1180px) {
  .voice-center-tab-bar .voice-center-tab,
  .voice-center-callout__actions .btn {
    min-height: 44px;
  }
}
