/* ═══════════════════════════════════════════════════════════════════════════
   MetaSupport – Modern Design System
   Inspired by eliastech.tech – Navy, Electric Blue, Clean & Lightweight
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables / Theme ──────────────────────────────────────────────── */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-glow: rgba(37, 99, 235, 0.15);
    --accent: #06b6d4;
    --accent-light: #ecfeff;

    --facebook: #1877F2;
    --instagram: #E4405F;
    --whatsapp: #25D366;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --purple: #8b5cf6;
    --teal: #14b8a6;

    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: rgba(255,255,255,0.06);
    --bg-sidebar-active: var(--primary);

    --text: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    --sidebar-width: 250px;
    --sidebar-collapsed: 68px;
    --topbar-height: 60px;
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --bg-sidebar-hover: rgba(255,255,255,0.05);
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --primary-light: rgba(37, 99, 235, 0.15);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
}

/* Dark mode: ensure all text and surfaces are readable in every section */
[data-theme="dark"] .section-header h2,
[data-theme="dark"] .info-value,
[data-theme="dark"] .detail-value,
[data-theme="dark"] .ticket-subject,
[data-theme="dark"] .message-media-file .file-name { color: var(--text); }

[data-theme="dark"] .alert-success { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
[data-theme="dark"] .alert-error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
[data-theme="dark"] .alert-warning { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }
[data-theme="dark"] .alert-info { background: rgba(37, 99, 235, 0.2); color: #93c5fd; border-color: rgba(37, 99, 235, 0.4); }

[data-theme="dark"] .stat-card-gradient-blue { background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, var(--bg-card) 100%); border-color: rgba(37, 99, 235, 0.35); color: var(--text); }
[data-theme="dark"] .stat-card-gradient-pink { background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, var(--bg-card) 100%); border-color: rgba(239, 68, 68, 0.3); color: var(--text); }
[data-theme="dark"] .stat-card-gradient-green { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, var(--bg-card) 100%); border-color: rgba(16, 185, 129, 0.35); color: var(--text); }
[data-theme="dark"] .stat-card-gradient-orange { background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, var(--bg-card) 100%); border-color: rgba(245, 158, 11, 0.35); color: var(--text); }

[data-theme="dark"] .btn-danger:hover { background: rgba(239, 68, 68, 0.2) !important; color: #fca5a5 !important; }

[data-theme="dark"] .badge-success { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
[data-theme="dark"] .badge-danger { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .badge-warning { background: rgba(245, 158, 11, 0.25); color: #fcd34d; }
[data-theme="dark"] .badge-info { background: rgba(37, 99, 235, 0.25); color: #93c5fd; }
[data-theme="dark"] .badge-outline { color: var(--text-secondary); border-color: var(--border); }
[data-theme="dark"] .badge-draft { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
[data-theme="dark"] .badge-scheduled { background: rgba(245, 158, 11, 0.25); color: #fcd34d; }
[data-theme="dark"] .badge-published { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
[data-theme="dark"] .badge-failed { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .badge-publishing { background: rgba(37, 99, 235, 0.25); color: #93c5fd; }

[data-theme="dark"] .priority-low { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
[data-theme="dark"] .priority-normal { background: rgba(37, 99, 235, 0.25); color: #93c5fd; }
[data-theme="dark"] .priority-high { background: rgba(245, 158, 11, 0.25); color: #fcd34d; }
[data-theme="dark"] .priority-urgent { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .status-open { background: rgba(37, 99, 235, 0.25); color: #93c5fd; }
[data-theme="dark"] .status-pending { background: rgba(245, 158, 11, 0.25); color: #fcd34d; }
[data-theme="dark"] .status-resolved { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
[data-theme="dark"] .status-closed { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
[data-theme="dark"] .sentiment-positive { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
[data-theme="dark"] .sentiment-negative { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .sentiment-neutral { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
[data-theme="dark"] .assigned-badge { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); }

[data-theme="dark"] .message-media-file { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .message-media-file:hover { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .message-media-file .file-icon.pdf { background: rgba(239, 68, 68, 0.3); color: #fca5a5; }
[data-theme="dark"] .message-media-file .file-icon.doc { background: rgba(37, 99, 235, 0.3); color: #93c5fd; }
[data-theme="dark"] .message-media-file .file-icon.generic { background: var(--border); color: var(--text-light); }

[data-theme="dark"] .ai-suggestion-bar { background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(37, 99, 235, 0.1) 100%); }
[data-theme="dark"] .ai-suggestion-content { color: var(--text); }
[data-theme="dark"] .activity-icon.post { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
[data-theme="dark"] .activity-icon.conversation { background: var(--primary-light); color: #93c5fd; }

[data-theme="dark"] .ticket-row.sla-breached { background: rgba(239, 68, 68, 0.12); }
[data-theme="dark"] .ticket-row.sla-breached:hover { background: rgba(239, 68, 68, 0.18); }
[data-theme="dark"] .stat-card.mini.stat-breach .stat-value { color: #fca5a5; }
[data-theme="dark"] .sla-badge.breached { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .sla-badge.ok { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }

[data-theme="dark"] .toast-success { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
[data-theme="dark"] .toast-error { background: rgba(239, 68, 68, 0.25); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
[data-theme="dark"] .toast-warning { background: rgba(245, 158, 11, 0.25); color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }
[data-theme="dark"] .toast-info { background: rgba(37, 99, 235, 0.25); color: #93c5fd; border-color: rgba(37, 99, 235, 0.4); }

[data-theme="dark"] .status-dot { background: var(--text-light); }
[data-theme="dark"] .status-dot.active { background: var(--success); }
[data-theme="dark"] .ai-reply-box,
[data-theme="dark"] .ai-alt-reply,
[data-theme="dark"] .ai-test-result { color: var(--text); }
[data-theme="dark"] .progress-bar-label { color: var(--text); }
[data-theme="dark"] .auth-divider span { color: var(--text-light); }

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

::selection { background: var(--primary); color: #fff; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed; left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    display: flex; flex-direction: column;
    z-index: 1000;
    transition: var(--transition-slow);
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.15rem; font-weight: 700;
    white-space: nowrap; letter-spacing: -0.3px;
}
.logo i { font-size: 1.4rem; color: var(--primary); }

.sidebar-toggle {
    background: none; border: none; color: rgba(255,255,255,0.5);
    cursor: pointer; padding: 6px; border-radius: var(--radius-sm);
    font-size: 1rem; transition: var(--transition);
}
.sidebar-toggle:hover { color: #fff; background: var(--bg-sidebar-hover); }

.sidebar-nav {
    display: flex; flex-direction: column;
    padding: 8px 10px;
    flex: 1; gap: 2px;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 14px;
    color: rgba(255,255,255,0.55);
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.88rem; font-weight: 500;
    text-decoration: none !important;
    white-space: nowrap;
    position: relative;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: rgba(255,255,255,0.9); }
.nav-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.nav-item i { width: 18px; text-align: center; font-size: 0.95rem; flex-shrink: 0; }

.sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 14px; }

.sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,0.06); }

.user-info {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
}
.user-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: #fff;
    flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-weight: 600; font-size: 0.82rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: rgba(255,255,255,0.4); }

.logout-btn { margin-top: 2px; }
.logout-btn:hover { color: var(--danger) !important; }

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1; min-height: 100vh;
    transition: var(--transition-slow);
    background: var(--bg);
}

.topbar {
    height: var(--topbar-height);
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 100;
}
[data-theme="dark"] .topbar { background: rgba(15,23,42,0.85); }

.topbar-left { display: flex; align-items: center; gap: 14px; }
.mobile-menu-btn {
    display: none; background: none; border: none;
    font-size: 1.2rem; cursor: pointer; color: var(--text);
    padding: 4px;
}
.page-title { font-size: 1.15rem; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 7px 16px; min-width: 260px;
    transition: var(--transition);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-box i { color: var(--text-light); font-size: 0.82rem; }
.search-box input {
    border: none; background: none; outline: none;
    font-family: var(--font); font-size: 0.85rem; color: var(--text);
    width: 100%;
}

.topbar-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border); background: var(--bg-card);
    cursor: pointer; position: relative;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 0.95rem;
    transition: var(--transition);
}
.topbar-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ─── Notification Bell & Badge ──────────────────────────────────────────── */
.notif-wrapper { position: relative; }

.notif-count-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    background: var(--danger); color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.62rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-card);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}
@keyframes badgePop {
    0% { transform: scale(0); }
    80% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Sidebar nav badge */
.nav-badge {
    position: absolute; right: 10px;
    min-width: 18px; height: 18px;
    background: var(--danger); color: #fff;
    font-size: 0.6rem; font-weight: 800;
    padding: 0 5px;
    border-radius: var(--radius-full);
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    animation: badgePop 0.3s ease;
}

/* ─── Notification Dropdown ─────────────────────────────────────────────── */
.notif-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0,0,0,0.03);
    z-index: 1000;
    opacity: 0; visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.notif-dropdown.open {
    opacity: 1; visibility: visible;
    transform: translateY(0) scale(1);
}

.notif-dropdown-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
}
.notif-dropdown-header h4 {
    font-size: 0.92rem; font-weight: 700; color: var(--text);
    margin: 0;
}
.notif-view-all {
    font-size: 0.78rem; font-weight: 600; color: var(--primary);
    text-decoration: none;
}
.notif-view-all:hover { text-decoration: underline; }

.notif-dropdown-body {
    max-height: 360px; overflow-y: auto;
}

.notif-dropdown-footer {
    padding: 10px 18px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}

.notif-summary {
    display: flex; align-items: center; gap: 14px;
    font-size: 0.75rem; font-weight: 600; color: var(--text-secondary);
}
.notif-summary span { display: flex; align-items: center; gap: 4px; }
.notif-summary i { font-size: 0.7rem; }

/* Notification items */
.notif-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px;
    text-decoration: none !important;
    color: var(--text);
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.notif-unread { background: var(--primary-light); }
.notif-item.notif-unread:hover { background: #dbeafe; }

.notif-item-avatar {
    width: 38px; height: 38px;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}

.notif-item-content { flex: 1; min-width: 0; }

.notif-item-title {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.notif-item-title strong {
    font-size: 0.84rem; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notif-item-time {
    font-size: 0.7rem; color: var(--text-light);
    white-space: nowrap; flex-shrink: 0;
}

.notif-item-desc {
    font-size: 0.76rem; color: var(--text-secondary);
    display: flex; align-items: center; gap: 4px;
    margin-top: 2px;
}
.notif-item-desc i { font-size: 0.68rem; }

.notif-priority {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px;
    background: var(--danger); color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.6rem; font-weight: 900;
    margin-left: 4px;
}

.notif-dot {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    width: 8px; height: 8px;
    background: var(--primary); border-radius: var(--radius-full);
    box-shadow: 0 0 0 2px var(--bg-card);
}

/* Empty state */
.notif-empty {
    text-align: center; padding: 30px 20px;
    color: var(--text-secondary);
}
.notif-empty i { font-size: 1.8rem; margin-bottom: 8px; opacity: 0.3; display: block; }
.notif-empty p { font-weight: 600; font-size: 0.88rem; margin: 0; color: var(--text); }
.notif-empty span { font-size: 0.78rem; color: var(--text-light); }

.notif-loading {
    text-align: center; padding: 24px;
    color: var(--text-light); font-size: 0.82rem;
}

.content-wrapper { padding: 24px; max-width: 1400px; }

/* ─── Messages / Alerts ──────────────────────────────────────────────────── */
.messages-container { padding: 14px 24px 0; }

.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    font-weight: 500; font-size: 0.88rem;
    animation: slideDown 0.3s ease;
    border: 1px solid transparent;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

.alert-close {
    margin-left: auto; background: none; border: none;
    font-size: 1.2rem; cursor: pointer; opacity: 0.5; color: inherit;
}
.alert-close:hover { opacity: 1; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.card-header h3 {
    font-size: 0.95rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    color: var(--text);
}
.card-header h3 i { color: var(--text-secondary); font-size: 0.88rem; }
.card-body { padding: 20px; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px; margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: 18px;
    display: flex; align-items: center; gap: 14px;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.stat-content { display: flex; flex-direction: column; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1.2; letter-spacing: -0.5px; }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; letter-spacing: 0.2px; }

.stat-bg-icon {
    position: absolute; right: 10px; bottom: -6px;
    font-size: 3.5rem; opacity: 0.04; color: var(--text);
}

/* Gradient stat cards */
.stat-card-gradient-blue { background: linear-gradient(135deg, #eff6ff 0%, #fff 100%); border-color: #bfdbfe; }
.stat-card-gradient-pink { background: linear-gradient(135deg, #fef2f2 0%, #fff 100%); border-color: #fecaca; }
.stat-card-gradient-green { background: linear-gradient(135deg, #ecfdf5 0%, #fff 100%); border-color: #a7f3d0; }
.stat-card-gradient-orange { background: linear-gradient(135deg, #fffbeb 0%, #fff 100%); border-color: #fde68a; }

/* ─── Grid Layouts ───────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px;
    border: none; border-radius: var(--radius);
    font-family: var(--font); font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    text-decoration: none !important; white-space: nowrap;
    line-height: 1.4; letter-spacing: 0.1px;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-primary {
    background: var(--primary); color: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-outline {
    background: var(--bg-card); color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-outline.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.btn-danger { color: var(--danger) !important; }
.btn-danger:hover { border-color: var(--danger) !important; background: #fef2f2 !important; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-facebook {
    background: linear-gradient(135deg, #1877F2, #0c5dc7);
    color: #fff; font-size: 0.95rem; padding: 12px 24px;
    box-shadow: 0 2px 8px rgba(24,119,242,0.35);
}
.btn-facebook:hover { background: linear-gradient(135deg, #1565D8, #0b52b5); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 5px;
    font-weight: 600; font-size: 0.82rem; color: var(--text);
}

.form-control {
    width: 100%; padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font); font-size: 0.88rem;
    color: var(--text); background: var(--bg-card);
    transition: var(--transition);
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-light); }

.textarea-lg { min-height: 110px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    padding-top: 14px; border-top: 1px solid var(--border-light);
    margin-top: 18px;
}

.input-icon { position: relative; }
.input-icon i {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--text-light); font-size: 0.88rem;
}
.input-icon input { padding-left: 38px; }

.select-sm {
    padding: 5px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font); font-size: 0.8rem;
    color: var(--text); background: var(--bg-card);
    cursor: pointer;
}
.select-sm:focus { outline: none; border-color: var(--primary); }

.input-action-group { display: flex; gap: 8px; align-items: flex-start; }
.input-action-group .form-control { flex: 1; }
.char-count { text-align: right; font-size: 0.75rem; color: var(--text-light); margin-top: 4px; }

.toggle-switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--border); border-radius: var(--radius-full);
    transition: var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute;
    height: 16px; width: 16px; left: 3px; bottom: 3px;
    background: #fff; border-radius: var(--radius-full);
    transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600; text-transform: capitalize;
}
.badge-success { background: #ecfdf5; color: #065f46; }
.badge-danger { background: #fef2f2; color: #991b1b; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-info { background: #eff6ff; color: #1e40af; }
.badge-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-scheduled { background: #fffbeb; color: #92400e; }
.badge-published { background: #ecfdf5; color: #065f46; }
.badge-failed { background: #fef2f2; color: #991b1b; }
.badge-publishing { background: #eff6ff; color: #1e40af; }
.badge-sm { font-size: 0.65rem; padding: 1px 6px; }

/* ─── Page Header ────────────────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header p { color: var(--text-secondary); margin: 0; font-size: 0.88rem; }
.page-header-info { display: flex; align-items: center; gap: 12px; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.header-actions { display: flex; gap: 8px; align-items: center; }

.section-header {
    display: flex; align-items: center; gap: 10px;
    margin: 24px 0 14px;
}
.section-header h2 {
    font-size: 1.05rem; font-weight: 700;
    display: flex; align-items: center; gap: 10px;
}

/* ─── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 18px; flex-wrap: wrap;
}
.filter-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.8rem; font-weight: 500;
    color: var(--text-secondary); background: var(--bg-card);
    transition: var(--transition);
    text-decoration: none !important;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-form .filter-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.filter-form .filter-item { flex: 1; min-width: 140px; }
.filter-form .filter-actions { min-width: 160px; }
.filter-form .btn-group { display: flex; gap: 6px; }

.search-box-inline {
    display: flex; align-items: center; gap: 6px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 5px 12px;
    margin-left: auto; background: var(--bg-card);
}
.search-box-inline input {
    border: none; background: none; outline: none;
    font-family: var(--font); font-size: 0.82rem;
    color: var(--text); width: 180px;
}
.search-box-inline i { color: var(--text-light); }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 10px 14px; text-align: left;
    border-bottom: 1px solid var(--border-light); font-size: 0.85rem;
}
.table th {
    font-weight: 600; color: var(--text-secondary);
    font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }

/* ─── Platform Elements ──────────────────────────────────────────────────── */
.platform-badge {
    width: 38px; height: 38px;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1rem; flex-shrink: 0;
}
.platform-badge-sm {
    width: 26px; height: 26px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.75rem; flex-shrink: 0;
}
.platform-tag {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.78rem; font-weight: 500;
}
.platform-dot {
    position: absolute; bottom: -2px; right: -2px;
    width: 14px; height: 14px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-card);
}

/* ─── Page List Items ────────────────────────────────────────────────────── */
.page-list-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.page-list-item:last-child { border-bottom: none; }
.page-list-info { display: flex; align-items: center; gap: 10px; }
.page-list-name { font-weight: 600; font-size: 0.88rem; }
.page-list-platform { font-size: 0.75rem; color: var(--text-secondary); display: block; }
.page-list-followers { font-size: 0.8rem; color: var(--text-light); }

/* ─── Page Selector ─────────────────────────────────────────────────────── */
.page-selector { display: flex; flex-direction: column; gap: 6px; }
.page-selector-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border: 1.5px solid var(--border);
    border-radius: var(--radius); cursor: pointer;
    transition: var(--transition);
}
.page-selector-item:hover { border-color: var(--primary); background: var(--primary-light); }
.page-selector-item input:checked ~ .page-selector-content { font-weight: 600; }
.page-selector-item input { margin-right: 4px; accent-color: var(--primary); }
.page-selector-content { display: flex; align-items: center; gap: 8px; flex: 1; }
.page-selector-name { font-weight: 500; display: block; }
.page-selector-platform { font-size: 0.75rem; color: var(--text-secondary); display: block; }

/* ─── Avatar System ──────────────────────────────────────────────────────── */
.avatar-lg { width: 52px; height: 52px; border-radius: var(--radius-full); object-fit: cover; }
.avatar-md { width: 40px; height: 40px; border-radius: var(--radius-full); object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; border-radius: var(--radius-full); object-fit: cover; }
.avatar-xs {
    width: 24px; height: 24px; border-radius: var(--radius-full);
    background: var(--primary-light); color: var(--primary);
    font-size: 0.65rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.avatar-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; font-weight: 700; font-size: 0.82rem;
}
.avatar-placeholder.avatar-xs { font-size: 0.6rem; }
.avatar-online { box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3.5px var(--success); }

/* ─── Posts ───────────────────────────────────────────────────────────────── */
.posts-list { display: flex; flex-direction: column; gap: 14px; }
.post-card .card-body { padding: 18px; }
.post-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
}
.post-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-content { margin-bottom: 10px; }
.post-content p { color: var(--text); font-size: 0.92rem; line-height: 1.6; }
.post-media-preview { max-width: 100%; border-radius: var(--radius-lg); overflow: hidden; margin-top: 8px; }
.post-media-preview img { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius-lg); }
.post-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 10px; border-top: 1px solid var(--border-light);
    flex-wrap: wrap; gap: 6px;
}
.post-pages-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.post-actions-bar { display: flex; gap: 10px; justify-content: flex-end; }
.post-stats { display: flex; gap: 16px; }
.post-stats .stat-item { display: flex; align-items: center; gap: 5px; color: var(--text-secondary); font-size: 0.82rem; }
.post-stats .stat-item i { font-size: 0.78rem; }
.post-detail-content { margin-bottom: 18px; }
.post-detail-content p { font-size: 1rem; line-height: 1.7; }
.post-detail-media { max-width: 600px; border-radius: var(--radius-lg); margin-top: 10px; }
.post-detail-link { display: inline-flex; align-items: center; gap: 5px; color: var(--primary); margin-top: 6px; }
.post-detail-meta {
    display: flex; gap: 18px; flex-wrap: wrap;
    padding-top: 14px; border-top: 1px solid var(--border-light);
    color: var(--text-secondary); font-size: 0.82rem;
}
.post-detail-meta span { display: flex; align-items: center; gap: 5px; }
.post-preview { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.preview-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.preview-content { font-size: 0.92rem; }

/* ─── Inbox ──────────────────────────────────────────────────────────────── */
.inbox-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.inbox-stat { font-size: 0.88rem; color: var(--text-secondary); }
.inbox-stat strong { color: var(--text); }
.inbox-list { display: flex; flex-direction: column; }

.inbox-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
    transition: var(--transition);
    text-decoration: none !important; color: var(--text);
}
.inbox-item:hover { background: var(--bg); }
.inbox-item.unread { background: var(--primary-light); border-left: 3px solid var(--primary); }
.inbox-item.unread .inbox-customer-name { font-weight: 700; }
.inbox-item-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.inbox-avatar { position: relative; flex-shrink: 0; }
.inbox-item-content { flex: 1; min-width: 0; }
.inbox-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.inbox-customer-name { font-weight: 600; font-size: 0.9rem; }
.inbox-time { font-size: 0.75rem; color: var(--text-light); white-space: nowrap; }
.inbox-item-subject { font-size: 0.8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.inbox-item-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.unread-dot { width: 8px; height: 8px; background: var(--primary); border-radius: var(--radius-full); flex-shrink: 0; }

/* Priority & Status Badges */
.priority-badge, .status-badge, .sentiment-badge, .assigned-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: var(--radius-full);
    font-size: 0.68rem; font-weight: 600; color: #fff; white-space: nowrap;
}
.priority-low { background: #ecfdf5; color: #065f46; }
.priority-normal { background: #eff6ff; color: #1e40af; }
.priority-high { background: #fffbeb; color: #92400e; }
.priority-urgent { background: #fef2f2; color: #991b1b; }
.status-open { background: #eff6ff; color: #1e40af; }
.status-pending { background: #fffbeb; color: #92400e; }
.status-resolved { background: #ecfdf5; color: #065f46; }
.status-closed { background: #f1f5f9; color: #475569; }
.sentiment-positive { background: #ecfdf5; color: #065f46; }
.sentiment-negative { background: #fef2f2; color: #991b1b; }
.sentiment-neutral { background: #f1f5f9; color: #475569; }
.assigned-badge { background: #f1f5f9; color: var(--text-secondary); }
.priority-dot { width: 7px; height: 7px; border-radius: var(--radius-full); flex-shrink: 0; }
.priority-dot.priority-low { background: var(--success); }
.priority-dot.priority-normal { background: var(--primary); }
.priority-dot.priority-high { background: var(--warning); }
.priority-dot.priority-urgent { background: var(--danger); }

/* ─── Conversation Detail ────────────────────────────────────────────────── */
.conversation-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; min-height: calc(100vh - 140px); }
.conversation-main {
    display: flex; flex-direction: column;
    background: var(--bg-card); border-radius: var(--radius-xl);
    border: 1px solid var(--border); overflow: hidden;
}
.conversation-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap; gap: 8px;
}
.conversation-header-left { display: flex; align-items: center; gap: 10px; }
.conversation-header-left h3 { font-size: 0.95rem; margin: 0; }
.conversation-header-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.conversation-avatar { position: relative; }

.messages-thread {
    flex: 1; overflow-y: auto; padding: 18px;
    display: flex; flex-direction: column; gap: 10px;
    max-height: calc(100vh - 360px); background: var(--bg);
}
.message-bubble {
    max-width: 70%; padding: 10px 14px;
    border-radius: var(--radius-xl); font-size: 0.9rem; line-height: 1.5;
}
.message-bubble.inbound {
    align-self: flex-start; background: var(--bg-card);
    border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.message-bubble.outbound {
    align-self: flex-end; background: var(--primary);
    color: #fff; border-bottom-right-radius: 4px;
}
.message-sender { font-size: 0.75rem; font-weight: 600; margin-bottom: 3px; opacity: 0.75; display: flex; align-items: center; gap: 5px; }
.message-time { font-size: 0.7rem; opacity: 0.5; margin-top: 4px; text-align: right; }
/* ─── Message Media (images, videos, audio, files) ─────────────────────────── */
.message-media {
    max-width: 280px; border-radius: var(--radius-lg); overflow: hidden;
    margin-top: 8px; position: relative;
}
.message-media img {
    width: 100%; max-height: 240px; object-fit: cover; display: block;
    border-radius: var(--radius-lg); cursor: pointer; transition: opacity 0.2s;
}
.message-media img:hover { opacity: 0.9; }
.message-media video {
    width: 100%; max-height: 260px; object-fit: contain; display: block;
    border-radius: var(--radius-lg); background: #000;
}
.message-media audio {
    width: 100%; min-width: 200px; margin-top: 4px;
}
.message-media-file {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-lg);
    background: rgba(0,0,0,0.05); margin-top: 6px; text-decoration: none;
    color: inherit; transition: background 0.15s;
}
.message-media-file:hover { background: rgba(0,0,0,0.08); }
.message-media-file .file-icon {
    width: 36px; height: 36px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.message-media-file .file-icon.pdf { background: #fde8e8; color: #dc3545; }
.message-media-file .file-icon.doc { background: #e3effe; color: #2563eb; }
.message-media-file .file-icon.generic { background: var(--bg); color: var(--text-light); }
.message-media-file .file-info { flex: 1; min-width: 0; }
.message-media-file .file-name {
    font-size: 0.78rem; font-weight: 500; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.message-media-file .file-meta { font-size: 0.68rem; color: var(--text-light); }
.message-media-file .file-download {
    font-size: 0.85rem; color: var(--primary); flex-shrink: 0;
}
.outbound .message-media-file {
    background: rgba(255,255,255,0.15);
}
.outbound .message-media-file .file-name,
.outbound .message-media-file .file-meta { color: rgba(255,255,255,0.9); }
.outbound .message-media-file .file-download { color: rgba(255,255,255,0.8); }
.message-media-badge {
    position: absolute; top: 6px; left: 6px;
    padding: 2px 8px; border-radius: var(--radius-full);
    font-size: 0.6rem; font-weight: 600; text-transform: uppercase;
    background: rgba(0,0,0,0.55); color: #fff; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 3px;
}
.msg-video-poster {
    position: relative; cursor: pointer; width: 100%;
}
.msg-video-poster img {
    width: 100%; max-height: 240px; object-fit: cover; display: block;
}
.msg-video-play-btn {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.35); transition: background 0.2s;
}
.msg-video-poster:hover .msg-video-play-btn { background: rgba(0,0,0,0.5); }
.msg-video-play-btn span {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255,255,255,0.9); display: flex;
    align-items: center; justify-content: center;
    font-size: 1.1rem; color: var(--primary);
    box-shadow: 0 3px 12px rgba(0,0,0,0.25); transition: transform 0.15s;
}
.msg-video-poster:hover .msg-video-play-btn span { transform: scale(1.1); }
/* Lightbox for inbox media */
.inbox-lightbox {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.88); display: none;
    align-items: center; justify-content: center;
    flex-direction: column;
}
.inbox-lightbox.open { display: flex; }
.inbox-lightbox-close {
    position: absolute; top: 14px; right: 18px;
    font-size: 1.8rem; color: #fff; background: none;
    border: none; cursor: pointer; z-index: 10; opacity: 0.8;
    transition: opacity 0.15s;
}
.inbox-lightbox-close:hover { opacity: 1; }
.inbox-lightbox-content { max-width: 92vw; max-height: 88vh; }
.inbox-lightbox-content img { max-width: 92vw; max-height: 88vh; border-radius: 8px; }
.inbox-lightbox-content video { max-width: 92vw; max-height: 88vh; border-radius: 8px; background: #000; }

@media (max-width: 600px) {
    .message-media { max-width: 100%; }
    .message-media img { max-height: 180px; }
    .message-media video { max-height: 200px; }
}

.ai-badge {
    display: inline-flex; align-items: center; gap: 3px;
    background: var(--purple); color: #fff;
    font-size: 0.6rem; padding: 1px 5px; border-radius: var(--radius-full);
}

/* AI Suggestion */
.ai-suggestion-bar {
    background: linear-gradient(135deg, #f5f3ff 0%, #eff6ff 100%);
    border-top: 1px solid var(--border); padding: 12px 18px;
}
.ai-suggestion-header { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--purple); margin-bottom: 6px; }
.ai-confidence { margin-left: auto; font-size: 0.72rem; color: var(--text-secondary); }
.ai-suggestion-content { font-size: 0.88rem; margin-bottom: 8px; }
.ai-suggestion-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Reply Box */
.reply-box { border-top: 1px solid var(--border); padding: 10px 18px; }
.reply-toolbar { display: flex; gap: 3px; margin-bottom: 6px; }
.toolbar-btn {
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    border: none; background: transparent; cursor: pointer;
    color: var(--text-secondary); display: flex; align-items: center;
    justify-content: center; transition: var(--transition);
}
.toolbar-btn:hover { background: var(--bg); color: var(--primary); }
.reply-box form { display: flex; gap: 8px; align-items: flex-end; }
.reply-box textarea {
    flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 9px 12px; font-family: var(--font); font-size: 0.88rem;
    resize: none; outline: none; color: var(--text); background: var(--bg-card);
}
.reply-box textarea:focus { border-color: var(--primary); }

/* Conversation Sidebar */
.conversation-sidebar {
    background: var(--bg-card); border-radius: var(--radius-xl);
    border: 1px solid var(--border); padding: 18px; height: fit-content;
}
.sidebar-section { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border-light); }
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section h4 { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.info-item { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; }
.info-label { font-size: 0.8rem; color: var(--text-secondary); }
.info-value { font-size: 0.82rem; font-weight: 500; }

.sentiment-display { display: flex; align-items: center; gap: 6px; font-size: 0.92rem; font-weight: 600; }
.sentiment-display.sentiment-positive { color: var(--success); }
.sentiment-display.sentiment-negative { color: var(--danger); }
.sentiment-display.sentiment-neutral { color: var(--text-secondary); }

.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { display: inline-flex; padding: 2px 8px; background: var(--bg); border-radius: var(--radius-full); font-size: 0.75rem; color: var(--text-secondary); }

/* ─── Charts ─────────────────────────────────────────────────────────────── */
.chart-container { position: relative; min-height: 280px; }
.engagement-bar { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 0.85rem; }
.engagement-bar::before { content: ''; display: inline-block; width: var(--width, 0%); max-width: 100px; height: 5px; background: var(--primary); border-radius: var(--radius-full); }
.satisfaction-bar { display: flex; align-items: center; gap: 6px; }
.satisfaction-fill { height: 5px; border-radius: var(--radius-full); background: var(--success); min-width: 4px; }

/* ─── Analytics Platform Cards ───────────────────────────────────────────── */
.platform-card { position: relative; overflow: hidden; }
.platform-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.platform-facebook::before { background: var(--facebook); }
.platform-instagram::before { background: var(--instagram); }
.platform-whatsapp::before { background: var(--whatsapp); }
.platform-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.platform-stat { text-align: center; }
.platform-stat-value { display: block; font-size: 1.3rem; font-weight: 800; color: var(--text); }
.platform-stat-label { display: block; font-size: 0.72rem; color: var(--text-secondary); }

/* ─── Team ───────────────────────────────────────────────────────────────── */
.team-card .card-body { padding: 18px; }
.team-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.team-header h3 { font-size: 1rem; }
.team-stats-mini { display: flex; gap: 10px; font-size: 0.8rem; color: var(--text-secondary); }
.team-stats-mini span { display: flex; align-items: center; gap: 3px; }
.team-members-preview { display: flex; gap: -4px; margin-bottom: 10px; }
.team-members-preview .avatar-xs { margin-left: -4px; border: 2px solid var(--bg-card); }
.more-members { font-size: 0.75rem; color: var(--text-secondary); margin-left: 4px; }
.members-list { display: flex; flex-direction: column; gap: 8px; }
.member-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.member-item:last-child { border-bottom: none; }
.member-info { display: flex; align-items: center; gap: 8px; }
.member-actions { display: flex; align-items: center; gap: 6px; }
.rank-badge { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: var(--radius-full); font-weight: 800; font-size: 0.8rem; }
.rank-badge.gold { background: #fbbf24; color: #78350f; }
.rank-badge.silver { background: #d1d5db; color: #374151; }
.rank-badge.bronze { background: #d97706; color: #fff; }

/* ─── AI Support ─────────────────────────────────────────────────────────── */
.quick-reply-item, .automation-rule-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--border-light);
}
.quick-reply-item:last-child, .automation-rule-item:last-child { border-bottom: none; }
.rule-card { transition: var(--transition); }
.rule-card.rule-inactive { opacity: 0.6; }
.rule-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rule-title { display: flex; align-items: center; gap: 10px; }
.rule-title h4 { font-size: 0.95rem; }
.rule-flow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: var(--radius); }
.rule-flow i { color: var(--text-light); }
.rule-trigger, .rule-action { display: flex; align-items: center; gap: 6px; }
.rule-label { font-size: 0.7rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: var(--radius-full); background: #ccc; }
.status-dot.active { background: var(--success); }
.ai-test-result { margin-top: 14px; padding: 14px; background: var(--bg); border-radius: var(--radius); }
.ai-reply-box { padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 6px; }
.ai-alt-reply { padding: 7px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 4px; font-size: 0.85rem; }

/* ─── Empty State ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-secondary); }
.empty-state i { font-size: 2.5rem; margin-bottom: 14px; opacity: 0.2; display: block; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; font-size: 1.1rem; }
.empty-state p { margin-bottom: 16px; }

/* ─── Activity Feed ──────────────────────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; gap: 10px; }
.activity-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
.activity-icon { width: 30px; height: 30px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; }
.activity-icon.conversation { background: var(--primary-light); color: var(--primary); }
.activity-icon.post { background: #ecfdf5; color: var(--success); }
.activity-content { flex: 1; }
.activity-title { font-size: 0.82rem; font-weight: 500; margin-bottom: 1px; }
.activity-time { font-size: 0.72rem; color: var(--text-light); }

/* ─── Quick Actions ──────────────────────────────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.quick-action-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; padding: 18px 10px;
    background: var(--bg); border-radius: var(--radius-lg);
    color: var(--text); font-size: 0.82rem; font-weight: 500;
    transition: var(--transition); text-decoration: none !important;
    border: 1px solid transparent;
}
.quick-action-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); transform: translateY(-2px); }
.quick-action-btn i { font-size: 1.2rem; }

/* ─── Auth / Login ───────────────────────────────────────────────────────── */
.auth-layout {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; width: 100%;
    background: #0f172a;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    position: relative; overflow: hidden;
}

/* Animated grid background */
.auth-layout::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 20s linear infinite;
}
@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

/* Floating glow orbs */
.auth-layout::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
    top: -100px; right: -100px;
    border-radius: 50%;
    animation: floatOrb 8s ease-in-out infinite alternate;
}
@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-30px, 30px) scale(1.1); }
}

.auth-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; width: 100%; position: relative; z-index: 2;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    padding: 40px 36px;
    width: 420px; max-width: 92%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
}
[data-theme="dark"] .auth-card {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255,255,255,0.08);
}

.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo i {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-logo h1 { font-size: 1.4rem; margin-top: 6px; color: var(--text); letter-spacing: -0.5px; }
.auth-logo p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 2px; }
.auth-form .form-group { margin-bottom: 14px; }

.auth-divider { text-align: center; margin: 20px 0; position: relative; }
.auth-divider::before { content: ''; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: var(--border); }
.auth-divider span { background: var(--bg-card); padding: 0 14px; position: relative; color: var(--text-light); font-size: 0.82rem; }
[data-theme="dark"] .auth-divider span { background: rgba(30,41,59,0.9); }

.auth-footer { text-align: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-light); }
.auth-footer p { color: var(--text-secondary); font-size: 0.82rem; margin-bottom: 6px; }
.platform-icons { display: flex; justify-content: center; gap: 14px; font-size: 1.2rem; }

/* ─── Welcome / Dashboard ────────────────────────────────────────────────── */
.welcome-container { text-align: center; max-width: 900px; margin: 0 auto; }
.welcome-hero { padding: 50px 20px; margin-bottom: 30px; }
.welcome-icon { font-size: 3.5rem; color: var(--primary); margin-bottom: 18px; }
.welcome-hero h2 { font-size: 1.6rem; margin-bottom: 10px; letter-spacing: -0.5px; }
.welcome-hero p { color: var(--text-secondary); max-width: 480px; margin: 0 auto 24px; font-size: 1rem; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; text-align: left; }
.feature-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 22px;
    transition: var(--transition);
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.feature-icon { width: 44px; height: 44px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: 14px; }
.feature-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.feature-card p { font-size: 0.82rem; color: var(--text-secondary); }

/* ─── Loading ────────────────────────────────────────────────────────────── */
.loading-spinner { text-align: center; padding: 36px; color: var(--text-light); font-size: 0.88rem; }

/* ─── Account Card ───────────────────────────────────────────────────────── */
.account-card .card-body { padding: 18px; }
.account-info { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.page-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.page-stats { margin-bottom: 10px; }
.stat-mini { display: flex; flex-direction: column; }
.stat-mini .stat-value { font-size: 1.15rem; font-weight: 700; }
.stat-mini .stat-label { font-size: 0.72rem; color: var(--text-secondary); }
.add-member-form { border-top: 1px solid var(--border-light); padding-top: 12px; }

/* ─── Ticketing System ────────────────────────────────────────────────────── */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-card.mini {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 14px 20px;
    text-align: center; flex: 1; min-width: 110px;
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.stat-card.mini .stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.stat-card.mini .stat-label { font-size: 0.68rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card.mini.stat-urgent .stat-value { color: var(--danger); }
.stat-card.mini.stat-breach .stat-value { color: #991b1b; }
.stat-card.mini.stat-open .stat-value { color: var(--warning); }
.stat-card.mini.stat-mine .stat-value { color: var(--primary); }

.ticket-table { width: 100%; border-collapse: collapse; }
.ticket-table th { padding: 10px 14px; text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); border-bottom: 2px solid var(--border); }
.ticket-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; font-size: 0.85rem; }
.ticket-row { cursor: pointer; transition: background 0.15s; }
.ticket-row:hover { background: var(--bg); }
.ticket-row.sla-breached { background: #fef2f2; }
.ticket-row.sla-breached:hover { background: #fee2e2; }
.ticket-number { font-weight: 600; color: var(--primary); white-space: nowrap; }
.ticket-subject { max-width: 280px; }

.category-badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-full); font-size: 0.72rem; border: 1.5px solid; background: transparent; }
.agent-badge { display: flex; align-items: center; gap: 6px; }
.sla-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 0.68rem; font-weight: 600; padding: 2px 7px; border-radius: var(--radius-full); }
.sla-badge.breached { background: #fef2f2; color: #991b1b; }
.sla-badge.ok { background: #ecfdf5; color: #065f46; }

/* Ticket Detail */
.ticket-description { font-size: 0.95rem; line-height: 1.7; color: var(--text); }
.ticket-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-badge { background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: var(--radius-full); font-size: 0.72rem; font-weight: 500; }
.ticket-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.ticket-details-list .detail-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border-light); }
.detail-row .detail-label { font-size: 0.8rem; color: var(--text-secondary); }
.detail-row .detail-value { font-size: 0.82rem; font-weight: 600; }

/* Timeline */
.ticket-timeline { position: relative; padding-left: 28px; }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 26px; bottom: -20px; width: 2px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-marker { position: absolute; left: -28px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 9px; }
.timeline-item.system .timeline-marker { background: var(--text-light); }
.timeline-item.internal .timeline-marker { background: var(--warning); color: #fff; }
.timeline-header { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.timeline-body { font-size: 0.85rem; line-height: 1.6; }
.timeline-item.internal { opacity: 0.75; }
.comment-actions { display: flex; justify-content: space-between; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; cursor: pointer; }

/* Categories */
.category-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.category-info { display: flex; align-items: center; gap: 10px; }
.category-color { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

/* Analytics extras */
.progress-bar-container { background: var(--border); border-radius: var(--radius-full); height: 20px; position: relative; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: var(--radius-full); transition: width 0.3s; }
.progress-bar-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 0.68rem; font-weight: 700; color: var(--text); }
.simple-table .table { margin: 0; }
.tips-list { padding-left: 18px; }
.tips-list li { margin-bottom: 6px; font-size: 0.85rem; color: var(--text-secondary); }
.btn-block { width: 100%; justify-content: center; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 18px; border-radius: var(--radius-lg);
    font-size: 0.85rem; font-weight: 500;
    box-shadow: var(--shadow-lg); animation: slideDown 0.3s ease;
    display: flex; align-items: center; gap: 8px;
}
.toast-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.toast-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.toast-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── Utility ────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-secondary) !important; }
.text-sm { font-size: 0.8rem !important; }
.text-center { text-align: center; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.d-block { display: block; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 20px; }
.flex-center-gap { display: flex; align-items: center; gap: 8px; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    .card-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
    .conversation-layout { grid-template-columns: 1fr; }
    .conversation-sidebar { display: none; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.4); }

    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .content-wrapper { padding: 14px; }
    .topbar { padding: 0 14px; }
    .search-box { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .card-grid.cols-2, .card-grid.cols-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-form .filter-row { flex-direction: column; }
    .search-box-inline { margin-left: 0; }
    .search-box-inline input { width: 100%; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header-actions { width: 100%; }
    .post-header { flex-direction: column; }
    .inbox-item { padding: 10px 12px; }
    .conversation-header { flex-direction: column; align-items: flex-start; }
    .stats-row { flex-direction: column; }
    .stat-card.mini { min-width: unset; }

    /* Mobile notification dropdown */
    .notif-dropdown { width: calc(100vw - 24px); right: -60px; }

    /* Mobile sidebar overlay */
    .sidebar-overlay {
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.5); z-index: 999;
        display: none;
    }
    .sidebar-overlay.active { display: block; }
}

@media (max-width: 480px) {
    html { font-size: 13px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 14px; }
    .auth-card { padding: 24px 20px; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .btn { padding: 7px 14px; font-size: 0.82rem; }
    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }
    .ticket-table th, .ticket-table td { padding: 8px 10px; font-size: 0.78rem; }
    .topbar { height: 52px; }
    .page-title { font-size: 1rem; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.card, .stat-card, .inbox-item, .post-card { animation: fadeIn 0.25s ease; }

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .reply-box, .ai-suggestion-bar { display: none !important; }
    .main-content { margin-left: 0 !important; }
}
