@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2535;
  --border: #2a3147;
  --text: #e2e8f5;
  --muted: #7b8db0;
  --accent: #4f7eff;
  --accent2: #7c3aed;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  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-logo {
  padding: 24px 20px 20px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.3px;
}

.sidebar-logo span { color: var(--accent); }

.sidebar-nav { padding: 16px 0; flex: 1; overflow-y: auto; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section { padding: 8px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav-link.active { color: var(--accent); background: rgba(79,126,255,0.08); }
.nav-link i { font-size: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 16px; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.user-badge .avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}

.content { padding: 28px; flex: 1; }

/* Cards */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: 15px; font-weight: 600; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 600; font-family: 'DM Mono', monospace; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-up { color: var(--success); }
.stat-down { color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid rgba(42,49,71,0.5); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-success { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #ef4444; }
.badge-info    { background: rgba(79,126,255,0.15);  color: #4f7eff; }
.badge-gray    { background: rgba(123,141,176,0.15); color: #7b8db0; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d6be8; text-decoration: none; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; text-decoration: none; color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #dc2626; text-decoration: none; color: #fff; }
.btn-ghost   { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 18px; }
.alert-success { background: rgba(16,185,129,0.1);  border: 1px solid rgba(16,185,129,0.3);  color: #10b981; }
.alert-danger  { background: rgba(239,68,68,0.1);   border: 1px solid rgba(239,68,68,0.3);   color: #ef4444; }
.alert-info    { background: rgba(79,126,255,0.1);   border: 1px solid rgba(79,126,255,0.3);  color: #4f7eff; }
.alert-warning { background: rgba(245,158,11,0.1);  border: 1px solid rgba(245,158,11,0.3);  color: #f59e0b; }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 20px; justify-content: center; }
.page-link {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.auth-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.auth-logo span { color: var(--accent); }
.auth-sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* Code block (zone embed) */
.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #a8b8d8;
  overflow-x: auto;
  white-space: pre;
}

/* Misc */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-20  { margin-top: 20px; }
.mb-20  { margin-bottom: 20px; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.mono   { font-family: 'DM Mono', monospace; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
