:root {
  color-scheme: light;
  --background: #f4f6f5;
  --surface: #fff;
  --ink: #202b26;
  --muted: #5e6e65;
  --line: #dce5df;
  --accent: #176448;
  --accent-hover: #12573e;
  --accent-soft: #e8f5ee;
  --sidebar: #172620;
  --sidebar-muted: #adc1b6;
  --sidebar-text: #eff6f1;
  --shadow: 0 2px 4px #17262007, 0 7px 21px #17262004;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden], .symbols { display: none !important; }
body { margin: 0; background: var(--background); color: var(--ink); }
button, input, textarea { font: inherit; }
button, a, input, textarea { outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #38a87d;
}
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
h1, h2, h3, p { margin: 0; }
input:not([type=file]) { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.workspace { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100dvh; min-height: 0; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; min-height: 0; padding: 25px 17px 17px; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 4px 30px; }
.brand-mark { display: inline-grid; width: 40px; height: 40px; border-radius: 13px; place-items: center; color: #214b38; background: #a6f0ca; flex: 0 0 auto; }
.brand-mark svg { width: 25px; height: 25px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.125rem; line-height: 1.35; }
.brand small { color: var(--sidebar-muted); font-size: .8125rem; }
.new-chat, .sidebar-row, .model-status { border: 0; text-align: left; color: inherit; background: transparent; display: flex; align-items: center; gap: 9px; }
.new-chat { width: 100%; padding: 10px 12px; border-radius: 9px; font-weight: 650; background: #31483b; }
.new-chat:hover { background: #395445; }
.sidebar-section { margin-top: 26px; min-height: 0; }
.chats-section { flex: 0 1 auto; display: flex; flex-direction: column; max-height: 38%; }
.files-section { flex: 1 1 auto; display: flex; flex-direction: column; }
.sidebar-section h2 { font-size: .8125rem; color: var(--sidebar-muted); font-weight: 650; padding-left: 9px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; }
.sidebar-list { overflow: auto; margin-top: 6px; scrollbar-color: #52685b transparent; scrollbar-width: thin; }
.sidebar-row { font-size: .9rem; width: 100%; padding: 8px 9px; border-radius: 8px; }
.sidebar-row[aria-current=true], .sidebar-row:hover { background: #294234; }
.sidebar-row svg { width: 17px; height: 17px; color: #b3cfbe; }
.sidebar-row span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.list-empty { color: var(--sidebar-muted); font-size: .875rem; padding: 8px 9px; }
.sidebar-footer { border-top: 1px solid #ffffff20; margin-top: 13px; padding-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.model-status { color: #c9dbd0; padding: 5px 4px; font-size: .8125rem; border-radius: 6px; }
.model-status:hover { color: #fff; }
.status-dot { width: 8px; height: 8px; background: #dbb46b; border-radius: 50%; flex: 0 0 auto; }
.model-status[data-state=ready] .status-dot { background: #75dda2; }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.top-bar { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 17px 26px; border-bottom: 1px solid var(--line); background: var(--surface); }
.top-bar h1 { flex: 1; font-size: clamp(1.12rem, 2vw, 1.375rem); font-weight: 700; letter-spacing: -.025em; }
.top-bar .mobile-menu, .tabs { display: none; }
.panels { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr); gap: 16px; padding: 22px 24px 24px; }
.panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.panel-header { padding: 15px 16px; min-height: 72px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.panel-icon { width: 38px; height: 38px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); display: grid; place-items: center; flex: 0 0 auto; }
.panel-title { flex: 1; min-width: 0; }
.panel-title h2 { font-size: 1rem; }
.panel-title p, .dialog-heading p { font-size: .875rem; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.icon-button, .light-button, .primary, .chip, .suggestion, .send {
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 8px; font-weight: 650; white-space: nowrap; font-size: .875rem;
}
.icon-button { width: 34px; height: 34px; padding: 0; border: 0; background: transparent; color: var(--muted); flex: 0 0 auto; }
.icon-button:hover { background: var(--accent-soft); color: var(--accent); }
.sidebar .icon-button { color: var(--sidebar-muted); }
.sidebar .icon-button:hover { background: #31483b; color: white; }
.light-button, .primary { padding: 8px 12px; min-height: 36px; }
.light-button { background: white; color: var(--ink); border: 1px solid var(--line); }
.light-button:hover { background: #f3f8f5; }
.light-button svg, .primary svg { width: 17px; height: 17px; }
.primary, .send { border: 1px solid var(--accent); background: var(--accent); color: white; }
.primary:hover:enabled, .send:hover:enabled { background: var(--accent-hover); }
.primary:disabled, .send:disabled { color: #4b6a5d; background: #e3eee8; border-color: #e3eee8; }
.chat-body { flex: 1; overflow: auto; min-height: 0; display: flex; flex-direction: column; }
.welcome { padding: 30px 22px; margin: auto; text-align: center; }
.welcome-icon { width: 54px; height: 54px; background: var(--accent-soft); color: var(--accent); border: 1px solid #d9efe2; border-radius: 16px; display: inline-grid; place-items: center; margin-bottom: 12px; }
.welcome-icon svg { width: 27px; height: 27px; stroke-width: 1.5; }
.welcome h3 { font-size: clamp(1.45rem, 2.6vw, 1.85rem); letter-spacing: -.035em; margin-bottom: 4px; }
.welcome p { color: var(--muted); max-width: 300px; margin: 0 auto; }
.suggestions { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.suggestion { background: white; color: var(--ink); border: 1px solid var(--line); font-weight: 550; padding: 8px 9px; }
.suggestion svg { width: 15px; height: 15px; color: var(--accent); }
.suggestion:hover { background: var(--accent-soft); }
.messages { padding: 14px 16px; display: flex; flex-direction: column; gap: 16px; }
.message { min-width: 0; }
.message.user { align-self: flex-end; max-width: 92%; background: #eaf4ee; border-radius: 12px; padding: 10px 14px; }
.message.assistant { width: 100%; padding: 1px 0; }
.message-label { font-size: .8125rem; font-weight: 700; color: var(--accent); margin-bottom: 5px; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.message.error .message-text { color: #9c322b; }
.message-attachment { color: var(--muted); overflow-wrap: anywhere; font-size: .8125rem; margin-top: 5px; }
.message .light-button { margin-top: 10px; }
.composer-area { padding: 10px 15px 15px; }
.connection-note { font-size: .875rem; color: var(--muted); margin: 0 0 8px; }
.connection-note button { background: transparent; border: 0; color: var(--accent); text-decoration: underline; padding: 0; }
.compose { border: 1px solid #c7d8cd; border-radius: 12px; padding: 9px; }
.compose:focus-within { border-color: #70aa8c; }
.attachments { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; padding: 0; margin: 0 0 5px; max-height: 130px; overflow: auto; }
.attachment { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px 3px 7px; background: var(--accent-soft); color: var(--accent); font-size: .875rem; }
.attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment svg { width: 16px; height: 16px; }
.attachment button { width: 25px; height: 25px; }
.drop-hint { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; pointer-events: none; background: #17262067; }
.drop-hint > div { display: grid; justify-items: center; gap: 10px; padding: 24px 32px; border: 2px dashed #7eab92; border-radius: 15px; background: #f8fdfa; color: var(--accent); box-shadow: 0 9px 36px #1726203b; }
.drop-hint svg { width: 28px; height: 28px; }
.compose.drag-target { box-shadow: 0 0 0 2px #70aa8c; border-color: var(--accent); background: #f8fdfa; }

.compose textarea { display: block; min-height: 70px; resize: vertical; width: 100%; min-width: 0; max-height: 30dvh; border: 0; padding: 6px 5px; color: var(--ink); outline: none; background: transparent; }
.compose textarea::placeholder { color: var(--muted); }
.compose-actions { display: flex; align-items: center; gap: 5px; }
.chip { min-width: 0; max-width: 50%; border: 1px solid transparent; padding: 5px 7px; color: var(--muted); background: transparent; font-weight: 550; }
.chip svg { width: 16px; height: 16px; }
.chip span { overflow: hidden; text-overflow: ellipsis; }
.chip:disabled { opacity: .55; }
.chip:hover:enabled, .chip[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.chip[aria-pressed=true] { border-color: #c4e2d0; }
.send { width: 35px; height: 35px; margin-left: auto; padding: 0; flex: 0 0 auto; }
.send svg { width: 19px; height: 19px; }
.file-actions { display: flex; gap: 4px; align-items: center; }
.file-empty { margin: auto; text-align: center; padding: 25px 15px; color: var(--muted); }
.file-empty > svg { width: 32px; height: 32px; color: var(--accent); }
.file-empty h3 { color: var(--ink); margin-top: 5px; }
.file-empty .light-button { margin-top: 12px; }
.editor-frame { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 15px; }
.editor-meta, .editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8125rem; color: var(--muted); }
.editor-meta { margin: 0 0 8px 0; }
.editor-meta span:first-child { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 8px; font-weight: 650; }
.editor-footer { margin-top: 9px; }
.text-editor { flex: 1; min-height: 0; display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fcfdfc; }
.text-editor pre, .text-editor textarea { margin: 0; padding: 12px 10px; font: .9rem/1.72 ui-monospace, "Cascadia Mono", Consolas, monospace; border: 0; tab-size: 4; }
.text-editor pre { background: #eef3f0; min-width: 40px; text-align: right; color: #52645a; user-select: none; overflow: hidden; }
.text-editor textarea { flex: 1; min-width: 0; min-height: 0; resize: none; color: var(--ink); background: transparent; overflow: auto; white-space: pre; outline: none; }
.text-editor:focus-within { border-color: #70aa8c; }
.word-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 9px; overflow: auto; }
.word-line { display: grid; grid-template-columns: 35px minmax(0, 1fr); gap: 4px; align-items: start; }
.word-line label { color: var(--muted); font-size: .8125rem; padding: 9px 4px; text-align: right; }
.word-line textarea { width: 100%; min-height: 43px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; color: var(--ink); }
.word-note { color: var(--muted); font-size: .875rem; margin-bottom: 5px; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
.login-card { width: min(100%, 395px); background: white; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 15px; padding: 26px; }
.login-card h1 { margin-top: 10px; font-size: 1.6rem; }
.login-card p { margin-bottom: 15px; color: var(--muted); }
.login-card label, .dialog-content label { display: block; font-size: .9rem; font-weight: 650; margin-bottom: 4px; }
.login-card button { margin-top: 12px; width: 100%; }
.login-card .form-error { margin: 9px 0 0; color: #9c322b; }
dialog { width: min(440px, calc(100% - 26px)); max-height: calc(100dvh - 26px); border: 1px solid var(--line); border-radius: 14px; padding: 0; color: var(--ink); box-shadow: 0 12px 45px #1726202b; }
dialog::backdrop { background: #15271f73; }
.dialog-content { padding: 18px; }
.dialog-content > p { margin-bottom: 9px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.dialog-heading h2 { font-size: 1.2rem; }
.dialog-heading > div { min-width: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-top: 13px; }
.command { display: block; border-radius: 6px; padding: 8px; margin: 9px 0; background: var(--accent-soft); overflow-wrap: anywhere; }
.form-error { color: #9c322b; font-size: .875rem; margin-top: 8px; }
.proposal-dialog { width: min(870px, calc(100% - 26px)); }
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.comparison section { min-width: 0; background: #f5f7f6; border-radius: 9px; padding: 10px; }
.comparison section + section { background: #eaf7ee; }
.comparison h3 { font-size: .9rem; margin-bottom: 6px; }
.comparison pre { margin: 0; max-height: 55dvh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .875rem; }
.toast { white-space: pre-line; position: fixed; z-index: 4; bottom: 17px; right: 17px; max-width: min(400px, calc(100% - 34px)); padding: 9px 13px; border-radius: 9px; background: var(--sidebar); color: white; box-shadow: var(--shadow); }
.overlay { display: none; }
@media (max-width: 1130px) {
  .workspace { grid-template-columns: 204px minmax(0, 1fr); }
  .panels { padding: 14px; gap: 12px; }
  .top-bar { padding-inline: 15px; }
  .panel-header { padding-inline: 12px; }
  .file-actions { gap: 1px; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .tabs { display: flex; gap: 5px; padding: 9px 14px 0; }
  .tabs button { border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 6px 13px; font-weight: 650; }
  .tabs button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
  .panels { grid-template-columns: 1fr; padding-top: 8px; }
  .workspace[data-tab=chat] .file-panel, .workspace[data-tab=file] .chat-panel { display: none; }
}
@media (max-width: 630px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .top-bar { padding: 8px; gap: 4px; }
  .top-bar .mobile-menu { display: inline-flex; }
  .top-bar h1 { white-space: nowrap; }
  .tabs { padding-inline: 8px; }
  .panels { padding: 6px 7px max(7px, env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .sidebar.open { position: fixed; display: flex; z-index: 3; inset: 0 auto 0 0; width: min(270px, 85vw); max-height: 100dvh; }
  .overlay:not([hidden]) { display: block; position: fixed; z-index: 2; inset: 0; border: 0; background: #15271f73; }
  .editor-frame { padding: 9px; }
  .composer-area { padding: 8px; }
  .comparison { grid-template-columns: 1fr; }
  .comparison pre { max-height: 25dvh; }
}
