:root {
  --ivory: #f7f5ee;
  --paper: #fffefa;
  --sage: #91a184;
  --olive: #3f4b35;
  --ink: #171a16;
  --muted: #70766d;
  --line: #dfe3da;
  --sand: #eee9dc;
  --danger: #8a3f35;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ivory);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 70% 0, #ffffff 0, var(--ivory) 45%); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { height: 68px; display: flex; align-items: center; gap: 22px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,254,250,.92); position: sticky; top: 0; z-index: 5; }
.brand { color: var(--ink); text-decoration: none; font-family: Georgia, serif; font-size: 25px; display: flex; align-items: center; gap: 8px; }
.mark { color: var(--olive); font-family: Georgia, serif; font-size: 35px; line-height: 1; }
.mark.large { font-size: 58px; }
.workspace-label { padding-left: 22px; border-left: 1px solid var(--line); color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.status-pill, .view-pill { border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; color: var(--olive); background: #f1f3ec; font-size: 12px; letter-spacing: .08em; }
.quiet-button { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 9px 15px; }
.app-shell { min-height: calc(100vh - 68px); grid-template-columns: 370px 1fr; }
.app-shell:not([hidden]) { display: grid; }
.chat-panel { border-right: 1px solid var(--line); background: rgba(255,254,250,.86); display: flex; flex-direction: column; min-height: calc(100vh - 68px); position: sticky; top: 68px; height: calc(100vh - 68px); }
.assistant-heading { padding: 22px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.assistant-heading small { display: block; color: var(--muted); margin-top: 4px; }
.assistant-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--olive); color: white; display: grid; place-items: center; font-weight: 700; }
.messages { padding: 22px; overflow-y: auto; flex: 1; }
.message-block { max-width: 96%; margin-bottom: 14px; }
.message-block.user { margin-left: auto; }
.message { max-width: 92%; padding: 12px 14px; border-radius: 16px; line-height: 1.45; white-space: pre-wrap; }
.message.user { margin-left: auto; background: var(--olive); color: white; border-bottom-right-radius: 5px; }
.message.assistant { background: var(--sand); border-bottom-left-radius: 5px; }
.message-actions { display: flex; gap: 4px; margin: 5px 0 0 5px; }
.message-actions button { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 4px 7px; border-radius: 8px; }
.message-actions button:hover { background: #ecefe7; color: var(--olive); }
.adjustment-panel { margin-top: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: 0 8px 24px rgba(40,48,34,.08); }
.adjustment-panel > strong { font-size: 14px; }
.adjustment-panel > p { color: var(--muted); font-size: 12px; margin: 4px 0 12px; }
.adjustment-row { padding: 9px 0; border-top: 1px solid var(--line); }
.adjustment-row > span { display: block; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 7px; }
.adjustment-row > div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.adjustment-row button { border: 1px solid var(--line); background: #f8f8f3; color: var(--olive); border-radius: 10px; padding: 8px; font-size: 12px; text-align: left; }
.adjustment-row button:hover { border-color: var(--sage); background: #f0f3eb; }
.survey-prompt { margin: 0 18px 12px; padding: 12px 14px; border-left: 3px solid var(--sage); background: #f2f3ed; line-height: 1.45; }
.composer { border-top: 1px solid var(--line); padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.composer textarea { resize: none; border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: white; }
.composer button, .auth-card form button, .setup-card a { border: 0; background: var(--olive); color: white; padding: 11px 17px; border-radius: 14px; align-self: end; text-decoration: none; }
.workspace { padding: 48px; min-width: 0; }
.workspace-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; }
.workspace-heading small, .memory-card small, .auth-card small { letter-spacing: .16em; color: var(--muted); }
h1, h2, p { margin-top: 0; }
.workspace-heading h1 { font-family: Georgia, serif; font-size: 42px; margin: 8px 0; font-weight: 500; }
.workspace-heading p { color: var(--muted); }
.notice { padding: 13px 16px; background: #f3ead8; border: 1px solid #e5d5b7; border-radius: 14px; margin-bottom: 18px; }
.setup-card, .memory-card, .artifact-window { background: rgba(255,255,252,.92); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 10px 32px rgba(40,48,34,.06); }
.setup-card { padding: 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 18px; }
.setup-card[hidden] { display: none; }
.setup-card .setup-copy { flex: 1; }
.setup-card h2 { margin: 4px 0; }
.setup-card p { color: var(--muted); margin-bottom: 0; }
.artifact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; margin-bottom: 18px; }
.artifact-window { overflow: hidden; }
.artifact-title { display: flex; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.artifact-title span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.artifact-body { overflow-x: auto; max-height: 390px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 15px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; background: #fafaf6; position: sticky; top: 0; }
.memory-card { padding: 20px; }
.memory-card h2 { margin: 5px 0 14px; }
.memory-card pre { white-space: pre-wrap; font: 14px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; color: #3d433a; margin: 0; max-height: 260px; overflow: auto; }
.auth-panel { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 30px; }
.auth-panel[hidden] { display: none; }
.auth-card { width: min(520px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,254,250,.95); box-shadow: 0 24px 80px rgba(40,48,34,.11); }
.auth-card h1 { font-family: Georgia, serif; font-size: 38px; font-weight: 500; margin: 14px 0; }
.auth-card > p { color: var(--muted); }
.auth-tabs { display: flex; gap: 8px; margin: 24px 0 16px; }
.auth-tabs button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 9px 14px; }
.auth-tabs button.active { background: var(--olive); color: white; }
.auth-card form { display: grid; gap: 13px; }
.auth-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.auth-card input { border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: white; color: var(--ink); }
.error { color: var(--danger) !important; min-height: 22px; margin-top: 12px !important; }
[hidden] { display: none !important; }
@media (max-width: 820px) {
  .app-shell:not([hidden]) { display: block; }
  .chat-panel { position: relative; top: 0; height: 56vh; min-height: 480px; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace { padding: 28px 18px; }
  .workspace-label { display: none; }
  .artifact-grid { grid-template-columns: 1fr; }
}

