:root {
  --bg: #0f1115;
  --surface: #181b21;
  --surface-2: #21262d;
  --text: #e6e6e6;
  --muted: #9aa3af;
  --accent: #58a6ff;
  --accent-2: #3fb950;
  --border: #30363d;
  --user-bubble: #1f4d7a;
  --assistant-bubble: #21262d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
}

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 0 0 auto;
}

.logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
}

.tagline {
  color: var(--muted);
  font-size: 14px;
}

.agent-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-left: auto;
  scrollbar-width: none;
}

.agent-bar::-webkit-scrollbar { display: none; }

.agent-btn {
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s ease;
}

.agent-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.agent-btn.active {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.12);
  color: var(--text);
}

.chat {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
}

.empty h1 {
  color: var(--text);
  font-size: 22px;
  margin-bottom: 8px;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: var(--assistant-bubble);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message .role {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.composer {
  padding: 14px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.input-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#input {
  flex: 1;
  resize: none;
  max-height: 160px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  font-family: inherit;
}

#input:focus {
  outline: none;
  border-color: var(--accent);
}

#input:disabled {
  opacity: 0.5;
}

#send {
  padding: 11px 20px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
}

#send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
}

.loading-dots::after {
  content: '';
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .agent-bar {
    margin-left: 0;
    width: 100%;
  }
  .message { max-width: 95%; }
}
