:root {
  --bg: #0f0f10;
  --bg-elev: #1a1a1d;
  --fg: #f5f5f7;
  --fg-dim: #a8a8ad;
  --accent: #ff5722;
  --border: #2a2a2e;
  --user-bg: #23231f;
  --assistant-bg: #1f1f22;
  --radius: 10px;
  --max-width: 760px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Space Grotesk", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

#intake-app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#intake-header {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

#intake-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#intake-subtitle {
  margin: 0;
  color: var(--fg-dim);
  font-size: 0.9rem;
}

#intake-consent,
#intake-done,
#intake-error {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

#intake-consent h2,
#intake-done h2,
#intake-error h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

#intake-consent ul {
  padding-left: 1.25rem;
  color: var(--fg-dim);
}

#intake-consent-proceed {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}

#intake-consent-proceed:hover { filter: brightness(1.1); }

#intake-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 1rem;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 320px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.msg {
  display: flex;
  flex-direction: column;
}

.msg-body {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 92%;
  font-size: 0.97rem;
}

.msg-user { align-items: flex-end; }
.msg-user .msg-body {
  background: var(--user-bg);
  border: 1px solid var(--border);
}

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

#chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#chat-input {
  width: 100%;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font: inherit;
  resize: vertical;
  min-height: 68px;
}

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

#chat-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

#chat-send,
#chat-complete {
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
}

#chat-send {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#chat-complete {
  background: transparent;
  color: var(--fg-dim);
}

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

#chat-send:hover:not(:disabled) { filter: brightness(1.1); }
#chat-complete:hover:not(:disabled) { color: var(--fg); border-color: var(--fg-dim); }

#chat-status {
  font-size: 0.85rem;
  color: var(--fg-dim);
  min-height: 1.2em;
}

.status-error { color: #ff6b6b; }
.status-loading { color: var(--fg-dim); font-style: italic; }

a { color: var(--accent); }

@media (max-width: 600px) {
  #intake-header h1 { font-size: 1.1rem; }
  #chat-messages { max-height: 55vh; }
  .msg-body { max-width: 100%; }
}
