:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6a6a6a;
  --accent: #1a4cff;
  --border: #d8d8d8;
  --code-bg: #f3f3f3;
  --error-bg: #fdf0f0;
  --error-fg: #861c1c;
  font-family:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --fg: #e6e6e6;
    --muted: #9aa2ad;
    --accent: #6f8eff;
    --border: #3a3f49;
    --code-bg: #232730;
    --error-bg: #2a1a1a;
    --error-fg: #f4a0a0;
  }
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

header,
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
}

.tagline {
  color: var(--muted);
  margin: 0;
}

section {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

section:last-child {
  border-bottom: none;
}

form label {
  display: block;
  margin-bottom: 1rem;
}

form label > span {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="url"],
input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}

legend {
  padding: 0 0.5rem;
  font-weight: 600;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
}

ul#status-log {
  list-style: none;
  padding: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: var(--code-bg);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  max-height: 220px;
  overflow-y: auto;
}

ul#status-log li {
  white-space: pre-wrap;
}

#status-line {
  font-weight: 600;
}

ul#file-list {
  list-style: none;
  padding: 0;
}

ul#file-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

ul#file-list li a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

ul#file-list li a:hover {
  text-decoration: underline;
}

#error-detail {
  background: var(--error-bg);
  color: var(--error-fg);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  white-space: pre-wrap;
}

details#known-sites {
  margin-top: 1.5rem;
}

details#known-sites summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

details#known-sites ul {
  list-style: none;
  padding: 0.75rem 0;
}

details#known-sites li {
  padding: 0.25rem 0;
}

details#known-sites small {
  color: var(--muted);
}

.confirm-controls {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.confirm-controls button {
  flex: 1;
}

#confirm-reject {
  background: var(--error-fg);
}

ul#confirm-artifact-list {
  list-style: none;
  padding: 0;
}

ul#confirm-artifact-list li {
  padding: 0.25rem 0;
}

#repair-log,
#builder-log {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  background: var(--code-bg);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  min-height: 200px;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.claude-chunk {
  padding: 0.25rem 0;
  border-bottom: 1px dotted var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

.claude-chunk.claude-text {
  color: var(--fg);
}

.claude-chunk.claude-tool_use {
  color: var(--accent);
}

.claude-chunk.claude-tool_result {
  color: var(--muted);
}

.claude-chunk.claude-turn_end {
  font-style: italic;
}

#human-login-reason {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  background: var(--code-bg);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-top: 1rem;
}
