/* ============================================================
   Chatyy — Support Dashboard Styles (v2 — 2026-04-06)
   Consolidated, dark mode, all component classes
   ============================================================ */

/* ── CSS Variables ── */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;
    --primary-rgb: 99,102,241;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --hover: #f1f5f9;
    --success: #22c55e;
    --success-bg: #dcfce7;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --error: #ef4444;
    --error-bg: #fee2e2;
    --info: #3b82f6;
    --info-bg: #dbeafe;
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #a5b4fc;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active-bg: rgba(99,102,241,0.15);
    --sidebar-w: 260px;
    --header-h: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.06);
    --transition: 0.2s ease;
    color-scheme: light;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: rgba(99,102,241,0.15);
    --primary-rgb: 129,140,248;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-raised: #273548;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --hover: #273548;
    --success-bg: rgba(34,197,94,0.12);
    --warning-bg: rgba(245,158,11,0.12);
    --error-bg: rgba(239,68,68,0.12);
    --info-bg: rgba(59,130,246,0.12);
    --sidebar-bg: linear-gradient(180deg, #0a0f1a 0%, #111827 100%);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.3);
    color-scheme: dark;
}

/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
#app { height: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100,100,100,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,100,100,0.4); }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes statusPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); } 50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
    height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg) 50%, var(--primary-light) 100%);
}
.login-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 48px 40px;
    width: 420px; max-width: 90vw;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border);
}
.login-logo {
    width: 64px; height: 64px; margin: 0 auto 16px;
    background: var(--primary); border-radius: 16px;
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.login-logo svg { width: 36px; height: 36px; }
.login-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 32px; }
.login-error { color: var(--error); font-size: 13px; margin-top: 12px; min-height: 20px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { text-align: left; margin-bottom: 16px; }
.form-label {
    display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--bg); color: var(--text); outline: none;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
    background: var(--surface);
}
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { min-height: 100px; resize: vertical; font-family: inherit; }
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Form rows (used in modals) */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-row input, .form-row textarea, .form-row select {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 13px; background: var(--bg); color: var(--text); outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
    border: none; cursor: pointer; transition: all var(--transition); text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #818cf8, var(--primary)); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-outline, .btn-secondary { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover, .btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ============================================================
   LAYOUT — SIDEBAR + MAIN
   ============================================================ */
.layout { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 10;
}
.sidebar-brand {
    padding: 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand-icon {
    width: 38px; height: 38px; background: var(--primary);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: #fff;
}
.sidebar-brand-icon svg { width: 20px; height: 20px; }
.sidebar-brand-text { font-weight: 700; font-size: 15px; line-height: 1.3; color: #f1f5f9; }
.sidebar-brand-sub { font-size: 11px; color: #64748b; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar-section {
    font-size: 10px; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 1px; padding: 16px 12px 6px;
}
.sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer;
    color: var(--sidebar-text); font-size: 13px; font-weight: 500;
    transition: all 0.15s ease; text-decoration: none;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: #e2e8f0; transform: translateX(2px); }
.sidebar-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active); font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.6; transition: opacity 0.2s; }
.sidebar-item:hover svg, .sidebar-item.active svg { opacity: 1; }
.sidebar-badge {
    margin-left: auto; background: var(--error); color: #fff;
    font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px;
    min-width: 20px; text-align: center;
}

.sidebar-footer { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
    width: 34px; height: 34px; border-radius: 99px; background: var(--primary);
    color: #fff; font-size: 13px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout { cursor: pointer; color: #64748b; padding: 6px; border-radius: var(--radius-sm); transition: all 0.15s; }
.sidebar-logout:hover { color: #f87171; background: rgba(239,68,68,0.1); }
.sidebar-logout svg { width: 18px; height: 18px; }

/* Status indicator (sidebar) */
.status-indicator {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; margin: 8px; border-radius: 10px;
    background: rgba(255,255,255,0.04); font-size: 12px; color: #94a3b8;
}

/* Main content area */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

/* Topbar */
.topbar {
    height: var(--header-h); background: rgba(var(--primary-rgb), 0.02);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 24px; gap: 16px;
    position: sticky; top: 0; z-index: 50;
}
[data-theme="dark"] .topbar { background: rgba(15,23,42,0.8); }
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Content */
.content { flex: 1; padding: 24px; overflow-y: auto; animation: pageIn 0.3s ease both; }

/* Hamburger (mobile) */
.hamburger {
    display: none; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--hover); cursor: pointer; border: none;
    color: var(--text); font-size: 20px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 9998;
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    margin-bottom: 16px; overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-body-np { padding: 0; }
.card-actions { display: flex; gap: 8px; align-items: center; }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { border-color: var(--primary); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--error); }
.stat-value.blue { color: var(--primary); }
.stat-value.orange { color: var(--warning); }

/* Stat card colored borders */
.stat-card-green { border-left: 4px solid #22c55e; }
.stat-card-blue { border-left: 4px solid #3b82f6; }
.stat-card-purple { border-left: 4px solid #6366f1; }
.stat-card-red { border-left: 4px solid #ef4444; }
.stat-card-amber { border-left: 4px solid #f59e0b; }
.stat-card-teal { border-left: 4px solid #14b8a6; }

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 16px; border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.kpi-icon svg, .kpi-icon .icon { width: 20px; height: 20px; }
.kpi-value { font-size: 24px; font-weight: 700; margin-bottom: 2px; }
.kpi-label { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
    background: var(--border-light); border-bottom: 2px solid var(--border); white-space: nowrap;
}
td {
    padding: 12px 16px; border-bottom: 1px solid var(--border-light);
    font-size: 13px; vertical-align: middle;
}
tr { transition: background 0.15s; }
tr:hover td { background: var(--hover); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
td code { background: var(--border-light); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--text); }
.td-actions { white-space: nowrap; display: flex; gap: 4px; }

/* Table modern (alias — same styling) */
.table-modern { width: 100%; border-collapse: collapse; }
.table-modern thead th {
    text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
    background: var(--border-light); border-bottom: 2px solid var(--border);
}
.table-modern tbody td {
    padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.table-modern tbody tr { transition: background 0.15s; }
.table-modern tbody tr:hover { background: var(--hover); }
.table-modern tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 20px; font-size: 11px;
    font-weight: 600; white-space: nowrap; letter-spacing: 0.3px;
}
.badge-success { background: var(--success-bg); color: #15803d; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-error { background: var(--error-bg); color: #dc2626; }
.badge-info { background: var(--info-bg); color: #1d4ed8; }
.badge-neutral { background: var(--border-light); color: var(--text-secondary); }
[data-theme="dark"] .badge-success { color: #4ade80; }
[data-theme="dark"] .badge-warning { color: #fbbf24; }
[data-theme="dark"] .badge-error { color: #f87171; }
[data-theme="dark"] .badge-info { color: #60a5fa; }
[data-theme="dark"] .badge-neutral { color: var(--text-secondary); }

/* Context background badges (dashboard) */
.cx-bg { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.cx-bg-g { background: var(--success-bg); color: #15803d; }
.cx-bg-r { background: var(--error-bg); color: #dc2626; }

/* Status dot */
.status-dot { width: 8px; height: 8px; border-radius: 99px; display: inline-block; flex-shrink: 0; animation: statusPulse 2s infinite; }
.status-dot.green { background: var(--success); }
.status-dot.red { background: var(--error); }
.status-dot.yellow { background: var(--warning); }

/* ============================================================
   SEARCH
   ============================================================ */
.search-bar {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 0 14px; transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar svg, .search-bar .icon { width: 18px; color: var(--text-muted); flex-shrink: 0; }
.search-bar input {
    flex: 1; border: none; background: transparent; padding: 10px 0;
    font-size: 14px; outline: none; color: var(--text);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1); }

/* Search bar large variant */
.search-bar-lg {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 0 16px; transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar-lg .icon { width: 18px; color: var(--text-muted); flex-shrink: 0; }
.search-bar-lg input {
    flex: 1; border: none; background: transparent; padding: 12px 0;
    font-size: 14px; outline: none; color: var(--text);
}
.search-bar-lg:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center;
    z-index: 100; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--surface); border-radius: 20px; width: 520px; max-width: 90vw;
    max-height: 85vh; box-shadow: 0 20px 60px rgba(0,0,0,0.2); display: flex; flex-direction: column;
    animation: slideUp 0.2s ease; border: 1px solid var(--border);
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { cursor: pointer; color: var(--text-muted); padding: 4px; font-size: 22px; line-height: 1; background: none; border: none; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 500;
    box-shadow: var(--shadow-md); animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 280px; transition: opacity 0.3s;
}
.toast-success { background: #15803d; color: #fff; }
.toast-error { background: #dc2626; color: #fff; }
.toast-info { background: var(--primary); color: #fff; }
.toast-warning { background: #d97706; color: #fff; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); }
.tab {
    padding: 10px 20px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all 0.2s; user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Tab bar (button variant) */
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
    padding: 8px 16px; font-size: 13px; font-weight: 500;
    border: 1px solid var(--border); border-radius: 99px;
    background: var(--surface); color: var(--text-secondary);
    cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px;
}
.tab-btn:hover { background: var(--hover); color: var(--text); border-color: var(--text-muted); }
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-btn .icon { width: 14px; height: 14px; }
.tab-count {
    background: rgba(255,255,255,0.25); color: inherit;
    font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 99px; margin-left: 4px;
}
.tab-btn.active .tab-count { background: rgba(255,255,255,0.3); }

/* ============================================================
   SPLIT PANEL (Tickets)
   ============================================================ */
.split-panel { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 500px; background: var(--surface); }
.split-left {
    width: 340px; flex-shrink: 0; border-right: 1px solid var(--border);
    overflow-y: auto; background: var(--surface);
}
.split-right { flex: 1; padding: 20px; overflow-y: auto; }

/* List items (ticket list) */
.list-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--border-light);
    cursor: pointer; transition: background 0.15s;
}
.list-item:hover { background: var(--hover); }
.list-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.li-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.li-body { flex: 1; min-width: 0; }
.li-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.li-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ============================================================
   CHAT TIMELINE (Ticket detail)
   ============================================================ */
.chat-timeline { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.chat-bubble {
    padding: 12px 16px; border-radius: 14px; max-width: 85%; font-size: 13px; line-height: 1.6;
    position: relative;
}
.chat-bubble.client {
    background: var(--border-light); color: var(--text);
    align-self: flex-start; border-bottom-left-radius: 4px;
}
.chat-bubble.support {
    background: var(--primary-light); color: var(--text);
    align-self: flex-end; border-bottom-right-radius: 4px;
}
.chat-bubble.note {
    background: var(--warning-bg); color: var(--text); border: 1px dashed var(--warning);
    align-self: center; font-size: 12px; border-radius: 10px;
}
.bubble-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ============================================================
   AVATARS
   ============================================================ */
.avatar-sm {
    width: 32px; height: 32px; border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0;
    background: var(--primary);
}
.avatar-md {
    width: 48px; height: 48px; border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 600; color: #fff; flex-shrink: 0;
    background: var(--primary);
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { padding-left: 20px; border-left: 2px solid var(--border); }
.timeline-item { padding: 0 0 20px 16px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: ''; position: absolute; left: -25px; top: 4px;
    width: 10px; height: 10px; border-radius: 99px; background: var(--primary);
    border: 2px solid var(--surface);
}
.timeline-item.support::before { background: var(--primary); }
.timeline-item.client::before { background: var(--text-muted); }
.timeline-item.note::before { background: var(--warning); }
.timeline-time { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-content { font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.timeline-from { font-weight: 600; font-size: 12px; margin-bottom: 2px; }

/* ============================================================
   LOG LINES & LOG VIEWER
   ============================================================ */
.log-line {
    font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;
    font-size: 12px; padding: 8px 14px; border-bottom: 1px solid var(--border-light);
    line-height: 1.6; word-break: break-all;
}
.log-line:hover { background: var(--hover); }
.log-line:last-child { border-bottom: none; }
.log-status {
    display: inline-block; padding: 1px 6px; border-radius: 3px;
    font-size: 11px; font-weight: 600; margin-right: 6px;
}
.log-status.delivered, .log-status.completed { background: var(--success-bg); color: #15803d; }
.log-status.bounced, .log-status.rejected { background: var(--error-bg); color: #dc2626; }
.log-status.deferred { background: var(--warning-bg); color: #92400e; }
.log-status.info { background: var(--border-light); color: var(--text-secondary); }

.log-viewer {
    background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace; font-size: 12px;
    line-height: 1.6; overflow-x: auto; white-space: pre-wrap; max-height: 60vh;
    word-break: break-all;
}

/* Config viewer (same as log-viewer) */
.config-viewer {
    background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace; font-size: 12px;
    line-height: 1.6; overflow-x: auto; white-space: pre; max-height: 60vh;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ============================================================
   DETAIL PANEL
   ============================================================ */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.detail-item span { font-size: 14px; display: block; }
.detail-full { grid-column: 1 / -1; }

/* ============================================================
   LOADING & SKELETON
   ============================================================ */
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block;
}
.loading-center { display: flex; align-items: center; justify-content: center; padding: 48px; flex-direction: column; gap: 12px; }
.loading-center span { font-size: 13px; color: var(--text-muted); }

.skeleton, .skeleton-card, .skeleton-text {
    background: linear-gradient(90deg, var(--hover) 25%, var(--border-light) 50%, var(--hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite; border-radius: 8px;
}
.skeleton-card { height: 80px; border-radius: var(--radius); }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.w60 { width: 60%; }
.skeleton-text.w80 { width: 80%; }
.skeleton-text.w40 { width: 40%; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.progress-fill.green { background: var(--success); }
.progress-fill.blue { background: var(--primary); }
.progress-fill.orange { background: var(--warning); }
.progress-fill.red { background: var(--error); }

/* ============================================================
   INFO BOX
   ============================================================ */
.info-box {
    padding: 14px 18px; border-radius: var(--radius); font-size: 13px;
    margin-bottom: 16px; display: flex; align-items: start; gap: 10px; border-left: 4px solid;
}
.info-box svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.info-box.info { background: var(--info-bg); color: #1d4ed8; border-left-color: #3b82f6; }
.info-box.warning { background: var(--warning-bg); color: #92400e; border-left-color: #f59e0b; }
.info-box.error { background: var(--error-bg); color: #dc2626; border-left-color: #ef4444; }
.info-box.success { background: var(--success-bg); color: #15803d; border-left-color: #22c55e; }
[data-theme="dark"] .info-box.info { color: #60a5fa; }
[data-theme="dark"] .info-box.warning { color: #fbbf24; }
[data-theme="dark"] .info-box.error { color: #f87171; }
[data-theme="dark"] .info-box.success { color: #4ade80; }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ============================================================
   CHART BARS
   ============================================================ */
.chart-container { display: flex; flex-direction: column; gap: 6px; }
.chart-row { display: flex; align-items: center; gap: 12px; }
.chart-label { width: 80px; font-size: 12px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; text-align: right; }
.chart-bars { flex: 1; display: flex; gap: 2px; height: 22px; }
.chart-bar { height: 100%; border-radius: 3px; min-width: 2px; transition: width 0.3s ease; }
.chart-bar.green { background: var(--success); }
.chart-bar.red { background: var(--error); }
.chart-bar.orange { background: var(--warning); }
.chart-bar.blue { background: var(--primary); }
.chart-values { display: flex; gap: 4px; min-width: 180px; }

/* Bar chart (vertical, used in reports/chatyy) */
.bar-chart {
    display: flex; align-items: flex-end; gap: 3px; height: 120px;
    padding: 0 4px; border-bottom: 1px solid var(--border);
}
.bar-chart .bar {
    flex: 1; border-radius: 3px 3px 0 0; min-height: 4px;
    position: relative; transition: height 0.3s ease; cursor: default;
}
.bar-chart .bar:hover { opacity: 0.8; }
.bar-chart .bar .bar-label {
    position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%);
    font-size: 10px; color: var(--text-muted); white-space: nowrap;
}

/* ============================================================
   AI RESPONSE
   ============================================================ */
.ai-response {
    font-size: 14px; line-height: 1.8; color: var(--text);
    padding: 16px; background: linear-gradient(135deg, var(--primary-light) 0%, rgba(168,85,247,0.05) 100%);
    border-radius: var(--radius-sm); border-left: 4px solid var(--primary);
}

/* ============================================================
   TOOL GRID (Diagnostics)
   ============================================================ */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.tool-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; transition: box-shadow var(--transition);
}
.tool-card:hover { box-shadow: var(--shadow-md); }
.tool-card-header {
    padding: 16px; display: flex; align-items: center; gap: 14px; cursor: pointer;
    transition: background 0.15s;
}
.tool-card-header:hover { background: var(--hover); }
.tool-card-header h4 { font-size: 14px; font-weight: 600; margin: 0; }
.tool-card-header p { font-size: 12px; color: var(--text-secondary); margin: 2px 0 0; }
.tool-card-body {
    padding: 0 16px 16px; max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}
.tool-card.open .tool-card-body { max-height: 600px; padding: 4px 16px 16px; }
.tool-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tool-icon .icon, .tool-icon span { display: flex; }

/* ============================================================
   SECURITY SCORE
   ============================================================ */
.security-score {
    display: flex; align-items: center; gap: 20px;
    padding: 24px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 20px;
}
.score-ring {
    width: 72px; height: 72px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 800; flex-shrink: 0;
    border: 4px solid;
}
.score-ring.good { color: var(--success); border-color: var(--success); background: var(--success-bg); }
.score-ring.warn { color: var(--warning); border-color: var(--warning); background: var(--warning-bg); }
.score-ring.bad { color: var(--error); border-color: var(--error); background: var(--error-bg); }

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.dash-hero { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.dash-card {
    background: var(--surface); border-radius: var(--radius); padding: 16px;
    border: 1px solid var(--border); position: relative; overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition); cursor: pointer;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.dash-card.g { border-left: 4px solid var(--success); }
.dash-card.r { border-left: 4px solid var(--error); }
.dash-card.b { border-left: 4px solid var(--primary); }
.dash-card.o { border-left: 4px solid var(--warning); }
.dash-card.p { border-left: 4px solid #7c3aed; }
.dash-card.t { border-left: 4px solid #0d9488; }
.dash-val { font-size: 28px; font-weight: 700; color: var(--text); }
.dash-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.dash-sec {
    background: var(--surface); border-radius: var(--radius); padding: 20px;
    border: 1px solid var(--border); margin-bottom: 16px;
}
.dash-sec h3 {
    margin: 0 0 14px; font-size: 15px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}
.dash-sec h3::after { content: ''; flex: 1; height: 1px; background: var(--border); margin-left: 12px; }
.dash-svc { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dash-svc:last-child { border: none; }
.dash-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dash-dot.on { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.4); }
.dash-dot.off { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.dash-action {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    border-radius: 10px; background: var(--hover); cursor: pointer;
    transition: all 0.15s; font-size: 13px; font-weight: 500;
    color: var(--text); text-decoration: none; border: 1px solid transparent;
}
.dash-action:hover { border-color: var(--primary); background: rgba(var(--primary-rgb), 0.05); transform: translateX(4px); }
.dash-alert {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 8px;
    display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.dash-alert.warn { background: var(--warning-bg); border: 1px solid rgba(245,158,11,0.15); color: var(--warning); }
.dash-alert.error { background: var(--error-bg); border: 1px solid rgba(239,68,68,0.15); color: var(--error); }
.dash-alert.ok { background: var(--success-bg); border: 1px solid rgba(16,185,129,0.15); color: var(--success); }

/* ============================================================
   DARK MODE TOGGLE
   ============================================================ */
.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06); border: none; cursor: pointer;
    color: #94a3b8; transition: all 0.15s; margin-right: 4px;
}
.theme-toggle:hover { background: rgba(255,255,255,0.1); color: #e2e8f0; }
.theme-toggle svg { width: 16px; height: 16px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; left: -280px; top: 0; bottom: 0;
        width: 280px; z-index: 9999;
        transition: left 0.3s cubic-bezier(0.4,0,0.2,1);
        overflow-y: auto;
    }
    .sidebar.open { left: 0; }
    .hamburger { display: flex; }
    .main { margin-left: 0; }
    .topbar { padding: 10px 16px; gap: 8px; }
    .topbar-title { font-size: 16px; }
    .topbar-actions { gap: 6px; }
    .topbar-actions input { width: 120px; font-size: 12px; }
    .content { padding: 12px; }

    /* Grid adjustments */
    .stats-grid, .kpi-grid, .dash-hero { grid-template-columns: 1fr 1fr; gap: 8px; }
    .detail-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .tool-grid { grid-template-columns: 1fr; }

    /* Split panel stacks */
    .split-panel { flex-direction: column; min-height: auto; }
    .split-left { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 300px; }
    .split-right { padding: 16px; }

    /* Tables scroll */
    .table-wrap { font-size: 11px; }
    th, td, .table-modern thead th, .table-modern tbody td { padding: 8px 10px; font-size: 11px; }

    /* Tabs scroll */
    .tab-bar, .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap; }
    .tab-bar::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
    .tab-btn, .tab { flex-shrink: 0; padding: 8px 12px; font-size: 12px; }

    /* Cards */
    .card-header { flex-direction: column; gap: 8px; }
    .card-actions { flex-wrap: wrap; }

    /* Buttons */
    .btn { font-size: 12px; padding: 6px 12px; }
    .btn-sm { font-size: 11px; padding: 4px 10px; }

    /* Stat cards */
    .stat-card { padding: 12px; }
    .stat-value, .dash-val, .kpi-value { font-size: 22px; }

    /* Modal */
    .modal { width: 95%; max-height: 90vh; }

    /* Bar chart */
    .bar-chart { height: 80px; }
    .bar-chart .bar .bar-label { font-size: 8px; }
}

@media (min-width: 769px) {
    .hamburger { display: none; }
    .sidebar-overlay { display: none; }
}

@media (max-width: 480px) {
    .stats-grid, .kpi-grid, .dash-hero { grid-template-columns: 1fr; }
    .topbar-actions input { display: none; }
}
