:root {
  --bg: #f4efe6;
  --ink: #1c2b24;
  --muted: #5c6b63;
  --card: #fffdf8;
  --line: #d7cec0;
  --accent: #b5532b;
  --accent-ink: #fffaf6;
  --ok: #2c6e4f;
  --wait: #8a5a12;
  --bad: #8f2d2d;
  --shadow: 0 10px 30px rgba(28, 43, 36, 0.08);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card, .topbar, .side, .chat {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.auth-card { max-width: 32rem; padding: 2.4rem; border-radius: 20px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; color: var(--accent); margin: 0 0 0.4rem; }
h1, h2 { margin: 0 0 0.6rem; font-weight: 600; }
.lead, .hint { color: var(--muted); line-height: 1.45; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 0.55rem 1rem; cursor: pointer; text-decoration: none;
  font: inherit; font-size: 0.95rem;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; position: sticky; top: 0; z-index: 2; }
.topbar-actions { display: flex; gap: 0.8rem; align-items: center; }
.who { color: var(--muted); font-size: 0.9rem; }
.layout { display: grid; grid-template-columns: minmax(16rem, 22rem) 1fr; gap: 0.8rem; padding: 0.8rem; align-items: start; }
.side { border-radius: 16px; padding: 1rem; display: grid; gap: 1.4rem; }
.chat { border-radius: 16px; min-height: calc(100vh - 7rem); display: flex; flex-direction: column; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.list li, .msg {
  border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem 0.7rem; background: #fff;
}
.list button { all: unset; cursor: pointer; display: block; width: 100%; }
.list .meta, .msg .meta { color: var(--muted); font-size: 0.8rem; }
.messages { flex: 1; overflow: auto; padding: 1rem; display: grid; gap: 0.6rem; align-content: start; }
.msg.user { border-left: 3px solid var(--accent); }
.msg.assistant { border-left: 3px solid var(--ok); }
.chat-head { padding: 1rem 1rem 0; }
.status { margin: 0; color: var(--wait); }
.status.completed { color: var(--ok); }
.status.failed, .status.ambiguous { color: var(--bad); }
.composer { padding: 1rem; display: grid; gap: 0.6rem; border-top: 1px solid var(--line); }
.composer textarea, .stack input, .composer input[type="file"] {
  width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem 0.7rem; background: #fff;
}
.composer-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.hidden { display: none !important; }
.stack { display: grid; gap: 0.4rem; margin-bottom: 0.6rem; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .chat { min-height: 70vh; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
}
