:root {
  --bg: #0f1117;
  --panel: #171a22;
  --border: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #4a9eff;
  --user: #1e3a5f;
  --assistant: #1a1d24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ctx {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.ctx.active {
  background: #222733;
  border-color: var(--border);
}

.ctx.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sidebar-actions { margin-top: auto; }

.voice-pick {
  display: block;
  margin: 0.25rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.voice-select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg {
  max-width: 720px;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.msg.user {
  align-self: flex-end;
  background: var(--user);
}

.msg.assistant {
  align-self: flex-start;
  background: var(--assistant);
  border: 1px solid var(--border);
}

.pending {
  margin: 0 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid #5c4a1f;
  background: #2a2418;
  border-radius: 10px;
}

.pending.hidden { display: none; }

.pending-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.composer {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

button {
  font: inherit;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

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

button:disabled {
  opacity: 0.5;
  cursor: wait;
}

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

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

.login-card {
  width: min(360px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.login-card label {
  display: block;
  margin: 1.25rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.login-card input {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.login-card form button {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.75rem;
}

.login-error {
  margin: 0.75rem 0 0;
  color: #f87171;
  font-size: 0.875rem;
}

.voice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 1.25rem 0;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #1e4d3a;
  background: #15261f;
}

.voice-bar.hidden { display: none; }

.voice-status {
  color: #6ee7b7;
  font-size: 0.9rem;
}

.voice-btn {
  padding: 0.55rem 0.7rem;
  font-size: 1.1rem;
  line-height: 1;
}

.voice-btn.active {
  border-color: #6ee7b7;
  color: #6ee7b7;
  box-shadow: 0 0 0 1px #1e4d3a;
}

.msg.voice-user,
.msg.voice-assistant {
  opacity: 0.92;
  font-style: italic;
}

