:root {
  --bg: #edf2ef;
  --bg-accent: #d8e4dc;
  --ink: #15231c;
  --muted: #5d6f66;
  --panel: rgba(255, 252, 248, 0.88);
  --line: rgba(21, 35, 28, 0.12);
  --brand: #0f6b4c;
  --brand-deep: #0a4d37;
  --warn: #9a5b12;
  --danger: #8f2f2f;
  --bot: #f4f7f5;
  --user: #0f6b4c;
  --shadow: 0 18px 50px rgba(21, 35, 28, 0.08);
  --radius: 22px;
  --font: "DM Sans", sans-serif;
  --display: "Instrument Serif", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 107, 76, 0.12), transparent 34%),
    radial-gradient(circle at bottom right, rgba(154, 91, 18, 0.1), transparent 28%),
    linear-gradient(160deg, #f7faf8 0%, var(--bg) 45%, var(--bg-accent) 100%);
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  min-height: 100vh;
  gap: 0;
}

.sidebar {
  padding: 28px 24px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.7), rgba(237, 242, 239, 0.55));
  backdrop-filter: blur(10px);
}

.brand-mark {
  margin: 0 0 10px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 400;
  line-height: 1.05;
}

.brand-copy {
  margin: 12px 0 28px;
  color: var(--muted);
  line-height: 1.5;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2,
.chat-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.pill-ok {
  background: rgba(15, 107, 76, 0.12);
  color: var(--brand-deep);
}

.pill-warn {
  background: rgba(154, 91, 18, 0.14);
  color: var(--warn);
}

.drop-zone {
  display: grid;
  gap: 6px;
  place-items: center;
  text-align: center;
  padding: 28px 16px;
  border: 1.5px dashed rgba(15, 107, 76, 0.35);
  border-radius: 18px;
  background: rgba(15, 107, 76, 0.04);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--brand);
  background: rgba(15, 107, 76, 0.08);
  transform: translateY(-1px);
}

.drop-zone strong {
  font-size: 0.98rem;
}

.drop-zone span {
  color: var(--muted);
  font-size: 0.86rem;
}

.file-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(21, 35, 28, 0.04);
  font-size: 0.88rem;
}

.file-list .size {
  color: var(--muted);
  white-space: nowrap;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--brand);
  color: #f7fffb;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--brand-deep);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.status-line {
  min-height: 1.3em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.status-line.error {
  color: var(--danger);
}

.status-line.success {
  color: var(--brand-deep);
}

.chat-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding: 24px 28px 20px;
}

.chat-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.chat-log {
  overflow: auto;
  padding: 22px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bubble {
  max-width: min(720px, 92%);
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.5;
  animation: rise 0.25s ease;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.bubble.bot {
  align-self: flex-start;
  background: var(--bot);
  border: 1px solid var(--line);
}

.bubble.user {
  align-self: flex-end;
  background: var(--user);
  color: #f4fff9;
}

.bubble.typing {
  color: var(--muted);
  font-style: italic;
}

.bubble .time {
  display: block;
  margin-top: 8px;
  font-size: 0.75rem;
  opacity: 0.7;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.composer textarea {
  width: 100%;
  resize: none;
  min-height: 54px;
  max-height: 160px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.9);
  color: var(--ink);
  outline: none;
}

.composer textarea:focus {
  border-color: rgba(15, 107, 76, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.12);
}

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

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

  .chat-main {
    min-height: auto;
    height: min(70vh, 720px);
  }

  .sidebar-actions {
    grid-template-columns: 1fr;
  }
}
