:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4f;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --user-bg: #1e3a5f;
  --assistant-bg: #1a2332;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

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

.header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1.35rem;
  font-weight: 600;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  max-width: 95%;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.bubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  line-height: 1.55;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user .bubble {
  background: var(--user-bg);
  border: 1px solid var(--border);
}

.message.assistant .bubble {
  background: var(--assistant-bg);
  border: 1px solid var(--border);
}

.bubble code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

.bubble strong {
  color: #93c5fd;
}

.sources {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.input-area {
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.product-hint {
  margin-bottom: 0.5rem;
}

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

.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

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

.input-row textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#sendBtn {
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

#sendBtn:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  min-height: 1.2em;
}

.typing::after {
  content: "▋";
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (max-width: 600px) {
  .header, .chat-container, .input-area {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
