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

:root {
  --bg: #12151b;
  --surface: #1a1e26;
  --surface-2: #212632;
  --border: #2a303c;
  --text: #e6e9ef;
  --text-dim: #8b93a3;
  --accent: #e0a638;
  --accent-dark: #b9832a;

  --status-stopped: #5b6472;
  --status-starting: #e0a638;
  --status-connecting: #e0a638;
  --status-online: #3ecf8e;
  --status-offline: #e0813e;
  --status-stopping: #5b6472;
  --status-crashed: #e0575f;
  --status-unknown: #5b6472;

  --radius: 6px;
  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

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

h1, h2, h3 { font-weight: 500; margin: 0; }

.muted { color: var(--text-dim); }

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-wrap { width: 100%; max-width: 360px; padding: 24px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { font-size: 22px; letter-spacing: 0.02em; }
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.login-card input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 10px;
}
.login-card input:focus, input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.error { color: var(--status-crashed); font-size: 13px; margin: 0; }

/* ---------- Buttons ---------- */
button {
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 8px 14px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn, .login-card button[type="submit"] {
  background: var(--accent);
  color: #1a1408;
  font-weight: 500;
  border: none;
}
.btn:hover, .login-card button[type="submit"]:hover { background: var(--accent-dark); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger {
  background: transparent;
  border: 1px solid var(--status-crashed);
  color: var(--status-crashed);
}
.btn-danger:hover { background: rgba(224, 87, 95, 0.12); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar-title { font-weight: 700; letter-spacing: 0.02em; }
.topbar-nav { display: flex; gap: 6px; flex: 1; }
.nav-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
}
.nav-link.active { color: var(--text); border-color: var(--border); background: var(--surface-2); }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 13px; }

/* ---------- Views ---------- */
.view { max-width: 1100px; margin: 0 auto; padding: 24px; }
.view-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.view-header h2 { flex: 1; }

/* ---------- Account grid ---------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--status-unknown);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.account-card:hover { background: var(--surface-2); }
.account-card .name { font-weight: 500; }
.account-card .status-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-dim);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.account-card .card-actions { display: flex; gap: 6px; }
.account-card .card-actions button { padding: 5px 10px; font-size: 12px; }
.disabled-tag {
  font-size: 11px; color: var(--text-dim); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1px 6px; align-self: flex-start;
}

/* ---------- Status badge ---------- */
.status-badge {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-dim);
}

/* ---------- Detail view ---------- */
.detail-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.detail-layout { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.console-panel { flex: 2 1 480px; min-width: 300px; }
.console-box {
  background: #0c0e12;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 420px;
  overflow-y: auto;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.console-line { color: #c7ccd4; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 10px;
  font-family: var(--font-mono);
}

.stats-panel {
  flex: 1 1 220px;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stats-panel h3 { margin-bottom: 12px; font-size: 14px; color: var(--text-dim); }
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px;
}
.stat-row:first-child { border-top: none; }
.stats-panel select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 6px;
}

/* ---------- Admin ---------- */
.admin-section { margin-bottom: 32px; }
.admin-section h3 { margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
.table th, .table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.table th { color: var(--text-dim); font-weight: 500; }
.table input[type="text"], .table input[type="number"] {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 5px 7px; width: 100%;
}
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input, .inline-form select {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 8px 10px;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; width: 100%; max-width: 360px;
}
.perm-checklist { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; max-height: 260px; overflow-y: auto; }
.perm-checklist label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Fix: [hidden] muss auch bei Elementen mit eigener display-Regel (z.B. .modal) greifen */
[hidden] { display: none !important; }
