:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #222536;
  --border: #2d3148;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --text: #e2e4ed;
  --text-muted: #8b8fa8;
  --success: #23d160;
  --warning: #ffdd57;
  --danger: #ff3860;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

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

/* ── Login ─────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1e2140 0%, var(--bg) 70%);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo .icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.login-logo span {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.login-logo .badge {
  font-size: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.login-box h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}

.login-box p.subtitle {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 13px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,101,242,0.15);
}

.form-group input::placeholder { color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.alert {
  background: rgba(255,56,96,0.1);
  border: 1px solid rgba(255,56,96,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  color: #ff6b81;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.alert.show { display: block; }

.login-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Layout ─────────────────────────────────── */

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

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

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

.sidebar-logo .icon {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 16px;
  font-weight: 700;
}

.nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 1px;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(88,101,242,0.15);
  color: var(--accent);
  font-weight: 500;
}

.nav-item .icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-item .icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

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

.user-info { flex: 1; min-width: 0; }
.user-info .name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .role {
  font-size: 11px;
  color: var(--text-muted);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}
.logout-btn:hover { color: var(--danger); }

/* Main */
.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.badge-pill {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: rgba(35,209,96,0.15); color: var(--success); }
.badge-warning { background: rgba(255,221,87,0.15); color: var(--warning); }
.badge-danger  { background: rgba(255,56,96,0.15);  color: var(--danger); }
.badge-info    { background: rgba(88,101,242,0.15);  color: var(--accent); }

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

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.card-icon.blue  { background: rgba(88,101,242,0.15); }
.card-icon.green { background: rgba(35,209,96,0.15); }
.card-icon.yellow{ background: rgba(255,221,87,0.15); }
.card-icon.red   { background: rgba(255,56,96,0.15); }

.card-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Table */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
}

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

.panel-title {
  font-size: 14px;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(45,49,72,0.5);
  font-size: 13px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* Loader */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s ease;
}

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

/* 404 */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.error-page h1 { font-size: 80px; font-weight: 800; color: var(--accent); }
.error-page h2 { font-size: 24px; margin: 8px 0; }
.error-page p  { color: var(--text-muted); margin-bottom: 24px; }

/* ── Landing page ───────────────────────────── */

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 0%, #1e2140 0%, var(--bg) 65%);
}

.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
  border-bottom: 1px solid var(--border);
}

.nav-top-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}

.nav-top-logo .icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.nav-top-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
  color: var(--text-muted);
}

.nav-top-links a { color: var(--text-muted); transition: color 0.2s; }
.nav-top-links a:hover { color: var(--text); }

.btn-signin {
  background: var(--accent);
  color: #fff;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s, transform 0.15s;
}
.btn-signin:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 60px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(88,101,242,0.12);
  border: 1px solid rgba(88,101,242,0.25);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-bottom: 28px;
}

.hero h1 {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  max-width: 720px;
  margin-bottom: 20px;
}

.hero h1 span { color: var(--accent); }

.hero p {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.65;
  margin-bottom: 40px;
}

.hero-cta {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-primary-lg {
  background: var(--accent);
  color: #fff;
  padding: 13px 28px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s, transform 0.15s;
}
.btn-primary-lg:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 13px 28px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 900px;
  margin: 60px auto 0;
  padding: 0 24px;
}

@media (max-width: 860px) and (min-width: 501px) {
  .features { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .features { grid-template-columns: 1fr; }
  .nav-top { padding: 16px 20px; }
  .nav-top-links { gap: 16px; }
  .hero h1 { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  border-color: rgba(88,101,242,0.4);
  box-shadow: 0 4px 24px rgba(88,101,242,0.08);
}

.feature-icon { font-size: 22px; margin-bottom: 12px; }

.feature-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }

.feature-card p { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

.footer {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

/* ── Docs page ──────────────────────────────── */

.docs-layout { display: flex; min-height: 100vh; }

.docs-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 32px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.docs-sidebar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 32px;
  text-decoration: none;
  color: var(--text);
}

.docs-sidebar .logo .icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.docs-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 0 8px 8px;
}

.docs-link {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 1px;
}

.docs-link:hover { background: var(--surface2); color: var(--text); }
.docs-link.active { background: rgba(88,101,242,0.12); color: var(--accent); font-weight: 500; }

.docs-main { flex: 1; padding: 48px 64px; max-width: 860px; }
.docs-main h1 { font-size: 32px; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.5px; }
.docs-main .lead { font-size: 16px; color: var(--text-muted); margin-bottom: 40px; line-height: 1.6; }
.docs-main h2 { font-size: 18px; font-weight: 700; margin: 36px 0 12px; padding-top: 36px; border-top: 1px solid var(--border); }
.docs-main p { font-size: 14px; line-height: 1.75; color: var(--text-muted); margin-bottom: 16px; }

.docs-main code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
}

.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 16px 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  color: var(--text);
}

.docs-nav-bottom {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.docs-nav-btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
}
.docs-nav-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Status page ────────────────────────────── */

.status-page { max-width: 720px; margin: 0 auto; padding: 48px 24px; }

.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}

.status-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

.status-logo .icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.status-overall {
  background: rgba(35,209,96,0.08);
  border: 1px solid rgba(35,209,96,0.25);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(35,209,96,0.2);
}

.status-overall h2 { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.status-overall p { font-size: 13px; color: var(--text-muted); }

.status-group { margin-bottom: 28px; }

.status-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.status-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.status-item-name { font-size: 14px; font-weight: 500; }
.status-item-uptime { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.s-ok   { background: rgba(35,209,96,0.12);  color: var(--success); }
.s-warn { background: rgba(255,221,87,0.12); color: var(--warning); }

.uptime-bar { display: flex; gap: 2px; margin-top: 10px; }

.uptime-tick {
  width: 10px; height: 28px;
  border-radius: 3px;
  background: rgba(35,209,96,0.5);
}

.uptime-tick.miss { background: rgba(255,56,96,0.4); }
.uptime-tick.warn { background: rgba(255,221,87,0.5); }

.uptime-summary { font-size: 12px; color: var(--text-muted); margin-top: 8px; text-align: right; }
