:root {
  --bg: #0f0f17;
  --bg2: #16162a;
  --bg3: #1e1e3a;
  --border: #2a2a50;
  --accent: #5865f2;
  --accent2: #7289da;
  --text: #e2e2f0;
  --text2: #9999bb;
  --green: #43b581;
  --red: #f04747;
  --orange: #faa61a;
  --yellow: #fee75c;
  --purple: #9b59b6;
  --teal: #1abc9c;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --sidebar-w: 240px;
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ---- LAYOUT ---- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
}
.brand-icon { font-size: 24px; }
.brand-name { background: linear-gradient(135deg, var(--accent), #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text2);
  text-decoration: none;
  transition: all 0.15s;
  font-weight: 500;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(88,101,242,0.15); color: var(--accent); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-badge { font-size: 13px; color: var(--text2); font-weight: 600; }
.logout-btn { color: var(--red); font-size: 12px; text-decoration: none; }
.logout-btn:hover { text-decoration: underline; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - var(--sidebar-w));
  overflow-x: hidden;
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-header h1 { font-size: 24px; font-weight: 700; }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(155,89,182,0.15); }
.stat-icon.blue { background: rgba(88,101,242,0.15); }
.stat-icon.green { background: rgba(67,181,129,0.15); }
.stat-icon.orange { background: rgba(250,166,26,0.15); }
.stat-icon.red { background: rgba(240,71,71,0.15); }
.stat-icon.teal { background: rgba(26,188,156,0.15); }
.stat-value { font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ---- SECTION ---- */
.section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.section h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { margin-bottom: 0; }

/* ---- TABLE ---- */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(42,42,80,0.5);
  vertical-align: middle;
}
.table tr:hover td { background: rgba(255,255,255,0.02); }
.table tr:last-child td { border-bottom: none; }
.text-truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge.green { background: rgba(67,181,129,0.15); color: var(--green); }
.badge.red { background: rgba(240,71,71,0.15); color: var(--red); }
.badge.orange { background: rgba(250,166,26,0.15); color: var(--orange); }
.badge.yellow { background: rgba(254,231,92,0.15); color: var(--yellow); }
.badge.blue { background: rgba(88,101,242,0.15); color: var(--accent2); }
.badge.grey { background: rgba(153,153,187,0.15); color: var(--text2); }
.badge.purple { background: rgba(155,89,182,0.15); color: var(--purple); }

/* ---- LOGS ---- */
.logs-container { display: flex; flex-direction: column; gap: 6px; max-height: 400px; overflow-y: auto; }
.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg3);
  border-radius: 8px;
  font-size: 13px;
}
.log-type { font-weight: 600; min-width: 160px; }
.log-user { color: var(--text2); font-family: 'JetBrains Mono', monospace; font-size: 12px; flex: 1; }
.log-time { color: var(--text2); font-size: 12px; white-space: nowrap; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent2); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: rgba(240,71,71,0.15); color: var(--red); }
.btn-danger:hover { background: rgba(240,71,71,0.3); }
.btn-warning { background: rgba(250,166,26,0.15); color: var(--orange); }
.btn-warning:hover { background: rgba(250,166,26,0.3); }
.btn-success { background: rgba(67,181,129,0.15); color: var(--green); }
.btn-success:hover { background: rgba(67,181,129,0.3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text2); }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--accent); }
.form-group input[type="checkbox"] { width: auto; margin-right: 6px; accent-color: var(--accent); }
.form-group input[type="color"] { width: 48px; height: 36px; padding: 2px; cursor: pointer; }
.form-row { display: flex; gap: 16px; align-items: flex-start; }
.form-row .form-group { flex: 1; }

/* ---- MODAL ---- */
.modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  z-index: 1;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* ---- STATUS ---- */
.status-pill { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-pill.online { background: rgba(67,181,129,0.15); color: var(--green); }
.status-pill.offline { background: rgba(240,71,71,0.15); color: var(--red); }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; color: var(--text2); padding: 40px; font-size: 14px; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(240,71,71,0.15); border: 1px solid rgba(240,71,71,0.3); color: var(--red); }

/* ---- LOGIN ---- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-icon { font-size: 48px; margin-bottom: 12px; }
.login-header h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; background: linear-gradient(135deg, var(--accent), #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-header p { color: var(--text2); font-size: 14px; }

/* ---- NOTIFICATIONS GRID ---- */
.notif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.notif-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notif-platform { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2); }
.notif-account { font-size: 18px; font-weight: 700; }
.notif-channel { font-size: 12px; color: var(--text2); font-family: 'JetBrains Mono', monospace; }
.notif-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ---- TWO COL ---- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---- CODE ---- */
code { background: var(--bg3); padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
