:root {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --accent-hover: #4593f8;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { font-size: 17px; font-weight: 600; margin: 0; }
h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 8px;
}
h2:first-child { margin-top: 0; }

.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); font-size: 13px; margin: 12px 0 0; }
.error:empty { display: none; }

/* ---------- brand ---------- */

.brand { display: flex; align-items: center; gap: 9px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); display: inline-block;
}

/* ---------- sign in ---------- */

.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.card {
  width: 100%; max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px 24px;
}
.card .brand { margin-bottom: 6px; }
.card form { display: flex; flex-direction: column; margin-top: 18px; }

label { font-size: 13px; color: var(--muted); margin-bottom: 5px; }

input[type="text"], input[type="password"], textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--fg);
  padding: 9px 11px;
  font-size: 15px;
  width: 100%;
  margin-bottom: 14px;
}
textarea { resize: vertical; font-family: inherit; margin-bottom: 12px; }
input:focus, textarea:focus, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.25);
}

button {
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 7px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--fg);
}
button.ghost:hover:not(:disabled) { background: #21262d; }

/* ---------- app shell ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar form { margin: 0; }

.pill {
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border);
}
.pill-idle { color: var(--muted); }
.pill-busy { color: var(--warn); border-color: rgba(210, 153, 34, 0.5); }
.pill-bad  { color: var(--bad);  border-color: rgba(248, 81, 73, 0.5); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  min-width: 0;
}

.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- live view ---------- */

.shot-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 8px;
}
.shot-wrap img {
  max-width: 100%; height: auto;
  border-radius: 4px;
  display: block;
}
.shot-wrap .muted { padding: 40px 0; }

.result {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 13px;
  max-height: 320px;
  overflow: auto;
}

/* ---------- activity log ---------- */

.log {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  height: 520px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.log .line { color: var(--fg); }
.log .line-sys  { color: var(--muted); }
.log .line-err  { color: var(--bad); }
.log .line-ok   { color: var(--ok); }
.log .line:empty::after { content: "\00a0"; }
