* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0b0f;
  --bg2: #111318;
  --glass: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --accent: #5865f2;
  --accent2: #7289da;
  --green: #23d18b;
  --red: #f04747;
  --orange: #faa81a;
  --purple: #a855f7;
  --text: #e2e8f0;
  --text2: #8892a4;
  --sidebar-w: 220px;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

/* GLASS */
.glass-card { background: var(--glass); border: 1px solid var(--glass-border); border-radius: 16px; padding: 24px; backdrop-filter: blur(12px); }

/* LOGIN */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 30% 50%, rgba(88,101,242,0.15) 0%, transparent 60%), radial-gradient(ellipse at 70% 20%, rgba(168,85,247,0.1) 0%, transparent 50%), var(--bg); }
.login-card { width: 100%; max-width: 420px; padding: 48px 40px; }
.login-logo { text-align: center; margin-bottom: 36px; }
.ts-icon { width: 72px; height: 72px; background: linear-gradient(135deg, var(--accent), var(--purple)); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; color: #fff; }
.ts-icon svg { width: 36px; height: 36px; }
.login-logo h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.login-logo h1 .accent { color: var(--accent); }
.login-logo p { color: var(--text2); margin-top: 6px; }
.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 8px; }
.input-group input { width: 100%; background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); border-radius: 10px; padding: 12px 16px; color: var(--text); font-size: 15px; font-family: inherit; outline: none; transition: border-color 0.2s; }
.input-group input:focus { border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 10px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit; transition: all 0.2s; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-full { width: 100%; justify-content: center; padding: 13px; }
.btn-success { background: rgba(35,209,139,0.15); color: var(--green); border: 1px solid rgba(35,209,139,0.25); }
.btn-success:hover { background: rgba(35,209,139,0.25); }
.btn-warning { background: rgba(250,168,26,0.15); color: var(--orange); border: 1px solid rgba(250,168,26,0.25); }
.btn-warning:hover { background: rgba(250,168,26,0.25); }
.btn-danger { background: rgba(240,71,71,0.15); color: var(--red); border: 1px solid rgba(240,71,71,0.25); }
.btn-danger:hover { background: rgba(240,71,71,0.25); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); color: var(--text); }
.btn-sm:hover { background: rgba(255,255,255,0.1); }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text2); padding: 6px; border-radius: 8px; transition: all 0.2s; }
.btn-icon:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.btn-icon svg { width: 18px; height: 18px; display: block; }
.error-msg { color: var(--red); font-size: 13px; text-align: center; margin-top: 12px; padding: 10px; background: rgba(240,71,71,0.1); border-radius: 8px; }

/* APP LAYOUT */
.app { display: flex; min-height: 100vh; }
.hidden { display: none !important; }

/* SIDEBAR */
.sidebar { width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--glass-border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.sidebar-header { padding: 24px 20px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--glass-border); }
.ts-icon-sm { width: 32px; height: 32px; background: linear-gradient(135deg, var(--accent), var(--purple)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0; }
.sidebar-header span { font-weight: 700; font-size: 15px; }
.nav-items { list-style: none; padding: 12px 10px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text2); font-size: 14px; font-weight: 500; transition: all 0.15s; position: relative; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: rgba(88,101,242,0.15); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.live-dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; margin-left: auto; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; }
.server-status-mini { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text2); flex-shrink: 0; transition: background 0.3s; }
.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(35,209,139,0.5); }
.status-dot.offline { background: var(--red); }

/* MAIN */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.top-header { padding: 20px 28px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; background: rgba(17,19,24,0.8); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 50; }
.header-left h2 { font-size: 20px; font-weight: 700; }
.breadcrumb { font-size: 13px; color: var(--text2); }
.header-right { display: flex; align-items: center; gap: 12px; }
.server-pill { display: flex; align-items: center; gap: 8px; background: var(--glass); border: 1px solid var(--glass-border); border-radius: 99px; padding: 6px 14px; font-size: 13px; font-weight: 500; }
.control-buttons { display: flex; gap: 8px; }

/* PAGES */
.page { display: none; padding: 28px; animation: fadeIn 0.2s ease; }
.page.active { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px);} to{opacity:1;transform:translateY(0);} }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 16px; padding: 20px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.green { background: rgba(35,209,139,0.1); color: var(--green); }
.stat-icon.blue { background: rgba(88,101,242,0.1); color: var(--accent); }
.stat-icon.purple { background: rgba(168,85,247,0.1); color: var(--purple); }
.stat-icon.orange { background: rgba(250,168,26,0.1); color: var(--orange); }
.stat-label { font-size: 12px; color: var(--text2); font-weight: 500; display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 22px; font-weight: 700; }

/* DASH GRID */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-header-row .card-title { margin-bottom: 0; }
.live-badge { margin-left: auto; font-size: 10px; font-weight: 700; padding: 3px 8px; background: rgba(35,209,139,0.15); color: var(--green); border-radius: 99px; letter-spacing: 0.5px; animation: pulse 2s infinite; }
.info-rows { display: flex; flex-direction: column; gap: 10px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: rgba(255,255,255,0.03); border-radius: 8px; font-size: 13px; }
.info-row span:first-child { color: var(--text2); }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent2); }

/* ACTIVITY FEED */
.activity-feed { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.activity-item { padding: 8px 12px; background: rgba(255,255,255,0.03); border-radius: 8px; font-size: 12px; font-family: 'JetBrains Mono', monospace; line-height: 1.5; }
.activity-item.info { border-left: 3px solid var(--accent); }
.activity-item.warning { border-left: 3px solid var(--orange); }
.activity-item.error { border-left: 3px solid var(--red); }
.activity-item.connect { border-left: 3px solid var(--green); }
.activity-item.disconnect { border-left: 3px solid var(--red); }
.activity-placeholder { color: var(--text2); font-size: 13px; text-align: center; padding: 20px; }

/* CLIENTS */
.clients-container { display: flex; flex-direction: column; gap: 10px; }
.client-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px; background: rgba(255,255,255,0.03); border-radius: 10px; border: 1px solid var(--glass-border); }
.client-avatar { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--purple)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0; }
.client-info { flex: 1; }
.client-name { font-weight: 600; font-size: 14px; }
.client-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.client-actions { display: flex; gap: 8px; }
.no-clients { text-align: center; padding: 60px 20px; color: var(--text2); }
.no-clients svg { width: 48px; height: 48px; margin: 0 auto 16px; display: block; opacity: 0.3; }

/* LOGS */
.logs-card { display: flex; flex-direction: column; height: calc(100vh - 160px); }
.logs-controls { display: flex; align-items: center; gap: 10px; }
.toggle-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); cursor: pointer; }
.log-terminal { flex: 1; background: rgba(0,0,0,0.4); border-radius: 10px; padding: 16px; font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.8; overflow-y: auto; color: #a8b3c5; border: 1px solid rgba(255,255,255,0.05); }
.log-line { display: block; }
.log-line.info { color: #7dd3fc; }
.log-line.warning { color: #fcd34d; }
.log-line.error { color: #f87171; }
.log-line.critical { color: #ef4444; font-weight: 700; }
.log-line.connect { color: #6ee7b7; }

/* SETTINGS */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-info code { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent2); background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 4px; }
.settings-info p { margin-bottom: 16px; font-size: 13px; color: var(--text2); }
.action-item { display: flex; align-items: center; justify-content: space-between; padding: 14px; background: rgba(255,255,255,0.03); border-radius: 10px; margin-bottom: 10px; }
.action-item strong { font-size: 14px; display: block; margin-bottom: 4px; }
.action-item p { font-size: 12px; color: var(--text2); margin: 0; }
.settings-actions { display: flex; flex-direction: column; gap: 0; }
.config-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.config-table tr:not(:last-child) td { border-bottom: 1px solid var(--glass-border); }
.config-table td { padding: 8px 10px; font-size: 13px; }
.config-table td:first-child { color: var(--text2); width: 40%; }
.config-table td:last-child { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* LOADING */
.loading-spinner { width: 32px; height: 32px; border: 3px solid var(--glass-border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast { padding: 14px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; min-width: 260px; display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease; backdrop-filter: blur(12px); border: 1px solid var(--glass-border); }
@keyframes slideIn { from{transform:translateX(100px);opacity:0;} to{transform:translateX(0);opacity:1;} }
.toast.success { background: rgba(35,209,139,0.15); border-color: rgba(35,209,139,0.3); color: var(--green); }
.toast.error { background: rgba(240,71,71,0.15); border-color: rgba(240,71,71,0.3); color: var(--red); }
.toast.info { background: rgba(88,101,242,0.15); border-color: rgba(88,101,242,0.3); color: var(--accent2); }
.toast.warning { background: rgba(250,168,26,0.15); border-color: rgba(250,168,26,0.3); color: var(--orange); }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(4px); }
.modal { max-width: 400px; width: 90%; padding: 32px; }
.modal h3 { margin-bottom: 12px; font-size: 18px; }
.modal p { color: var(--text2); margin-bottom: 24px; font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
