/* AI Assistant — ChatGPT / Claude inspired dark theme */
:root{--bg:#212121;--sidebar-bg:#171717;--surface:#2f2f2f;--surface-hover:#3a3a3a;--border:#3a3a3a;--fg:#ececec;--fg-secondary:#b4b4b4;--fg-tertiary:#8e8e8e;--blue:#4383f4;--blue-hover:#5b96f7;--green:#31c76a;--red:#e5484d;--font-sans:'Inter','Segoe UI',system-ui,sans-serif;--font-mono:'JetBrains Mono','Fira Code',Consolas,monospace}
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%;font-family:var(--font-sans);background:var(--bg);color:var(--fg);font-size:15px;line-height:1.6;overflow:hidden;-webkit-font-smoothing:antialiased}
button,input,textarea,select{font-family:inherit}button{cursor:pointer;border:none;background:none;color:inherit}textarea{resize:none}
#app{display:flex;height:100%}
#sidebar{width:260px;min-width:260px;background:var(--sidebar-bg);display:flex;flex-direction:column;border-right:1px solid var(--border);transition:transform .25s ease,min-width .25s ease,width .25s ease,opacity .25s ease;overflow:hidden;z-index:20}
#sidebar.collapsed{min-width:0;width:0;opacity:0;pointer-events:none;border-right:none}
.sidebar-header{padding:16px 14px 10px}
.sidebar-header h2{font-size:13px;font-weight:600;color:var(--fg-secondary);text-transform:uppercase;letter-spacing:.4px}
.new-chat-btn{padding:10px 14px;margin:0 10px 8px;border-radius:12px;border:1px solid var(--border);color:var(--fg);font-size:13px;font-weight:500;display:flex;align-items:center;gap:8px;transition:background .15s}
.new-chat-btn:hover{background:var(--surface-hover)}
.chat-list{flex:1;overflow-y:auto;padding:0 8px 8px}
.chat-list::-webkit-scrollbar{width:4px}.chat-list::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}
.chat-item{padding:10px 12px;border-radius:8px;cursor:pointer;font-size:13px;position:relative;margin-bottom:1px;transition:background .1s;display:flex;align-items:flex-start;gap:8px}
.chat-item:hover{background:var(--surface-hover)}.chat-item.active{background:var(--surface)}
.chat-item .icon{font-size:14px;flex-shrink:0;margin-top:1px;opacity:.6}
.chat-item .info{overflow:hidden;flex:1}
.chat-item .title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:450}
.chat-item .meta{font-size:11px;color:var(--fg-tertiary);margin-top:1px}
.chat-item .del{position:absolute;right:6px;top:6px;opacity:0;font-size:12px;padding:3px 6px;border-radius:4px;color:var(--fg-tertiary)}
.chat-item:hover .del{opacity:1}.chat-item .del:hover{color:var(--red);background:rgba(229,72,77,.15)}
#main{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}
#topbar{height:54px;display:flex;align-items:center;padding:0 16px;border-bottom:1px solid var(--border);gap:10px;flex-shrink:0}
.menu-btn{width:34px;height:34px;display:flex;align-items:center;justify-content:center;border-radius:8px;color:var(--fg-secondary);font-size:18px;transition:background .15s}
.menu-btn:hover{background:var(--surface)}
.model-select{padding:6px 12px;border-radius:8px;border:1px solid var(--border);background:var(--surface);color:var(--fg);font-size:13px;outline:none;cursor:pointer;min-width:160px;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e8e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;padding-right:32px}
.topbar-right{margin-left:auto;display:flex;align-items:center;gap:10px}
.serial-tag{font-size:11px;color:var(--fg-tertiary);font-family:var(--font-mono);padding:3px 10px;border-radius:20px;border:1px solid var(--border)}
#tabbar{display:flex;padding:6px 16px 0;gap:2px;flex-shrink:0;border-bottom:1px solid var(--border)}
.tab-btn{padding:8px 16px;font-size:13px;font-weight:500;color:var(--fg-tertiary);border-radius:8px 8px 0 0;transition:.15s}
.tab-btn.active{color:var(--fg);border-bottom:2px solid var(--fg);margin-bottom:-1px}
.tab-btn:hover:not(.active){color:var(--fg-secondary)}
.tab-panel{display:none;flex:1;overflow:hidden}
.tab-panel.active{display:flex;flex-direction:column}
.messages{flex:1;overflow-y:auto;padding:24px 0 32px;scroll-behavior:smooth}
.messages::-webkit-scrollbar{width:6px}.messages::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}
.msg-container{max-width:750px;margin:0 auto;padding:0 32px}
.msg-row{display:flex;gap:14px;padding:20px 0}
.msg-row.user{flex-direction:row-reverse}
.msg-avatar{width:32px;height:32px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:600;color:white}
.msg-row.bot .msg-avatar{background:#19c37d}.msg-row.user .msg-avatar{background:var(--blue)}
.msg-body{max-width:85%}.msg-row.user .msg-body{display:flex;flex-direction:column;align-items:flex-end}
.msg-text{line-height:1.7;font-size:14.5px;word-wrap:break-word;overflow-wrap:break-word}
.msg-row.user .msg-text{background:var(--surface);border-radius:16px;padding:12px 18px;border:1px solid var(--border)}
.msg-label{font-size:11.5px;color:var(--fg-tertiary);margin-top:4px;display:flex;gap:6px;align-items:center}
.typing-dots{display:flex;gap:4px;padding:8px 0}
.typing-dots span{width:6px;height:6px;border-radius:50%;background:var(--fg-tertiary);animation:dotPulse 1.2s infinite}
.typing-dots span:nth-child(2){animation-delay:.2s}.typing-dots span:nth-child(3){animation-delay:.4s}
@keyframes dotPulse{0%,60%,100%{opacity:.2;transform:scale(.8)}30%{opacity:1;transform:scale(1)}}
.welcome{max-width:750px;margin:80px auto 0;text-align:center;padding:0 32px}
.welcome-icon{font-size:48px;margin-bottom:16px}
.welcome h2{font-size:22px;font-weight:600;margin-bottom:8px}
.welcome p{color:var(--fg-tertiary);font-size:14px}
.input-area{padding:0 32px 24px;flex-shrink:0}
.input-wrapper{max-width:750px;margin:0 auto;display:flex;align-items:flex-end;gap:8px}
.input-box{flex:1;background:var(--surface);border:1px solid var(--border);border-radius:24px;padding:14px 20px;display:flex;align-items:center;gap:10px;transition:border-color .15s,box-shadow .15s}
.input-box:focus-within{border-color:var(--blue);box-shadow:0 0 0 1px rgba(67,131,244,.3)}
.input-box textarea{flex:1;background:none;border:none;color:var(--fg);font-size:15px;outline:none;padding:0;line-height:1.5;max-height:180px}
.input-box textarea::placeholder{color:var(--fg-tertiary)}
.send-btn{width:36px;height:36px;border-radius:50%;background:var(--fg);display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:.15s}
.send-btn:hover{background:var(--fg-secondary)}.send-btn:disabled{opacity:.35;cursor:not-allowed}
.code-block{background:#1a1a1a;border:1px solid var(--border);border-radius:8px;margin:10px 0;overflow:hidden}
.code-header{background:#252525;padding:8px 14px;display:flex;justify-content:space-between;align-items:center;font-size:11.5px;color:var(--fg-tertiary)}
.code-header button{color:var(--fg-secondary);font-size:11px;padding:2px 8px;border-radius:4px;transition:.15s}
.code-header button:hover{background:var(--surface);color:var(--fg)}
.code-block pre{padding:14px 16px;margin:0;overflow-x:auto;font-family:var(--font-mono);font-size:13px;line-height:1.55;color:#d4d4d4}
.inline-code{background:#252525;padding:2px 6px;border-radius:4px;font-family:var(--font-mono);font-size:13px;color:#e0e0e0}
.image-layout{flex:1;overflow-y:auto}.image-inner{max-width:750px;margin:0 auto;padding:32px}
.image-card{margin-bottom:28px;text-align:center}
.image-card .image-label{font-size:12.5px;color:var(--fg-tertiary);margin-bottom:10px}
.image-card img{max-width:100%;max-height:520px;border-radius:12px;border:1px solid var(--border)}
.image-error{background:rgba(229,72,77,.08);border:1px solid rgba(229,72,77,.25);color:var(--red);padding:16px 20px;border-radius:8px;text-align:center;font-size:13.5px;margin:12px 0}
.image-loading{text-align:center;padding:40px}
.image-loading .spin{width:32px;height:32px;border:3px solid var(--border);border-top-color:var(--fg);border-radius:50%;margin:0 auto 16px;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.image-input-row{display:flex;align-items:center;gap:10px;padding:0 32px 24px;flex-shrink:0}
.image-input-row select{padding:10px 28px 10px 14px;border-radius:24px;border:1px solid var(--border);background:var(--surface);color:var(--fg);font-size:13.5px;outline:none;appearance:none;cursor:pointer;flex-shrink:0;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e8e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center}
.gen-btn{padding:12px 24px;border-radius:24px;background:var(--fg);color:var(--bg);font-size:14px;font-weight:600;cursor:pointer;flex-shrink:0;transition:.15s}
.gen-btn:hover{background:var(--fg-secondary)}.gen-btn:disabled{opacity:.35;cursor:not-allowed}
.save-btn-img{padding:10px 20px;border-radius:24px;border:1px solid var(--border);color:var(--fg);font-size:13px;font-weight:500;cursor:pointer;transition:.15s;flex-shrink:0}
.save-btn-img:hover{background:var(--surface)}.save-btn-img:disabled{opacity:.3;cursor:not-allowed}
.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--fg);color:var(--bg);padding:10px 24px;border-radius:20px;font-size:13px;font-weight:500;opacity:0;pointer-events:none;transition:opacity .3s;z-index:100}
.toast.show{opacity:1}.toast.error{background:var(--red);color:white}
@media(max-width:768px){#sidebar{position:fixed;left:0;top:0;bottom:0}#sidebar.collapsed{transform:translateX(-100%)}.msg-container,.welcome,.input-wrapper,.image-inner{padding:0 16px}.image-input-row{padding:0 16px 24px;flex-wrap:wrap}}