/* ===== VARIABLES ===== */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(20, 20, 45, 0.85);
    --bg-card-hover: rgba(30, 30, 60, 0.95);
    --bg-glass: rgba(255,255,255,0.03);
    --border: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.4);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dark: #4f46e5;
    --gradient: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    --gradient-btn: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; min-height: 100vh; overflow-x: hidden; }
a { text-decoration: none; color: var(--accent-light); transition: var(--transition); }
a:hover { color: #c4b5fd; }
img { max-width: 100%; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; }

/* ===== ANIMATED BG ===== */
body::before {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(168,85,247,0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(236,72,153,0.04) 0%, transparent 50%);
    z-index: 0; pointer-events: none;
}

/* ===== LAYOUT ===== */
.app-wrapper { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.main-content { flex: 1; margin-left: 260px; padding: 30px; min-height: 100vh; }
.container { max-width: 1200px; margin: 0 auto; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px; height: 100vh; position: fixed; left: 0; top: 0;
    background: linear-gradient(180deg, rgba(15,15,35,0.98), rgba(10,10,26,0.98));
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
    z-index: 100; display: flex; flex-direction: column;
    transition: var(--transition);
}
.sidebar-brand {
    padding: 24px 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--gradient); display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: white; font-weight: 700;
}
.sidebar-brand h2 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.sidebar-brand span { font-size: 11px; color: var(--text-muted); display: block; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 24px; }
.nav-section-title {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-muted); padding: 0 12px; margin-bottom: 8px;
}
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    border-radius: var(--radius-sm); color: var(--text-secondary);
    font-size: 14px; font-weight: 500; transition: var(--transition); position: relative;
}
.nav-link:hover { background: var(--bg-glass); color: var(--text-primary); }
.nav-link.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(168,85,247,0.1));
    color: var(--accent-light); border: 1px solid rgba(99,102,241,0.2);
}
.nav-link.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; background: var(--gradient); border-radius: 3px;
}
.nav-link i { width: 20px; text-align: center; font-size: 15px; }
.nav-link .badge {
    margin-left: auto; background: var(--danger); color: white; font-size: 10px;
    padding: 2px 7px; border-radius: 10px; font-weight: 600;
}

.sidebar-user {
    padding: 16px 20px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-user img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.sidebar-user .user-info h4 { font-size: 13px; font-weight: 600; }
.sidebar-user .user-info span { font-size: 11px; color: var(--text-muted); }

/* ===== TOP BAR ===== */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); margin-bottom: 28px; backdrop-filter: blur(20px);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-left h1 { font-size: 22px; font-weight: 700; }
.topbar-left p { color: var(--text-muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-search {
    position: relative;
}
.topbar-search input {
    background: var(--bg-glass); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 16px 10px 40px; color: var(--text-primary); font-size: 13px;
    width: 280px; outline: none; transition: var(--transition);
}
.topbar-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.topbar-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; backdrop-filter: blur(20px); transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-header h3 { font-size: 18px; font-weight: 700; }
.card-grid { display: grid; gap: 20px; }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-4px); border-color: var(--border-hover); box-shadow: var(--shadow); }
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--gradient); opacity: 0; transition: var(--transition);
}
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; font-size: 20px; margin-bottom: 16px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    border: none; cursor: pointer; transition: var(--transition); text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-primary { background: var(--gradient-btn); color: white; }
.btn-primary:hover { color:white; box-shadow: 0 8px 25px rgba(99,102,241,0.4); }
.btn-secondary { background: var(--bg-glass); color: var(--text-primary); border: 1px solid var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #1a1a1a; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-icon { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 10px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.form-control {
    width: 100%; padding: 12px 16px; background: rgba(10,10,26,0.5); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px;
    outline: none; transition: var(--transition);
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-open { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-in_progress { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-waiting { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-resolved { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-closed { background: rgba(100,116,139,0.15); color: #94a3b8; }
.badge-low { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-medium { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-high { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-urgent { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-solved { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-pinned { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* ===== FORUM ===== */
.forum-categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 20px; }
.forum-cat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; display: flex; gap: 16px; transition: var(--transition); cursor: pointer;
}
.forum-cat-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: var(--shadow); }
.forum-cat-icon {
    width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center;
    justify-content: center; font-size: 22px; flex-shrink: 0;
}
.forum-cat-info h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.forum-cat-info p { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.forum-cat-stats { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }
.forum-cat-stats span i { margin-right: 4px; }

.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-item {
    display: flex; gap: 16px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; transition: var(--transition); align-items: flex-start;
}
.post-item:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.post-avatar img { width: 44px; height: 44px; border-radius: 12px; }
.post-content { flex: 1; }
.post-content h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-content h3 a { color: var(--text-primary); }
.post-content h3 a:hover { color: var(--accent-light); }
.post-meta { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.post-meta span i { margin-right: 4px; }
.post-excerpt { font-size: 13px; color: var(--text-secondary); margin: 8px 0; line-height: 1.5; }
.post-stats { display: flex; gap: 20px; font-size: 13px; color: var(--text-secondary); }
.post-stats span { display: flex; align-items: center; gap: 6px; }

/* ===== SINGLE POST ===== */
.post-detail { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; margin-bottom: 24px; }
.post-detail .post-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.post-detail .post-header img { width: 48px; height: 48px; border-radius: 12px; }
.post-detail .post-header .author-name { font-weight: 600; font-size: 15px; }
.post-detail .post-header .author-role { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: rgba(99,102,241,0.15); color: var(--accent-light); }
.post-detail .post-body { font-size: 15px; line-height: 1.8; color: var(--text-secondary); }
.post-detail .post-body p { margin-bottom: 12px; }
.post-detail .post-body code { background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; font-size: 13px; color: #c4b5fd; }
.post-detail .post-body pre { background: rgba(0,0,0,0.4); padding: 16px; border-radius: 8px; overflow-x: auto; margin: 12px 0; }
.post-actions { display: flex; gap: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ===== REPLIES ===== */
.replies-section { margin-top: 24px; }
.replies-section h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.reply-item {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; margin-bottom: 12px; position: relative;
}
.reply-item.solution { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.05); }
.reply-item.solution::before {
    content: '✓ Solution'; position: absolute; top: -10px; right: 16px;
    background: var(--success); color: white; font-size: 11px; font-weight: 600;
    padding: 2px 10px; border-radius: 6px;
}
.reply-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.reply-header img { width: 36px; height: 36px; border-radius: 10px; }
.reply-body { font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.reply-actions { display: flex; gap: 12px; margin-top: 12px; font-size: 13px; }

/* ===== TICKETS ===== */
.ticket-table {
    width: 100%; border-collapse: separate; border-spacing: 0 8px;
}
.ticket-table th {
    text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.ticket-table td { padding: 16px; background: var(--bg-card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ticket-table td:first-child { border-left: 1px solid var(--border); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.ticket-table td:last-child { border-right: 1px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.ticket-table tr:hover td { border-color: var(--border-hover); background: var(--bg-card-hover); }
.ticket-id { font-weight: 600; color: var(--accent-light); font-size: 13px; }

/* ===== KB ===== */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.kb-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 28px; transition: var(--transition);
}
.kb-card:hover { transform: translateY(-4px); border-color: var(--border-hover); box-shadow: var(--shadow); }
.kb-card .kb-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 16px; }
.kb-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.kb-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.kb-card .article-count { font-size: 12px; color: var(--accent-light); }

.kb-article { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; }
.kb-article h1 { font-size: 28px; font-weight: 800; margin-bottom: 12px; }
.kb-article .article-meta { display: flex; gap: 20px; font-size: 13px; color: var(--text-muted); margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.kb-article .article-content { font-size: 15px; line-height: 1.8; color: var(--text-secondary); }
.kb-article .article-content h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 28px 0 12px; }
.kb-article .article-content h3 { font-size: 17px; font-weight: 600; color: var(--text-primary); margin: 20px 0 8px; }
.kb-article .article-content p { margin-bottom: 14px; }
.kb-article .article-content ul, .kb-article .article-content ol { padding-left: 24px; margin-bottom: 14px; }
.kb-article .article-content li { margin-bottom: 6px; list-style: disc; }
.helpful-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); text-align: center; }
.helpful-section p { margin-bottom: 12px; font-size: 15px; }
.helpful-btns { display: flex; gap: 12px; justify-content: center; }

/* ===== LIVE CHAT ===== */
.chat-container { display: flex; height: calc(100vh - 140px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.chat-sidebar { width: 300px; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.chat-sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.chat-list { flex: 1; overflow-y: auto; }
.chat-item { padding: 14px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition); display: flex; align-items: center; gap: 12px; }
.chat-item:hover, .chat-item.active { background: rgba(99,102,241,0.1); }
.chat-item img { width: 40px; height: 40px; border-radius: 10px; }
.chat-item .chat-preview h4 { font-size: 14px; font-weight: 600; }
.chat-item .chat-preview p { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.chat-item .chat-time { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.chat-item .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: auto; flex-shrink: 0; }

.chat-main { flex: 1; display: flex; flex-direction: column; background: rgba(8,8,20,0.6); }
.chat-main-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: var(--bg-card); }
.chat-main-header img { width: 40px; height: 40px; border-radius: 10px; }
.chat-main-header .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 4px; }
.chat-main-header .status-dot.online { background: var(--success); }
.chat-main-header .status-dot.offline { background: var(--text-muted); }

.chat-messages { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.chat-bubble { max-width: 70%; padding: 12px 18px; border-radius: 16px; font-size: 14px; line-height: 1.5; animation: bubbleIn 0.3s ease; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.chat-bubble.user { align-self: flex-end; background: var(--gradient-btn); color: white; border-bottom-right-radius: 4px; }
.chat-bubble.bot { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); border-bottom-left-radius: 4px; }
.chat-bubble.agent { align-self: flex-start; background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--text-primary); border-bottom-left-radius: 4px; }
.chat-bubble.system { align-self: center; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: var(--warning); font-size: 12px; padding: 6px 16px; border-radius: 20px; }
.chat-bubble .sender { font-size: 11px; font-weight: 600; margin-bottom: 4px; opacity: 0.7; }
.chat-bubble .time { font-size: 10px; opacity: 0.5; margin-top: 4px; text-align: right; }

.chat-input-area { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg-card); display: flex; gap: 12px; align-items: center; }
.chat-input-area input {
    flex: 1; padding: 12px 18px; background: rgba(10,10,26,0.5); border: 1px solid var(--border);
    border-radius: 12px; color: var(--text-primary); font-size: 14px; outline: none;
}
.chat-input-area input:focus { border-color: var(--accent); }
.chat-input-area button { width: 44px; height: 44px; border-radius: 12px; background: var(--gradient-btn); border: none; color: white; font-size: 16px; cursor: pointer; transition: var(--transition); }
.chat-input-area button:hover { transform: scale(1.05); }

/* ===== USER CHAT WIDGET ===== */
.chat-widget-btn {
    position: fixed; bottom: 24px; right: 24px; width: 60px; height: 60px;
    border-radius: 50%; background: var(--gradient-btn); border: none; color: white;
    font-size: 24px; cursor: pointer; box-shadow: 0 8px 30px rgba(99,102,241,0.4);
    z-index: 1000; transition: var(--transition); animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); } 50% { box-shadow: 0 0 0 15px rgba(99,102,241,0); } }
.chat-widget-btn:hover { transform: scale(1.1); }

.chat-widget {
    position: fixed; bottom: 100px; right: 24px; width: 380px; height: 520px;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 20px;
    z-index: 1000; display: none; flex-direction: column; overflow: hidden;
    box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.chat-widget.active { display: flex; }
.chat-widget-header {
    padding: 16px 20px; background: var(--gradient-btn); color: white;
    display: flex; align-items: center; gap: 12px;
}
.chat-widget-header h4 { font-size: 15px; font-weight: 600; }
.chat-widget-header p { font-size: 11px; opacity: 0.8; }
.chat-widget-header .close-chat { margin-left: auto; background: none; border: none; color: white; font-size: 18px; cursor: pointer; }
.chat-widget-messages { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.chat-widget-input { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-widget-input input { flex: 1; padding: 10px 14px; background: var(--bg-glass); border: 1px solid var(--border); border-radius: 10px; color: var(--text-primary); font-size: 13px; outline: none; }
.chat-widget-input button { width: 40px; height: 40px; border-radius: 10px; background: var(--gradient-btn); border: none; color: white; cursor: pointer; }

/* ===== TICKET VIEW ===== */
.ticket-detail { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
.ticket-conversation { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.ticket-sidebar-info { display: flex; flex-direction: column; gap: 16px; }
.ticket-info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.ticket-info-card h4 { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.ticket-info-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ticket-info-item:last-child { border: none; }

.ticket-message { padding: 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; }
.ticket-message:last-child { border: none; }
.ticket-message img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.ticket-message .msg-content { flex: 1; }
.ticket-message .msg-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ticket-message .msg-header strong { font-size: 14px; }
.ticket-message .msg-header span { font-size: 11px; color: var(--text-muted); }
.ticket-message .msg-body { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* ===== AUTH PAGES ===== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
    width: 100%; max-width: 440px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 20px; padding: 40px; backdrop-filter: blur(20px);
}
.auth-card .auth-header { text-align: center; margin-bottom: 32px; }
.auth-card .auth-header .logo { width: 60px; height: 60px; border-radius: 16px; background: var(--gradient); display: flex; align-items: center; justify-content: center; font-size: 28px; color: white; margin: 0 auto 16px; }
.auth-card .auth-header h1 { font-size: 24px; font-weight: 700; }
.auth-card .auth-header p { font-size: 14px; color: var(--text-muted); margin-top: 6px; }
.auth-card .auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-muted); }

/* ===== ALERTS ===== */
.alert { padding: 14px 20px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #60a5fa; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.page-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); font-size: 13px; font-weight: 600; transition: var(--transition); }
.page-btn:hover, .page-btn.active { background: var(--gradient-btn); color: white; border-color: transparent; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; background: var(--bg-glass); border-radius: 12px; padding: 4px; margin-bottom: 24px; border: 1px solid var(--border); width: fit-content; }
.tab { padding: 8px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: var(--transition); border: none; background: none; }
.tab.active, .tab:hover { background: var(--gradient-btn); color: white; }

/* ===== NOTIFICATIONS DROPDOWN ===== */
.notif-dropdown { position: relative; }
.notif-btn { position: relative; }
.notif-btn .notif-count { position: absolute; top: -4px; right: -4px; background: var(--danger); color: white; font-size: 10px; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.notif-panel { position: absolute; top: 50px; right: 0; width: 360px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 200; display: none; }
.notif-panel.active { display: block; }
.notif-panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-panel-header h4 { font-size: 15px; font-weight: 600; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item { padding: 14px 20px; border-bottom: 1px solid var(--border); transition: var(--transition); display: flex; gap: 12px; }
.notif-item:hover { background: var(--bg-glass); }
.notif-item.unread { background: rgba(99,102,241,0.05); }
.notif-item .notif-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-item .notif-text h5 { font-size: 13px; font-weight: 600; }
.notif-item .notif-text p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-item .notif-text time { font-size: 11px; color: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .ticket-detail { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); z-index: 200; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
    .forum-categories { grid-template-columns: 1fr; }
    .kb-grid { grid-template-columns: 1fr; }
    .chat-container { flex-direction: column; height: calc(100vh - 100px); }
    .chat-sidebar { width: 100%; height: 200px; }
    .topbar { flex-direction: column; gap: 12px; }
    .topbar-search input { width: 100%; }
    .mobile-toggle { display: block !important; }
    .chat-widget { width: calc(100% - 32px); right: 16px; }
}
.mobile-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 201; width: 40px; height: 40px; border-radius: 10px; background: var(--gradient-btn); border: none; color: white; font-size: 18px; cursor: pointer; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 199; }
.sidebar-overlay.active { display: block; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease forwards; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.5); }

/* ===== EDITOR TOOLBAR ===== */
.editor-toolbar { display: flex; gap: 4px; padding: 8px; background: var(--bg-glass); border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; flex-wrap: wrap; }
.editor-toolbar button { width: 32px; height: 32px; border-radius: 6px; border: none; background: none; color: var(--text-secondary); cursor: pointer; transition: var(--transition); font-size: 13px; }
.editor-toolbar button:hover { background: rgba(99,102,241,0.2); color: var(--text-primary); }
.editor-content { border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar select { padding: 8px 32px 8px 12px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; }
.tab { padding: 8px 16px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); font-size: 13px; font-weight: 500; text-decoration: none; transition: var(--transition); cursor: pointer; }
.tab:hover { color: var(--text-primary); border-color: var(--border-hover); }
.tab.active { background: var(--gradient-btn); color: white; border-color: transparent; }

/* ===== TICKET TABLE ===== */
.ticket-table { width: 100%; border-collapse: collapse; }
.ticket-table thead th { text-align: left; padding: 12px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600; }
.ticket-table tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.ticket-table tbody tr:hover { background: rgba(99,102,241,0.05); }
.ticket-table tbody td { padding: 14px 16px; font-size: 14px; }
.ticket-id { font-family: 'Courier New', monospace; font-size: 12px; color: var(--accent-light); background: rgba(99,102,241,0.1); padding: 3px 8px; border-radius: 6px; font-weight: 600; }

/* ===== BADGE VARIANTS ===== */
.badge-open { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-in_progress { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-waiting { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-resolved { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-closed { background: rgba(100,116,139,0.15); color: #94a3b8; }
.badge-low { background: rgba(16,185,129,0.1); color: #34d399; }
.badge-medium { background: rgba(59,130,246,0.1); color: #60a5fa; }
.badge-high { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-urgent { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-pinned { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* ===== TICKET DETAIL ===== */
.ticket-detail { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
.ticket-conversation { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ticket-message { display: flex; gap: 14px; padding: 20px; border-bottom: 1px solid var(--border); }
.ticket-message img { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; object-fit: cover; }
.msg-content { flex: 1; }
.msg-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.msg-header strong { font-size: 14px; color: var(--text-primary); }
.msg-header span { font-size: 11px; color: var(--text-muted); }
.msg-body { font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.ticket-sidebar-info { display: flex; flex-direction: column; gap: 16px; }
.ticket-info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.ticket-info-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary); }
.ticket-info-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px; }
.ticket-info-item span:first-child { color: var(--text-muted); }
.ticket-info-item span:last-child { color: var(--text-secondary); font-weight: 500; }

/* ===== AGENT CHAT DASHBOARD ===== */
.chat-container { display: flex; height: calc(100vh - 180px); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-sidebar { width: 320px; border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.chat-sidebar-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.chat-list { overflow-y: auto; flex: 1; }
.chat-item { display: flex; align-items: center; gap: 12px; padding: 14px 20px; cursor: pointer; transition: var(--transition); border-bottom: 1px solid rgba(255,255,255,0.03); }
.chat-item:hover { background: rgba(99,102,241,0.08); }
.chat-item.active { background: rgba(99,102,241,0.12); border-left: 3px solid var(--accent); }
.chat-item img { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
.chat-preview { flex: 1; min-width: 0; }
.chat-preview h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.chat-preview p { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-main-header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.chat-main-header img { width: 36px; height: 36px; border-radius: 10px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble { max-width: 80%; padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.5; position: relative; }
.chat-bubble.user { background: var(--gradient-btn); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-bubble.bot { background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.2); color: var(--text-secondary); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-bubble.agent { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: var(--text-secondary); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-bubble.system { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.15); color: var(--warning); text-align: center; align-self: center; font-size: 12px; max-width: 90%; }
.chat-bubble .sender { font-size: 11px; font-weight: 600; color: var(--accent-light); margin-bottom: 2px; }
.chat-bubble .time { font-size: 10px; opacity: 0.5; margin-top: 4px; text-align: right; }
.chat-input-area { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.chat-input-area input { flex: 1; background: var(--bg-glass); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; color: var(--text-primary); font-size: 14px; }
.chat-input-area input:focus { outline: none; border-color: var(--accent); }
.chat-input-area button { width: 44px; height: 44px; border-radius: 12px; background: var(--gradient-btn); border: none; color: white; font-size: 16px; cursor: pointer; transition: var(--transition); }
.chat-input-area button:hover { transform: scale(1.05); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 4px; }
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--text-muted); }

/* ===== NOTIFICATIONS ===== */
.notif-item { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); transition: var(--transition); }
.notif-item:hover { background: rgba(99,102,241,0.05); }
.notif-item.unread { background: rgba(99,102,241,0.03); }
.notif-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.notif-text h5 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-text p { font-size: 13px; color: var(--text-muted); margin-bottom: 2px; }
.notif-text time { font-size: 11px; color: var(--text-muted); opacity: 0.7; }

/* ===== KB ARTICLE ===== */
.kb-article { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.article-meta { display: flex; gap: 20px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.article-meta span { font-size: 13px; color: var(--text-muted); }
.article-content { font-size: 15px; line-height: 1.8; color: var(--text-secondary); }
.article-content h2, .article-content h3 { color: var(--text-primary); margin: 24px 0 12px; }
.article-content p { margin-bottom: 16px; }
.article-content code { background: rgba(99,102,241,0.1); color: var(--accent-light); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.article-content pre { background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 10px; padding: 16px; overflow-x: auto; margin: 16px 0; }
.article-content ul, .article-content ol { margin: 12px 0; padding-left: 24px; }
.article-content li { margin-bottom: 6px; }
.article-content img { max-width: 100%; border-radius: 12px; margin: 12px 0; }
.helpful-section { text-align: center; padding: 24px; margin-top: 24px; border-top: 1px solid var(--border); }
.helpful-section p { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.helpful-btns { display: flex; gap: 12px; justify-content: center; }
.btn-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); }
.btn-danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.btn-warning:hover { background: rgba(245,158,11,0.25); }

/* ===== ALERTS ===== */
.alert { padding: 14px 20px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: #60a5fa; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: #34d399; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #f87171; }

/* ===== RESPONSIVE: TICKET DETAIL ===== */
@media (max-width: 768px) {
    .ticket-detail { grid-template-columns: 1fr; }
    .ticket-sidebar-info { order: -1; }
}

/* ===== GLOBAL TOPBAR (Notification Bar) ===== */
.global-topbar {
    display: flex;
    align-items: center;
    padding: 0 0 16px 0;
    gap: 12px;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== NOTIFICATION BELL ===== */
.notif-bell-wrapper {
    position: relative;
}
.notif-bell {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
    position: relative;
}
.notif-bell:hover {
    border-color: var(--accent-light);
    color: var(--accent-light);
    background: rgba(99,102,241,0.1);
    transform: scale(1.05);
}
.notif-badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-main);
    animation: notifPulse 2s infinite;
}
@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== NOTIFICATION DROPDOWN ===== */
.notif-dropdown {
    position: absolute;
    top: 52px;
    right: 0;
    width: 380px;
    max-height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    overflow: hidden;
}
.notif-dropdown.open { display: block; animation: fadeSlideDown 0.2s ease; }
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.notif-dropdown-header strong { font-size: 15px; color: var(--text-primary); }
.notif-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}
.notif-dropdown-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    text-decoration: none;
    transition: var(--transition);
    align-items: flex-start;
}
.notif-dropdown-item:hover { background: rgba(99,102,241,0.05); }
.notif-dropdown-item.unread { background: rgba(99,102,241,0.03); border-left: 3px solid var(--accent-light); }
.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.notif-text { flex: 1; min-width: 0; }
.notif-text strong { font-size: 13px; color: var(--text-primary); display: block; margin-bottom: 2px; }
.notif-text p { font-size: 12px; color: var(--text-muted); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-text time { font-size: 11px; color: var(--text-muted); opacity: 0.7; }
.notif-dropdown-footer {
    display: block;
    text-align: center;
    padding: 12px;
    border-top: 1px solid var(--border);
    color: var(--accent-light);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.notif-dropdown-footer:hover { background: rgba(99,102,241,0.05); }

/* ===== SOUND TOGGLE ===== */
.sound-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(99,102,241,0.08);
    color: var(--accent-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: var(--transition);
    margin-left: auto;
    flex-shrink: 0;
}
.sound-toggle-btn:hover {
    background: rgba(99,102,241,0.2);
    transform: scale(1.1);
}

/* ===== MODERATION ITEM ===== */
.moderation-item { transition: var(--transition); }
.moderation-item:hover { background: rgba(99,102,241,0.03); }
.moderation-item:last-child { border-bottom: none; }

/* ===== BADGE VARIANT (for pending/approved/rejected) ===== */
.badge-pending { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-approved { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-rejected { background: rgba(239,68,68,0.15); color: #f87171; }

/* ===== TABS ENHANCEMENT ===== */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; background: var(--bg-card); padding: 4px; border-radius: 12px; border: 1px solid var(--border); }
.tab { padding: 8px 16px; border-radius: 10px; background: transparent; border: none; color: var(--text-muted); font-size: 13px; font-weight: 500; text-decoration: none; transition: var(--transition); cursor: pointer; }
.tab:hover { color: var(--text-primary); background: rgba(99,102,241,0.08); }
.tab.active { background: var(--gradient-btn); color: white; }

/* ===== RESPONSIVE UPDATES ===== */
@media (max-width: 768px) {
    .notif-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
    }
    .global-topbar { padding: 0 0 12px 0; }
}

/* ===== AI SUGGESTION PANEL ===== */
.ai-panel {
    background: var(--bg-card);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: 0 0 20px rgba(99,102,241,0.05);
}
.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(168,85,247,0.08));
    border-bottom: 1px solid rgba(99,102,241,0.1);
}
.ai-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}
.ai-icon {
    font-size: 18px;
}
.ai-panel-actions {
    display: flex;
    gap: 6px;
}
.ai-panel-body {
    padding: 16px;
}
.ai-suggestion-placeholder {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}
.ai-suggestion-content {
    margin-bottom: 12px;
}
.ai-suggestion-text {
    background: rgba(99,102,241,0.04);
    border: 1px solid rgba(99,102,241,0.1);
    border-radius: 10px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-line;
    max-height: 250px;
    overflow-y: auto;
}
.ai-suggestion-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.ai-meta {
    display: flex;
    gap: 14px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}
.ai-meta i { margin-right: 3px; }
.ai-error {
    background: rgba(239,68,68,0.05);
    border: 1px solid rgba(239,68,68,0.15);
    border-radius: 10px;
    padding: 12px;
    color: #f87171;
    font-size: 13px;
}
.ai-error i { margin-right: 6px; }
.ai-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}
.ai-loading-dots {
    display: flex;
    gap: 4px;
}
.ai-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-light);
    animation: aiDotBounce 1.4s ease-in-out infinite;
}
.ai-loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.ai-loading-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes aiDotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* AI Buttons */
.ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.ai-btn-sm { padding: 5px 10px; font-size: 11px; }
.ai-btn-primary {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
}
.ai-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.ai-btn-secondary {
    background: rgba(99,102,241,0.1);
    color: var(--accent-light);
    border: 1px solid rgba(99,102,241,0.2);
}
.ai-btn-secondary:hover { background: rgba(99,102,241,0.2); }
.ai-btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.ai-btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.ai-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* ===== CANNED MESSAGES PICKER ===== */
.canned-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}
.canned-picker {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 480px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.canned-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.canned-picker-header h3 { font-size: 15px; font-weight: 700; }
.canned-picker-search {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}
.canned-picker-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.canned-picker-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
}
.canned-item {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    cursor: pointer;
    transition: background 0.15s;
}
.canned-item:hover { background: rgba(99,102,241,0.06); }
.canned-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 13px;
}
.canned-item-preview {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ===== SHORTCUT POPUP ===== */
.shortcut-popup {
    position: fixed;
    z-index: 10001;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.shortcut-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
}
.shortcut-item:hover, .shortcut-item.active {
    background: rgba(99,102,241,0.1);
}
.shortcut-item code {
    background: rgba(99,102,241,0.15);
    color: var(--accent-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.shortcut-item span { color: var(--text-secondary); }

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(100,116,139,0.3);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ===== AI RESPONSIVE ===== */
@media (max-width: 768px) {
    .canned-picker { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; }
    .canned-overlay { align-items: flex-end; }
    .ai-suggestion-actions { flex-wrap: wrap; }
    .shortcut-popup { left: 10px !important; right: 10px !important; width: auto !important; }
}
