:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2e38;
  --text: #e6e8ec;
  --muted: #9aa1ad;
  --accent: #5b8cff;
  --accent-hover: #4a78ea;
  --danger: #e5534b;
  --ok: #3fb950;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.login-body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card h1 { margin: 0; font-size: 20px; }
.login-card .sub { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; margin: 0; }

input, textarea, button {
  font: inherit;
  color: var(--text);
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea {
  background: #0d0f14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}

input:disabled { color: var(--muted); }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

button:hover { background: var(--accent-hover); }
button:disabled { background: #33384a; color: var(--muted); cursor: not-allowed; }

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 16px; margin: 0; }

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.panel h2 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.panel h2:first-child { border-top: none; padding-top: 0; }

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.5;
}

.hint code {
  background: #0d0f14;
  padding: 1px 5px;
  border-radius: 4px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.status {
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }

.term-panel { display: flex; flex-direction: column; min-height: 500px; }

.run-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.run-list li {
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

.run-list li:last-child { border-bottom: none; }
.run-list li:hover { background: #1e222c; }
.run-list li.selected { background: #202538; }

.run-list .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot.running { background: var(--ok); }
.dot.stopped { background: var(--muted); }

.term-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.terminal {
  flex: 1;
  background: #0a0b0e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  min-height: 300px;
}
