:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #64717d;
  --line: #d9e0e5;
  --accent: #176b64;
  --accent-strong: #0f504b;
  --user: #0f504b;
  --assistant: #eef3f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.8rem 1rem;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #e5eceb;
  color: var(--accent-strong);
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1280px;
  min-height: calc(100vh - 40px);
  margin: 0 auto;
}

.sidebar,
.chat-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 1.8rem;
  line-height: 1.1;
}

h2 {
  font-size: 1rem;
}

.upload-panel {
  display: grid;
  gap: 10px;
}

.upload-panel label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input[type="file"],
.composer input,
.settings-panel input,
.settings-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0.78rem;
}

.settings-panel {
  display: grid;
  gap: 12px;
}

.settings-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.settings-panel textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.35;
}

.status-block {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.status-block div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.status-block span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.status-block strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.chat-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 560px;
  overflow: hidden;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 22px;
}

.message {
  display: grid;
  gap: 8px;
  max-width: 76%;
}

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

.bubble {
  border-radius: 8px;
  background: var(--assistant);
  padding: 12px 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message.user .bubble {
  background: var(--user);
  color: #fff;
}

.sources {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 0.86rem;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 70vh;
  }

  .message {
    max-width: 92%;
  }

  .composer {
    grid-template-columns: 1fr;
  }
}
