:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #222725;
  background: #fff;
  --ink: #222725;
  --muted: #656c67;
  --line: #e4e6df;
  --leaf: #284c3b;
}
* { box-sizing: border-box; }
[hidden], .symbols { display: none !important; }
body { margin: 0; font-size: 15px; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #508463; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; color: var(--muted); border: 0; border-radius: 8px; background: transparent; }
.icon-button:hover { color: var(--ink); background: #e9ece5; }
.brand-mark { width: 32px; height: 32px; display: inline-grid; flex: none; place-items: center; background: var(--leaf); color: #fff; border-radius: 9px; font-size: 13px; font-weight: 750; letter-spacing: -.07em; padding-right: 1px; }
.mobile-only { display: none; }

.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: #f8f8f5; padding: 28px; }
.gate-panel { width: min(100%, 440px); text-align: center; }
.gate-mark { width: 50px; height: 50px; font-size: 20px; border-radius: 14px; }
.gate h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -.045em; line-height: 1.15; margin: 22px 0 12px; font-weight: 650; }
.gate p { margin: 0 auto 28px; color: var(--muted); line-height: 1.55; max-width: 335px; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 18px; min-height: 44px; background: var(--leaf); color: #fff; border: 0; border-radius: 11px; text-decoration: none; font-weight: 570; }
.primary:hover { background: #193d2c; }

.workspace { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 262px minmax(0, 1fr); overflow: hidden; }
.sidebar { min-height: 0; min-width: 0; display: flex; flex-direction: column; padding: 18px 14px 0; background: #f6f7f3; border-right: 1px solid var(--line); }
.brand-row { display: flex; align-items: center; justify-content: space-between; padding: 0 7px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 660; letter-spacing: -.03em; font-size: 17px; }
.new-chat { flex: none; display: flex; align-items: center; gap: 11px; background: #fff; color: var(--ink); border: 1px solid #d5dad1; border-radius: 10px; padding: 11px 13px; margin: 25px 1px 28px; text-align: left; font-weight: 570; }
.new-chat:hover { border-color: #aab7aa; background: #fdfefa; }
.new-chat .icon { width: 17px; height: 17px; }
.history-heading { margin: 0 10px 9px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.history { flex: 1; min-height: 0; overflow-y: auto; padding: 0 2px 16px; scrollbar-width: thin; }
.history-item { display: block; color: #404740; border-radius: 8px; padding: 10px; text-decoration: none; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; line-height: 1.35; font-size: 14px; }
.history-item:hover { background: #ecefe8; }
.history-item[aria-current="page"] { background: #e5ebe1; color: #203f2e; font-weight: 580; }
.history-note { margin: 8px 8px 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.history .text-action { margin: 0 8px; }
.account { border-top: 1px solid var(--line); display: flex; align-items: center; gap: 9px; padding: 12px 1px max(12px, env(safe-area-inset-bottom)); }
.account-avatar { width: 30px; height: 30px; background: #e4e9df; color: var(--leaf); border-radius: 50%; font-size: 14px; font-weight: 600; display: grid; place-items: center; flex: none; }
.account-email { flex: 1; min-width: 0; font-size: 12px; font-weight: 550; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.chat-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-header { flex: none; display: flex; align-items: center; gap: 9px; padding: 0 clamp(18px, 3vw, 42px); min-height: 66px; border-bottom: 1px solid #eeefeb; }
.chat-header h1 { margin: 0; font-size: 15px; font-weight: 580; letter-spacing: -.02em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-layout.empty { justify-content: center; padding-bottom: min(15vh, 115px); }
.welcome { width: 100%; text-align: center; padding: 0 18px; }
.welcome h2 { font-size: clamp(30px, 3.6vw, 45px); line-height: 1.13; letter-spacing: -.055em; font-weight: 580; margin: 0 0 22px; }
.transcript { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.messages, .compose-inner { width: min(100%, 800px); margin: auto; padding-inline: 26px; }
.messages { padding-block: 30px 22px; }
.message { line-height: 1.65; font-size: 15px; overflow-wrap: anywhere; }
.message + .message { margin-top: 24px; }
.message.user { display: flex; justify-content: flex-end; }
.user-bubble { max-width: min(88%, 620px); border-radius: 17px 17px 5px 17px; padding: 10px 16px; margin: 0; background: #f0f3ed; white-space: pre-wrap; }
.assistant-name { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; color: var(--leaf); margin-bottom: 8px; }
.assistant-name .brand-mark { width: 22px; height: 22px; border-radius: 6px; font-size: 9px; }
.answer > :first-child { margin-top: 0; }
.answer > :last-child { margin-bottom: 0; }
.answer p { margin: 0 0 .7em; white-space: pre-line; }
.answer h3, .answer h4, .answer h5 { margin: 1.1em 0 .35em; font-size: 1.08em; }
.answer ul, .answer ol { margin: .35em 0 .8em; padding-left: 1.65em; }
.answer li + li { margin-top: .2em; }
.answer a, .text-action { color: #345f47; text-underline-offset: 3px; }
.text-action { background: transparent; padding: 4px 0; border: 0; text-decoration: underline; font-size: 13px; }
.answer code { background: #f1f3ef; border-radius: 4px; padding: .1em .3em; font: .9em ui-monospace, Consolas, monospace; }
.answer pre { overflow-x: auto; background: #f5f6f3; border: 1px solid var(--line); padding: 13px 16px; border-radius: 10px; line-height: 1.5; }
.answer pre code { background: transparent; padding: 0; }
.table-wrap { max-width: 100%; overflow-x: auto; margin: 12px 0; }
.answer table { border-collapse: collapse; font-size: 14px; }
.answer th, .answer td { border: 1px solid var(--line); text-align: left; padding: 7px 10px; vertical-align: top; min-width: 60px; }
.answer th { background: #f3f5f0; }
.sources { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.sources-title { color: var(--muted); font-size: 12px; margin-right: 2px; }
.source { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; border: 1px solid #dbe2d6; border-radius: 7px; color: #3e5242; text-decoration: none; padding: 3px 8px; font-size: 12px; }
a.source:hover { background: #eff3ec; }
.source .icon { width: 13px; height: 13px; }
.pending, .transcript-note { color: var(--muted); font-size: 14px; }
.transcript-note { margin: 5px 0 8px; }
.pending { margin: 0; display: flex; align-items: center; gap: 8px; }
.pending::before { content: ""; width: 11px; height: 11px; border: 2px solid #d6dfd3; border-top-color: var(--leaf); border-radius: 100%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pending::before { animation: none; } }

.compose-area { flex: none; padding: 10px 0 max(12px, env(safe-area-inset-bottom)); background: #fff; }
.composer { display: flex; align-items: flex-end; gap: 9px; border: 1px solid #cdd4cb; background: #fff; border-radius: 20px; padding: 11px; box-shadow: 0 3px 11px rgb(34 47 32 / 4%); }
.composer:focus-within { border-color: #86a18d; }
.composer textarea { resize: none; flex: 1; min-width: 0; max-height: min(180px, 28vh); margin: 0; border: 0; outline: none; color: var(--ink); background: transparent; padding: 8px 4px 6px 6px; line-height: 1.45; font-size: 16px; }
.composer textarea::placeholder { color: #767d75; }
.send-button { flex: none; width: 37px; height: 37px; padding: 0; display: grid; place-items: center; border-radius: 12px; border: 0; background: var(--leaf); color: #fff; }
.send-button:not(:disabled):hover { background: #193d2c; }
.send-button:disabled { background: #e9ece6; color: #838a81; }
.key-hint { text-align: center; margin: 9px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted); }
.key-hint kbd { font: inherit; }
.key-hint span { padding-inline: 4px; }
.error-note { margin-bottom: 8px; color: #873721; background: #fcf5f1; border: 1px solid #eed6cb; padding: 9px 13px; border-radius: 9px; font-size: 13px; line-height: 1.45; }
.shade { display: none; }
@media (max-width: 760px) {
  .workspace { display: flex; }
  .chat-main { flex: 1; }
  .mobile-only { display: grid; }
  .sidebar { position: fixed; z-index: 3; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-101%); visibility: hidden; }
  .workspace.drawer-open .sidebar { transform: none; visibility: visible; }
  .shade { display: block; position: fixed; inset: 0; z-index: 2; border: 0; background: rgb(24 32 25 / 30%); }
  .chat-header { padding-inline: 12px 18px; min-height: 55px; }
  .messages, .compose-inner { padding-inline: 16px; }
  .messages { padding-block: 22px 16px; }
  .chat-layout.empty { padding-bottom: min(12vh, 85px); }
  .welcome h2 { margin-bottom: 16px; }
  .key-hint { display: none; }
  .compose-area { padding-block: 9px max(12px, env(safe-area-inset-bottom)); }
}
@media (max-height: 480px) {
  .chat-layout.empty { padding-bottom: 0; }
  .welcome h2 { font-size: 27px; margin: 0; }
}
