:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3e;
  --text: #e2e8f0;
  --muted: #8892a4;
  --accent: #6366f1;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 14px;
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.nav-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}
.nav-title:hover { color: var(--text); }
.nav-logo { height: 26px; width: auto; display: block; }
.nav-right { display: flex; align-items: center; gap: 18px; }
.nav-user { font-size: 12px; color: var(--text); }
.nav-version { font-size: 11px; color: var(--muted); }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px 40px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.login-logo { width: 200px; max-width: 100%; height: auto; }
.login-header h1 { font-size: 22px; }
.login-version { font-size: 11px; color: var(--muted); }
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.login-box input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.login-box button {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}
.login-box button:hover { opacity: 0.9; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
main { padding: 24px; }
.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.loading, .muted { color: var(--muted); }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* ── Status dots ──────────────────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--red); }

/* ── Valheim panel ────────────────────────────────────────────────────────── */
.vh { display: flex; flex-direction: column; gap: 18px; }
.node-header { display: flex; align-items: center; gap: 8px; }
.node-name { font-size: 16px; font-weight: 700; }
.stats-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 90px;
}
.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.stat-value { font-size: 14px; font-weight: 600; }
.stat-card.players-empty { opacity: 0.55; }
.stat-card.players-empty .stat-value { color: var(--muted); }
.stat-card.players-active { border-color: var(--green); background: rgba(34, 197, 94, 0.12); }
.stat-card.players-active .stat-value { color: var(--green); }

.vm-list { display: flex; flex-wrap: wrap; gap: 6px; }
.vm-tag {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
}
.vm-tag.running { border-color: var(--green); color: var(--green); }

/* ── World list ───────────────────────────────────────────────────────────── */
.world-list { display: flex; flex-direction: column; gap: 10px; }
.world {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}
.world-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.world-name { font-size: 15px; font-weight: 700; }
.world-meta { font-size: 12px; color: var(--muted); }
.world-files { font-size: 11px; color: var(--muted); font-family: monospace; }
.btn-download {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-download:hover { opacity: 0.9; }

/* ── History table ────────────────────────────────────────────────────────── */
table.history { width: 100%; border-collapse: collapse; font-size: 13px; }
table.history th, table.history td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
table.history th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
}
table.history tbody tr:last-child td { border-bottom: none; }

/* ── Shared ───────────────────────────────────────────────────────────────── */
.error { color: var(--red); }
