:root {
  --bg: #1b1f24;
  --surface: #262b33;
  --surface-hover: #2f3540;
  --text: #e8ecef;
  --text-dim: #9aa4b2;
  --accent: #4f8cff;
  --accent-hover: #6fa0ff;
  --border: #3a4049;
  --error: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

#app { min-height: 100vh; display: flex; flex-direction: column; }

.screen {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.login-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.app-header h1 { font-size: 1.25rem; margin: 0; flex: 1; }

.session-info { color: var(--text-dim); font-size: 0.9rem; margin-top: -8px; }

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.agent-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}

.agent-card:hover { background: var(--surface-hover); }
.agent-card h3 { margin: 0 0 4px; }

.agent-department {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.agent-card p { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

.empty-state { color: var(--text-dim); text-align: center; padding: 40px 0; }

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }

.btn-text {
  background: none;
  color: var(--accent);
  padding: 8px 4px;
  font-weight: 500;
  text-decoration: none;
}
.btn-text:hover { color: var(--accent-hover); }

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

.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.chat-entry {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-entry-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.chat-entry-agent {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
}

.chat-entry-error {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.chat-form textarea {
  flex: 1;
  resize: none;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 1rem;
}

@media (max-width: 480px) {
  .chat-entry { max-width: 90%; }
}
