:root{--chat-bg:#212121;--sidebar-bg:#171717;--surface:#2c2c2c;--hover:#ffffff0a;--selected:#ffffff11;--text:#ececec;--subtle:#a0a0a0;--border:#ffffff13;--accent:#dbc78b}
:root[data-theme=light]{color-scheme:light;--chat-bg:#fff;--sidebar-bg:#f8f8f8;--surface:#f3f3f3;--hover:#00000006;--selected:#0000000b;--text:#242424;--subtle:#767676;--border:#00000010;--accent:#796127}
body{background:var(--chat-bg);color:var(--text)}
.chat-layout{grid-template-columns:280px minmax(0,1fr)}
#chat-sidebar{background:var(--sidebar-bg);padding:22px 12px 16px;border-right:1px solid var(--border);color:var(--text)}
.sidebar-head{display:flex;align-items:center;justify-content:space-between;margin:0 9px 27px;gap:10px}
.sidebar-head .chat-brand{margin:0;gap:9px;font-size:21px;color:var(--text)}
.sidebar-head .chat-brand img{width:27px;height:27px}
.sidebar-collapse{display:grid;place-items:center;border:0;background:none;border-radius:7px;width:32px;height:32px;color:var(--subtle);flex-shrink:0}
.sidebar-collapse:hover{background:var(--selected);color:var(--text)}
.sidebar-collapse svg,.library-menu svg,.history-row svg,.project-row svg,.project-add svg,#chat-theme svg{width:17px;height:17px;flex-shrink:0}
.new-chat{border:0;background:var(--hover);border-radius:9px;padding:10px 12px;gap:10px;font-size:14px;color:var(--text)}
.new-chat:hover{background:var(--selected)}
.new-chat-symbol{font-size:22px;line-height:20px}.new-chat-label{margin-right:auto}
.new-chat kbd{color:var(--subtle);border-color:var(--border);font-size:10px}
.search-label{margin:12px 4px 0}
.search-label input{border:0;background:none;color:var(--text);font-size:13px;padding:9px 10px;border-radius:7px}
.search-label input:focus{background:var(--selected)}
.search-label input::placeholder{color:var(--subtle)}
#conversation-list{margin:18px -4px 10px;padding:0 4px 20px;scrollbar-width:thin;scrollbar-color:transparent transparent;overflow-x:hidden}
#conversation-list:hover{scrollbar-color:#8885 transparent}
.library-section{margin-top:16px;min-height:50px;border-radius:9px}
.library-section:first-child{margin-top:0}
.library-section-heading{display:flex;align-items:center;color:var(--subtle);font-size:12px;font-weight:450;letter-spacing:0;padding:8px 12px;margin-bottom:3px;min-height:34px}
.project-heading{margin-top:18px;padding-right:5px}
.project-add{display:grid;place-items:center;width:28px;height:28px;margin-left:auto;background:none;border:0;color:var(--subtle);border-radius:6px}
.project-add:hover{background:var(--selected);color:var(--text)}
.library-empty{font-size:12px;line-height:1.6;color:var(--subtle);padding:3px 12px 7px;margin:0}
.library-empty-drop{font-size:12px;line-height:1.5;color:var(--subtle);padding:6px 12px;margin:0;opacity:.8}
.history-row{display:flex;align-items:center;position:relative;gap:0;padding:0 5px 0 0;border:0;border-radius:8px;margin:2px 0;min-height:39px;color:var(--text)}
.history-row:hover{background:var(--hover)}
.history-row.active{background:var(--selected);border:0}
.history-open{display:flex;align-items:center;gap:8px;padding:10px 7px 10px 12px;font-size:13px;line-height:19px;color:var(--text);border-radius:8px;min-width:0}
.history-open>svg{display:none}
.history-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1;text-align:left}
.history-pin{color:var(--subtle);display:grid;place-items:center}
.history-pin svg{width:13px;height:13px;transform:rotate(30deg)}
.history-more,.history-quick-pin{display:grid;place-items:center;width:28px;height:30px;flex-shrink:0;padding:0;border:0;border-radius:6px;background:none;color:var(--subtle);opacity:0;transition:opacity .12s}
.history-more svg{width:18px}.history-quick-pin svg{width:14px;transform:rotate(30deg)}
.history-row:hover>.history-more,.history-row:hover>.history-quick-pin,.history-row:focus-within>.history-more,.history-row:focus-within>.history-quick-pin,.project-row:hover>.history-more,.project-row:focus-within>.history-more,[aria-expanded=true].history-more{opacity:1}
.history-more:hover,.history-quick-pin:hover{background:var(--selected);color:var(--text)}
.history-quick-pin{display:none}.history-row:hover>.history-quick-pin,.history-row:focus-within>.history-quick-pin{display:grid}
.project-conversations .history-row:hover>.history-quick-pin,.project-conversations .history-row:focus-within>.history-quick-pin{display:none}
.project-row{display:flex;align-items:center;gap:0;padding-right:5px;border-radius:8px;min-height:40px}
.project-row:hover{background:var(--hover)}
.project-open{display:flex;align-items:center;gap:9px;min-width:0;flex:1;padding:9px 6px 9px 12px;border:0;background:none;color:var(--text);font-size:13px;text-align:left}
.project-open>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}
.project-open small{font-size:11px;color:var(--subtle)}
.project-open>svg:last-child{width:12px;color:var(--subtle);transition:transform .15s}
.project-open[aria-expanded=true]>svg:last-child{transform:rotate(90deg)}
.project-conversations{margin:1px 0 8px 18px;padding-left:4px;border-left:1px solid var(--border)}
.project-conversations .history-open{font-size:12px;padding-left:10px}.project-conversations .history-quick-pin{display:none}
.project-conversations .library-empty-drop{font-size:11px;padding:9px}
.library-project{border-radius:9px}
.library-menu{position:fixed;z-index:90;max-height:calc(100dvh - 24px);overflow-y:auto;background:var(--chat-bg);color:var(--text);border:1px solid var(--border);padding:6px;border-radius:12px;box-shadow:0 8px 35px #0003;animation:menu-arrive .12s ease-out}
.library-menu-item{width:100%;display:flex;align-items:center;gap:11px;padding:10px 11px;border:0;border-radius:7px;background:none;color:var(--text);font-size:13px;text-align:left;min-height:38px}
.library-menu-item:hover,.library-menu-item:focus-visible{background:var(--selected)}
.library-menu-item:disabled{opacity:.35;cursor:default}
.library-menu-item[data-action=delete],.library-menu-item[data-action=delete-project]{border-top:1px solid var(--border);margin-top:5px;padding-top:12px;border-radius:0 0 7px 7px}
.library-menu .library-danger{color:#e47d73}
:root[data-theme=light] .library-danger{color:#b12e28}
.library-dialog{background:var(--chat-bg);color:var(--text);border-color:var(--border);padding:28px;border-radius:16px}
.library-dialog h2{font-size:23px;color:var(--text);margin:0 0 16px;font-weight:550}
.library-dialog p{font-size:13px;color:var(--subtle);line-height:1.7}
.library-dialog label{font-size:13px;color:var(--text)}
.library-dialog input,.library-dialog select{width:100%;font:14px/1.5 Geist,Inter,sans-serif;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:11px;margin-top:10px;min-height:44px}
.library-dialog .dialog-actions button{font-size:13px;padding:10px 15px;border:0;border-radius:8px}
.library-dialog .dialog-actions button:first-child{background:var(--surface);color:var(--text)}
.library-dialog .library-form-error{color:#e47d73;font-size:12px}
.library-dialog .library-form-error:empty{display:none}
.library-dialog .dialog-actions button.library-danger{color:white;background:#b24036}
.library-drag-ghost{position:fixed;left:-10000px;top:0;display:flex;align-items:center;gap:10px;width:245px;padding:12px 15px;background:var(--chat-bg);color:var(--text);border:1px solid var(--border);border-radius:10px;box-shadow:0 5px 16px #0003;font:13px Geist,Inter,sans-serif;pointer-events:none}
.library-drag-ghost svg{width:17px;height:17px;flex-shrink:0}.library-drag-ghost span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-row.dragging{opacity:.28}
.history-row.drop-before:before,.history-row.drop-after:after{content:"";position:absolute;left:10px;right:3px;height:2px;background:var(--accent);border-radius:2px;pointer-events:none}
.history-row.drop-before:before{top:-2px}.history-row.drop-after:after{bottom:-2px}
.library-project.drop-inside,.library-section.drop-inside{background:#d4bf7812;outline:1px dashed var(--accent);outline-offset:-1px}
.is-dragging [data-ephemeral]{border:1px dashed var(--border);padding-bottom:8px}
.sidebar-foot{border-color:var(--border);padding:13px 10px 0;gap:7px}
.sidebar-foot p{font-size:10px;color:var(--subtle)}
.sidebar-foot button,.sidebar-foot a{color:var(--subtle);font-size:12px;padding:3px 0}
.sidebar-foot button:hover,.sidebar-foot a:hover{color:var(--text)}
#chat-theme{display:flex;align-items:center;gap:9px;font-size:12px;margin-bottom:6px}
.chat-top{color:var(--text)}.model-choice select{color:var(--text)}.model-choice select option,.mode-choice select option{background:var(--chat-bg);color:var(--text)}
.connection,.model-choice>span{color:var(--subtle)}
.chat-project-label{font-size:12px;color:var(--subtle);border-left:1px solid var(--border);padding-left:12px;max-width:180px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.welcome h1{color:var(--text);font-size:clamp(28px,3vw,40px);font-weight:500}.welcome>p,.welcome-kicker{color:var(--subtle)}
.suggestions button{background:none;border-color:var(--border)}.suggestions button:hover{background:var(--hover)}.suggestions strong{color:var(--text)}.suggestions small{color:var(--subtle)}
.message-content{color:var(--text);font-size:15px}.user>.message-content{background:var(--surface);border:0}.message-tools button,.message-status,.composer-note,.live-activity{color:var(--subtle)}
.assistant-brand{color:var(--subtle)}.composer-zone{background:linear-gradient(transparent,var(--chat-bg) 20%)}
.code-block{background:#161616;border-color:#ffffff1c}.code-toolbar{background:#292929;color:#aaa}.code-toolbar button{color:#bbb}.message-content code{background:#303030;color:#e5e5e5}.code-block pre code{background:none}
.web-composer{background:var(--surface);border-color:var(--border);box-shadow:0 5px 25px #00000008}.web-composer:focus-within{border-color:#b8a37470}
.web-composer textarea{color:var(--text);font-size:15px}.web-composer textarea::placeholder{color:var(--subtle)}.square-button,.mode-choice select{color:var(--subtle)}
:root[data-theme=light] .code-block{background:#f8f8f8;border-color:#dedede}:root[data-theme=light] .code-toolbar{background:#eee;color:#626262}:root[data-theme=light] .code-toolbar button{color:#555}:root[data-theme=light] .message-content code{background:#eee;color:#272727}:root[data-theme=light] .code-block pre code{background:none}
:root[data-theme=light] .chat-alert{background:#fff8e6;color:#6e4b1e;border-color:#dfcdab}:root[data-theme=light] .pending-file{background:#f7f3e7;color:#6c5935;border-color:#ded2ad}
@keyframes menu-arrive{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
@media(min-width:721px){body.library-collapsed .chat-layout{grid-template-columns:72px minmax(0,1fr)}body.library-collapsed #chat-sidebar{padding:22px 11px 16px}body.library-collapsed .sidebar-head{flex-direction:column;margin:0 0 20px;gap:18px}body.library-collapsed .chat-brand span,body.library-collapsed .new-chat-label,body.library-collapsed .new-chat kbd,body.library-collapsed .search-label,body.library-collapsed #conversation-list,body.library-collapsed .sidebar-foot>*:not(#chat-theme),body.library-collapsed #chat-theme span{display:none}body.library-collapsed .new-chat{justify-content:center;padding:12px 0}body.library-collapsed .sidebar-foot{margin-top:auto;padding:15px 0 0}body.library-collapsed #chat-theme{justify-content:center}}
@media(max-width:720px){.chat-layout{grid-template-columns:1fr}#chat-sidebar{width:min(300px,86vw);left:-320px;padding-top:22px}.sidebar-head{margin-bottom:22px}.history-row{min-height:42px}.history-more{opacity:1}.history-quick-pin{display:none!important}.project-conversations .history-open{font-size:13px}.library-section-heading{font-size:12px}.chat-project-label{display:none}.message-content{font-size:14px}.library-menu-item{min-height:43px}.library-dialog{padding:24px}}
@media(prefers-reduced-motion:reduce){.library-menu{animation:none}.history-more,.history-quick-pin,.project-open>svg:last-child{transition:none}}
