:root {
  --fg: #1a1a1a;
  --bg: #fafafa;
  --muted: #777;
  --accent: #2563eb;
  --err: #b91c1c;
  --ok: #166534;
  --border: #e5e5e5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

.layout {
  max-width: 840px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: 100vh;
}

.chat { display: flex; flex-direction: column; gap: 0.75rem; }

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 60vh;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}

.message {
  border-left: 3px solid var(--ok);
  padding: 0.5rem 0.75rem;
  background: #f5f5f5;
  border-radius: 0 4px 4px 0;
}
.message.err { border-left-color: var(--err); }
.message .cmd {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.message pre.body {
  margin: 0;
  font-family: ui-monospace, monospace;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

.composer { display: flex; gap: 0.5rem; }
.composer input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-family: ui-monospace, monospace;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.composer button {
  padding: 0.5rem 1rem;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

.composer-wrap { position: relative; }

.suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  max-height: 16rem;
  overflow-y: auto;
  z-index: 10;
}
.suggestions:empty {
  display: none;
}
.suggestion {
  padding: 0.35rem 0.6rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  cursor: pointer;
}
.suggestion + .suggestion { border-top: 1px solid var(--border); }
.suggestion:hover { background: #f1f5f9; }
.suggestion.active {
  background: #dbeafe;
  box-shadow: inset 3px 0 0 var(--accent);
}
.suggestion .value { font-weight: 600; }
.suggestion .args { color: var(--accent); margin-left: 0.5rem; }
.suggestion .detail { color: var(--muted); margin-left: 0.5rem; }

.muted { color: var(--muted); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar h1 { margin: 0; }
.topbar h1 .version {
  margin-left: 0.5rem;
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--muted);
  vertical-align: middle;
}
.logout { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.logout .who { color: var(--muted); font-size: 0.85rem; }
.logout button {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 360px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}
.login h1 { margin: 0 0 0.5rem; }
.login label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.login input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
}
.login button {
  padding: 0.5rem 1rem;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}
.login .error {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--err);
  background: #fdecec;
  color: var(--err);
  font-size: 0.9rem;
}
.login code {
  background: #f0f0f0;
  padding: 0 0.25rem;
  border-radius: 3px;
}
