:root {
  --ink: #1d2722;
  --muted: #66716a;
  --paper: #fbf8f1;
  --panel: #ffffff;
  --accent: #6d3f2c;
  --accent-dark: #4b2a1e;
  --line: #dfd8ca;
  --soft: #eee5d8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(109,63,44,.10), transparent 32rem),
    linear-gradient(180deg, #f7f1e7, var(--paper));
  font-family: Georgia, "Times New Roman", serif;
  min-height: 100vh;
}
.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
  display: grid;
  grid-template-columns: minmax(250px, .8fr) minmax(0, 1.45fr);
  gap: 36px;
}
.intro { padding: 28px 8px; }
.eyebrow {
  font-family: Arial, sans-serif;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 { font-size: clamp(3rem, 7vw, 5.6rem); line-height: .95; margin: 18px 0 24px; }
.intro p { font-size: 1.2rem; line-height: 1.65; }
.privacy {
  margin-top: 28px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  background: rgba(255,255,255,.52);
  font-family: Arial, sans-serif;
  font-size: .9rem;
  line-height: 1.45;
}
.chat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  min-height: 690px;
  box-shadow: 0 20px 55px rgba(42, 31, 22, .12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: Arial, sans-serif;
}
.chat-header strong { display: block; font-size: 1.05rem; }
.chat-header span { color: var(--muted); font-size: .82rem; }
.chat-header button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.message {
  max-width: 88%;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.58;
  white-space: pre-wrap;
}
.message.assistant {
  align-self: flex-start;
  background: var(--soft);
  border-bottom-left-radius: 5px;
}
.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 5px;
}
.message.error {
  background: #fff0ed;
  border: 1px solid #e4a597;
}
.composer {
  border-top: 1px solid var(--line);
  padding: 18px;
  background: #fffdf9;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  font: 1rem/1.45 Arial, sans-serif;
  color: var(--ink);
  background: white;
}
textarea:focus { outline: 3px solid rgba(109,63,44,.15); border-color: var(--accent); }
.composer-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: Arial, sans-serif;
  color: var(--muted);
  font-size: .8rem;
}
#send {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  font-weight: 700;
  cursor: pointer;
}
#send:hover { background: var(--accent-dark); }
#send:disabled { opacity: .55; cursor: wait; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; padding-top: 20px; }
  .intro { padding-bottom: 0; }
  .chat-card { min-height: 660px; }
}

.message-sources { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(0,0,0,.12); display: grid; gap: 7px; font-family: Arial, sans-serif; font-size: .78rem; }
.message-sources strong { color: var(--accent-dark); }
.message-sources a { color: var(--accent-dark); overflow-wrap: anywhere; }
