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

:root {
  --bg: #0c0c0f;
  --bg-elevated: rgba(18, 18, 24, 0.92);
  --panel: rgba(28, 28, 33, 0.72);
  --panel-hover: rgba(37, 37, 44, 0.85);
  --border: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(139, 92, 246, 0.35);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.16);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --warn: #f59e0b;
  --danger: #ef4444;
  --sidebar-w: 248px;
  --top-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "DM Sans", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(139, 92, 246, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(16, 185, 129, 0.08), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(255,255,255,0.02); }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1rem 0.85rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.35rem 0.5rem 1rem; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(145deg, #a78bfa, #7c3aed);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
}
.brand h1 { font-size: 1rem; line-height: 1.1; }
.brand p { color: var(--muted); font-size: 0.72rem; margin-top: 0.15rem; }
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.68rem; padding: 0.15rem 0.45rem; border-radius: 999px;
  background: var(--accent-soft); color: #ddd6fe; border: 1px solid var(--border-accent);
}
.nav-section { color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.6rem 0.65rem 0.25rem; }
.nav a, .nav button.nav-link {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  padding: 0.55rem 0.65rem; border-radius: 10px; color: var(--muted);
  border: 0; background: transparent; text-align: left;
}
.nav a:hover, .nav button.nav-link:hover { background: var(--panel-hover); color: var(--text); }
.nav a.active, .nav button.nav-link.active {
  background: var(--accent-soft); color: #ede9fe; border: 1px solid var(--border-accent);
}
.nav .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.sidebar-foot { margin-top: auto; padding: 0.75rem 0.5rem; border-top: 1px solid var(--border); }
.user-chip { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.55rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; border-bottom: 1px solid var(--border);
  background: rgba(12,12,15,0.65); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.topbar .crumb { color: var(--muted); font-size: 0.85rem; }
.topbar .crumb strong { color: var(--text); }
.content { padding: 1.25rem; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1.15rem; flex-wrap: wrap; }
.page-header h2 { font-size: 1.45rem; }
.page-header p { color: var(--muted); margin-top: 0.3rem; font-size: 0.9rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1.15rem; }
.stat, .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}
.stat .label { color: var(--muted); font-size: 0.75rem; }
.stat .value { font-size: 1.35rem; font-weight: 700; margin-top: 0.2rem; }
.value-ok { color: var(--success); }
.value-warn { color: var(--warn); }
.value-bad { color: var(--danger); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.85rem; }
.card h3 { font-size: 0.95rem; margin-bottom: 0.35rem; }
.card p, .muted { color: var(--muted); font-size: 0.85rem; }
.incomplete {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-top: 0.55rem; font-size: 0.72rem; color: #fcd34d;
  background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245,158,11,0.3);
  padding: 0.2rem 0.5rem; border-radius: 999px;
}

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--border); background: var(--panel);
  padding: 0.45rem 0.8rem; border-radius: 10px; color: var(--text);
}
.btn:hover { background: var(--panel-hover); }
.btn.primary { background: var(--accent); border-color: transparent; color: white; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: rgba(239,68,68,0.4); color: #fecaca; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.row-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; }
.field label { font-size: 0.78rem; color: var(--muted); }
.field input, .field select, .field textarea {
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.55rem 0.7rem; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%); background: var(--panel);
  border: 1px solid var(--border); border-radius: 18px; padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-card h1 { font-size: 1.35rem; margin-bottom: 0.25rem; }
.alert {
  padding: 0.65rem 0.75rem; border-radius: 10px; margin-bottom: 0.85rem; font-size: 0.85rem;
}
.alert.error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.35); color: #fecaca; }
.alert.info { background: var(--accent-soft); border: 1px solid var(--border-accent); color: #ddd6fe; }
.alert.ok { background: var(--success-soft); border: 1px solid rgba(16,185,129,0.35); color: #a7f3d0; }

.tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab {
  padding: 0.4rem 0.75rem; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 0.82rem;
}
.tab.active { background: var(--accent-soft); color: #ede9fe; border-color: var(--border-accent); }

.status-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--border);
}
.status-pill.up { background: var(--success-soft); color: #6ee7b7; }
.status-pill.down { background: rgba(239,68,68,0.12); color: #fca5a5; }
.status-pill.warn { background: rgba(245,158,11,0.12); color: #fcd34d; }

.loading { color: var(--muted); padding: 1.5rem 0; }
.empty { color: var(--muted); padding: 1rem 0; font-size: 0.9rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, var(--sidebar-w));
    transform: translateX(-105%); transition: transform .2s ease; z-index: 20;
  }
  .sidebar.open { transform: translateX(0); }
  .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 15; }
}
