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

:root {
  --ocean: #0891b2;
  --ocean-dark: #0e7490;
  --ocean-light: #e0f2fe;
  --tiare: #f97316;
  --tiare-light: #ffedd5;
  --text: #1e293b;
  --text-light: #64748b;
  --bg: #fafafa;
  --white: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

/* HEADER */
.header {
  background: linear-gradient(135deg, var(--ocean) 0%, var(--ocean-dark) 100%);
  color: var(--white);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  font-size: 0.9rem;
  opacity: 0.9;
  font-weight: 400;
}

/* MAIN */
.main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 1rem;
}

/* WELCOME */
.welcome {
  text-align: center;
  padding: 2rem 0;
}

.welcome h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.subtitle {
  color: var(--text-light);
  margin-bottom: 2rem;
  font-size: 1rem;
}

.suggestions-title {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
  max-width: 700px;
  margin: 0 auto;
}

.suggestion {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1
padding: 1rem 1.25rem;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
}

.suggestion:hover {
  border-color: var(--ocean);
  background: var(--ocean-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* CONVERSATION */
.conversation {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.message {
  display: flex;
  gap: 0.75rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.9rem;
}

.message-user .message-avatar {
  background: var(--text);
  color: var(--white);
}

.message-bot .message-avatar {
  background: linear-gradient(135deg, var(--ocean), var(--tiare));
  color: var(--white);
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-role {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.message-text {
  background: var(--white);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  word-wrap: break-word;
}

.message-user .message-text {
  background: var(--ocean-light);
  border-color: #bae6fd;
}

.message-text h1, .message-text h2, .message-text h3 {
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.message-text h1:first-child,
.message-text h2:first-child,
.message-text h3:first-child {
  margin-top: 0;
}

.message-text h1 { font-size: 1.3rem; }
.message-text h2 { font-size: 1.15rem; color: var(--ocean-dark); }
.message-text h3 { font-size: 1rem; }

.message-text p { margin-bottom: 0.75rem; }
.message-text p:last-child { margin-bottom: 0; }

.message-text ul, .message-text ol {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.message-text li { margin-bottom: 0.25rem; }

.message-text strong { font-weight: 700; color: var(--text); }

.message-text code {
  background: #f1f5f9;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: "SF Mono", Monaco, Consolas, monospace;
}

.sources {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-light);
}

.sources-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.source-item {
  padding: 0.25rem 0;
}

.source-item strong {
  color: var(--text);
}

.stats {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-light);
  opacity: 0.7;
}

/* LOADER */
.loader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.loader.hidden { display: none; }

.loader-dot {
  width: 8px;
  height: 8px;
  background: var(--ocean);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.loader-text {
  margin-left: 0.5rem;
}

/* INPUT BAR */
.input-bar {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  position: sticky;
  bottom: 0;
}

.input-container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  transition: border-color 0.15s;
}

.input-container:focus-within {
  border-color: var(--ocean);
  box-shadow: 0 0 0 3px var(--ocean-light);
}

.input {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  padding: 0.5rem 0;
  max-height: 150px;
}

.input::placeholder {
  color: var(--text-light);
}

.send-btn {
  background: var(--ocean);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.send-btn:hover:not(:disabled) {
  background: var(--ocean-dark);
  transform: scale(1.05);
}

.send-btn:disabled {
  background: var(--border);
  cursor: not-allowed;
}

.disclaimer {
  max-width: 900px;
  margin: 0.75rem auto 0;
  font-size: 0.75rem;
  color: var(--text-light);
  text-align: center;
  line-height: 1.4;
}

/* RESPONSIVE */
@media (max-width: 640px) {
  .header-content { gap: 0.5rem; }
  .logo { font-size: 1.25rem; }
  .tagline { font-size: 0.8rem; width: 100%; }
  .welcome h2 { font-size: 1.3rem; }
  .subtitle { font-size: 0.9rem; }
  .suggestions { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
  .message-text { padding: 0.75rem 1rem; }
}
