:root {
  --bg: #05070f;
  --bg-soft: #0b101c;
  --card: #0d1420;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --emerald: #34d399;
  --amber: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--bg-soft);
  border-right: 1px solid var(--border); padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { font-weight: 800; font-size: 16px; padding: 4px 12px 18px; letter-spacing: -0.02em; }
.sidebar-brand .dot { color: var(--accent); }.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; color: var(--text-muted); cursor: pointer; font-weight: 500;
  border: 1px solid transparent; transition: all .12s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--text); background: rgba(56,189,248,0.1); border-color: rgba(56,189,248,0.25); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .badge { margin-left: auto; background: var(--accent); color: #000; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-foot .user { padding: 6px 12px; font-size: 12px; color: var(--text-dim); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; border-bottom: 1px solid var(--border); background: rgba(5,7,15,0.7);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; font-weight: 700; margin: 0; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 28px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.space-y-6 > * + * { margin-top: 24px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-2 > * + * { margin-top: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.ml-2 { margin-left: 8px; } .ml-6 { margin-left: 24px; }
.p-0 { padding: 0; }
.pt-1 { padding-top: 4px; } .pt-2 { padding-top: 8px; } .pt-3 { padding-top: 12px; }
.px-2 { padding-left: 8px; padding-right: 8px; } .px-3 { padding-left: 12px; padding-right: 12px; } .px-4 { padding-left: 16px; padding-right: 16px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; } .py-2 { padding-top: 8px; padding-bottom: 8px; } .py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-16 { padding-top: 64px; padding-bottom: 64px; }

/* ---------- Typography ---------- */
.text-2xl { font-size: 24px; }
.text-lg { font-size: 18px; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-mono { font-family: ui-monospace, "Cascadia Code", monospace; }
.uppercase { text-transform: uppercase; }
.normal-case { text-transform: none; }
.tracking-wider { letter-spacing: 0.05em; }
.leading-relaxed { line-height: 1.625; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ---------- Colors ---------- */
.text-slate-100 { color: #f1f5f9; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-white { color: #fff; }
.text-emerald-300 { color: #6ee7b7; } .text-emerald-400 { color: #34d399; }
.text-amber-300 { color: #fcd34d; }
.text-danger-400 { color: #f87171; }
.text-sky-300 { color: #7dd3fc; }
.text-sky-500 { color: #0ea5e9; }

/* ---------- Inputs ---------- */
.input {
  width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 14px;
  font-family: inherit; outline: none; transition: border-color .12s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-dim); }
.input:disabled { opacity: 0.5; }
textarea.input { resize: vertical; }
select.input { appearance: auto; }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.label.\!mb-0 { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; font-family: inherit; transition: all .12s;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #001018; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: rgba(248,113,113,0.15); color: var(--danger); border-color: rgba(248,113,113,0.3); }
.btn-danger:hover { background: rgba(248,113,113,0.25); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn.w-full { width: 100%; }
.flex-1 { flex: 1; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.badge-ok { background: rgba(52,211,153,0.12); color: var(--emerald); border: 1px solid rgba(52,211,153,0.3); }
.badge-err { background: rgba(248,113,113,0.12); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.badge-warn { background: rgba(251,191,36,0.12); color: var(--amber); border: 1px solid rgba(251,191,36,0.3); }
.badge-info { background: rgba(56,189,248,0.12); color: var(--accent); border: 1px solid rgba(56,189,248,0.3); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 10px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); background: rgba(255,255,255,0.02); }
.table td { padding: 10px 16px; border-top: 1px solid rgba(255,255,255,0.04); }
.table tr:hover td { background: rgba(255,255,255,0.02); }

/* ---------- Status dots ---------- */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-green { background: var(--emerald); }
.dot-red { background: var(--danger); }
.dot-amber { background: var(--amber); }
.dot-gray { background: var(--text-dim); }

/* ---------- Scrollable terminal ---------- */
.term {
  background: rgba(0,0,0,0.5); font-family: ui-monospace, monospace; font-size: 12px;
  line-height: 1.6; padding: 16px; overflow: auto; max-height: 280px; border-radius: 8px;
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- Checkbox / toggle ---------- */
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--border-strong); border-radius: 16px; max-width: 560px; width: 100%; padding: 24px; }

/* ---------- Login screen ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 28px; }

/* ---------- Brand logo ---------- */
.brand-logo { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); filter: drop-shadow(0 0 6px rgba(56,189,248,0.55));
  animation: brandGlow 3s ease-in-out infinite;
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-word { font-weight: 800; letter-spacing: -0.03em; }
.brand-word .dot { color: var(--accent); }
.login-logo .brand-word { font-size: 28px; }
.sidebar-brand .brand-word { font-size: 16px; }
@keyframes brandGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(56,189,248,0.45)); }
  50% { filter: drop-shadow(0 0 12px rgba(56,189,248,0.85)); }
}

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; max-width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.toast.ok { background: #0b2a1e; color: #6ee7b7; border: 1px solid rgba(52,211,153,0.3); }
.toast.err { background: #2a0f13; color: #fca5a5; border: 1px solid rgba(248,113,113,0.3); }

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .sidebar-brand { padding: 4px 12px; }
  .sidebar-foot { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
