/* ================================================================
   SupportAI — Admin CRM Dashboard
   admin_dashboard.css | Professional Blue + White Enterprise Light Theme
   ================================================================ */

/* ─── Shell Layout ─────────────────────────────────────────────── */
.admin-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-page);
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
.sidebar {
    width: 228px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 100;
    padding: var(--space-5) var(--space-3);
    flex-shrink: 0;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 2px var(--space-2) var(--space-5);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-4);
}

.brand-icon {
    width: 34px; height: 34px;
    background: var(--primary);
    color: var(--text-on-primary);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
}

.brand-text h2 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    line-height: 1.2;
}
.brand-text p {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ─── Navigation ──────────────────────────────────────────────── */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-base);
    text-align: left;
    width: 100%;
    background: transparent;
    font-family: var(--font-sans);
}
.nav-item i {
    font-size: 13px;
    width: 16px;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition-base);
    flex-shrink: 0;
}
.nav-item:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-color: var(--border);
}
.nav-item:hover i { color: var(--text-secondary); }
.nav-item.active {
    background: var(--primary-subtle);
    color: var(--primary);
    border-color: var(--primary-border);
    font-weight: 600;
}
.nav-item.active i { color: var(--primary); }

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: var(--text-on-primary);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    letter-spacing: 0.5px;
}

/* ─── Sidebar Footer ─────────────────────────────────────────── */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.user-meta-footer {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    overflow: hidden;
    min-width: 0;
}

.avatar-circle {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--primary-subtle);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 11px;
    border: 1px solid var(--primary-border);
    flex-shrink: 0;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.user-info-text strong {
    font-size: 12.5px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}
.user-info-text span {
    font-size: 10px;
    color: var(--text-muted);
}

.btn-logout {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 14px;
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-base);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.btn-logout:hover {
    background: var(--danger-subtle);
    color: var(--danger);
    border-color: var(--danger-border);
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */
.main-content {
    margin-left: 228px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100vh;
    overflow: hidden;
}

/* ─── Top Header ─────────────────────────────────────────────── */
.header {
    height: 56px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 90;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.search-bar {
    position: relative;
    width: 400px;
}
.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 13px;
    pointer-events: none;
}
.search-bar input {
    width: 100%;
    padding: 9px 14px 9px 34px;
    background: var(--bg-surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-base);
}
.search-bar input::placeholder { color: var(--text-dim); }
.search-bar input:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.status-pill {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--success-subtle);
    border: 1px solid var(--success-border);
    color: var(--success);
    font-size: 11.5px;
    font-weight: 600;
}
.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: ds-pulse 2s ease infinite;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-base);
    font-family: var(--font-sans);
    box-shadow: var(--shadow-xs);
}
.refresh-btn:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* ─── Tab Panes ──────────────────────────────────────────────── */
.tab-content-container {
    padding: var(--space-6);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.tab-pane { display: none; flex: 1; min-height: 0; overflow-y: auto; }
.tab-pane.active { display: block; }

/* Call Support tab — no scroll, full-height flex */
#tab-call-support.active {
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}
.tab-content-container:has(#tab-call-support.active) {
    padding: 0;
    overflow: hidden;
}

/* ─── Page Header ────────────────────────────────────────────── */
.page-header { margin-bottom: var(--space-5); }
.page-header h1 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.page-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD TAB — ANALYTICS
   ═══════════════════════════════════════════════════════════════ */

/* Metric Cards Grid */
.metrics-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: var(--space-6);
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}
.metric-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.metric-card.lg {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.metric-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.metric-icon {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
}
.metric-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.8px;
    line-height: 1;
}
.metric-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

.charts-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}
.chart-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}
.chart-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    padding: 3px 9px;
    border-radius: var(--radius-full);
}

.chart-container-wrapper { position: relative; }
.chart-container-wrapper.main-timeline { height: 220px; }
.chart-container-wrapper.doughnut-wrapper { height: 160px; }
.chart-container-wrapper canvas { max-height: 220px; }

.chart-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

/* Doughnut Card */
.doughnut-card-body {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.resolution-side-stats { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.res-stat-item { display: flex; align-items: center; gap: 10px; }
.res-stat-indicator { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.res-stat-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.res-stat-label  { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.res-stat-pct    { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text-primary); }
.res-stat-count  { font-size: 11px; color: var(--text-muted); }

/* ─── Live Calls Panel (Dashboard) ──────────────────────────── */
.live-calls-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    height: calc(100vh - 260px);
    min-height: 480px;
    overflow: hidden;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.panel-title h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.live-pulse-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pulse-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: ds-ping 1.4s ease infinite;
}

.live-calls-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.live-call-card {
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border);
    background: var(--bg-surface);
    transition: var(--transition-slow);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.live-call-card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.live-call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.live-customer-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.live-call-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}
.live-call-details div {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.live-call-details i {
    color: var(--primary);
    width: 14px;
    text-align: center;
    font-size: 12.5px;
}
.btn-view-conv {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-border);
    background: var(--primary-subtle);
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition-base);
    width: 100%;
}
.btn-view-conv:hover {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-primary);
}
.btn-view-conv i {
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   CALL SUPPORT TAB (HIGHEST PRIORITY ENTERPRISE CRM WORKSPACE)
   ═══════════════════════════════════════════════════════════════ */
.call-support-workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left Panel — Customer List */
.cs-left-panel {
    width: 320px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    flex-shrink: 0;
    min-height: 0;
}

.cs-left-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cs-left-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}
.cs-left-title-row h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}
.cs-customer-count {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    background: var(--primary-subtle);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 24px;
    text-align: center;
}

.cs-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.cs-search-wrap i {
    position: absolute;
    left: 10px;
    color: var(--text-dim);
    font-size: 12px;
    pointer-events: none;
}
.cs-search-input {
    width: 100%;
    padding: 8px 12px 8px 30px;
    background: var(--bg-surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-base);
}
.cs-search-input::placeholder { color: var(--text-dim); }
.cs-search-input:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.cs-customer-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: var(--space-2);
}

/* Customer Item Card */
.cs-customer-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
    border: 1.5px solid transparent;
    border-left: 3px solid transparent;
    margin-bottom: 3px;
    background: var(--bg-surface);
}
.cs-customer-card:hover {
    background: var(--bg-surface-2);
    border-color: var(--border);
}
.cs-customer-card.selected {
    background: var(--primary-subtle);
    border-color: var(--primary-border);
    border-left-color: var(--primary);
}

.cs-card-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    color: #fff;
    flex-shrink: 0;
    font-family: var(--font-display);
}

.cs-card-body {
    flex: 1;
    min-width: 0;
}
.cs-card-row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}
.cs-card-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-card-time {
    font-size: 11px;
    color: var(--text-muted);
}
.cs-card-phone {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.cs-card-row3 {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.cs-mini-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface-2);
    color: var(--text-muted);
}
.cs-mini-badge.resolved {
    background: var(--success-subtle);
    color: var(--success);
    border-color: var(--success-border);
}
.cs-mini-badge.unresolved {
    background: var(--danger-subtle);
    color: var(--danger);
    border-color: var(--danger-border);
}
.cs-mini-badge.booking {
    background: var(--accent-amber-subtle);
    color: var(--accent-amber);
    border-color: var(--accent-amber-border);
}
.cs-mini-badge.lang {
    background: var(--accent-purple-subtle);
    color: var(--accent-purple);
    border-color: var(--accent-purple-border);
}
.cs-card-preview {
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
}

/* Skeleton */
.skeleton-customer {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 12px 14px;
    margin-bottom: 3px;
}
.skel-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.skel-line { height: 10px; border-radius: var(--radius-xs); }
.skel-avatar, .skel-line { background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--border) 50%, var(--bg-surface-2) 75%); background-size: 800px 100%; animation: ds-shimmer 1.4s infinite linear; }
.w-70 { width: 70%; }
.w-50 { width: 50%; }
.w-40 { width: 40%; }

/* ─── Right Panel — Conversation Workspace ───────────────────── */
.cs-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--bg-page);
    position: relative;
}

/* No-selection state */
.cs-no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: var(--space-4);
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-8);
}
.ns-icon {
    width: 64px; height: 64px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    color: var(--text-dim);
    margin-bottom: var(--space-2);
    box-shadow: var(--shadow-sm);
}
.cs-no-selection h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-secondary);
}
.cs-no-selection p {
    font-size: 13.5px;
    color: var(--text-muted);
    max-width: 280px;
    line-height: 1.5;
}

/* Conversation view */
.cs-conversation-view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Sticky header */
.conv-sticky-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
    z-index: 10;
}

.conv-header-top {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
}

.conv-header-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    color: #fff;
    flex-shrink: 0;
    font-family: var(--font-display);
}

.conv-header-identity { flex: 1; min-width: 0; }
.conv-header-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-header-phone {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 1px;
}

.conv-header-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Conversation search bar */
.conv-search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px var(--space-5);
    border-top: 1px solid var(--border);
}

.conv-search-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}
.conv-search-wrap i {
    position: absolute;
    left: 11px;
    color: var(--text-dim);
    font-size: 12px;
    pointer-events: none;
}
.conv-search-input {
    width: 100%;
    padding: 8px 12px 8px 30px;
    background: var(--bg-surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-base);
}
.conv-search-input::placeholder { color: var(--text-dim); }
.conv-search-input:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.conv-search-clear {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex; align-items: center; justify-content: center;
}
.conv-search-clear:hover {
    background: var(--danger-subtle);
    border-color: var(--danger-border);
    color: var(--danger);
}

/* Conv meta grid */
.conv-meta-grid {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 8px var(--space-5) 10px;
    flex-wrap: wrap;
}
.conv-meta-item {
    background: var(--bg-surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 100px;
}
.conv-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.conv-meta-value {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.badge-status-sm {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
}
.badge-status-sm.badge-resolved {
    background: var(--success-subtle);
    color: var(--success);
    border-color: var(--success-border);
}
.badge-status-sm.badge-pending {
    background: var(--danger-subtle);
    color: var(--danger);
    border-color: var(--danger-border);
}
.badge-status-sm.badge-active {
    background: var(--primary-subtle);
    color: var(--primary);
    border-color: var(--primary-border);
}

/* Scrollable chat */
.conv-chat-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-height: 0;
    scroll-behavior: smooth;
}

/* ─── Call Divider / Session Block ───────────────────────────── */
.call-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-2) 0;
}
.call-divider-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}
.call-divider-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-surface-2);
}

/* ─── Chat Messages (Admin CRM view) ────────────────────────── */
.call-session-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    animation: ds-fade-in 0.2s ease;
}

.chat-msg-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: var(--space-2);
}
.chat-msg-group.customer {
    align-items: flex-start;
}
.chat-msg-group.ai {
    align-items: flex-end;
}
.chat-bubble-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 80%;
}
.chat-msg-group.customer .chat-bubble-wrap {
    flex-direction: row;
}
.chat-msg-group.ai .chat-bubble-wrap {
    flex-direction: row-reverse;
}
.chat-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}
.chat-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
    box-shadow: var(--shadow-sm);
}
.chat-msg-group.customer .chat-bubble {
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    border-top-left-radius: var(--radius-xs);
}
.chat-msg-group.ai .chat-bubble {
    background: var(--primary);
    color: var(--text-on-primary);
    border-top-right-radius: var(--radius-xs);
    box-shadow: var(--shadow-primary);
}
.bubble-text {
    margin-bottom: 4px;
}
.bubble-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.bubble-time {
    font-size: 11px;
    color: var(--text-muted);
}
.chat-msg-group.ai .bubble-time {
    color: rgba(255, 255, 255, 0.7);
}
.bubble-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
}
.chat-msg-group.ai .bubble-badge {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}
.bubble-badge.intent {
    background: var(--accent-purple-subtle);
    color: var(--accent-purple);
    border-color: var(--accent-purple-border);
}
.chat-msg-group.ai .bubble-badge.intent {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Audio player */
.audio-player {
    margin-top: 8px;
    width: 100%;
    height: 32px;
    border-radius: var(--radius-sm);
    accent-color: var(--primary);
    cursor: pointer;
}

/* Scroll to bottom FAB */
.scroll-bottom-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
    z-index: 10;
}
.scroll-bottom-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════════
   FEEDBACK TAB
   ═══════════════════════════════════════════════════════════════ */
.feedback-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: var(--space-5);
}

/* Sentiment split metric card styling */
#fb-sentiment-split {
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    color: inherit;
    display: block;
    width: 100%;
}

.sentiment-split-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: 4px;
}

.sentiment-values {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
}

.sentiment-pos {
    color: var(--success);
}

.sentiment-neg {
    color: var(--danger);
}

.sentiment-pos small,
.sentiment-neg small {
    font-size: 11px;
    font-family: var(--font-sans);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-left: 2px;
}

.sentiment-track {
    display: flex;
    height: 6px;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--bg-surface-2);
}

.sentiment-bar {
    height: 100%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.sentiment-bar-pos {
    background: var(--success);
}

.sentiment-bar-neg {
    background: var(--danger);
}

.distribution-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-sm);
}

/* Rating bars */
.dist-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: 8px;
}
.dist-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}
.dist-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border);
}
.dist-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
}
.dist-value {
    font-size: 11px;
    color: var(--text-muted);
    width: 64px;
    text-align: right;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */
.table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.custom-table thead tr {
    border-bottom: 1px solid var(--border);
}
.custom-table thead th {
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-surface-2);
    white-space: nowrap;
}
.custom-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition-fast);
}
.custom-table tbody tr:last-child { border-bottom: none; }
.custom-table tbody tr:hover { background: var(--bg-surface-2); }
.custom-table td {
    padding: 13px 16px;
    color: var(--text-secondary);
    vertical-align: middle;
}
.custom-table a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.custom-table a:hover { text-decoration: underline; }

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-12);
    text-align: center;
    color: var(--text-muted);
}
.empty-state-box i { font-size: 28px; color: var(--text-dim); }
.empty-state-box p { font-size: 13.5px; }

/* ─── Inline Status Badges ───────────────────────────────────── */
.badge-resolved   { background: var(--success-subtle); color: var(--success);  border: 1px solid var(--success-border); }
.badge-unresolved { background: var(--danger-subtle);  color: var(--danger);   border: 1px solid var(--danger-border); }
.badge-pending    { background: var(--warning-subtle); color: var(--warning);  border: 1px solid var(--warning-border); }
.badge-paid       { background: var(--success-subtle); color: var(--success);  border: 1px solid var(--success-border); }
.badge-unpaid     { background: var(--danger-subtle);  color: var(--danger);   border: 1px solid var(--danger-border); }
.badge-chat       { background: var(--primary-subtle); color: var(--primary);  border: 1px solid var(--primary-border); }
.badge-call       { background: var(--accent-purple-subtle); color: var(--accent-purple); border: 1px solid var(--accent-purple-border); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    .metrics-grid-4   { grid-template-columns: repeat(2, 1fr); }
    .feedback-summary-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .sidebar { width: 60px; padding: var(--space-4) var(--space-2); }
    .brand-text, .nav-item span, .user-info-text { display: none; }
    .main-content { margin-left: 60px; }
    .cs-left-panel { width: 260px; }
}
