/* Import modern Google Fonts (Variable Font Weights 100-900) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=Outfit:wght@100..900&display=swap');

/* Core Design System Variables */
:root {
    /* Color Palette - Dark Mode (Default) */
    --bg-primary: #090d16;
    --bg-secondary: #0f172a;
    --card-bg: rgba(17, 25, 40, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Primary UI Accent */
    --accent-primary: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.15);
    
    /* Notification Stream Accents */
    --color-stream1: #14b8a6; /* Teal - Chạm là chốt */
    --color-stream1-glow: rgba(20, 184, 166, 0.15);
    --color-stream2: #a855f7; /* Purple - Nhắc nhở FTQ */
    --color-stream2-glow: rgba(168, 85, 247, 0.15);
    --color-stream3: #06b6d4; /* Cyan - CSAT 1, 2 KTV */
    --color-stream3-glow: rgba(6, 182, 212, 0.15);
    --color-stream4: #f59e0b; /* Amber - Phát triển thuê bao */
    --color-stream4-glow: rgba(245, 158, 11, 0.15);
    
    /* Status Colors */
    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.1);
    --color-failure: #ef4444;
    --color-failure-bg: rgba(239, 68, 68, 0.1);
    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.1);
    --color-info: #3b82f6;
    --color-info-bg: rgba(59, 130, 246, 0.1);
    
    /* Font Families */
    --font-header: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Shadows & Border Radius */
    --shadow-sm: 0 2px 8px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.4);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    /* Sidebar Width */
    --sidebar-width: 260px;
    --transition-speed: 0.3s;
}

/* Light Theme Variables & Typographic Overrides */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #334155; /* Warm charcoal with robust contrast */
    --text-muted: #64748b;     /* High-contrast cool gray for captions */
    --border-color: #e2e8f0;
    
    --accent-primary: #4f46e5;
    --accent-hover: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.06);
    
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.03), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
}

/* Light Theme Typographic & Layout Enhancements */
[data-theme="light"] body {
    font-weight: 480; /* Optimal weight for clear rendering of sans-serif body copy */
    color: #1e293b;
}

[data-theme="light"] .page-title,
[data-theme="light"] .logo-text,
[data-theme="light"] .metric-value,
[data-theme="light"] .chart-title,
[data-theme="light"] .drawer-title,
[data-theme="light"] .settings-card-title,
[data-theme="light"] .login-title {
    color: #0f172a !important;
    font-weight: 750 !important;
    letter-spacing: -0.025em !important;
}

[data-theme="light"] .page-subtitle {
    color: #475569 !important;
    font-weight: 480 !important;
    letter-spacing: -0.01em;
}

[data-theme="light"] .nav-item {
    font-weight: 550 !important;
    color: #475569;
    letter-spacing: -0.015em;
}

[data-theme="light"] .nav-item:hover {
    color: #0f172a !important;
    background-color: rgba(15, 23, 42, 0.04) !important;
}

[data-theme="light"] .nav-item.active {
    color: #4f46e5 !important;
    background-color: rgba(79, 70, 229, 0.08) !important;
    font-weight: 650 !important;
    border-color: rgba(79, 70, 229, 0.15) !important;
}

[data-theme="light"] .nav-label {
    color: #64748b !important;
    font-weight: 750 !important;
    letter-spacing: 0.05em !important;
}

/* Tables in Light Mode */
[data-theme="light"] .log-table th {
    color: #334155 !important;
    font-weight: 650 !important;
    background: #f8fafc !important;
    border-bottom: 2px solid #e2e8f0 !important;
    letter-spacing: 0.03em !important;
}

[data-theme="light"] .log-table td {
    color: #334155 !important;
    font-weight: 480 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

[data-theme="light"] .log-table tbody tr:hover {
    background: #f8fafc !important;
    color: #0f172a !important;
}

[data-theme="light"] .metric-title {
    color: #475569 !important;
    font-weight: 650 !important;
    letter-spacing: 0.02em;
}

[data-theme="light"] .form-label,
[data-theme="light"] .filter-label {
    color: #334155 !important;
    font-weight: 650 !important;
    letter-spacing: -0.01em;
}

[data-theme="light"] .timeline-sender {
    color: #0f172a !important;
    font-weight: 650 !important;
}

[data-theme="light"] .timeline-desc {
    color: #475569 !important;
    font-weight: 480 !important;
}

[data-theme="light"] .detail-label {
    color: #475569 !important;
    font-weight: 650 !important;
    letter-spacing: 0.02em;
}

[data-theme="light"] .detail-val {
    color: #0f172a !important;
    font-weight: 550 !important;
}

[data-theme="light"] .message-body-container {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .message-body-text {
    color: #1e293b !important;
    font-weight: 460 !important;
    line-height: 1.625 !important;
}

[data-theme="light"] .select-filter, 
[data-theme="light"] .date-filter,
[data-theme="light"] .search-input,
[data-theme="light"] .form-input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    font-weight: 500 !important;
}

[data-theme="light"] .search-input:focus,
[data-theme="light"] .form-input:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12) !important;
}

[data-theme="light"] .badge-channel {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .badge-channel.fpt-chat {
    background: rgba(59, 130, 246, 0.08) !important;
    color: #1d4ed8 !important;
    border-color: rgba(59, 130, 246, 0.15) !important;
}

[data-theme="light"] .badge-channel.email {
    background: rgba(236, 72, 153, 0.08) !important;
    color: #be185d !important;
    border-color: rgba(236, 72, 153, 0.15) !important;
}


/* Base resets & layout rules */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout shell */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width var(--transition-speed);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-primary), #ec4899);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
    color: white;
}

.logo-text {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-label {
    font-family: var(--font-header);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 12px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--text-primary);
    background-color: var(--accent-glow);
    border-color: rgba(99, 102, 241, 0.2);
}

.nav-item.active i {
    color: var(--accent-primary);
}

/* Custom coloring for stream active items */
.nav-item.stream-1-item.active {
    background-color: var(--color-stream1-glow);
    border-color: rgba(20, 184, 166, 0.2);
}
.nav-item.stream-1-item.active i { color: var(--color-stream1); }

.nav-item.stream-2-item.active {
    background-color: var(--color-stream2-glow);
    border-color: rgba(168, 85, 247, 0.2);
}
.nav-item.stream-2-item.active i { color: var(--color-stream2); }

.nav-item.stream-3-item.active {
    background-color: var(--color-stream3-glow);
    border-color: rgba(6, 182, 212, 0.2);
}
.nav-item.stream-3-item.active i { color: var(--color-stream3); }

.nav-item.stream-4-item.active {
    background-color: var(--color-stream4-glow);
    border-color: rgba(245, 158, 11, 0.2);
}
.nav-item.stream-4-item.active i { color: var(--color-stream4); }


.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
    color: var(--text-secondary);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.theme-toggle i {
    font-size: 1.1rem;
}

/* Main Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Top bar styles */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-title {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.action-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
}

.metric-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-primary);
}

.metric-card.stream-1::before { background: var(--color-stream1); }
.metric-card.stream-2::before { background: var(--color-stream2); }
.metric-card.stream-3::before { background: var(--color-stream3); }
.metric-card.stream-4::before { background: var(--color-stream4); }

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.metric-title {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-primary);
}

.metric-value {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
}

.metric-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.metric-trend-up {
    color: var(--color-success);
}
.metric-trend-down {
    color: var(--color-failure);
}

/* Glassmorphic Panel Layout */
.dashboard-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 350px;
}

.chart-title-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title {
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 1.1rem;
}

.chart-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Connection Status indicator tags */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
}

.status-active {
    background: var(--color-success-bg);
    color: var(--color-success);
}
.status-active .pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 1.5s infinite;
}

.status-mock {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}
.status-mock .pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--color-warning);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-loading {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.status-live {
    background: var(--color-success-bg);
    color: var(--color-success);
}
.status-live .pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 1.5s infinite;
}

.status-empty {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.status-error {
    background: var(--color-failure-bg);
    color: var(--color-failure);
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

/* Filters Panel Styles */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.select-filter, .date-filter {
    padding: 9px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border 0.2s;
}

.select-filter:focus, .date-filter:focus {
    border-color: var(--accent-primary);
}

.select-filter option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Log Table Styles */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

.log-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 14px 18px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
}

.log-table th:hover {
    color: var(--text-primary);
}

.log-table th i {
    margin-left: 6px;
    font-size: 0.8rem;
}

.log-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.log-table tbody tr {
    cursor: pointer;
    transition: all 0.2s;
}

.log-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.log-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badge components */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.badge-failure {
    background: var(--color-failure-bg);
    color: var(--color-failure);
}

.badge-channel {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.badge-channel i {
    margin-right: 6px;
}

.badge-channel.fpt-chat {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.2);
}

.badge-channel.email {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
    border-color: rgba(236, 72, 153, 0.2);
}

/* Message content preview column style */
.preview-text {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-body);
}

/* Empty State */
.empty-state {
    padding: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
}

.empty-state-title {
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-primary);
}

/* Table Pagination styling */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-page {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 10px;
}

/* Detail Drawer (Slide out panel) */
.detail-drawer {
    position: fixed;
    top: 0;
    right: -460px;
    width: 460px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.detail-drawer.open {
    right: 0;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-title {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.2rem;
}

.drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.detail-val {
    font-weight: 500;
    color: var(--text-primary);
}

.message-body-container {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.message-body-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-body);
}

/* Beautiful dynamic blocks inside message bodies */
.message-body-text p {
    margin-bottom: 12px;
}

.message-body-text ul {
    list-style-type: none;
    padding-left: 0;
    margin: 8px 0;
}

.message-body-text li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 6px;
}

.message-body-text li::before {
    content: "•";
    position: absolute;
    left: 4px;
    color: var(--accent-primary);
    font-weight: bold;
}

/* Overview tab custom layouts */
.overview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.activity-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 6px;
}

.timeline-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 10px 10px 0;
    transition: background 0.2s;
}

.timeline-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.timeline-item.stream-1 { border-left-color: var(--color-stream1); }
.timeline-item.stream-2 { border-left-color: var(--color-stream2); }
.timeline-item.stream-3 { border-left-color: var(--color-stream3); }
.timeline-item.stream-4 { border-left-color: var(--color-stream4); }

.timeline-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-sender {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.timeline-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

/* Settings Form Styles */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.settings-card-title {
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-glow);
}

.radio-group {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.radio-label input {
    accent-color: var(--accent-primary);
}

/* Alert system */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: var(--color-failure-bg);
    color: var(--color-failure);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Skeleton loader animations */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: loading-skeleton 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    width: 80%;
    margin-bottom: 8px;
}
.skeleton-title {
    height: 24px;
    width: 50%;
    margin-bottom: 12px;
}
.skeleton-value {
    height: 36px;
    width: 60%;
}
.skeleton-row {
    height: 20px;
    margin: 8px 0;
}

/* Glassmorphic Login Overlay styles */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent), var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease, visibility 0.5s;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    transition: transform 0.3s ease;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-primary), #ec4899);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
}

.login-title {
    font-family: var(--font-header);
    font-weight: 800;
    font-size: 1.6rem;
    margin-bottom: 8px;
    background: linear-gradient(to right, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Animations */
.animate-fade-in {
    animation: login-fade-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes login-fade-in {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Input shaking on failure */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
    20%, 40%, 60%, 80% { transform: translateX(6px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Slow spin logo animation */
.fa-spin-slow {
    animation: spin-slow 8s linear infinite;
}

@keyframes spin-slow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   11. MOBILE RESPONSIVE MEDIA QUERIES
   ========================================== */

/* Mobile hamburger button */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

[data-theme="light"] .mobile-menu-btn {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .mobile-menu-btn:hover {
    background: #f1f5f9;
}

/* Sidebar backdrop overlay on mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Responsiveness overrides */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: inline-flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
        left: 0;
    }
    
    .sidebar.active {
        transform: translateX(0);
        width: var(--sidebar-width);
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 16px !important;
        gap: 16px !important;
    }
    
    .header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    
    .action-group {
        width: 100%;
        justify-content: flex-start;
    }
    
    .action-group .btn {
        flex: 1;
        justify-content: center;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .charts-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .chart-card {
        min-height: 280px !important;
        padding: 14px !important;
    }
    
    .filters-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 14px !important;
    }
    
    .search-box {
        width: 100%;
    }
    
    .filter-item {
        width: 100%;
    }
    
    .select-filter, .date-filter {
        width: 100%;
    }
    
    /* Detail drawer covering full screen on mobile */
    .detail-drawer {
        width: 100% !important;
        right: -100% !important;
    }
    
    .detail-drawer.open {
        right: 0 !important;
    }
    
    /* Responsive forms in settings */
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
    
    /* Responsive login gate */
    .login-card {
        padding: 24px !important;
        margin: 10px !important;
        width: 100% !important;
        max-width: 380px !important;
    }
    
    .login-title {
        font-size: 1.4rem !important;
    }
}

/* ==========================================
   12. KIOSK MODE, VINH DANH OVERLAY & SAVED VIEWS
   ========================================== */

/* Pinned Saved Views List Link styles */
.saved-view-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 550;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

[data-theme="light"] .saved-view-item {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #475569;
}

.saved-view-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

[data-theme="light"] .saved-view-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.saved-view-link {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-delete-view {
    opacity: 0.4;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: opacity 0.2s, background 0.2s;
    color: var(--text-muted);
}

.btn-delete-view:hover {
    opacity: 1;
    color: var(--color-failure) !important;
    background: rgba(239, 68, 68, 0.1);
}



/* Fullscreen Glassmorphic Vinh Danh Dynamic Pop-up */
.vinhdanh-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(17, 24, 39, 0.95), rgba(9, 13, 22, 0.99));
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: fade-in-vinhdanh 0.4s ease-out;
}

[data-theme="light"] .vinhdanh-overlay {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.99));
}

@keyframes fade-in-vinhdanh {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.vinhdanh-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.2);
    padding: 48px;
    width: 90%;
    max-width: 520px;
    text-align: center;
    position: relative;
    z-index: 10001;
    transform: scale(1);
    animation: scale-up-card 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] .vinhdanh-card {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.1), 0 0 40px rgba(79, 70, 229, 0.08);
}

@keyframes scale-up-card {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.vinhdanh-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: white;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 24px;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
}

.vinhdanh-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-primary), #ec4899);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
}

.vinhdanh-name {
    font-family: var(--font-header);
    font-weight: 800;
    font-size: 2.2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

[data-theme="light"] .vinhdanh-name {
    color: #0f172a !important;
}

.vinhdanh-dept {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vinhdanh-award {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 24px;
}

[data-theme="light"] .vinhdanh-award {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.vinhdanh-footer {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Confetti particle rain container & particles */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    border-radius: 2px;
    top: -10px;
    opacity: 0.85;
    animation: confetti-fall 4s linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(105vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==========================================
   13. EXECUTIVE OVERVIEW ENHANCEMENTS
   ========================================== */

/* --- System Health Bar --- */
.health-bar {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.health-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.health-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.health-bar-left i {
    font-size: 1rem;
    flex-shrink: 0;
}

.health-message {
    font-weight: 600;
}

.health-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.health-detail {
    font-size: 0.8rem;
    opacity: 0.8;
}

.health-green {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.health-yellow {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--color-warning);
}

.health-red {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--color-failure);
}

.health-loading {
    background: rgba(100, 116, 139, 0.07);
    border-color: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

[data-theme="light"] .health-green {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.25);
}
[data-theme="light"] .health-yellow {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.25);
}
[data-theme="light"] .health-red {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.25);
}

@media (max-width: 640px) {
    .health-bar-right { display: none; }
}

/* --- KPI Card row for delta + footer side-by-side --- */
.metric-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* --- Sparkline mini-chart inside KPI cards --- */
.sparkline-canvas {
    width: 100% !important;
    height: 40px !important;
    margin-top: 4px;
    opacity: 0.75;
}

/* --- KPI Delta badges --- */
.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
}

.kpi-delta-up {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
}

.kpi-delta-down {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-failure);
}

[data-theme="light"] .kpi-delta-up {
    background: rgba(16, 185, 129, 0.1);
}
[data-theme="light"] .kpi-delta-down {
    background: rgba(239, 68, 68, 0.1);
}

/* --- Stream Mini-Cards Grid --- */
.stream-mini-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

@media (max-width: 1024px) {
    .stream-mini-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stream-mini-grid {
        grid-template-columns: 1fr;
    }
}

.stream-mini-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border-top: 3px solid var(--smc-color, var(--accent-primary));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stream-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--smc-color, var(--accent-primary));
}

.smc-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.smc-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--smc-color, var(--accent-primary));
    flex-shrink: 0;
}

[data-theme="light"] .smc-icon {
    background: rgba(0, 0, 0, 0.04);
}

.smc-title {
    font-family: var(--font-header);
    font-weight: 650;
    font-size: 0.875rem;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smc-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    flex-shrink: 0;
}

.smc-live {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.smc-live .pulse-dot {
    width: 5px;
    height: 5px;
    background: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--color-success);
    animation: pulse 1.5s infinite;
}

.smc-empty {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

.smc-error {
    background: var(--color-failure-bg);
    color: var(--color-failure);
}

.smc-loading {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.smc-metrics {
    display: flex;
    align-items: center;
    gap: 10px;
}

.smc-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    flex: 1;
}

.smc-val {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.smc-label {
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.smc-sep {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    flex-shrink: 0;
}

.smc-no-data {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Channel Donut empty state container --- */
.channel-donut-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    padding: 20px;
}

/* --- Executive Summary Strip --- */
.executive-summary-strip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

[data-theme="light"] .executive-summary-strip {
    background: rgba(79, 70, 229, 0.04);
    border-color: rgba(79, 70, 229, 0.12);
    color: #334155;
}

.executive-summary-strip strong {
    color: var(--text-primary);
    font-weight: 700;
}

[data-theme="light"] .executive-summary-strip strong {
    color: #0f172a;
}

/* Inline coloured summary text spans */
.summ-good { color: var(--color-success); font-weight: 700; }
.summ-warn { color: var(--color-warning); font-weight: 700; }
.summ-bad  { color: var(--color-failure); font-weight: 700; }

/* --- Stream Performance Comparison Panel --- */
#stream-perf-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.sp-row {
    display: grid;
    grid-template-columns: 220px 1fr 420px;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: background 0.2s, transform 0.15s;
}

.sp-row:hover {
    background: rgba(255,255,255,0.04);
    transform: translateX(2px);
}

[data-theme="light"] .sp-row {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] .sp-row:hover {
    background: #f1f5f9;
}

.sp-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sp-name {
    font-weight: 650;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.sp-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sp-bar-track {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 100px;
    overflow: hidden;
}

[data-theme="light"] .sp-bar-track {
    background: #e2e8f0;
}

.sp-bar-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.85;
}

.sp-total-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 52px;
    text-align: right;
}

.sp-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    flex-wrap: wrap;
}

.sp-rate {
    font-family: var(--font-header);
    font-weight: 800;
    font-size: 1rem;
    min-width: 52px;
}

.sp-divider {
    color: var(--text-muted);
    opacity: 0.5;
}

.sp-detail {
    color: var(--text-secondary);
}

.sp-detail strong {
    color: var(--text-primary);
    font-weight: 700;
}

.sp-no-data {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.82rem;
}

@media (max-width: 900px) {
    .sp-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .sp-stats { flex-wrap: wrap; gap: 6px; }
}

/* --- Realtime Auto-Refresh Indicators --- */

/* Sync tag in header subtitle */
.header-sync-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    margin-left: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    vertical-align: middle;
}

[data-theme="light"] .header-sync-tag {
    background: #e2e8f0;
    color: #64748b;
}

/* Spinning indicator on refresh button during silent fetch */
.btn.refreshing i.fa-arrows-rotate {
    animation: spin-refresh 0.8s linear infinite;
}

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

/* New Data Toast Notification */
.new-data-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-secondary);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-left: 4px solid var(--color-success);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 280px;
    max-width: 380px;
    /* Hidden by default */
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.new-data-toast i:first-child {
    color: var(--color-success);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.new-data-toast strong {
    color: var(--color-success);
}

.new-data-toast.toast-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: color 0.15s;
}

.toast-close:hover { color: var(--text-primary); }

[data-theme="light"] .new-data-toast {
    background: #ffffff;
    border-color: rgba(16, 185, 129, 0.3);
    border-left-color: var(--color-success);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

/* --- Fchat Recipient Components --- */
.fchat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
    user-select: none;
    transition: background 0.15s;
}

.fchat-badge:hover {
    background: rgba(59, 130, 246, 0.18);
}

[data-theme="light"] .fchat-badge {
    background: rgba(59, 130, 246, 0.07);
    border-color: rgba(59, 130, 246, 0.18);
}

.fchat-badge-small {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 100px;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    margin-left: 5px;
    vertical-align: middle;
}

.fchat-recipients-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-height: 200px;
    overflow-y: auto;
}

[data-theme="light"] .fchat-recipients-list {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.fchat-email-chip {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 6px;
    white-space: nowrap;
}

[data-theme="light"] .fchat-email-chip {
    background: rgba(59, 130, 246, 0.06);
    color: #334155;
}

/* --- Status dot inside timeline item --- */
.tl-status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}

.tl-status-dot.success { background: var(--color-success); }
.tl-status-dot.failure { background: var(--color-failure); }

