:root {
  --bg: #0f1220;
  --card: #1a1f35;
  --text: #e7e9f0;
  --muted: #9aa3bd;
  --accent: #4f7cff;
  --error: #ff6b6b;
  --border: #2a3152;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  padding: 1.5rem;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

input {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1430;
  color: var(--text);
  font-size: 1rem;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-error {
  color: var(--error);
  font-size: 0.8rem;
  margin: 0.15rem 0 0;
}

button {
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* Chat panel */
.chat-panel {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.link-button {
  margin: 0;
  padding: 0.25rem 0.5rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: auto;
}

.transcript {
  height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #0f1430;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.bubble {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.bubble.left {
  align-self: flex-start;
  align-items: flex-start;
}

.bubble.right {
  align-self: flex-end;
  align-items: flex-end;
}

.bubble-sender {
  font-size: 0.7rem;
  color: var(--muted);
}

.bubble-body {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: #222a4d;
  color: var(--text);
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.right .bubble-body {
  background: var(--accent);
}

.typing {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  min-height: 1em;
}

.message-row {
  flex-direction: row;
  gap: 0.5rem;
}

.message-row input {
  flex: 1;
}

.message-row button {
  margin-top: 0;
  width: auto;
  padding: 0.65rem 1rem;
}
