/* Design tokens — a control-room instrument panel, not a SaaS dashboard.
   System font stacks are deliberate here, not a fallback: this runs on a
   private VPN interface that may have no route to a font CDN, and a data
   console like this earns its personality from scale/weight/spacing and a
   restrained status palette rather than an imported display face. */
:root {
  --bg: #12151a;
  --panel: #1b1f27;
  --panel-raised: #21262f;
  --hairline: #2a303b;
  --text: #e4e7eb;
  --text-muted: #8b93a1;
  --text-faint: #5a6270;

  --accent: #5b8def;
  --ok: #4fae6d;
  --warn: #d9a441;
  --danger: #d9534f;
  --info: #5b8def;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Menlo", "Consolas", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

/* ── Login ────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 32px 28px;
}
.login-mark {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin: 0 0 4px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}
.login-sub {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 13px;
}
#login-form label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
#login-form input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 16px;
}
#login-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
#login-form button {
  width: 100%;
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-weight: 600;
}
.error-text {
  color: var(--danger);
  font-size: 12px;
  min-height: 16px;
  margin: 10px 0 0;
}

/* ── App shell ────────────────────────────────────────────────────────── */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid var(--hairline);
  background: var(--panel);
  flex-shrink: 0;
}
.topbar-brand { display: flex; align-items: baseline; gap: 8px; }
.topbar-mark { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--text-faint); }
.topbar-name { font-weight: 600; }
.topbar-version { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; }
.topbar-actor { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.role-badge {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--hairline);
  color: var(--text-muted);
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-unknown { background: var(--text-faint); }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-danger { background: var(--danger); }

.layout { display: flex; flex: 1; min-height: 0; }

.sidenav {
  width: 180px;
  flex-shrink: 0;
  border-right: 1px solid var(--hairline);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}
.nav-item:hover { background: var(--panel-raised); color: var(--text); }
.nav-item.active { background: var(--panel-raised); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }

.content { flex: 1; padding: 24px; overflow-y: auto; }

.view { display: none; flex-direction: column; gap: 20px; }
.view.active { display: flex; }

.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.stat-list dt { color: var(--text-muted); font-size: 12px; }
.stat-list dd { margin: 0; font-family: var(--mono); font-size: 13px; text-align: right; }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }

.btn {
  border: 1px solid var(--hairline);
  background: var(--panel-raised);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
}
.btn:hover { border-color: var(--text-faint); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
.btn-secondary { background: var(--panel-raised); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .log-controls select {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 13px;
}
.inline-form label { color: var(--text-muted); font-size: 12px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
}
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); font-family: var(--mono); font-size: 12px; }
.data-table tbody tr:hover { background: var(--panel-raised); }

.log-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.log-output {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  max-width: 360px;
}
.toast.toast-error { border-color: var(--danger); color: var(--danger); }
.toast.toast-ok { border-color: var(--ok); color: var(--ok); }

@media (max-width: 720px) {
  .sidenav { width: 56px; }
  .nav-item span { display: none; }
  .topbar { gap: 12px; }
  .topbar-actor { gap: 8px; }
}

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