:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --border: #dbe2ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: #f8faff;
  padding: 1rem;
  overflow-y: auto;
}

.chat-panel {
  padding: 1rem;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  margin-bottom: 0.8rem;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.4rem;
}

h2 {
  font-size: 1rem;
}

input,
select,
textarea,
button {
  width: 100%;
  margin-top: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem;
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
}

button {
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  margin-top: 0.6rem;
  background: #eef2ff;
  color: #1e3a8a;
}

.messages {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  overflow-y: auto;
  min-height: 360px;
}

.bubble {
  max-width: 78%;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  margin-bottom: 0.7rem;
  white-space: pre-wrap;
  line-height: 1.4;
}

.bubble.user {
  margin-left: auto;
  background: #dbeafe;
}

.bubble.assistant {
  background: #f3f4f6;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  min-height: 1.1rem;
  margin: 0.4rem 0 0;
  color: #1d4ed8;
  font-size: 0.9rem;
}

.list {
  padding-left: 1rem;
  margin: 0;
}

.list li {
  margin-bottom: 0.35rem;
}

.citations {
  max-height: 240px;
  overflow-y: auto;
}

.citation {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  margin-bottom: 0.6rem;
  background: #fafcff;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .messages {
    min-height: 240px;
  }
}
