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

:root {
  --page: #e8edf0;
  --panel: #ffffff;
  --header: #00857a;
  --header-dark: #006e65;
  --sidebar: #f3f7f8;
  --section: #f7fafb;
  --card: #ffffff;
  --border: #dce3e7;
  --text: #212b36;
  --text-muted: #76828e;
  --accent: #00857a;
  --accent-soft: #dff3f0;
  --positive: #2ea05c;
  --negative: #c84646;
  --isolate: #be8228;
  --white: #ffffff;
  --radius: 10px;
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

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

button, input, select { font-family: inherit; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--header-dark);
  outline-offset: 2px;
}

/* ---------- App shell ---------- */

.app-header {
  background: linear-gradient(135deg, var(--header), var(--header-dark));
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header .logo-mark {
  width: 32px;
  height: 32px;
  background: var(--white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--header);
  flex-shrink: 0;
}

.app-header .brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  margin-right: auto;
}

.app-header .brand .name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.02em;
}

.app-header .brand .sub {
  font-size: 11px;
  color: rgba(255,255,255,0.78);
  margin-top: 1px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 5px 11px 5px 9px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--white);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8fe0a8;
  box-shadow: 0 0 0 3px rgba(143,224,168,0.25);
}
.status-dot.down { background: #f3a3a3; box-shadow: 0 0 0 3px rgba(243,163,163,0.25); }
.status-dot.pending { background: #f0d68a; box-shadow: 0 0 0 3px rgba(240,214,138,0.25); }

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge img.avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.3);
  object-fit: cover;
}

.user-badge .who {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-badge .who .name { font-weight: 700; font-size: 13.5px; }
.user-badge .who .role { font-size: 11px; color: rgba(255,255,255,0.78); }

.logout-btn {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--white);
  border-radius: 7px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
}
.logout-btn:hover { background: rgba(255,255,255,0.24); }

.app-body {
  display: flex;
  min-height: calc(100vh - 58px);
}

.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
}

.sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.sidebar a.nav-link:hover { background: rgba(0,133,122,0.08); }

.sidebar a.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.content {
  flex: 1;
  padding: 22px 26px 40px;
  max-width: 1080px;
}

/* ---------- Cards / sections ---------- */

.section {
  background: var(--section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.section h2 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 12px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 12px 12px;
  position: relative;
  overflow: hidden;
}

.stat-card .bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.stat-card .value { font-family: var(--font-display); font-weight: 800; font-size: 26px; margin-top: 6px; }
.stat-card .caption { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

@media (max-width: 720px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .app-body { flex-direction: column; }
  .sidebar { width: 100%; display: flex; gap: 6px; overflow-x: auto; }
  .sidebar a.nav-link { flex-shrink: 0; margin-bottom: 0; }
}

/* ---------- Tables & rows ---------- */

.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  margin-bottom: 5px;
  font-size: 13px;
}

.data-row .count { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  text-align: left;
  color: var(--text-muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
table.grid td { padding: 8px; border-bottom: 1px solid var(--border); }
table.grid tr:last-child td { border-bottom: none; }

/* ---------- Forms ---------- */

input[type="text"], input[type="search"], input[type="password"], select, textarea {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--text);
  width: 100%;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}
.btn-accent { background: var(--accent); color: var(--white); }
.btn-positive { background: var(--positive); color: var(--white); }
.btn-negative { background: var(--negative); color: var(--white); }
.btn-isolate { background: var(--isolate); color: var(--white); }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn:hover { filter: brightness(0.95); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
}
.tab-btn.active { background: var(--accent); color: var(--white); border-color: var(--accent); }

.hint { color: var(--text-muted); font-size: 12px; }
.error-text { color: var(--negative); font-size: 12.5px; }
.success-text { color: var(--positive); font-size: 12.5px; }

/* ---------- Login page ---------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #0a978a 0%, #005851 65%, #003d38 100%);
}

.login-card {
  width: 380px;
  background: var(--panel);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,30,28,0.35);
}

.login-card .banner {
  background: linear-gradient(135deg, var(--header), var(--header-dark));
  padding: 30px 26px 24px;
  color: var(--white);
}

.login-card .banner .logo-mark {
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--white); color: var(--header);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  margin-bottom: 12px;
}

.login-card .banner h1 { font-family: var(--font-display); margin: 0; font-size: 22px; }
.login-card .banner p { margin: 4px 0 0; font-size: 13px; color: rgba(255,255,255,0.82); }

.login-card .body { padding: 26px; }

.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #5865f2;
  color: var(--white);
  border: none;
  border-radius: 9px;
  padding: 13px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
}
.discord-btn:hover { background: #4a54d8; }

.login-foot {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 16px;
}

.gate-message {
  max-width: 420px;
  margin: 60px auto;
  text-align: center;
}
