@import url('https://fonts.googleapis.com/css2?family=Cabinet+Grotesk:wght@400;500;700;800&family=JetBrains+Mono:wght@300;400;500&display=swap');

:root {
  --font-body:    'Cabinet Grotesk', sans-serif;
  --font-display: 'Cabinet Grotesk', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --bg:        #080c14;
  --surface:   #0d1220;
  --surface2:  #131929;
  --surface3:  #192038;

  --border:     rgba(100,140,220,0.10);
  --border-mid: rgba(100,140,220,0.16);
  --border-hi:  rgba(100,140,220,0.28);

  --accent:  #6c9ef8;
  --accent2: #a78bfa;
  --green:   #4ade80;
  --red:     #f87171;
  --amber:   #fbbf24;

  --text:  #e8eef8;
  --text2: #7a8aaa;
  --text3: #3a4460;

  --glow-accent: 0 0 24px rgba(108,158,248,0.15);
  --glow-green:  0 0 8px rgba(74,222,128,0.4);
}

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

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

body::before, body::after {
  content: ''; position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
}
body::before {
  top: -15%; left: -10%; width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(108,158,248,0.04) 0%, transparent 65%);
}
body::after {
  bottom: -10%; right: -5%; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(167,139,250,0.04) 0%, transparent 65%);
}

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

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

/* ── Shell ── */
.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  position: relative; z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
  grid-row: 1 / 3;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 16px;
  gap: 6px;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 10px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 20px rgba(108,158,248,0.28), inset 0 1px 0 rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--font-body); font-size: 17px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }
.brand-sub  { font-family: var(--font-mono); font-size: 10px; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; }

.nav-section {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 2.5px; color: var(--text3); text-transform: uppercase;
  padding: 16px 10px 5px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: var(--text2); transition: all 0.15s;
  cursor: pointer; text-decoration: none;
}
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(108,158,248,0.1); color: var(--accent); font-weight: 700; }

.nav-item svg { width: 18px; height: 18px; opacity: 0.6; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 10px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #1a2040, #242d50);
  border: 1.5px solid var(--border-mid);
  object-fit: cover;
}

.user-name { font-size: 13px; font-weight: 700; color: var(--text); }
.user-sub  { font-family: var(--font-mono); font-size: 10px; color: var(--text3); }

/* ── Topbar ── */
.topbar {
  padding: 22px 36px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: flex-end; justify-content: space-between;
}

.page-eyebrow {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text3); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px;
}
.page-title {
  font-family: var(--font-body); font-size: 28px;
  font-weight: 800; color: var(--text); letter-spacing: -0.5px;
}

/* ── Main Content ── */
.main {
  padding: 32px 36px;
  overflow-y: auto;
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px;
  position: relative; overflow: hidden; transition: all 0.2s;
  animation: fadeUp 0.5s ease forwards;
}
.stat:nth-child(2) { animation-delay: 0.08s; }
.stat:nth-child(3) { animation-delay: 0.16s; }
.stat:nth-child(4) { animation-delay: 0.24s; }

.stat::before {
  content: ''; position: absolute; top: -20px; right: -20px;
  width: 100px; height: 100px; border-radius: 50%;
  opacity: 0.1; filter: blur(24px);
}
.stat.s-blue::before   { background: var(--accent); }
.stat.s-green::before  { background: var(--green); }
.stat.s-violet::before { background: var(--accent2); }
.stat.s-red::before    { background: var(--red); }

.stat:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,0.4); border-color: var(--border-mid); }

.stat-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text3); margin-bottom: 14px; }
.stat-value { font-family: var(--font-body); font-size: 36px; font-weight: 700; color: var(--text); letter-spacing: -1px; margin-bottom: 8px; }
.stat-sub   { font-size: 12px; color: var(--text3); }

/* ── Panels ── */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px;
  margin-bottom: 24px;
  animation: fadeUp 0.5s ease forwards;
}

.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.panel-title { font-family: var(--font-body); font-size: 14px; font-weight: 700; color: var(--text); }

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text3); margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border-mid);
  border-radius: 9px;
  padding: 10px 14px;
  font-family: var(--font-body); font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,158,248,0.1);
}

.form-textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  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='%237a8aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--surface2);
  color: var(--text);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Buttons ── */
.btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  padding: 9px 20px; border-radius: 9px;
  cursor: pointer; transition: all 0.15s; border: none;
  display: inline-flex; align-items: center; gap: 8px;
}

.btn-ghost {
  background: var(--surface2); border: 1px solid var(--border-mid); color: var(--text2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hi); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; box-shadow: var(--glow-accent);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(108,158,248,0.3); }

.btn-danger {
  background: rgba(248,113,113,0.1); color: var(--red);
  border: 1px solid rgba(248,113,113,0.2);
}
.btn-danger:hover { background: rgba(248,113,113,0.2); }

.btn:disabled {
  opacity: 0.4; cursor: not-allowed; transform: none !important;
}

/* ── Badges ── */
.badge {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  padding: 3px 10px; border-radius: 100px;
}
.badge.up   { background: rgba(74,222,128,0.1);  color: var(--green); }
.badge.down { background: rgba(248,113,113,0.1); color: var(--red); }

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

table {
  width: 100%; border-collapse: collapse;
}
thead th {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text3); padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody td {
  font-family: var(--font-body); font-size: 13px;
  color: var(--text2); padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }

/* ── Embed Preview ── */
.embed-preview {
  background: var(--surface2);
  border-left: 4px solid var(--accent);
  border-radius: 0 9px 9px 0;
  padding: 16px 20px;
  margin-top: 16px;
}

.embed-preview-title {
  font-weight: 700; font-size: 16px; color: var(--text);
  margin-bottom: 8px;
}

.embed-preview-desc {
  font-size: 14px; color: var(--text2); line-height: 1.6;
  white-space: pre-wrap;
}

.embed-preview-footer {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text3); margin-top: 12px;
}

/* ── Color Picker Row ── */
.color-options {
  display: flex; gap: 8px; flex-wrap: wrap;
}

.color-dot {
  width: 32px; height: 32px; border-radius: 9px;
  border: 2px solid transparent; cursor: pointer;
  transition: all 0.15s;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.active { border-color: var(--text); box-shadow: 0 0 12px rgba(255,255,255,0.15); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface); border: 1px solid var(--border-mid);
  border-radius: 12px; padding: 14px 20px;
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  color: var(--text); z-index: 1000;
  animation: fadeUp 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }

/* ── Login Page ── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; position: relative; z-index: 1;
}

.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 48px;
  text-align: center; max-width: 400px; width: 100%;
  animation: fadeUp 0.5s ease forwards;
}

.login-card .brand-mark {
  width: 64px; height: 64px; border-radius: 18px;
  margin: 0 auto 24px; font-size: 28px;
}

.login-card h1 {
  font-family: var(--font-body); font-size: 24px;
  font-weight: 800; margin-bottom: 8px;
}

.login-card p {
  font-size: 14px; color: var(--text2); margin-bottom: 32px;
}

.login-btn {
  font-family: var(--font-body); font-size: 15px; font-weight: 700;
  background: #5865F2; color: #fff;
  border: none; border-radius: 9px;
  padding: 12px 32px; cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 10px;
}
.login-btn:hover { background: #4752c4; transform: translateY(-1px); }

.login-error {
  background: rgba(248,113,113,0.1); color: var(--red);
  font-size: 13px; padding: 10px 16px; border-radius: 9px;
  margin-bottom: 20px;
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px 16px; }
  .topbar { padding: 16px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}
