:root {
  --bg: #070b14;
  --bg-2: #0b1220;
  --card: #121b2e;
  --card-2: #0e1627;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --border: #23314f;
  --shadow: 0 20px 35px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 10% -10%, #1f2d57 0%, transparent 55%),
    radial-gradient(700px 500px at 90% 0%, rgba(124,58,237,.12), transparent 60%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: -20vmax;
  background:
    radial-gradient(circle at 20% 20%, rgba(124,58,237,.14), transparent 35%),
    radial-gradient(circle at 80% 10%, rgba(79,70,229,.12), transparent 30%),
    radial-gradient(circle at 30% 80%, rgba(16,185,129,.08), transparent 35%);
  z-index: -2;
  animation: floatGlow 14s ease-in-out infinite alternate;
}

.container { max-width: 1260px; margin: 22px auto; padding: 0 16px; }
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }

.sidebar {
  position: sticky;
  top: 14px;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  transition: width .25s ease, transform .25s ease;
  animation: rise .4s ease both;
}

body.sidebar-collapsed .layout { grid-template-columns: 86px 1fr; }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-link span,
body.sidebar-collapsed .theme-picker,
body.sidebar-collapsed .sidebar-footer { display: none; }
body.sidebar-collapsed .nav-link { justify-content: center; }

.logo-wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.logo-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo,
img.logo {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 8px 16px rgba(79,70,229,.28);
  border: 1px solid #334155;
  display: block;
}

.brand-title { font-weight: 800; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0b1220;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.nav { display: grid; gap: 8px; margin-top: 10px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: .2s;
}
.nav-link:hover { background: #1b2741; border-color: #2f446d; transform: translateX(2px); }
.nav-link.active { background: #1b2741; border-color: #38558d; }
.nav-link i { font-style: normal; width: 18px; text-align: center; }

.theme-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.theme-btn {
  border: 1px solid #334155;
  background: #111827;
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  min-height: 40px;
}
.theme-btn.active { border-color: #6366f1; color: #fff; background: #1f2937; }

.sidebar-footer { margin-top: 12px; font-size: 12px; color: var(--muted); }

.main { display: grid; gap: 14px; }
.hero {
  background: linear-gradient(135deg, rgba(79,70,229,.28), rgba(124,58,237,.2));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  animation: rise .5s ease both;
}
.hero h1 { margin: 0 0 8px; font-size: 34px; letter-spacing: .2px; }
.hero p { margin: 0; color: var(--muted); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* Global button baseline to avoid white UA defaults */
button {
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #334155;
  border-radius: 10px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2)) !important;
  color: #fff !important;
  padding: 14px 20px;
  border-radius: 12px;
  text-decoration: none;
  border: none !important;
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  min-height: 48px;
  min-width: 128px;
  line-height: 1;
  transition: .2s transform, .2s opacity, .2s box-shadow;
  box-shadow: 0 10px 20px rgba(79,70,229,.25);
}
.btn:hover { transform: translateY(-1px); opacity: .98; box-shadow: 0 14px 24px rgba(79,70,229,.32); }
.btn.secondary { background: #27344f !important; }
.btn.ghost { background: transparent !important; border: 1px solid #334155 !important; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  animation: rise .45s ease both;
}
.card h2, .card h3 { margin: 0 0 10px; }
.card p { margin: 0; color: var(--muted); }
.card.ok { border-left: 4px solid var(--ok); }
.card.warning { border-left: 4px solid var(--warn); }
.card.danger { border-left: 4px solid var(--danger); }

.metric { font-size: 32px; font-weight: 800; line-height: 1; margin-top: 6px; }

.server-card-title, .server-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pill {
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: #0b1220;
  color: #cbd5e1;
}
.pill.ok { border-color: #14532d; color: #86efac; }

.compact-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.compact-overview-item {
  background: rgba(11, 18, 32, 0.65);
  border: 1px solid #2b3a59;
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.compact-overview-item span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.compact-overview-item strong {
  font-size: 20px;
  line-height: 1.1;
}

.compact-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.compact-stat {
  border: 1px solid #2b3a59;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(11, 18, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-stat span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.compact-stat strong {
  font-size: 15px;
  color: #f1f5f9;
}

.server-card {
  display: grid;
  gap: 10px;
}

.server-card.pending {
  border-color: #5b4a1d;
}

.server-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.quick-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #cbd5e1;
  display: grid;
  gap: 6px;
}

.mini-health {
  padding: 12px;
}

.mini-health h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

label { display: block; margin: 8px 0 6px; color: #cbd5e1; font-size: 13px; font-weight: 600; }
input, textarea, select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: var(--bg-2);
  color: #e2e8f0;
  margin-bottom: 10px;
  min-height: 44px;
}
textarea { resize: vertical; min-height: 92px; }
.muted { color: var(--muted); }

.tab-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-btn {
  border: 1px solid #334155;
  background: #111827;
  color: #cbd5e1;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
}
.tab-btn.active { border-color: #6366f1; color: #fff; background: #171f34; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .2s ease both; }

code { background: #0b1220; padding: 2px 6px; border-radius: 6px; border: 1px solid #1f2d49; }
pre { white-space: pre-wrap; background: #0b1220; border: 1px solid #1f2d49; padding: 10px; border-radius: 10px; }

.toast-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}
.toast {
  background: #0b1220;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease both;
}
.toast.ok { border-left: 4px solid var(--ok); }
.toast.warning { border-left: 4px solid var(--warn); }
.toast.danger { border-left: 4px solid var(--danger); }

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  opacity: .85;
  display: inline-block;
  animation: pulse 1s ease infinite;
}

/* Themes */
body.theme-neon { --brand: #00e5ff; --brand-2: #7c4dff; --border: #1d4b5a; }
body.theme-sunset { --brand: #f97316; --brand-2: #ec4899; --border: #5a2d26; }
body.theme-emerald { --brand: #10b981; --brand-2: #06b6d4; --border: #224a45; }
body.theme-wick {
  --bg: #05070d;
  --bg-2: #0b101a;
  --card: #101826;
  --card-2: #0c1320;
  --text: #dbe7ff;
  --muted: #92a7c9;
  --brand: #4da3ff;
  --brand-2: #7a5cff;
  --border: #22334f;
}

body.theme-wick .hero {
  background: linear-gradient(135deg, rgba(77,163,255,.2), rgba(122,92,255,.18));
}

body.theme-wick .card {
  border-color: #2d4266;
  box-shadow: 0 16px 30px rgba(7, 14, 28, .5);
}

body.theme-wick .tab-btn.active {
  border-color: #4da3ff;
  background: #13233b;
}

body.theme-wick .pill.ok {
  border-color: #2f5f9a;
  color: #9fd0ff;
}

body.theme-wick .btn {
  background: linear-gradient(90deg, #3b82f6, #6366f1) !important;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .compact-overview { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .container { margin: 16px auto; }
  .btn { width: 100%; }
}

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 50% { transform: scale(1.25); opacity: 1; } }
@keyframes floatGlow { from { transform: translateY(-8px) scale(1); } to { transform: translateY(8px) scale(1.02); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
