:root {
  --bg: #0f1115;
  --surface: #161923;
  --surface-alt: #1e2230;
  --border: #2a2f3d;
  --text: #e7e9ee;
  --text-dim: #9aa0ae;
  --accent: #6d8bff;
  --ok: #3ecf8e;
  --fail: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topnav .brand { font-weight: 700; letter-spacing: 0.02em; margin-right: 1rem; }
.topnav a { color: var(--text-dim); text-decoration: none; font-size: 0.92rem; }
.topnav a.active, .topnav a:hover { color: var(--text); }
.topnav .logout { margin-left: auto; }

.content { max-width: 1080px; margin: 0 auto; padding: 2rem 1.5rem; }

h1 { font-size: 1.5rem; margin-bottom: 1.25rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; color: var(--text-dim); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat { text-align: center; }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.25rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 800px) { .two-col, .stat-grid { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.empty { color: var(--text-dim); text-align: center; padding: 1rem; }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; }
.badge.ok { background: rgba(62, 207, 142, 0.15); color: var(--ok); }
.badge.fail { background: rgba(255, 107, 107, 0.15); color: var(--fail); }

.link { display: inline-block; margin-top: 0.75rem; color: var(--accent); text-decoration: none; font-size: 0.85rem; }

.login-wrap { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
.login-card { width: 320px; }
.login-card h1 { margin-bottom: 0.1rem; }
.subtitle { color: var(--text-dim); font-size: 0.85rem; margin-top: 0; margin-bottom: 1.25rem; }

label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.9rem; }
input, select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--accent);
  color: #0b0d12;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
button:hover { opacity: 0.9; }

.btn-small {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
}
.btn-small.danger { color: var(--fail); border-color: rgba(255,107,107,0.4); }

.inline-form { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { width: auto; margin-top: 0; }
form.inline { display: inline-block; margin-right: 0.4rem; }
.actions { white-space: nowrap; }

.alert { padding: 0.7rem 0.9rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.88rem; }
.alert.error { background: rgba(255,107,107,0.12); color: var(--fail); border: 1px solid rgba(255,107,107,0.3); }
.alert.ok { background: rgba(62,207,142,0.1); color: var(--ok); border: 1px solid rgba(62,207,142,0.3); }
.alert code { background: var(--surface-alt); padding: 0.15rem 0.4rem; border-radius: 4px; }

.filters { margin-bottom: 1.25rem; }
