:root {
  color-scheme: light;
  --ink: #11161c;
  --ivory: #fcfaf6;
  --paper: #fff;
  --line: #e3dbce;
  --muted: #535b5e;
  --accent: #775722;
  --gold: #c8a15a;
  --warm: #f4ede0;
  --radius: 21px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--ivory);
  font: 1rem/1.65 "Segoe UI", Tahoma, Arial, sans-serif;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid #a77425; outline-offset: 3px; }

.site-top { background: var(--ink); }
.top-inner {
  width: min(100% - 36px, 900px);
  min-height: 85px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.top-inner a { display: flex; align-items: center; }
.top-inner img { width: min(154px, 42vw); height: auto; filter: invert(1); }
.workspace-main { width: min(100% - 36px, 900px); margin: clamp(22px, 6vw, 64px) auto 48px; }
.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 16px 60px #11161c0b;
}
.access-card {
  max-width: 560px;
  margin-inline: auto;
  padding: clamp(20px, 5vw, 42px);
}
.eyebrow { margin: 0; color: var(--accent); font-size: .8125rem; font-weight: 800; letter-spacing: .06em; }
.access-card .eyebrow { text-align: start; }
h1 { margin: .25em 0 .2em; line-height: 1.22; font-size: clamp(1.7rem, 5vw, 2.65rem); }
h2 { margin: 0; line-height: 1.3; font-size: 1.28rem; }
.muted { color: var(--muted); }
.access-card > .muted { margin: .6em 0 1.4em; }
label { font-weight: 700; }
input, textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid #bbb1a3;
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
}
#accessForm { display: grid; gap: 9px; }
#accessForm .button { margin-top: 7px; }
.button {
  min-height: 44px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
}
.solid { color: white; background: var(--ink); }
.solid:not(:disabled):hover { background: #27313c; }
.ghost { color: var(--ink); border-color: #c9bfae; background: transparent; }
.ghost:not(:disabled):hover { background: var(--warm); }
.site-top .ghost { color: var(--paper); border-color: #77766e; }
.site-top .ghost:not(:disabled):hover { background: #28313a; }
.feedback { min-height: 1.45em; margin: 10px 0 0; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.feedback[data-error="true"] { color: #8e3027; }

.conversation { display: grid; gap: 15px; }
.workspace-header {
  padding: clamp(18px, 4vw, 30px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.workspace-reference { display: inline-block; margin: .3em 0 0; color: var(--muted); font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.workspace-actions, .workspace-status { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.workspace-status { align-items: baseline; padding-inline: 3px; color: var(--muted); font-size: .9rem; }
.workspace-status p { margin: 0; }
.workspace-pill { padding: 3px 10px; color: #664822; background: var(--warm); border-radius: 999px; font-weight: 700; }
.workspace-pill[data-configured="true"] { color: #1b593e; background: #e7f3ec; }
.workspace-profile { min-width: 0; padding: 18px 23px; overflow-wrap: anywhere; }
.workspace-profile p { margin: 7px 0 0; white-space: pre-wrap; }
.workspace-goal-label { color: var(--accent); font-weight: 700; }
.chat { overflow: clip; }
.chat-title { padding: 20px 23px 14px; border-bottom: 1px solid var(--line); }
.chat-title p { margin: 5px 0 0; font-size: .9rem; }
.messages {
  min-height: 175px;
  max-height: min(58dvh, 530px);
  padding: 15px 23px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.message {
  width: fit-content;
  max-width: min(95%, 690px);
  margin: 0 0 11px;
  padding: 11px 13px;
  border-radius: 15px;
  background: #f3eee5;
}
.message[data-role="user"] { margin-inline-start: auto; color: white; background: var(--ink); }
.message-label { margin: 0; color: var(--accent); font-size: .8rem; font-weight: 750; }
.message[data-role="user"] .message-label { color: #e5c487; }
.message-body { margin: .25em 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-time { font-size: .77rem; color: var(--muted); }
.message[data-role="user"] .message-time { color: #e0d9cc; }
.composer { padding: 15px 23px 19px; display: grid; gap: 7px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 85px; resize: vertical; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.composer-actions .feedback { margin: 0; }
.composer-actions .button { min-width: 72px; flex: none; }

@media (max-width: 530px) {
  .top-inner, .workspace-main { width: calc(100% - 24px); }
  .top-inner { min-height: 70px; }
  .workspace-header { align-items: start; }
  .workspace-profile { padding-inline: 14px; }
  .chat-title, .messages, .composer { padding-inline: 14px; }
}
