*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg0: #0d0d0f; --bg1: #111115; --bg2: #17171d; --bg3: #1e1e26;
    --line: #2a2a35; --text1: #f0f0f5; --text2: #b0b0bf; --text3: #7070a0;
    --accent: #6366f1; --accent2: #818cf8; --green: #22c55e; --red: #ef4444;
    --yellow: #f59e0b; --radius: 10px; --sidebar: 220px;
}
body { font-family: 'Inter',-apple-system,sans-serif; background:var(--bg0); color:var(--text1); min-height:100vh; font-size:14px; }
a { color:inherit; text-decoration:none; }
input,select,textarea { background:var(--bg2); border:1px solid var(--line); color:var(--text1); border-radius:var(--radius); padding:8px 12px; font-size:13px; outline:none; width:100%; }
input:focus,select:focus,textarea:focus { border-color:var(--accent); }
button,.btn { cursor:pointer; border:none; border-radius:var(--radius); padding:8px 16px; font-size:13px; font-weight:500; transition:.15s; }
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:var(--accent2); }
.btn-danger { background:var(--red); color:#fff; }
.btn-danger:hover { opacity:.85; }
.btn-sm { padding:5px 10px; font-size:12px; }
.btn-ghost { background:transparent; color:var(--text2); border:1px solid var(--line); }
.btn-ghost:hover { background:var(--bg3); color:var(--text1); }

/* Layout */
.layout { display:flex; min-height:100vh; }
.sidebar { width:var(--sidebar); background:var(--bg1); border-right:1px solid var(--line); display:flex; flex-direction:column; position:fixed; top:0; left:0; height:100vh; z-index:100; }
.sidebar-logo { padding:20px 16px 16px; border-bottom:1px solid var(--line); }
.sidebar-logo h2 { font-size:14px; font-weight:700; color:var(--text1); }
.sidebar-logo span { font-size:11px; color:var(--text3); }
.sidebar-nav { flex:1; padding:12px 8px; overflow-y:auto; }
.nav-group-title { font-size:10px; font-weight:600; letter-spacing:.1em; text-transform:uppercase; color:var(--text3); padding:8px 8px 4px; }
.nav-item { display:flex; align-items:center; gap:9px; padding:8px 10px; border-radius:8px; color:var(--text2); font-size:13px; font-weight:500; transition:.12s; margin-bottom:1px; }
.nav-item:hover { background:var(--bg3); color:var(--text1); }
.nav-item.active { background:var(--accent); color:#fff; }
.nav-item svg { width:15px; height:15px; flex-shrink:0; }
.sidebar-footer { padding:12px; border-top:1px solid var(--line); }

.main { margin-left:var(--sidebar); flex:1; display:flex; flex-direction:column; }
.topbar { position:sticky; top:0; z-index:50; height:52px; background:var(--bg0)/80; backdrop-filter:blur(8px); border-bottom:1px solid var(--line); display:flex; align-items:center; padding:0 24px; gap:12px; }
.topbar h1 { font-size:15px; font-weight:600; flex:1; }
.page-content { padding:24px; flex:1; }

/* Cards */
.card { background:var(--bg1); border:1px solid var(--line); border-radius:var(--radius); padding:20px; }
.card-title { font-size:12px; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:.08em; margin-bottom:16px; }
.stat-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:16px; margin-bottom:24px; }
.stat-card { background:var(--bg1); border:1px solid var(--line); border-radius:var(--radius); padding:18px; }
.stat-label { font-size:11px; color:var(--text3); font-weight:600; text-transform:uppercase; letter-spacing:.08em; }
.stat-value { font-size:26px; font-weight:700; color:var(--text1); margin:6px 0 4px; }
.stat-sub { font-size:12px; color:var(--text3); }
.stat-up { color:var(--green); } .stat-down { color:var(--red); }

/* Table */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:13px; }
th { text-align:left; padding:10px 12px; font-size:11px; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:.06em; border-bottom:1px solid var(--line); }
td { padding:10px 12px; border-bottom:1px solid var(--line); color:var(--text2); vertical-align:middle; }
tr:last-child td { border-bottom:none; }
tr:hover td { background:var(--bg2); }
.badge { display:inline-block; padding:2px 8px; border-radius:20px; font-size:11px; font-weight:600; }
.badge-open { background:#22c55e22; color:var(--green); }
.badge-closed { background:#6366f122; color:var(--accent2); }
.badge-answered { background:#22c55e22; color:var(--green); }
.badge-missed { background:#ef444422; color:var(--red); }

/* Pagination */
.pagination { display:flex; gap:6px; align-items:center; margin-top:16px; flex-wrap:wrap; }
.page-btn { padding:5px 10px; border-radius:6px; font-size:12px; background:var(--bg2); border:1px solid var(--line); color:var(--text2); cursor:pointer; }
.page-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.page-btn:hover:not(.active) { background:var(--bg3); }

/* Bars */
.bar-list { display:flex; flex-direction:column; gap:8px; }
.bar-item { display:flex; flex-direction:column; gap:4px; }
.bar-label { display:flex; justify-content:space-between; font-size:12px; color:var(--text2); }
.bar-track { height:6px; background:var(--bg3); border-radius:3px; }
.bar-fill { height:6px; background:var(--accent); border-radius:3px; transition:width .4s; }

/* Forms */
.form-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:16px; }
.form-group { display:flex; flex-direction:column; gap:6px; }
.form-label { font-size:12px; font-weight:600; color:var(--text3); }
.form-actions { margin-top:20px; display:flex; gap:10px; }

/* Messages */
.msg { display:flex; gap:10px; margin-bottom:12px; }
.msg-body { background:var(--bg2); border:1px solid var(--line); border-radius:10px; padding:10px 14px; max-width:80%; font-size:13px; line-height:1.5; }
.msg.agent .msg-body { background:#6366f122; border-color:#6366f144; margin-left:auto; }
.msg-meta { font-size:11px; color:var(--text3); margin-top:4px; }

/* Alerts */
.alert { padding:10px 14px; border-radius:8px; font-size:13px; margin-bottom:16px; }
.alert-success { background:#22c55e22; color:var(--green); border:1px solid #22c55e44; }
.alert-error { background:#ef444422; color:var(--red); border:1px solid #ef444444; }

/* Live dot */
.live-dot { width:8px; height:8px; border-radius:50%; background:var(--green); display:inline-block; animation:pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.text-muted { color:var(--text3); }
.text-sm { font-size:12px; }
.mt-4 { margin-top:16px; } .mb-4 { margin-bottom:16px; } .gap-12 { gap:12px; }
.flex { display:flex; } .items-center { align-items:center; } .justify-between { justify-content:space-between; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
@media(max-width:768px){ .grid-2{grid-template-columns:1fr;} .sidebar{transform:translateX(-100%);} .main{margin-left:0;} }
