:root {
  color-scheme: light dark;
  --bg: #111318;
  --panel: #1b1f29;
  --text: #eef1f7;
  --muted: #aab3c5;
  --accent: #7cc7ff;
  --border: #30384a;
  --danger: #ff8a8a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }
code, pre, input, textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background: #151923;
}
.topbar h1 { margin: 0 0 .25rem; }
.topbar p { margin: 0; color: var(--muted); }
.topbar nav { display: flex; gap: 1rem; align-items: center; white-space: nowrap; }

main {
  width: min(1100px, calc(100vw - 2rem));
  margin: 1.5rem auto 3rem;
  display: grid;
  gap: 1rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 1rem;
}
.card h2 { margin-top: 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .75rem;
}
label { display: grid; gap: .35rem; color: var(--muted); }
input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .7rem;
  background: #0e1118;
  color: var(--text);
}
textarea { resize: vertical; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
button {
  border: 0;
  border-radius: 10px;
  padding: .7rem 1rem;
  background: var(--accent);
  color: #07111a;
  font-weight: 700;
  cursor: pointer;
}
button.secondary { background: #323a4d; color: var(--text); }
button:disabled { opacity: .5; cursor: not-allowed; }
.status { color: var(--muted); min-height: 1.4em; }
.status.error { color: var(--danger); }
.command {
  overflow: auto;
  padding: .75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0e1118;
  white-space: pre-wrap;
}
.chat-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.messages {
  min-height: 220px;
  max-height: 60vh;
  overflow: auto;
  display: grid;
  gap: .75rem;
  padding: .5rem 0;
}
.message {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem;
  background: #131722;
}
.message .meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  color: var(--muted);
  font-size: .85rem;
}
.message .body { white-space: pre-wrap; margin-top: .5rem; }
.composer { display: grid; gap: .75rem; }

@media (max-width: 700px) {
  .topbar { display: block; }
  .topbar nav { margin-top: 1rem; }
}
