:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  color: #30362f; background: #fff; font-synthesis: none;
  --muted: #92998b; --line: #e8ece3; --sidebar: #f5f6f2; --accent: #294733;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid #73936a; outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; vertical-align: middle; flex-shrink: 0; }
[data-icon] { display: inline-flex; }
.icon-button { border: 0; background: none; padding: 6px; border-radius: 6px; color: #94a087; display: inline-flex; align-items: center; justify-content: center; }
.icon-button:hover { background: #e9eee1; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 8px; padding: 10px 15px; font-size: 12px; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: #3f6547; }
.secondary { border: 1px solid #e0e6d7; background: white; color: #7a8b68; }
.workspace { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 260px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line); padding: 22px 13px 10px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 9px; margin-bottom: 27px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 600; letter-spacing: -.5px; }
.new-session { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 4px 16px; border: 1px solid #dfe6d6; border-radius: 8px; background: white; text-align: left; font-size: 12px; }
.new-session:hover { background: #edf2e7; }
.new-session svg { width: 16px; }
.search { display: flex; gap: 7px; align-items: center; color: #a3ae97; padding: 5px 11px 15px; }
.search svg { width: 14px; height: 14px; }
.search input { border: 0; background: none; padding: 0; min-width: 0; width: 100%; outline: 0; font-size: 11px; }
input::placeholder, textarea::placeholder { color: #a7b19b; }
.session-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.device-group { margin: 15px 0 8px; }
.device-group-heading { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #99a38e; padding: 0 12px 9px; }
.session-item { display: block; width: 100%; border: 0; text-align: left; padding: 11px 12px; border-radius: 7px; background: none; margin-bottom: 2px; }
.session-item:hover { background: #ecf0e5; }
.session-item.selected { background: #e5ecdc; }
.session-item-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.session-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #58664b; font-size: 12px; }
.session-kind { font-family: monospace; font-size: 10px; color: #899a79; }
.session-item-top .dot { margin-left: auto; }
.session-preview { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-top: 6px; color: #a3ae96; font-size: 10px; }
.sidebar-empty { padding: 20px 12px; color: #9ba98b; font-size: 11px; line-height: 1.9; }
.sidebar-footer { margin-top: 12px; padding-top: 9px; border-top: 1px solid #e1e7d9; }
.sidebar-footer > button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 11px; color: #7b8a6d; }
.sidebar-footer > button:hover { background: #e9eee1; }
.sidebar-footer > button svg { width: 15px; height: 15px; }
#device-count { margin-left: auto; font-size: 10px; color: #a4ae97; }
.connection-row { display: flex; align-items: center; gap: 7px; padding: 9px 11px 0; color: #a0ad92; font-size: 10px; }
.connection-row .icon-button { margin-left: auto; }
.connection-row svg { width: 14px; height: 14px; }
.dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; background: #c0c9b5; }
.dot.online { background: #86a76f; }
.dot.busy { background: #bca367; }
.dot.offline { background: #c4cbbd; }
.conversation { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.conversation-header { display: flex; align-items: center; gap: 12px; min-height: 78px; padding: 18px 35px; border-bottom: 1px solid #f0f3eb; }
.conversation-heading { min-width: 0; }
.conversation-header h1 { font-size: 14px; font-weight: 500; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-meta { color: #9ea991; font-family: monospace; font-size: 10px; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-meta:empty { display: none; }
.conversation-status { display: flex; align-items: center; gap: 7px; margin-left: auto; color: #99a58c; font-size: 10px; white-space: nowrap; }
.empty-conversation { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 25px 20px 80px; text-align: center; }
.empty-conversation img { opacity: .8; margin-bottom: 20px; }
.empty-conversation h2 { font-size: 24px; font-weight: 500; letter-spacing: -.6px; margin: 0 0 12px; }
.empty-conversation p { color: #9ba98b; font-size: 12px; line-height: 1.8; margin-bottom: 22px; }
.thread { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.message-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; scrollbar-width: thin; }
.message-column { width: min(100%, 850px); margin: auto; padding: 28px 35px 20px; }
.load-older { display: block; margin: 0 auto 30px; background: none; border: 0; padding: 8px; color: #9bab8b; font-size: 11px; }
.message { margin: 0 0 30px; line-height: 1.9; font-size: 14px; overflow-wrap: anywhere; }
.message.user { display: flex; flex-direction: column; align-items: flex-end; margin-bottom: 27px; }
.message.user .message-body { max-width: 85%; background: #f0f3eb; padding: 11px 18px; border-radius: 15px 15px 4px 15px; white-space: pre-wrap; }
.message.assistant .message-body { color: #46533c; }
.message-byline { display: flex; align-items: center; gap: 8px; font-size: 10px; color: #92a180; margin-bottom: 9px; }
.message-byline svg { width: 17px; height: 17px; }
.message-byline time { margin-left: auto; color: #b1bba5; opacity: 0; }
.message:hover time { opacity: 1; }
.message-state { display: flex; align-items: center; gap: 7px; font-size: 10px; color: #a6b497; margin-top: 8px; }
.message-state button { background: none; border: 0; padding: 0; font-size: 10px; color: #a3af93; text-decoration: underline; text-underline-offset: 3px; }
.message-error { color: #b57e63; background: #fcf6ef; padding: 10px 13px; border-radius: 7px; margin-top: 10px; font-size: 12px; white-space: pre-wrap; }
.prose { white-space: pre-wrap; }
.prose strong { font-weight: 600; }
.prose code { font-size: .9em; padding: 2px 5px; border-radius: 4px; background: #f0f4e9; }
.code-block { background: #f6f8f1; border: 1px solid #e8edde; border-radius: 8px; margin: 13px 0; overflow: hidden; white-space: normal; }
.code-heading { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e9eddf; padding: 6px 12px; color: #a4af94; font-size: 10px; }
.code-heading button { border: 0; background: none; color: #8d9d7b; font-size: 10px; padding: 2px 0; }
.code-block pre { font-size: 12px; line-height: 1.8; margin: 0; padding: 14px; overflow-x: auto; color: #61764e; white-space: pre; }
.typing { display: inline-flex; align-items: center; gap: 5px; color: #a1ad91; font-size: 12px; }
.typing::before { content: ''; width: 6px; height: 6px; background: #90ab76; border-radius: 50%; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.thread-empty { text-align: center; color: #a6b197; font-size: 13px; margin: 13vh 0; }
.composer-wrap { width: min(100%, 850px); padding: 9px 35px 13px; margin: 0 auto; }
.composer { border: 1px solid #dfe6d5; background: #fcfdf9; border-radius: 14px; padding: 14px 15px 10px; box-shadow: 0 3px 15px #34482204; }
.composer:focus-within { border-color: #b5c9a1; }
.composer textarea { border: 0; background: transparent; resize: none; width: 100%; min-height: 48px; max-height: 180px; padding: 0; outline: 0; font-size: 13px; line-height: 1.8; color: #46543b; box-shadow: none; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.composer-actions > span { color: #b0b9a4; font-size: 9px; }
.composer-actions > div { display: flex; align-items: center; gap: 11px; }
.send-button { width: 30px; height: 30px; padding: 6px; border: 0; background: #315037; color: #fff; border-radius: 8px; display: grid; place-items: center; }
.send-button:hover { background: #48704a; }
.stop-button { display: flex; gap: 5px; align-items: center; background: transparent; border: 0; color: #879a75; padding: 5px 0; font-size: 10px; }
.stop-button svg { width: 12px; height: 12px; }
.queue-hint { margin: 8px 0 0; min-height: 15px; font-size: 10px; color: #a4b093; text-align: center; line-height: 1.6; }
.new-messages { position: absolute; bottom: 155px; left: 50%; transform: translateX(-50%); border-radius: 20px; font-size: 11px; box-shadow: 0 3px 16px #394c2612; z-index: 1; }
.new-messages svg { width: 13px; height: 13px; }
input, select { border: 1px solid #e0e7d5; border-radius: 7px; background: #fafcf7; color: #637450; padding: 11px 12px; outline: none; }
input:focus, select:focus { border-color: #b2ca99; }
dialog { border: 1px solid #e4eadb; border-radius: 13px; background: #fff; color: #4b5e3a; padding: 0; width: 430px; max-width: calc(100% - 28px); max-height: calc(100dvh - 60px); box-shadow: 0 20px 70px #25301b20; }
dialog::backdrop { background: #16201255; backdrop-filter: blur(2px); }
.wide-dialog { width: 540px; }
.dialog-content { padding: 24px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog-heading h2 { font-size: 17px; font-weight: 500; margin: 0; }
.dialog-content label, .login-card label { display: block; font-size: 11px; color: #8b9b78; margin: 17px 0 8px; }
.dialog-content input, .dialog-content select { width: 100%; font-size: 12px; min-width: 0; }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 23px; }
.device-entry { padding: 15px 0; border-bottom: 1px solid #eef2e7; }
.device-entry-heading { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.device-entry-heading small { font-size: 10px; color: #a2b18e; margin-left: auto; }
.device-roots { font-family: monospace; font-size: 10px; line-height: 1.8; color: #a6b197; overflow-wrap: anywhere; margin: 8px 0 0 13px; }
.setup { margin-top: 20px; color: #95a77f; font-size: 11px; }
.setup summary { cursor: pointer; color: #7f9567; }
.setup p { font-size: 10px; line-height: 1.8; }
.setup pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; background: #f5f8ef; border-radius: 6px; font-size: 10px; line-height: 1.9; }
.file-input-row { display: flex; gap: 8px; }
.file-input-row input { flex: 1; }
#file-form small { color: #a7b794; font-size: 10px; display: block; margin: 9px 0 19px; }
.file-entry { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid #edf2e4; }
.file-entry > div { min-width: 0; flex: 1; }
.file-entry-name { display: block; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.file-entry small { display: block; font-size: 10px; color: #a7b597; margin-top: 6px; line-height: 1.7; overflow-wrap: anywhere; }
.file-entry .error { color: #bd8c70; }
.file-entry button { font-size: 10px; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: #f7f9f3; }
.login-card { width: 370px; max-width: 100%; padding: 32px; background: #fff; border: 1px solid #e6ecdd; border-radius: 14px; }
.login-card h1 { font-size: 23px; font-weight: 500; margin: 24px 0 9px; }
.login-card > p { color: #9eab8f; font-size: 11px; line-height: 1.8; }
.login-card input { width: 100%; }
.login-card .button { width: 100%; margin-top: 24px; }
.error { color: #bb8667 !important; font-size: 11px; }
.error:empty { display: none; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 30px); border-radius: 8px; padding: 12px 18px; background: #314b2d; color: #e6efdc; font-size: 12px; line-height: 1.8; z-index: 10; box-shadow: 0 5px 25px #24371c22; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.mobile-only { display: none; }
@supports (height: 100dvh) { .workspace { height: 100dvh; } }
@media (max-width: 760px) {
  .mobile-only { display: inline-flex; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 4; transform: translateX(-100%); transition: transform .15s ease; }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 3; border: 0; background: #1e2a1955; }
  .conversation-header { min-height: 68px; padding: 12px 16px; gap: 9px; }
  .conversation-header h1 { font-size: 13px; }
  .conversation-meta { font-size: 9px; max-width: 210px; }
  .conversation-status { font-size: 9px; }
  .message-column { padding: 24px 22px 12px; }
  .message { font-size: 13px; margin-bottom: 27px; }
  .message.user .message-body { max-width: 92%; padding: 10px 15px; }
  .message-byline time { opacity: 1; font-size: 9px; }
  .composer-wrap { padding: 8px 13px 7px; }
  .composer { padding: 12px; border-radius: 12px; }
  .composer-actions > span { font-size: 8px; }
  .queue-hint { font-size: 9px; }
  .empty-conversation h2 { font-size: 23px; }
  .code-block pre { font-size: 11px; }
  .dialog-content { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
