:root {
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  color: #142e2d;
  background: #f8faf8;
  font-synthesis: none;
  --ink: #142e2d;
  --muted: #506663;
  --green: #164b47;
  --mint: #eef4ef;
  --line: #d9e4dc;
  --lime: #e4f4b9;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--green); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid #629d72; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--muted); }
.error { color: #9a301a; }

.workspace { display: grid; grid-template-columns: 259px minmax(0, 1fr); height: 100dvh; }
.sidebar { display: flex; flex-direction: column; background: var(--mint); border-right: 1px solid var(--line); min-height: 0; padding: 26px 16px 12px; }
.sidebar-top { padding: 0 5px; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--green); font-size: 1.18rem; font-weight: 720; letter-spacing: -.04em; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: inline-grid; place-items: center; background: var(--green); color: white; position: relative; flex-shrink: 0; }
.brand-mark::before { content: ""; width: 14px; height: 17px; border: 1.6px solid currentColor; border-radius: 3px; transform: translate(2px, -2px); }
.brand-mark::after { content: ""; width: 14px; height: 17px; border: 1.6px solid currentColor; border-radius: 3px; transform: translate(-2px, 2px); position: absolute; background: var(--green); box-shadow: inset 0 0 0 2px var(--green); }
.new-chat { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 29px; border: 0; border-radius: 11px; padding: 12px 10px; font-weight: 640; color: var(--green); background: var(--lime); }
.new-chat:hover { background: #d8ed9f; }
.plus { width: 15px; height: 15px; position: relative; }
.plus::before, .plus::after { content: ""; position: absolute; left: 1px; top: 7px; width: 13px; height: 1.5px; background: currentColor; border-radius: 2px; }
.plus::after { transform: rotate(90deg); }
.history { margin-top: 32px; overflow: auto; flex: 1; min-height: 0; }
.history h2 { font-size: .875rem; color: var(--muted); margin: 0 10px 9px; font-weight: 600; }
.history button { border: 0; background: transparent; padding: 11px 10px; border-radius: 8px; text-align: left; width: 100%; color: var(--ink); font-size: .9rem; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.history button:hover { background: #e3ece5; }
.history button[aria-current="page"] { background: #dbe9dd; font-weight: 650; }
.history .muted { margin: 10px; font-size: .875rem; }
.sidebar-footer { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 9px; }
.invite-button { display: flex; gap: 12px; align-items: center; border: 0; background: transparent; border-radius: 8px; width: 100%; padding: 9px; font-weight: 600; font-size: .9rem; text-align: left; }
.invite-button:hover, .account summary:hover { background: #e3ece5; }
.link-icon { position: relative; width: 18px; height: 17px; }
.link-icon::before, .link-icon::after { position: absolute; content: ""; border: 1.5px solid currentColor; width: 11px; height: 6px; border-radius: 5px; transform: rotate(-40deg); }
.link-icon::before { top: 4px; left: 0; }
.link-icon::after { top: 8px; left: 5px; }
.account { position: relative; }
.account summary { cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 8px; list-style: none; }
.account summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; color: var(--green); background: #d6e6d9; width: 34px; height: 34px; border-radius: 10px; font-weight: 700; flex-shrink: 0; }
.account-name { display: grid; gap: 2px; min-width: 0; flex: 1; font-size: .9rem; }
.account-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name small { color: var(--muted); font-size: .77rem; }
.menu-dots { font-size: 1.4rem; color: var(--muted); }
.account > button { width: 100%; text-align: left; padding: 10px; }

.main { display: grid; grid-template-rows: 65px minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 13px; padding: 0 28px; border-bottom: 1px solid #e4ebe5; }
.thread-title { font-weight: 625; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.model { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: .875rem; font-weight: 630; color: var(--green); background: white; white-space: nowrap; }
.model-dot { width: 7px; height: 7px; background: #63a778; border-radius: 50%; }
.icon-button { padding: 0; border: none; display: grid; place-items: center; width: 37px; height: 37px; border-radius: 8px; background: transparent; color: var(--muted); flex-shrink: 0; }
.icon-button:hover { background: var(--mint); }
.trash { width: 11px; height: 12px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; position: relative; margin-top: 3px; }
.trash::before, .trash::after { content: ""; height: 1.5px; background: currentColor; position: absolute; left: -3px; top: -3px; width: 14px; }
.trash::after { left: 2px; top: -6px; width: 4px; }
.nav-toggle, .scrim { display: none; }
.hamburger, .hamburger::before, .hamburger::after { width: 17px; height: 1.5px; border-radius: 2px; background: currentColor; }
.hamburger { position: relative; }
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; top: -5px; }
.hamburger::after { top: 5px; }

.conversation { min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.welcome { margin: auto; text-align: center; padding: clamp(28px, 6vh, 70px) 22px 25px; width: min(100%, 790px); }
.welcome-mark { width: 66px; height: 66px; display: grid; place-items: center; background: #e6f0e6; border: 1px solid #dceadc; border-radius: 21px; margin: 0 auto 21px; }
.welcome h1 { font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.06; letter-spacing: -.065em; font-weight: 690; margin: 0; }
.welcome p { margin: 14px 0 0; color: var(--muted); font-size: 1.06rem; }
.examples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 34px; }
.examples button { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.examples button:hover { border-color: #a0bcaa; background: #f2f7f0; }
.examples strong { font-size: .91rem; font-weight: 660; }
.examples span { color: var(--muted); font-size: .875rem; line-height: 1.35; }
.messages { width: min(100%, 810px); margin: 0 auto; padding: 30px 24px 20px; overflow-wrap: anywhere; }
.turn { margin: 0 0 32px; }
.user-message { margin-left: auto; width: fit-content; max-width: min(88%, 650px); background: #e9f1e8; border: 1px solid #dbe7dc; padding: 12px 15px; border-radius: 15px 15px 4px 15px; }
.user-message p { white-space: pre-wrap; margin: 0; line-height: 1.55; }
.assistant-message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; margin-top: 22px; }
.assistant-message .brand-mark { width: 34px; height: 34px; }
.answer { min-width: 0; line-height: 1.6; }
.answer p, .answer ul, .answer ol { margin: 0 0 13px; }
.answer h2, .answer h3 { font-size: 1.1rem; margin: 13px 0 6px; }
.answer pre { overflow-x: auto; background: #eaf0ec; border-radius: 9px; padding: 15px; font-size: .87rem; }
.answer code { background: #eaf0ec; border-radius: 4px; padding: 1px 4px; }
.answer pre code { padding: 0; }
.answer table { border-collapse: collapse; display: block; overflow-x: auto; margin: 0 0 14px; }
.answer th, .answer td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.answer th { background: #eef4ef; }
.answer .usage { margin-top: 10px; color: var(--muted); font-size: .8rem; }
.pending { display: flex; align-items: center; gap: 8px; color: var(--muted); min-height: 34px; }
.pending::before { content: ""; display: block; width: 12px; height: 12px; border: 2px solid #d7e5db; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.progress-elapsed { margin-left: auto; font-size: .8rem; white-space: nowrap; }
.answer .progress-note { color: var(--muted); font-size: .9rem; margin: 5px 0 12px; }
.transfer-time { display: block; margin-top: 8px; color: var(--muted); font-size: .8rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.files { display: flex; gap: 8px; flex-wrap: wrap; margin: 9px 0 0; }
.file-link { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: inline-flex; align-items: baseline; gap: 8px; font-size: .875rem; font-weight: 600; max-width: 100%; }
.file-link small { text-decoration: none; color: var(--muted); font-size: .8rem; white-space: nowrap; }

.composer-wrap { width: min(100%, 810px); padding: 0 22px 15px; margin: auto auto 0; }
.composer { padding: 12px 12px 10px; border: 1px solid #cfded4; border-radius: 17px; background: #fff; box-shadow: 0 5px 20px #173e3110; }
.composer:focus-within { border-color: #9ab8a5; }
.composer.dragging { outline: 2px dashed #6f9e76; background: #f2f8ee; }
.composer textarea { display: block; resize: none; border: 0; outline: 0; min-height: 46px; max-height: min(240px, 32vh); width: 100%; line-height: 1.45; padding: 6px 8px; background: transparent; }
.composer textarea::placeholder { color: #687e76; }
.composer-actions { display: flex; align-items: center; gap: 10px; min-height: 39px; }
.attach { padding: 8px 10px; display: flex; align-items: center; gap: 8px; background: #eef4ef; border: 0; border-radius: 8px; font-weight: 610; font-size: .875rem; }
.attach:hover { background: #e0ece2; }
.clip { position: relative; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 5px 5px; width: 9px; height: 12px; transform: rotate(38deg); }
.clip::after { content: ""; position: absolute; top: -1px; left: 2px; width: 5px; height: 9px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; }
.attachment-limit, .upload-progress { color: var(--muted); font-size: .81rem; }
.upload-progress { color: var(--green); font-weight: 600; }
.cancel-upload { border: 0; border-radius: 8px; padding: 7px 8px; background: transparent; color: var(--green); font-size: .85rem; }
.cancel-upload:hover { background: var(--mint); }
.send { margin-left: auto; width: 42px; height: 39px; border: 0; border-radius: 9px; display: grid; place-items: center; background: var(--green); color: #fff; flex-shrink: 0; }
.send:hover { background: #23645d; }
.send:disabled { background: #dce7df; color: #627b71; }
.send-symbol { width: 16px; height: 16px; background: currentColor; clip-path: polygon(0 39%, 100% 0, 68% 100%, 47% 58%, 82% 19%, 39% 49%); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 8px; max-height: 125px; overflow: auto; }
.attachment { display: flex; align-items: center; gap: 7px; font-size: .85rem; border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; max-width: 100%; }
.attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment button { border: 0; background: transparent; line-height: 1; color: var(--muted); }
.keyboard-hint { text-align: center; margin-top: 9px; font-size: .77rem; color: var(--muted); }
.keyboard-hint kbd { font-family: inherit; }
.composer-error { margin: 7px 6px 0; font-size: .9rem; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 0, #e7f2e3, #f8faf8 65%); }
.login-card, .dialog-body { border-radius: 18px; background: #fff; padding: 29px; }
.login-card { width: min(100%, 448px); border: 1px solid var(--line); box-shadow: 0 14px 56px #163a2810; }
.login-card h1 { font-size: 1.65rem; letter-spacing: -.045em; margin: 25px 0 21px; }
.login-card label, .dialog-body label { display: block; font-size: .875rem; font-weight: 650; margin: 13px 0 6px; }
.login-card input, .dialog-body input { width: 100%; border: 1px solid #cfded4; border-radius: 8px; padding: 10px 11px; background: #f9fbf9; }
.login-card .primary { width: 100%; margin-top: 19px; }
.login-card .text-button { display: block; margin: 10px auto 0; }
.login-card .muted, .dialog-body .muted { font-size: .875rem; margin-bottom: 0; }
.primary, .secondary, .danger { border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 650; }
.primary { color: white; background: var(--green); }
.primary:hover { background: #23645d; }
.secondary { background: #e9f1e9; }
.danger { color: white; background: #963d29; }
.text-button { background: transparent; color: var(--green); border: 0; font-size: .875rem; text-decoration: underline; text-underline-offset: 3px; }
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(450px, calc(100% - 28px)); color: var(--ink); }
dialog::backdrop { background: #112b2a6a; }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.dialog-body p { line-height: 1.55; }
.dialog-body h2 { margin: 0; font-size: 1.27rem; }
.dialog-body .primary { margin-top: 10px; }
.close { font-size: 1.4rem; }
.startup-error { margin: 35px auto; padding: 0 20px; max-width: 620px; }

@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(270px, 84vw); z-index: 3; transform: translateX(-110%); visibility: hidden; transition: transform .18s ease; }
  .sidebar.open { visibility: visible; transform: translateX(0); }
  .scrim { display: block; z-index: 2; position: fixed; inset: 0; border: 0; background: #1733326c; }
  .nav-toggle { display: grid; }
  .main { grid-template-rows: 58px minmax(0, 1fr) auto; }
  .topbar { padding: 0 12px; gap: 7px; }
  .composer-wrap { padding: 0 12px max(12px, env(safe-area-inset-bottom)); }
}
@media (max-width: 540px) {
  .welcome { padding: 22px 16px 20px; }
  .welcome-mark { width: 53px; height: 53px; border-radius: 16px; margin-bottom: 16px; }
  .welcome p { font-size: .96rem; }
  .examples { grid-template-columns: 1fr; gap: 6px; max-width: 340px; margin: 20px auto 0; }
  .examples button { padding: 9px 11px; gap: 2px; }
  .keyboard-hint { display: none; }
  .composer-actions { gap: 6px; }
  .messages { padding: 22px 14px 14px; }
  .user-message { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .pending::before { animation: none; }
}
