/* 样式：照搬旧版最终版本（去掉注释，去掉 AI 日记 / ERP / 上下文窗口 / 授权等已删除功能的样式）。配色改 :root 里的变量。 */
html.need-login .auth-overlay{display:flex !important}
.step-fallback{margin:12px 0;padding-left:22px;line-height:1.8}
.step-fallback li{margin:4px 0}
.step-card{border:1px solid var(--border);border-radius:10px;margin:14px 0; overflow:hidden;background:var(--surface)}
.step-head{display:flex;align-items:center;gap:10px;padding:11px 14px; background:var(--surface-2);border-bottom:1px solid var(--border)}
.step-card.folded .step-head{border-bottom:none}
.step-card.folded .step-body{display:none}
.step-title{font-weight:600;font-size:14px;flex:1;line-height:1.4}
.step-count{font-size:12px;color:var(--text-3);white-space:nowrap}
.step-all{font-size:12px;padding:3px 9px;border-radius:7px;cursor:pointer; border:1px solid var(--border-strong);background:transparent;color:var(--text-3);white-space:nowrap}
.step-all:hover{color:var(--text)}
.step-fold{width:22px;height:22px;line-height:1;border-radius:7px;cursor:pointer; border:1px solid var(--border-strong);background:transparent;color:var(--text-3); font-size:14px;display:flex;align-items:center;justify-content:center;padding:0}
.step-item{border-bottom:1px solid var(--border)}
.step-item:last-child{border-bottom:none}
.step-item.openable{cursor:pointer}
.step-row{display:flex;align-items:center;gap:10px;padding:10px 14px}
.step-item.openable:hover .step-row{background:var(--surface-2)}
.step-no{width:20px;height:20px;border-radius:50%;flex:none; background:var(--primary);color:#fff;font-size:11px; display:flex;align-items:center;justify-content:center}
.step-name{flex:1;font-size:14px;line-height:1.4}
.step-caret{color:var(--text-3);font-size:16px;transition:transform .15s;flex:none}
.step-item.open .step-caret{transform:rotate(90deg)}
.step-desc{display:grid;grid-template-rows:0fr;transition:grid-template-rows .18s ease; font-size:13px;line-height:1.7;color:var(--text-3)}
.step-desc-in{overflow:hidden;min-height:0}
.step-item.open .step-desc{grid-template-rows:1fr}
.step-item.open .step-desc-in{padding:0 14px 12px 44px}
.skill-foot{display:flex;align-items:center;justify-content:space-between;gap:12px; margin:16px 0 0;padding-top:13px;border-top:1px solid var(--border)}
.skill-foot-hint{font-size:12px;color:var(--text-3);flex:1;line-height:1.5}
.skill-foot-btn{padding:7px 14px;border-radius:7px;border:none;cursor:pointer; background:var(--primary);color:#fff;font-size:13px;white-space:nowrap}
.skill-foot-btn:disabled{background:var(--border);color:var(--text-3);cursor:default}
:root{--bg: #FCFCFB; --sidebar-bg: #F4F4F1; --surface: #FFFFFF; --border: #E2E1DC; --text: #1C1B19; --text-2: #57544E; --text-3: #8C877F; --primary: #0E7490; --primary-hover: #155E75; --primary-light: #E6F2F5; --red: #B91C1C; --user-bubble: #E6F2F5; --grp-other-bubble: #E6F2F5; --grp-other-border: #C7E0E7; --grp-me-bubble: #E6F2F5; --grp-me-border: #C7E0E7; --grp-bg: #FCFCFB; --shadow: 0 1px 2px rgba(28,27,25,0.04); --shadow-sm: 0 1px 2px rgba(28,27,25,0.04); --shadow-lg: 0 8px 24px rgba(28,27,25,0.10); --sidebar-w: 265px; --history-mask: #E6F2F5; --history-more-bg: #FFFFFF; --history-more-bg-hover: #C7E0E7; --chat-bubble-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 20l1.3-3.9a9 8 0 1 1 3.4 2.9l-4.7 1z'/%3E%3C/svg%3E"); --brand-grad: linear-gradient(140deg,#0E7490 0%,#155E75 100%); --brand-glow: rgba(14,116,144,.28); --grp-accent: #0E7490; --grp-accent-hover: #155E75; --grp-erp: #f59e0b; --grp-erp-light: rgba(245,158,11,0.12); --notes-fill: #F4F4F1; --notes-fill-hover: #F0EFEC; --filetag-size: 42px; --filetag-font: 11px; --search-row-h: 41px; --diary-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 12 10 18 20 6'/%3E%3C/svg%3E"); --radius: 10px; --tr: 0.16s ease; --text-1: var(--text); --muted: var(--text-3); --card: var(--surface); --bg-soft: var(--surface-2); --border-soft: var(--border); --surface-2: #F0EFEC; --border-strong: #D5D3CC; --primary-edge: #C7E0E7; --accent: #96530B; --accent-bg: #FBF3E8; --accent-edge: #E5CBA8; --shadow-card: 0 1px 2px rgba(28,27,25,0.04); --radius-card: 10px; --radius-control: 7px; --radius-tag: 4px;}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;font-family:"PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;font-size:15px;background:var(--bg);color:var(--text)}
button{cursor:pointer;border:none;background:none;font:inherit;color:inherit}
textarea,input{font:inherit}
textarea{resize:none}
a{color:var(--primary);text-decoration:none}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:var(--text-3)}
::-webkit-scrollbar-track{background:transparent}
@supports (-moz-appearance:none){
  *{scrollbar-width:thin;scrollbar-color:var(--text-3) transparent}
}
.app{display:flex;height:100vh;height:100dvh;overflow:hidden;border-top:1px solid var(--border);box-sizing:border-box}
.sidebar{position:relative;width:var(--sidebar-w);flex-shrink:0;background:var(--sidebar-bg);border-right:1px solid var(--border);display:flex;flex-direction:column;overflow:hidden;transition:transform var(--tr), width var(--tr), border-color var(--tr)}
.sidebar.collapsed{width:0;border-right-color:transparent}
.sidebar-resizer{position:absolute;top:0;right:0;bottom:0;width:6px;cursor:col-resize;z-index:5}
body.resizing,body.resizing *{cursor:col-resize!important}
.collapse-btn{flex-shrink:0}
.sidebar-header{padding:16px 12px 8px;display:flex;flex-direction:column;gap:8px}
.logo{display:flex;align-items:center;gap:10px;padding:4px 8px;font-size:18px;font-weight:700;color:var(--primary)}
.logo>span{font-family:"Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;font-weight:700;letter-spacing:0.5px}
.brand-spark{display:block;flex:none}
.logo-icon .brand-spark{width:17px;height:17px}
.msg-avatar .brand-spark{width:17px;height:17px}
.auth-logo .brand-spark{width:24px;height:24px}
.logo-icon{width:32px;height:32px;border-radius:7px;background:var(--brand-grad);display:flex;align-items:center;justify-content:center;color:#fff;font-size:16px;font-weight:700;flex-shrink:0}
.new-chat-btn{display:flex;align-items:center;justify-content:center;gap:8px;padding:9px 14px;border-radius:var(--radius-control);background:var(--primary);color:#fff;font-size:14px;font-weight:500;transition:background var(--tr)}
.new-chat-btn:hover{background:var(--primary-hover)}
.sidebar-quick-actions{display:flex;flex-direction:column;gap:2px;padding:2px 0}
.sidebar-divider{height:1px;background:var(--border);margin:10px 8px}
.sidebar-quick-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:7px;cursor:pointer;font-size:14px;font-weight:500;color:var(--text);transition:background var(--tr)}
.sidebar-quick-item:hover{background:var(--primary-light);color:var(--primary)}
.sidebar-quick-item.active{background:var(--primary-light);color:var(--primary)}
.sidebar-quick-item svg{flex-shrink:0}
.history-list{flex:1;overflow-y:auto;padding:4px 8px}
.history-group-label{font-size:11px;color:var(--text-3);padding:10px 8px 4px;font-weight:600;letter-spacing:.4px;text-transform:uppercase}
.history-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:7px;cursor:pointer;position:relative;transition:background var(--tr)}
.history-item::before{content:'';flex:none;width:18px;height:18px;background:var(--text-3);transition:background var(--tr);-webkit-mask:var(--chat-bubble-icon) center/contain no-repeat;mask:var(--chat-bubble-icon) center/contain no-repeat}
.history-item.active::before{background:var(--text-2)}
.history-item:hover{background:var(--primary-light)}
.history-item.active{background:var(--primary-light)}
.history-item.active .history-title{color:var(--text)}
.history-icon{flex-shrink:0;opacity:.5;width:14px}
.history-title{flex:1;min-width:0;font-size:13.5px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:clip}
.history-rename-input{flex:1;min-width:0;background:var(--bg);border:1.5px solid var(--primary);border-radius:7px;padding:1px 6px;font-size:13.5px;color:var(--text);outline:none}
.history-actions{position:absolute;right:6px;top:50%;transform:translateY(-50%);display:flex;gap:1px;flex-shrink:0;opacity:0;transition:opacity var(--tr);padding-left:22px;background:linear-gradient(to right,transparent,var(--history-mask) 22px)}
.history-item:hover .history-actions{opacity:1}
.history-action{width:22px;height:22px;border-radius:7px;flex-shrink:0;display:flex;align-items:center;justify-content:center;color:var(--text-3);transition:all var(--tr)}
.history-action.more{background:var(--history-more-bg);box-shadow:inset 0 0 0 1px var(--border-strong);color:var(--text-2)}
.history-action.more:hover{background:var(--history-more-bg-hover);color:var(--primary)}
.history-menu{display:none;position:absolute;top:100%;right:8px;z-index:60;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 24px rgba(28,27,25,0.10);padding:4px;min-width:110px}
.history-menu.open{display:block}
.history-menu-item{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:7px;font-size:12.5px;color:var(--text);cursor:pointer;white-space:nowrap}
.history-menu-item:hover{background:var(--primary-light);color:var(--primary)}
.history-menu-item.danger:hover{background:rgba(185,28,28,.08);color:var(--red)}
.history-item.pinned{background:var(--primary-light)}
.history-item.pinned:hover{background:var(--primary-light)}
.history-item.pinned.active{background:var(--primary-light)}
.history-empty{padding:24px 16px;text-align:center;color:var(--text-3);font-size:13px}
.sidebar-footer{padding:10px 12px;border-top:1px solid var(--border);display:flex;align-items:center;gap:4px}
.user-area{display:flex;align-items:center;gap:8px;flex:1;cursor:pointer;padding:4px 6px;border-radius:7px;transition:background var(--tr);min-width:0}
.user-area:hover{background:var(--surface-2)}
.user-avatar{width:34px;height:34px;border-radius:50%;background:var(--brand-grad);color:#fff;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;flex-shrink:0}
.user-name{font-size:13px;font-weight:500;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.icon-btn{width:32px;height:32px;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--text-3);transition:all var(--tr);flex-shrink:0;-webkit-appearance:none;appearance:none}
.icon-btn:hover{background:var(--surface-2);color:var(--text)}
.icon-btn.active{background:var(--primary);color:#fff;border-radius:50%}
.user-panel{position:fixed;z-index:60;animation:slideUp .15s ease}
@keyframes slideUp{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
.user-panel-inner{background:var(--bg);border:1.5px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-lg);overflow:hidden}
.user-panel-profile{display:flex;align-items:center;gap:12px;padding:14px 16px 12px}
.user-avatar-lg{width:44px;height:44px;border-radius:50%;background:var(--brand-grad);color:#fff;display:flex;align-items:center;justify-content:center;font-size:17px;font-weight:700;flex-shrink:0}
.user-panel-name{font-size:14px;font-weight:600;color:var(--text)}
.user-panel-sub{font-size:12px;color:var(--text-3);margin-top:1px}
.panel-divider{height:1px;background:var(--border)}
.panel-section{padding:10px 16px 12px}
.panel-label{font-size:11.5px;color:var(--text-3);margin-bottom:6px;font-weight:600;letter-spacing:.3px;text-transform:uppercase}
.panel-key-row{display:flex;gap:6px}
.panel-key-input{flex:1;background:var(--surface);border:1.5px solid var(--border-strong);border-radius:7px;padding:7px 10px;font-size:13px;color:var(--text);outline:none;min-width:0}
.panel-key-input:focus{border-color:var(--primary)}
.panel-save-btn{padding:7px 14px;border-radius:7px;background:var(--primary);color:#fff;font-size:13px;white-space:nowrap;transition:background var(--tr)}
.panel-save-btn:hover{background:var(--primary-hover)}
.panel-key-hint{font-size:12px;margin-top:6px;color:var(--primary);display:flex;align-items:center;justify-content:space-between;gap:8px}
.panel-key-unbind{font-size:11.5px;color:var(--text-3);flex-shrink:0;transition:color var(--tr)}
.panel-key-unbind:hover{color:var(--red)}
.panel-menu-item{display:flex;align-items:center;gap:10px;padding:10px 16px;font-size:13.5px;cursor:pointer;color:var(--text-2);transition:background var(--tr)}
.panel-menu-item:hover{background:var(--surface-2)}
.panel-menu-item.danger{color:var(--red)}
.panel-menu-item.danger:hover{background:rgba(185,28,28,.06)}
.panel-version{padding:8px 16px 10px;font-size:11.5px;color:var(--text-3);text-align:center}
.content-col{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden; background:var(--bg);transition:background var(--tr)}
.content-col:has(.grp-wrap){background:var(--grp-bg)}
.content-row{flex:1;display:flex;min-height:0;overflow:hidden;background-color:inherit}
.main{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden;position:relative;background-color:inherit}
.suggest-bar{position:relative;display:flex;flex-direction:column;gap:6px;margin-bottom:10px;padding:10px 34px 10px 12px;background:var(--surface);border:1px solid var(--border);border-radius:10px}
.suggest-bar-close{position:absolute;top:6px;right:6px;width:22px;height:22px;display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:transparent;color:var(--text-3);font-size:16px;line-height:1;cursor:pointer;transition:all var(--tr)}
.suggest-bar-close:hover{background:var(--border);color:var(--text)}
.suggest-bar-btn{text-align:left;padding:8px 12px;border:1px solid var(--border-strong);border-radius:7px;background:var(--bg);color:var(--text);font-size:13px;cursor:pointer;transition:all var(--tr)}
.suggest-bar-btn:hover{background:var(--primary);border-color:var(--primary);color:#fff}
.suggest-btn:hover{background:var(--primary);border-color:var(--primary);color:#fff}
.chat-header{display:flex;align-items:center;justify-content:space-between;padding:5px 20px;background-color:inherit;min-height:40px;flex-shrink:0;position:relative;border-bottom:1px solid var(--border)}
.header-left,.header-right{display:flex;align-items:center;gap:6px}
.content-col:has(.welcome) .header-right{display:none}
.content-col:has(.welcome) .chat-header{border-bottom:none}
.header-icons{display:flex;align-items:center;gap:6px}
.filelib-tabs-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:22px}
.chat-header.filelib-mode{min-height:0;padding-top:0;padding-bottom:0;border-bottom:none}
.hamburger{display:none}
.model-selector-wrap{position:relative}
.model-selector{display:flex;align-items:center;gap:6px;padding:4px 10px 4px 6px;border-radius:7px;border:1.5px solid var(--primary);background:var(--primary-light);color:var(--primary);font-size:12px;font-weight:500;cursor:pointer;transition:all var(--tr);user-select:none;flex:none;white-space:nowrap}
.model-dropdown-group-label{padding:8px 14px 4px;font-size:11px;font-weight:600;color:var(--text-3);letter-spacing:.3px}
.model-dropdown-group-label:first-child{padding-top:10px}
.model-selector:hover{border-color:var(--primary);color:var(--primary)}
.provider-toggle{display:flex;align-items:center;gap:5px;padding:5px 11px;border-radius:7px;border:1px solid var(--border-strong);background:var(--surface);font-size:12px;font-weight:600;color:var(--text-2);cursor:pointer;transition:all var(--tr);letter-spacing:.2px;user-select:none}
.provider-toggle:hover{border-color:var(--primary);color:var(--primary)}
.provider-toggle.groq{border-color:#f55036;color:#f55036;background:rgba(245,80,54,.09)}
.provider-toggle.groq:hover{border-color:#d44028}
.messages-area{flex:1;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column; --tail-base:calc(var(--composer-h,118px) + 12px); padding:12px 24px var(--tail-gap,var(--tail-base))}
.messages-inner{max-width:800px;margin:0 auto;display:flex;flex-direction:column;gap:0;width:100%}
.messages-inner:has(.filelib-wrap){max-width:100%}
.messages-inner:has(.welcome){flex:1;justify-content:center}
.welcome{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px 20px}
.welcome-title{font-size:26px;font-weight:700;color:var(--text);margin-bottom:10px}
.msg{display:flex;gap:12px;padding:12px 0;position:relative}
.msg.user{flex-direction:row-reverse}
.msg-avatar{width:34px;height:34px;border-radius:50%;flex-shrink:0;margin-top:2px;background:var(--brand-grad);display:flex;align-items:center;justify-content:center;color:#fff;font-size:13px;font-weight:700}
.msg.assistant .msg-avatar{display:none}
.msg.assistant .msg-bubble{padding-left:0}
.msg-body{display:flex;flex-direction:column;gap:6px;min-width:0;max-width:82%}
.msg.user .msg-body{align-items:flex-end;max-width:72%}
.msg-bubble{padding:12px 16px;border-radius:10px;background:transparent;color:var(--text);line-height:1.75;font-size:15px;word-break:break-word;max-width:100%}
.msg-bubble table{display:block;overflow-x:auto;max-width:100%;border-collapse:collapse}
.msg-bubble pre{max-width:100%;overflow-x:auto}
.msg-bubble.instance-alt{color:var(--primary)}
.block-divider{display:flex;align-items:center;gap:10px;margin:16px 4px;color:var(--primary);font-size:12px;user-select:none}
.block-divider::before,.block-divider::after{content:'';flex:1;border-top:1px dashed currentColor;opacity:.45}
.inst-tag{display:inline-block;font-size:11px;color:var(--text-3);border:1px solid var(--border);border-radius:4px;padding:0 6px;line-height:16px;margin-bottom:4px;user-select:none}
.sys-warn{display:flex;align-items:center;gap:8px;margin:14px 4px;padding:9px 14px;border-radius:10px;font-size:12.5px;line-height:1.6}
.sys-warn.amber{background:#fffbeb;border:1px solid #fcd34d;color:#92400e}
.sys-warn.red{background:#fef2f2;border:1px solid #fca5a5;color:var(--red)}
.sys-warn .sys-warn-close{margin-left:auto;flex:none;border:none;background:none;cursor:pointer;color:inherit;font-size:15px;line-height:1;opacity:.6}
.sys-warn .sys-warn-close:hover{opacity:1}
.artifacts-badge{position:absolute;top:-3px;right:-3px;min-width:15px;height:15px;border-radius:4px;background:var(--primary);color:#fff;font-size:10px;line-height:15px;text-align:center;padding:0 3px;font-weight:600}
.artifacts-panel{flex:0 0 0;width:0;overflow:hidden;height:100%;background:var(--bg);transition:flex-basis .25s ease,width .25s ease;box-sizing:border-box}
.artifacts-panel.open{flex:0 0 296px;width:296px}
.artifacts-card{margin:12px;height:calc(100% - 24px);border:1px solid var(--border);border-radius:10px;overflow:hidden;display:flex;flex-direction:column;background:var(--bg);box-sizing:border-box}
.artifacts-head{display:flex;align-items:center;justify-content:space-between;padding:13px 16px;font-weight:700;font-size:14px;white-space:normal;flex-shrink:0}
.artifacts-list{flex:1;min-height:0;overflow-y:auto;padding:10px;white-space:normal}
.artifact-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:7px;cursor:pointer;transition:background var(--tr),border-color var(--tr);text-decoration:none;color:inherit;border:1px solid var(--border);background:var(--surface);margin-bottom:8px}
.artifact-item:hover{background:var(--bg);border-color:var(--primary)}
.artifact-icon{flex:none;width:var(--filetag-size);height:var(--filetag-size);border-radius:7px;display:flex;align-items:center;justify-content:center;font-size:var(--filetag-font);font-weight:700;color:#fff;letter-spacing:0;line-height:1}
.artifact-name{font-size:13px;word-break:break-all;line-height:1.45}
.artifact-dl-icon{flex:none;color:var(--text-2);margin-left:auto}
.artifact-item:hover .artifact-dl-icon{color:var(--primary)}
.artifact-empty{padding:34px 16px;text-align:center;color:var(--text-3);font-size:12.5px;line-height:1.8}
.filelib-wrap{width:100%;box-sizing:border-box;padding:16px 24px 32px}
.filelib-search-row{display:flex;align-items:center;gap:10px;padding:11px 16px;margin-bottom:14px;border:1px solid var(--border-strong);border-radius:7px;background:var(--surface);height:var(--search-row-h);box-sizing:border-box}
.filelib-search-row svg{flex:none;color:var(--text-3)}
.filelib-search-row input{flex:1;border:none;outline:none;background:none;font-size:14px;color:var(--text)}
.filelib-search-row input::placeholder{color:var(--text-3)}
.filelib-sub{font-size:13px;color:var(--text-3);margin-bottom:16px}
.filelib-tab.disabled{opacity:.45;cursor:not-allowed}
.filelib-tab.disabled:hover{color:var(--text-2);background:var(--surface-2)}
.filelib-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
@media(max-width:900px){
  .filelib-list{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:520px){
  .filelib-list{grid-template-columns:minmax(0,1fr)}
}
.filelib-card{display:flex;flex-direction:column;gap:10px;padding:20px;border-radius:10px;background:var(--surface);border:1px solid var(--border);text-decoration:none;color:inherit;cursor:pointer;transition:background var(--tr);min-height:160px}
.filelib-card:hover{background:var(--primary-light)}
.filelib-file-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:7px;cursor:pointer;transition:background var(--tr),border-color var(--tr);text-decoration:none;color:inherit;border:1px solid var(--border);background:var(--surface)}
.filelib-file-item:hover{background:var(--bg);border-color:var(--primary)}
.filelib-file-act{flex:none;width:28px;height:28px;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--text-3);background:none;transition:all var(--tr);text-decoration:none}
.filelib-file-act:hover{background:var(--primary-light);color:var(--primary)}
.filelib-file-act.danger:hover{background:rgba(185,28,28,.08);color:var(--red)}
.filelib-file-icon{flex:none;width:var(--filetag-size);height:var(--filetag-size);border-radius:7px;display:flex;align-items:center;justify-content:center;font-size:var(--filetag-font);font-weight:700;color:#fff;letter-spacing:0;line-height:1}
.filelib-file-meta{flex:1;min-width:0}
.filelib-file-name{font-size:13px;word-break:break-all;line-height:1.45;color:var(--text)}
.filelib-file-date{font-size:11px;color:var(--text-3);margin-top:2px}
.filelib-file-dl-icon{flex:none;color:var(--text-2);transition:color var(--tr)}
.filelib-file-item:hover .filelib-file-dl-icon{color:var(--primary)}
.notes-wrap{width:100%;box-sizing:border-box;padding:16px 24px 32px}
.messages-inner:has(.notes-wrap){max-width:100%}
.notes-quota{margin-bottom:16px}
.notes-quota-bar{height:4px;border-radius:999px;background:var(--surface-2);overflow:hidden;margin-bottom:6px}
.notes-quota-bar span{display:block;height:100%;border-radius:999px;transition:width var(--tr)}
.notes-quota-text{font-size:12px;color:var(--text-3)}
.notes-quota-text.full{color:var(--red)}
.notes-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
@media(max-width:900px){
  .notes-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:520px){
  .notes-grid{grid-template-columns:minmax(0,1fr)}
}
.note-card{display:flex;flex-direction:column;gap:6px;min-width:0;padding:14px;border:1px solid var(--border);border-radius:10px;background:var(--surface);transition:background var(--tr),border-color var(--tr)}
.note-card:hover{background:var(--bg);border-color:var(--primary)}
.note-card-head{display:flex;align-items:center;gap:8px}
.note-card-title{flex:1;min-width:0;font-size:14px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.note-card-date{flex:none;font-size:11.5px;color:var(--text-3)}
.note-card-body{font-size:12.5px;line-height:1.6;color:var(--text-3);display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;height:80px;white-space:pre-wrap;word-break:break-word}
.note-card-acts{display:flex;gap:4px;justify-content:flex-end}
.note-act{width:28px;height:28px;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--text-3);transition:all var(--tr)}
.note-act:hover{background:var(--primary-light);color:var(--primary)}
.note-act.danger:hover{background:rgba(185,28,28,.08);color:var(--red)}
.notes-empty{padding:44px 0;text-align:center;font-size:13px;line-height:1.9;color:var(--text-3)}
.notes-wrap .filelib-search-row,.notes-wrap .filelib-tab:not(.active),.notes-wrap .note-card,.notes-wrap .notes-quota-bar{background:var(--notes-fill)}
.notes-wrap .note-card:hover,.notes-wrap .filelib-tab:not(.active):hover{background:var(--notes-fill-hover)}
.note-pad{position:fixed;right:0;bottom:0;width:420px;z-index:850;display:none;flex-direction:column;background:var(--bg);border:1px solid var(--border);border-right:none;border-bottom:none;border-radius:10px 0 0 0;box-shadow:var(--shadow-lg);overflow:hidden}
.note-pad.open{display:flex}
.note-pad-head{display:flex;align-items:center;gap:8px;padding:10px 10px 10px 12px;cursor:pointer;background:var(--surface-2);user-select:none}
.note-pad-arrow{flex:none;color:var(--text-3);transition:transform var(--tr)}
.note-pad.collapsed .note-pad-arrow{transform:rotate(180deg)}
.note-pad-title{flex:1;min-width:0;font-size:13.5px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.note-pad-label{display:none;flex:1;font-size:13px;font-weight:600;color:var(--text-2)}
.note-pad.collapsed .note-pad-title{display:none}
.note-pad.collapsed .note-pad-label{display:block}
.note-pad.collapsed{width:180px !important}
.note-pad.collapsed .note-pad-head{background:var(--bg)}
.note-pad.collapsed .note-pad-grip{display:none}
.note-pad-dirty{flex:none;width:7px;height:7px;border-radius:50%;background:var(--primary);display:none}
.note-pad-dirty.show{display:block}
.note-pad-body{display:flex;flex-direction:column;padding:10px 12px 12px}
.note-pad.collapsed .note-pad-body{display:none}
.note-pad-name{width:100%;padding:7px 10px;border:1px solid var(--border-strong);border-radius:7px;background:var(--surface);color:var(--text);font-size:13px;font-weight:600;box-sizing:border-box;margin-bottom:8px}
.note-pad-text{width:100%;height:46vh;min-height:180px;max-height:62vh;overflow-y:auto;padding:10px 12px;border:1px solid var(--border-strong);border-radius:10px;background:var(--bg);color:var(--text);font-size:13.5px;line-height:1.7;font-family:inherit;box-sizing:border-box;margin-bottom:8px}
.note-pad-text:empty:before{content:attr(data-placeholder);color:var(--text-3)}
.note-pad-toolbar{margin-bottom:8px}
.note-pad-text:focus,.note-pad-name:focus{outline:2px solid var(--primary);outline-offset:-2px}
.note-pad-foot{display:flex;align-items:center;gap:8px}
.note-pad-meta{flex:1;min-width:0;font-size:11.5px;color:var(--text-3)}
.note-pad-grip{position:absolute;left:0;top:0;width:16px;height:16px;cursor:nwse-resize;z-index:2}
.note-pad-grip::before{content:'';position:absolute;left:5px;top:5px;width:7px;height:7px;border-left:2px solid var(--text-3);border-top:2px solid var(--text-3);border-radius:2px 0 0 0;opacity:.6}
.note-pad-grip:hover::before{opacity:1;border-color:var(--primary)}
@media(max-width:520px){
  .note-pad{left:0;right:0;width:auto;border-left:none;border-radius:0}
  .note-pad-grip{display:none}
}
.skills-wrap{width:100%;box-sizing:border-box;padding:16px 24px 32px}
.messages-inner:has(.skills-wrap){max-width:100%}
.messages-inner:has(.grp-wrap){max-width:100%}
.skills-topbar{display:flex;align-items:center;gap:10px;margin-bottom:14px}
.skills-search{flex:1;min-width:0;display:flex;align-items:center;gap:10px;height:var(--search-row-h);padding:0 16px;border:1px solid var(--border-strong);border-radius:7px;background:var(--surface)}
.skills-search svg{flex:none;color:var(--text-3)}
.skills-search input{flex:1;min-width:0;border:none;outline:none;background:none;font-size:14px;color:var(--text)}
.skills-search input::placeholder{color:var(--text-3)}
.skills-topbtn{display:flex;align-items:center;gap:6px;flex:none;height:var(--search-row-h);padding:0 16px;border:1px solid var(--border-strong);border-radius:7px;background:var(--surface);font-size:13.5px;color:var(--text-2);transition:all var(--tr)}
.skills-topbtn:hover{border-color:var(--primary);color:var(--primary)}
.skills-topbtn.primary{background:var(--primary);border-color:var(--primary);color:#fff}
.skills-topbtn.primary:hover{background:var(--primary-hover);border-color:var(--primary-hover);color:#fff}
@media(max-width:520px){
  .skills-topbar{flex-wrap:wrap;gap:8px}
  .skills-search{flex:1 1 100%}
  .skills-topbtn{flex:1 1 0;justify-content:center;padding:0 10px}
}
.skills-cats{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:22px}
.skills-cat,.filelib-tab,.office-tool-tab{padding:6px 14px;border-radius:7px;font-size:13px;color:var(--text-2);background:var(--surface-2);cursor:pointer;transition:all var(--tr);white-space:nowrap}
.skills-cat:hover,.filelib-tab:hover,.office-tool-tab:hover{color:var(--text)}
.skills-cat.active,.filelib-tab.active,.office-tool-tab.active{background:var(--primary-light);color:var(--primary);font-weight:600}
.skills-section{font-size:13px;color:var(--text-3);margin-bottom:12px}
.skills-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}
@media(max-width:900px){
  .skills-grid{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:520px){
  .skills-grid{grid-template-columns:1fr}
}
.skill-card{display:flex;align-items:flex-start;gap:12px;padding:14px;border:1px solid var(--border);border-radius:10px;background:var(--surface);transition:background var(--tr),border-color var(--tr)}
.skill-card:hover{background:var(--bg);border-color:var(--primary)}
.skill-icon{flex:none;width:38px;height:38px;border-radius:7px;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;color:#fff;letter-spacing:.3px}
.skill-body{flex:1;min-width:0}
.skill-name-row{display:flex;align-items:center;gap:6px;margin-bottom:4px}
.skill-name{font-size:14px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.skill-tag{flex:none;padding:1px 6px;border-radius:4px;font-size:11px;color:var(--text-3);background:var(--primary-light)}
.skill-desc{font-size:12.5px;line-height:1.5;color:var(--text-3);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.skill-add{flex:none;width:30px;height:30px;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--text-2);background:none;transition:all var(--tr)}
.skill-add:hover{background:var(--primary-light);color:var(--primary)}
.skills-empty{padding:40px 0;text-align:center;font-size:13px;color:var(--text-3)}
.filelib-card{display:flex;flex-direction:column;gap:10px;padding:20px;border-radius:10px;background:var(--surface);border:1px solid var(--border);text-decoration:none;color:inherit;cursor:pointer;transition:background var(--tr);min-height:160px}
.filelib-card:hover{background:var(--primary-light)}
.filelib-card-head{display:flex;align-items:center;gap:6px}
.filelib-card-badge{flex:none;width:22px;height:22px;border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;color:#fff}
.filelib-card-type{font-size:12px;color:var(--text-3);font-weight:600}
.filelib-card-title{font-size:14.5px;font-weight:600;color:var(--text);line-height:1.4;word-break:break-all;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.filelib-card-preview{font-size:12px;color:var(--text-3);line-height:1.55;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;flex:1}
.center-toast{position:fixed;top:38%;left:50%;transform:translate(-50%,-50%);z-index:3000;background:rgba(28,27,25,.94);color:#fff;padding:13px 26px;border-radius:10px;font-size:14px;line-height:1.6;max-width:70vw;text-align:center;box-shadow:0 8px 24px rgba(28,27,25,0.10);opacity:0;transition:opacity .25s ease;pointer-events:none}
.center-toast.show{opacity:1}
.sb-log{margin-top:12px;border:1px solid var(--border);border-radius:10px;background:var(--surface);overflow:hidden}
.sb-log>summary{padding:10px 14px;cursor:pointer;font-size:13px;font-weight:600;list-style:none;user-select:none}
.sb-log>summary::-webkit-details-marker{display:none}
.sb-log>summary::before{content:'▸ ';color:var(--primary)}
.sb-log[open]>summary::before{content:'▾ '}
.sb-lv{padding:0 14px 8px;font-size:11.5px;color:var(--text-3)}
.sb-step{padding:10px 14px;border-top:1px solid var(--border)}
.sb-step-h{font-size:11.5px;color:var(--primary);font-weight:600;margin-bottom:6px}
.sb-code,.sb-out{margin:0 0 6px;padding:9px 11px;border-radius:7px;font-size:12px;line-height:1.55;white-space:pre-wrap;word-break:break-word;max-height:260px;overflow:auto;font-family:ui-monospace,Menlo,Consolas,monospace}
.sb-code{background:#1f2937;color:#e5e7eb}
.sb-out{background:var(--bg);border:1px solid var(--border);color:var(--text-2)}
.arch-confirm{position:fixed;z-index:3000;background:var(--bg);border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 24px rgba(28,27,25,0.10);padding:14px 16px;width:auto;min-width:280px}
.arch-confirm-text{font-size:13.5px;line-height:1.6;margin-bottom:12px;white-space:nowrap}
.arch-keep-row{display:flex;align-items:center;gap:8px;margin-bottom:0}
.arch-keep-input{width:54px;padding:6px 8px;border:1px solid var(--border-strong);border-radius:7px;font-size:14px;color:var(--text);flex-shrink:0}
.arch-keep-input:focus{outline:none;border-color:var(--primary)}
.arch-keep-label{font-size:13px;color:var(--text-2);flex-shrink:0}
.arch-keep-unit{font-size:13px;color:var(--text-2);flex-shrink:0}
.arch-keep-row .ac-no,.arch-keep-row .ac-yes{padding:6px 14px;border-radius:7px;font-size:13px;cursor:pointer;white-space:nowrap;margin-left:auto}
.arch-keep-row .ac-yes{margin-left:6px}
.ac-yes{background:var(--primary);border:1px solid var(--primary);color:#fff}
.ac-no{background:none;border:1px solid var(--border-strong);color:var(--text-2)}
.arch-confirm-link{margin-top:10px;padding-top:9px;border-top:1px dashed var(--border);font-size:12px;color:var(--primary);cursor:pointer;text-align:center}
.arch-confirm-link:hover{text-decoration:underline}
.arch-mem-row{display:flex;align-items:center;gap:8px;margin-top:9px;padding-top:9px;border-top:1px dashed var(--border)}
.arch-mem-label{font-size:13px;font-weight:600;color:var(--text-1);flex:none}
.arch-mem-hint{font-size:11px;color:var(--text-3);flex:1;line-height:1.3}
.arch-mem-btn{padding:5px 12px;border-radius:7px;border:1px solid var(--border-strong);background:none; color:var(--text-2);font-size:12px;cursor:pointer;white-space:nowrap;flex:none}
.arch-mem-btn.on{border-color:var(--primary);background:var(--primary-light);color:var(--primary)}
.chat-search-panel{position:fixed;top:56px;right:16px;width:320px;max-height:min(70vh,520px);background:var(--bg);border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 24px rgba(28,27,25,0.10);z-index:2200;display:flex;flex-direction:column;overflow:hidden}
.chat-search-head{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--border)}
.chat-search-head input{flex:1;border:none;outline:none;background:none;font-size:13.5px;color:var(--text)}
.chat-search-count{font-size:11.5px;color:var(--text-3);white-space:nowrap}
.chat-search-list{overflow-y:auto;padding:6px}
.chat-search-item{padding:9px 10px;border-radius:7px;cursor:pointer;font-size:12.5px;line-height:1.55}
.chat-search-item:hover{background:var(--surface-2)}
.chat-search-item .csi-role{font-size:11px;font-weight:700;color:var(--primary);margin-bottom:2px}
.chat-search-item mark{background:#fde68a;color:inherit;border-radius:2px;padding:0 1px}
mark.search-hit-mark{background:#fde68a;color:inherit;border-radius:2px;padding:0 1px}
.chat-search-empty{padding:26px 16px;text-align:center;color:var(--text-3);font-size:12.5px}
.msg-flash{animation:msg-flash-kf 1.6s ease}
@keyframes msg-flash-kf{0%,100%{background:transparent}20%,60%{background:rgba(14,116,144,.12)}}
.tp-drop{border:1.5px dashed var(--border-strong);border-radius:10px;padding:34px 18px;text-align:center;cursor:pointer;transition:all var(--tr)}
.tp-drop:hover,.tp-drop.drag{border-color:var(--primary);background:var(--surface-2)}
.tp-drop-icon{margin-bottom:10px;color:var(--primary)}
.tp-drop-main{font-size:14px;font-weight:600;margin-bottom:4px}
.tp-drop-sub{font-size:12px;color:var(--text-3)}
.tp-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}
.tp-btn{padding:7px 20px;border-radius:7px;font-size:13px;cursor:pointer}
.tp-btn.go{background:var(--primary);border:1px solid var(--primary);color:#fff}
.tp-btn.cancel{background:none;border:1px solid var(--border-strong);color:var(--text-2)}
.tp-btn.secondary{background:none;border:1px solid var(--primary);color:var(--primary)}
.tp-btn:disabled{opacity:.5;cursor:not-allowed}
.tp-convo-hint{font-size:12.5px;color:var(--text-2);margin-bottom:10px}
.tp-convo-list{max-height:320px;overflow-y:auto;display:flex;flex-direction:column;gap:6px}
.tp-convo-item{padding:10px 12px;border:1px solid var(--border);border-radius:7px;cursor:pointer;transition:all var(--tr);display:flex;align-items:center;gap:10px}
.tp-convo-item:hover{border-color:var(--primary);background:var(--surface-2)}
.tp-convo-item.selected{border-color:var(--primary);background:var(--primary-light)}
.tp-convo-check{width:16px;height:16px;border-radius:4px;border:1.5px solid var(--border-strong);flex-shrink:0;position:relative}
.tp-convo-item.selected .tp-convo-check{border-color:var(--primary);background:var(--primary)}
.tp-convo-item.selected .tp-convo-check::after{content:'';position:absolute;left:4px;top:1px;width:4px;height:8px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}
.tp-convo-main{flex:1;min-width:0}
.tp-convo-name{font-size:13.5px;font-weight:600;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tp-convo-meta{font-size:11.5px;color:var(--text-3)}
.arch-viewer-overlay{position:fixed;inset:0;z-index:2500;background:rgba(28,27,25,.35);display:flex;align-items:center;justify-content:center}
.arch-viewer{width:min(680px,92vw);max-height:80vh;background:var(--bg);border-radius:10px;border:1px solid var(--border);display:flex;flex-direction:column;box-shadow:0 8px 24px rgba(28,27,25,0.10)}
.arch-viewer-head{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);font-weight:700;font-size:14.5px}
.arch-viewer-note{padding:9px 18px;font-size:12px;color:var(--text-3);border-bottom:1px solid var(--border)}
.arch-viewer-list{flex:1;overflow-y:auto;padding:12px 18px}
.arch-round{padding:11px 0;border-bottom:1px dashed var(--border)}
.arch-round:last-child{border-bottom:none}
.arch-round-time{font-size:11px;color:var(--text-3);margin-bottom:5px}
.arch-round-u{font-size:13px;font-weight:600;margin-bottom:5px;white-space:pre-wrap;word-break:break-word}
.arch-round-a{font-size:13px;color:var(--text-2);white-space:pre-wrap;word-break:break-word}
.sess-search-overlay{position:fixed;inset:0;z-index:2500;background:rgba(28,27,25,.35);display:flex;align-items:flex-start;justify-content:center;padding-top:12vh}
.sess-search-modal{width:min(640px,92vw);max-height:70vh;background:var(--bg);border:1px solid var(--border);border-radius:10px;display:flex;flex-direction:column;box-shadow:var(--shadow-lg);overflow:hidden}
.sess-search-head{display:flex;align-items:center;gap:8px;padding:14px}
.sess-search-box{flex:1;min-width:0;display:flex;align-items:center;gap:10px;height:var(--search-row-h);padding:0 14px;border:1px solid var(--border-strong);border-radius:7px;background:var(--surface)}
.sess-search-box svg{flex:none;color:var(--text-3)}
.sess-search-head input{flex:1;min-width:0;border:none;outline:none;background:none;font-size:14px;color:var(--text)}
.sess-search-head input::placeholder{color:var(--text-3)}
.sess-search-list{flex:1;overflow-y:auto;padding:0 8px 10px}
.sess-search-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:7px;cursor:pointer;font-size:13.5px;color:var(--text-2);transition:background var(--tr),color var(--tr)}
.sess-search-item:hover{background:var(--primary-light);color:var(--text)}
.sess-search-item mark{background:var(--primary-light);color:var(--primary);font-weight:600;border-radius:4px;padding:0 2px}
.sess-search-icon{width:18px;height:18px;flex-shrink:0;background:var(--text-3);transition:background var(--tr);-webkit-mask:var(--chat-bubble-icon) center/contain no-repeat;mask:var(--chat-bubble-icon) center/contain no-repeat}
.sess-search-item:hover .sess-search-icon{background:var(--text-2)}
.sess-search-item-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sess-search-item-date{flex-shrink:0;font-size:11.5px;color:var(--text-3)}
.sess-search-item:hover .sess-search-item-date{color:var(--text-2)}
#archiveBtn{color:var(--text);position:relative}
#archMemDot{position:absolute;top:3px;right:3px;width:6px;height:6px;border-radius:50%; background:var(--primary);animation:arch-pulse 1.6s ease infinite;display:none}
#archiveBtn.mem-on #archMemDot{display:block}
#archiveBtn.arch-blue{color:var(--primary)}
#archiveBtn.arch-red{color:var(--red);animation:arch-pulse 1.6s ease infinite}
@keyframes arch-pulse{0%,100%{opacity:1}50%{opacity:.45}}
.warn-act{margin:0 4px;padding:3px 12px;border:1px solid currentColor;border-radius:7px;background:none;color:inherit;font-size:12px;font-weight:600;cursor:pointer}
.warn-act:hover{background:var(--red);border-color:var(--red);color:#fff}
.msg-body:has(.gen-file-card){width:100%}
.gen-file-card{display:flex;align-items:center;gap:12px;width:100%;margin-top:10px;padding:12px 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface);text-decoration:none;color:inherit;transition:all var(--tr);box-sizing:border-box}
.gen-file-card:hover{border-color:var(--primary);box-shadow:0 1px 2px rgba(28,27,25,0.04)}
.gen-file-icon{flex:none;width:var(--filetag-size);height:var(--filetag-size);border-radius:7px;display:flex;align-items:center;justify-content:center;font-size:var(--filetag-font);font-weight:700;color:#fff;letter-spacing:0;line-height:1}
.gen-file-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.gen-file-name{font-size:13.5px;font-weight:600;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gen-file-stamp{flex:none;font-size:12px;color:var(--text-3);font-variant-numeric:tabular-nums;line-height:1.35}
.gen-file-stamp:empty{display:none}
.gen-file-type{display:none}
.gen-file-dl{flex:none;padding:6px 16px;border:1px solid var(--border-strong);border-radius:7px;font-size:12.5px;font-weight:600;color:var(--text-2);text-decoration:none;white-space:nowrap;transition:all var(--tr)}
.filelib-list .gen-file-card{margin-top:0}
.artifacts-list .gen-file-card{margin-top:0;margin-bottom:8px}
.gen-file-card:hover .gen-file-dl{background:var(--primary);border-color:var(--primary);color:#fff}
.gen-file-dlicon{flex:none;width:30px;height:30px;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--text-3);background:none;text-decoration:none;transition:all var(--tr)}
.gen-file-dlicon:hover,.gen-file-card:hover .gen-file-dlicon{background:var(--primary-light);color:var(--primary)}
.gen-file-card .filelib-file-act{width:30px;height:30px;border-radius:7px}
.msg.user .msg-bubble{background:var(--user-bubble);border-radius:10px}
.msg-time{display: none;}
.msg-files{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:4px;justify-content:flex-end}
.msg.assistant .msg-files{justify-content:flex-start}
.msg-file-chip{display:flex;align-items:center;gap:6px;padding:5px 10px;border-radius:7px;background:var(--surface);border:1px solid var(--border);font-size:12px;color:var(--text-2)}
.msg-img{max-width:240px;max-height:200px;border-radius:10px;display:block;cursor:zoom-in;border:1px solid var(--border)}
.msg-actions{display:flex;gap:2px;opacity:0;transition:opacity var(--tr);margin-top:2px}
.msg:hover .msg-actions{opacity:1}
.msg.editing .msg-actions{opacity:1}
.action-btn{width:28px;height:28px;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--text-3);font-size:13px;transition:all var(--tr)}
.action-btn:hover{background:var(--surface-2);color:var(--text-2)}
.action-btn.favorited{color:#f59e0b}
.action-btn.fb-done{color:var(--red)}
.fb-card{width:100%;max-width:520px;background:var(--surface);border:1.5px solid var(--border);border-radius:10px;box-shadow:var(--shadow-lg);padding:20px}
.fb-title{font-size:15px;font-weight:600;color:var(--text);margin-bottom:4px}
.fb-sub{font-size:12.5px;color:var(--text-3);line-height:1.6;margin-bottom:14px}
.fb-tags{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:12px}
.fb-tag{padding:5px 12px;border-radius:7px;border:1.5px solid var(--border-strong);background:transparent;color:var(--text-2);cursor:pointer;font-size:12.5px;transition:all var(--tr)}
.fb-tag.on{background:var(--primary);color:#fff;border-color:var(--primary)}
.fb-textarea{width:100%;min-height:110px;max-height:260px;padding:10px 12px;border-radius:7px;border:1px solid var(--border-strong);background:var(--bg);color:var(--text);resize:vertical;outline:none;font-size:14px;line-height:1.6;font-family:inherit}
.fb-textarea:focus{border-color:var(--primary)}
.fb-actions{display:flex;gap:10px;margin-top:14px}
.edit-textarea{width:100%;min-height:100px;max-height:240px;padding:10px 12px;border-radius:7px;border:1px solid var(--border-strong);background:var(--surface);color:var(--text);resize:none;outline:none;font-size:15px;line-height:1.6}
.edit-actions{justify-content:flex-end;gap:6px;margin-top:8px}
.cursor{display:inline-block;width:2px;height:1em;background:var(--primary);margin-left:2px;vertical-align:text-bottom;animation:blink .7s steps(1) infinite}
@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}
.md p{margin:0 0 10px}
.md p:last-child{margin-bottom:0}
.md ul,.md ol{margin:8px 0;padding-left:22px}
.md li{margin-bottom:4px}
.md h1,.md h2,.md h3,.md h4{margin:16px 0 8px;font-weight:600;line-height:1.3}
.md h1{font-size:1.4em}
.md h2{font-size:1.2em}
.md h3{font-size:1.05em}
.md blockquote{margin:10px 0;padding:10px 14px;border-left:3px solid var(--primary);background:var(--primary-light);border-radius:0 8px 8px 0;color:var(--text-2)}
.md table{border-collapse:collapse;width:100%;margin:12px 0;font-size:14px}
.md th,.md td{border:1px solid var(--border);padding:8px 12px;text-align:left}
.md th{background:var(--surface);font-weight:600}
.md hr{border:none;border-top:1px solid var(--border);margin:16px 0}
.md code{font-family:'Fira Code','Cascadia Code','Consolas',monospace;font-size:.88em;background:var(--primary-light);color:var(--primary);padding:2px 6px;border-radius:4px}
.code-block{background:#1e1e2e;border-radius:10px;margin:12px 0;overflow:hidden;box-shadow:var(--shadow-sm)}
.code-header{display:flex;align-items:center;justify-content:space-between;padding:8px 14px;background:rgba(255,255,255,.05);font-size:12px;color:#9ca3af;border-bottom:1px solid rgba(255,255,255,.06)}
.copy-code-btn{padding:2px 10px;border-radius:4px;border:1px solid rgba(255,255,255,.1);color:#9ca3af;font-size:11px;cursor:pointer;background:transparent;transition:all .15s}
.copy-code-btn:hover{color:#fff;background:rgba(255,255,255,.1)}
.code-block pre{margin:0}
.code-block pre code{background:none!important;padding:14px 16px;display:block;overflow-x:auto;font-size:13.5px;line-height:1.6;font-family:'Fira Code','Cascadia Code','Consolas',monospace}
.code-block pre code{color:#e6e6ef;border-radius:0;white-space:pre}
.code-header span{font-family:'Fira Code','Cascadia Code','Consolas',monospace}
.copy-code-btn{white-space:nowrap}
.code-block pre code::-webkit-scrollbar{height:10px}
.code-block pre code::-webkit-scrollbar-thumb{background:#6b7280;border-radius:5px}
.code-block pre code::-webkit-scrollbar-track{background:rgba(255,255,255,.06)}
@supports (scrollbar-color:auto){
  .code-block pre code{scrollbar-width:thin;scrollbar-color:#6b7280 rgba(255,255,255,.06)}
}
.typing{display:inline-flex;gap:5px;padding:4px 0;align-items:center}
.typing span{width:7px;height:7px;border-radius:50%;background:var(--text-3);animation:dot 1.2s infinite}
.typing span:nth-child(2){animation-delay:.2s}
.typing span:nth-child(3){animation-delay:.4s}
@keyframes dot{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}
.input-section{position:absolute;left:0;right:var(--sb-w,0px);bottom:0;z-index:20; padding:0 12px 8px;background-color:inherit}
:root{--composer-w:100%}
.input-inner{max-width:var(--composer-w);margin:0 auto}
.file-strip{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
.file-chip{display:flex;align-items:center;gap:6px;padding:5px 8px 5px 10px;border-radius:7px;background:var(--surface);border:1px solid var(--border);font-size:12.5px;color:var(--text-2);max-width:200px}
.file-chip.uploading{opacity:.75}
.file-chip .chip-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}
.file-chip .chip-status{font-size:10.5px;color:var(--primary);flex-shrink:0}
.file-chip .chip-rm{width:16px;height:16px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:var(--text-3);flex-shrink:0;transition:all var(--tr);font-size:11px}
.file-chip .chip-rm:hover{background:rgba(185,28,28,.08);color:var(--red)}
.chip-img-preview{width:32px;height:32px;border-radius:4px;object-fit:cover;flex-shrink:0}
.chip-ext{width:28px;height:28px;border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;flex-shrink:0;text-transform:uppercase}
.chip-ext.img{background:var(--primary-light);color:var(--primary)}
.chip-ext.doc{background:#dcfce7;color:#16a34a}
.chip-ext.code{background:#f3e8ff;color:#7c3aed}
.chip-ext.other{background:var(--surface);color:var(--text-3);border:1px solid var(--border)}
.chip-spinner{width:14px;height:14px;border-radius:50%;border:2px solid var(--border);border-top-color:var(--primary);flex-shrink:0;animation:chipspin .7s linear infinite}
@keyframes chipspin{to{transform:rotate(360deg)}}
.input-box{background:var(--bg);border:1.5px solid var(--border-strong);border-radius:10px;padding:10px 12px 8px;box-shadow:var(--shadow);transition:border-color var(--tr); display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.input-box:focus-within,.input-box.has-content{border-color:var(--primary)}
.attach-btn{width:28px;height:28px;border-radius:7px;flex-shrink:0;display:flex;align-items:center;justify-content:center;color:var(--text-2);border:1.5px solid transparent;background:transparent;transition:all var(--tr)}
.attach-btn:hover{border-color:var(--border);color:var(--text)}
.attach-btn.on{background:var(--primary);border-color:var(--primary);color:#fff}
#fileInput{display:none}
#textarea{order:1;flex:0 0 100%;min-width:0;background:none;border:none;outline:none;font-size:15px;color:var(--text);line-height:1.6;max-height:180px;min-height:40px;padding:2px 0;overflow-y:auto}
#textarea::placeholder{color:var(--text-3)}
.send-btn{order:4;width:34px;height:34px;border-radius:7px;flex-shrink:0;margin-left:auto;display:flex;align-items:center;justify-content:center;background:var(--primary);color:#fff;transition:all var(--tr)}
.send-btn:hover{background:var(--primary-hover);transform:scale(1.05)}
.send-btn:disabled{background:var(--border);color:var(--text-3);transform:none;cursor:not-allowed}
.send-btn.stop{background:var(--red)}
.send-btn.stop:hover{background:var(--red)}
.input-footer{order:3;flex:1 1 auto;min-width:0;display:flex;align-items:center;justify-content:flex-start;gap:4px;flex-wrap:wrap}
.feature-btn{display:flex;align-items:center;gap:4px;padding:4px 9px;border-radius:7px;border:1.5px solid transparent;font-size:12px;color:var(--text-2);background:transparent;transition:all var(--tr);flex:none;white-space:nowrap}
.feature-btn.disabled{opacity:.4;cursor:not-allowed;pointer-events:none}
.feature-btn:hover{border-color:var(--border);color:var(--text)}
.feature-btn.active{border-color:var(--primary);color:#fff;background:var(--primary)}
.feature-btn.active:hover{border-color:var(--primary);color:#fff;background:var(--primary)}
.agent-banner{margin:0 0 8px;padding:8px 12px;border-radius:10px;font-size:12px;line-height:1.5; background:var(--hover);color:var(--text-2);border:1px solid var(--border)}
.feature-btn.agent-follow{opacity:.55;cursor:not-allowed;pointer-events:auto}
.feature-btn.agent-follow:hover{background:inherit}
.feature-btn.feature-disabled{opacity:.4;cursor:not-allowed}
.feature-btn.feature-disabled:hover{border-color:transparent;color:var(--text-2);background:transparent}
.disclaimer-side{position:absolute;right:6px;bottom:100%;writing-mode:vertical-rl; font-size:10px;color:var(--text-3);letter-spacing:1px;line-height:1.5; padding-bottom:4px;pointer-events:none;user-select:none;white-space:nowrap}
.drag-overlay{display:none;position:fixed;inset:0;background:rgba(14,116,144,.08);border:2px dashed var(--primary);z-index:100;align-items:center;justify-content:center;font-size:20px;color:var(--primary);font-weight:600;pointer-events:none}
.drag-overlay.visible{display:flex}
.model-dropdown{position:absolute;bottom:calc(100% + 6px);top:auto;left:0;background:var(--bg);border:1.5px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-lg);min-width:200px;z-index:50;overflow:hidden;animation:fadeIn .12s ease}
.model-option{display:flex;align-items:center;gap:10px;padding:5px 14px;font-size:13.5px;cursor:pointer;transition:background var(--tr)}
.model-option:hover{background:var(--surface-2)}
.model-option.selected{color:var(--primary)}
.model-btn.model-unavailable,.model-label.model-unavailable,#modelLabel.model-unavailable,#grpModelLabel.model-unavailable{color:var(--text-3);text-decoration:line-through;text-decoration-thickness:1px}
.model-option.dim{opacity:.45;cursor:not-allowed}
.model-option.dim:hover{background:transparent}
.model-group-note{padding:2px 14px 8px;font-size:11.5px;color:var(--text-3);line-height:1.6}
.model-option-name{font-weight:500;white-space:nowrap}
.model-option-desc{font-size:11.5px;color:var(--text-3);margin-top:1px}
.model-tag{flex:none;font-size:10.5px;line-height:16px;padding:0 6px;border-radius:4px; background:var(--surface);color:var(--text-3);border:1px solid var(--border)}
.model-option.selected .model-tag{color:var(--primary);border-color:var(--primary)}
.model-tag.local{color:var(--text-2);border-color:var(--text-3)}
.model-check{margin-left:auto;color:var(--primary)}
.model-option.offline{color:var(--text-3)}
.model-picker-card{max-width:760px}
.model-picker-body{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:4px 12px;align-content:start}
.model-picker-group{min-width:0}
.model-picker-body .model-dropdown-group-label{padding:8px 14px 4px}
.model-picker-body .model-option{border-radius:7px}
.model-picker-body .model-option.selected{background:var(--primary-light)}
.model-picker-group.no-key .model-dropdown-group-label{color:var(--text-3)}
.model-picker-group.no-key .model-dropdown-group-label::after{content:' · 未绑定 Key';font-weight:400}
.attach-wrap{order:2;position:relative;display:flex;flex:none}
.attach-dropdown{position:absolute;bottom:calc(100% + 6px);left:0;background:var(--bg);border:1.5px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-lg);min-width:190px;z-index:50;overflow:hidden;animation:fadeIn .12s ease}
.attach-option{display:flex;align-items:center;gap:10px;padding:10px 14px;font-size:13.5px;cursor:pointer;transition:background var(--tr)}
.attach-option:hover{background:var(--surface-2)}
.attach-option svg{flex-shrink:0;color:var(--text-3)}
.attach-option-name{font-weight:500}
.attach-option-desc{font-size:11px;color:var(--text-3)}
@keyframes fadeIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:768px){
  .sidebar{position:fixed;left:0;top:0;bottom:0;z-index:40;transform:translateX(-100%);transition:transform .2s ease}
  .sidebar.open{transform:translateX(0)}
  .overlay{display:none;position:fixed;inset:0;background:rgba(28,27,25,.4);z-index:30}
  .overlay.visible{display:block}
  .hamburger{display:flex}
  .messages-area{padding:12px 14px var(--tail-gap,var(--tail-base))}
  .input-section{padding:0 7px 14px 14px}
  .disclaimer-side{display:none}
  .chat-header{padding:8px 8px}
  .msg-body{max-width:90%}
  .msg.user .msg-body{max-width:85%}
  .history-actions{display:none}
  .history-item,.history-item *{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
  .history-item{-webkit-tap-highlight-color:transparent}
  .history-item.lp-hold{background:var(--primary-light)}
  .history-menu{position:fixed;left:auto;right:auto;top:auto;bottom:auto;min-width:150px}
  .input-box{align-items:flex-end}
  .attach-wrap{order:1}
  .input-footer{order:2;flex:1 1 0;min-width:0;flex-wrap:nowrap;overflow-x:auto; padding-bottom:2px;-webkit-overflow-scrolling:touch}
  .input-box::after{content:'';order:3;flex:0 0 100%;height:0;margin-top:-6px}
  #textarea{order:4;flex:1 1 auto;min-width:0;min-height:34px}
  .send-btn{order:5;margin-left:0}
  .input-footer::-webkit-scrollbar{height:0;display:none}
  @supports (-moz-appearance:none){
    .input-footer{scrollbar-width:none}
  }
  .input-footer>*{flex:none}
  .input-footer .grp-model-bar{flex-wrap:nowrap}
  .model-dropdown{position:fixed;left:14px;right:14px;top:auto; bottom:calc(var(--composer-h,118px) + 6px); min-width:0;max-height:min(50vh,340px);overflow-y:auto;overflow-x:hidden}
}
.auth-overlay{position:fixed;inset:0;background:var(--bg);z-index:1000;display:flex;align-items:center;justify-content:center;padding:20px}
.dlg-overlay{position:fixed;inset:0;background:rgba(28,27,25,.35);z-index:1200; display:none;align-items:center;justify-content:center;padding:20px}
.dlg-overlay.open{display:flex}
.dlg-card{width:100%;max-width:400px;background:var(--surface);border:1.5px solid var(--border); border-radius:10px;box-shadow:var(--shadow-lg);overflow:hidden}
.dlg-body{padding:22px 22px 18px;display:flex;gap:13px;align-items:flex-start}
.dlg-icon{width:34px;height:34px;border-radius:50%;flex:none;display:flex; align-items:center;justify-content:center;font-size:17px}
.dlg-icon.warn{background:#fef3c7;color:#b45309}
.dlg-icon.err{background:#fee2e2;color:var(--red)}
.dlg-icon.info{background:var(--primary-light);color:var(--primary)}
.dlg-text{flex:1;min-width:0;padding-top:3px}
.dlg-title{font-size:14.5px;font-weight:600;margin-bottom:5px;line-height:1.45}
.dlg-msg{font-size:13px;color:var(--text-2);line-height:1.7;white-space:pre-wrap; word-break:break-word;max-height:46vh;overflow-y:auto}
.dlg-foot{display:flex;justify-content:flex-end;gap:8px;padding:0 22px 20px}
.dlg-btn{padding:8px 18px;border-radius:7px;border:none;cursor:pointer;font-size:13px; background:var(--primary);color:#fff}
.dlg-btn.ghost{background:transparent;border:1px solid var(--border-strong);color:var(--text-2)}
.kb-overlay{position:fixed;inset:0;background:rgba(28,27,25,.35);z-index:900;display:none;align-items:center;justify-content:center;padding:20px}
.kb-overlay.open{display:flex}
#kbOverlay,#dqOverlay{z-index:950}
#miniConfirmOverlay{z-index:1100}
.kb-card{width:100%;max-width:520px;max-height:80vh;display:flex;flex-direction:column;background:var(--surface);border:1.5px solid var(--border);border-radius:10px;box-shadow:var(--shadow-lg);overflow:hidden}
.settings-card{width:100%;max-width:800px;height:82vh;display:flex;background:var(--bg);border:1.5px solid var(--border);border-radius:10px;box-shadow:var(--shadow-lg);overflow:hidden}
.settings-nav{flex:0 0 200px;background:var(--sidebar-bg);border-right:1px solid var(--border);padding:16px 10px;overflow-y:auto}
.settings-nav-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:7px;font-size:13.5px;color:var(--text-2);cursor:pointer;transition:all var(--tr)}
.settings-nav-item:hover{background:var(--bg)}
.settings-nav-item.active{background:var(--primary-light);color:var(--primary);font-weight:600}
.settings-main{flex:1;display:flex;flex-direction:column;min-width:0}
.settings-main-head{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--border);flex:none}
.settings-main-title{font-size:16px;font-weight:700}
.settings-main-body{flex:1;overflow-y:auto;padding:22px 24px}
.settings-panel{display:none}
.settings-panel.active{display:block}
.settings-field-label{font-size:12.5px;font-weight:600;color:var(--text-2);margin-bottom:6px}
.settings-field-hint{font-size:11.5px;color:var(--text-3);margin-top:6px;line-height:1.6}
.settings-input-row{display:flex;gap:8px;margin-bottom:4px}
.agent-danger-note{font-size:12.5px;line-height:1.85;color:#92400e;background:#fffbeb;border:1px solid #fde68a;border-radius:10px;padding:12px 14px}
.agent-switch-row{display:flex;align-items:flex-start;gap:10px;font-size:13px;line-height:1.7;cursor:pointer;padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--surface)}
.agent-switch-row input{margin-top:3px;flex:none;width:16px;height:16px;cursor:pointer}
.settings-danger-btn{color:var(--red);border-color:#fecaca}
.settings-danger-btn:hover{background:#fef2f2}
.fa-status-badge{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;padding:4px 12px;border-radius:4px}
.fa-status-badge.online{background:#dcfce7;color:#16a34a}
.fa-status-badge.offline{background:#fee2e2;color:var(--red)}
.fa-status-dot{width:7px;height:7px;border-radius:50%;background:currentColor}
.mini-confirm-card{width:100%;max-width:360px;background:var(--surface);border:1.5px solid var(--border);border-radius:10px;box-shadow:var(--shadow-lg);padding:20px;text-align:center}
.mini-confirm-text{font-size:14px;line-height:1.5;color:var(--text);margin-bottom:16px}
.mini-confirm-remember{display:flex;align-items:center;gap:7px;justify-content:center;margin:12px 0 2px;font-size:12.5px;color:var(--text-2);cursor:pointer;user-select:none}
.mini-confirm-remember input{width:14px;height:14px;cursor:pointer}
.mini-confirm-actions{display:flex;gap:10px}
.mini-confirm-btn{flex:1;padding:9px 0;border-radius:7px;border:1.5px solid var(--border-strong);background:transparent;color:var(--text-2);cursor:pointer;font-size:13.5px;transition:background var(--tr)}
.mini-confirm-btn:hover{background:var(--primary-light)}
.mini-confirm-btn.primary{background:var(--primary);color:#fff;border-color:var(--primary)}
.mini-confirm-btn.primary:hover{background:var(--primary-hover)}
.kb-header{display:flex;align-items:center;justify-content:space-between;gap:4px;padding:18px 20px;border-bottom:1px solid var(--border)}
#excelToolOverlay .kb-header{padding:12px 16px}
#excelToolOverlay .office-tool-tabs{margin-right:auto}
#excelToolOverlay .kb-body{padding:12px 16px 14px;flex:1;min-height:0;display:flex;flex-direction:column}
#excelToolOverlay .office-tool-panel.active{display:flex;flex-direction:column;flex:1;min-height:0}
#excelToolOverlay .word-tool-editor{flex:1;min-height:0;max-height:none}
#excelToolOverlay .excel-tool-grid-wrap{flex:1;height:auto;min-height:120px;max-height:none}
#excelToolOverlay .excel-tool-footer{flex:none;margin-top:auto}
.kb-title{font-size:15.5px;font-weight:700}
.kb-close{width:28px;height:28px;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--text-3);font-size:18px}
.kb-close:hover{background:var(--surface-2)}
.kb-body{flex:1;overflow-y:auto;padding:16px 20px}
.excel-tool-name-input{width:100%;padding:8px 14px;border:1px solid var(--border-strong);border-radius:7px;background:var(--surface);color:var(--text);font-size:13.5px;margin-bottom:10px}
.excel-tool-name-input::placeholder{color:var(--text-3)}
.excel-tool-grid-wrap{overflow:auto;resize:both;width:100%;height:46vh;min-width:280px;min-height:160px;max-height:56vh;background:var(--bg);border:1px solid var(--border);border-radius:10px;margin-bottom:12px;box-sizing:border-box}
.excel-tool-grid{border-collapse:separate;border-spacing:0;table-layout:fixed}
.excel-tool-grid td{border:1px solid var(--border);padding:0;position:relative;box-sizing:border-box}
.excel-tool-grid textarea{display:block;width:100%;height:34px;padding:8px 10px;border:none;background:transparent;color:var(--text);font-size:13px;box-sizing:border-box;resize:none;overflow:hidden;white-space:nowrap;font-family:inherit;line-height:1.3;max-height:34px}
.excel-tool-col-resize{position:absolute;top:0;right:-3px;width:6px;height:100%;cursor:col-resize;z-index:2}
.excel-tool-col-resize:hover{background:var(--primary)}
.excel-tool-grid textarea:focus{outline:2px solid var(--primary);outline-offset:-2px}
.excel-tool-grid tr:first-child textarea{font-weight:700;background:var(--surface)}
.excel-tool-actions{display:flex;gap:8px;margin-bottom:14px}
.excel-tool-actions .mini-confirm-btn{flex:none;padding:7px 14px}
.excel-tool-hint{font-size:12.5px;color:var(--text-3);margin-bottom:16px;line-height:1.5}
.excel-tool-footer{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.excel-tool-footer button{flex:0 0 auto;height:36px;padding:0 14px;font-size:13px;border-radius:7px;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;line-height:1}
.excel-tool-footer .mini-confirm-btn{border-width:1px}
.excel-tool-footer .panel-save-btn{border:1px solid var(--border-strong);background:transparent;color:var(--text-2);transition:all var(--tr)}
.excel-tool-footer .panel-save-btn:hover{background:var(--primary-light);border-color:var(--primary);color:var(--primary)}
.excel-tool-footer .oft-download{width:40px;padding:0;margin-right:auto}
#excelToolOverlay .kb-card{position:relative;height:86vh;max-height:94vh;background:var(--bg);border-width:1px;border-radius:10px}
#excelToolOverlay .kb-header{border-bottom-color:var(--border)}
#excelToolOverlay .kb-body{overflow:hidden}
@media(max-width:560px){
  .excel-tool-footer .panel-save-btn{order:1;flex:1 1 calc(33.333% - 6px);padding:0 4px}
  .excel-tool-footer .oft-cancel{order:2;flex:1 1 auto}
  .excel-tool-footer .oft-download{order:3;flex:0 0 40px;margin-right:0}
  .excel-tool-grid-wrap{min-width:0}
  #excelToolOverlay .kb-body{padding:10px 12px 12px}
}
.excel-tool-toast{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(.95);background:var(--text);color:var(--bg);padding:14px 22px;border-radius:10px;font-size:14px;font-weight:600;box-shadow:var(--shadow-lg);opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:10;white-space:nowrap}
.excel-tool-toast.show{opacity:1;transform:translate(-50%,-50%) scale(1)}
.excel-tool-prompt{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(.95);background:var(--surface);border:1.5px solid var(--border);color:var(--text);padding:18px;border-radius:10px;box-shadow:var(--shadow-lg);opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:11;width:220px}
.excel-tool-prompt.show{opacity:1;transform:translate(-50%,-50%) scale(1);pointer-events:auto}
.excel-tool-prompt-label{font-size:13px;color:var(--text-2);margin-bottom:10px}
.excel-tool-prompt-input{width:100%;padding:8px 10px;border:1.5px solid var(--border-strong);border-radius:7px;background:var(--bg);color:var(--text);font-size:13.5px;margin-bottom:12px;box-sizing:border-box}
.excel-tool-prompt-actions{display:flex;gap:8px}
.excel-tool-prompt-actions button{flex:1}
.excel-tool-grid td.excel-tool-rownum{background:var(--surface);color:var(--text-3);text-align:center;font-size:12px;vertical-align:middle;user-select:none;width:34px;box-sizing:border-box;position:sticky;left:0;z-index:2;box-shadow:1px 0 0 var(--border)}
.excel-tool-grid td.excel-tool-colletter{background:var(--surface);color:var(--text-3);text-align:center;font-size:12px;vertical-align:middle;user-select:none;font-weight:700;box-sizing:border-box;position:sticky;top:0;z-index:2;box-shadow:0 1px 0 var(--border)}
.excel-tool-grid tr.excel-tool-letter-row td.excel-tool-rownum{top:0;z-index:3;box-shadow:1px 1px 0 var(--border)}
.sidebar-quick-item.has-draft{position:relative}
.sidebar-quick-item.has-draft::after{content:'';position:absolute;top:calc(50% - 3.5px);right:10px;width:7px;height:7px;border-radius:50%;background:var(--primary);z-index:1}
.sidebar-quick-item.has-draft::before{content:'';position:absolute;top:calc(50% - 3.5px);right:10px;width:7px;height:7px;border-radius:50%;background:var(--primary);animation:draft-pulse 2s ease-out infinite;pointer-events:none}
@keyframes draft-pulse{0%{transform:scale(1);opacity:.55} 70%{transform:scale(2.6);opacity:0} 100%{transform:scale(2.6);opacity:0}}
@media (prefers-reduced-motion: reduce){
  .sidebar-quick-item.has-draft::before{animation:none;opacity:0}
}
.office-tool-tabs{display:flex;gap:8px}
.office-tool-tab{border:none;font-family:inherit}
.office-tool-panel{display:none}
.office-tool-panel.active{display:block}
.word-tool-toolbar{display:flex;align-items:center;gap:6px;margin-bottom:8px;flex-wrap:nowrap}
.word-tool-toolbar>.word-tool-select{flex:1 1 0;min-width:0}
.word-tool-toolbar>.word-tool-select:first-child{flex:1.5 1 0}
.word-tool-toolbar>.word-tool-color-label,.word-tool-toolbar>.word-tool-btn{flex:none}
.word-tool-select{padding:5px 8px;border:1px solid var(--border-strong);border-radius:7px;background:var(--surface);color:var(--text);font-size:12.5px}
.word-tool-color-label{display:flex;align-items:center;width:28px;height:28px;border:1px solid var(--border-strong);border-radius:7px;overflow:hidden;cursor:pointer}
.word-tool-color-label input{width:38px;height:38px;border:none;padding:0;margin:-4px;cursor:pointer}
.word-tool-btn{width:28px;height:28px;border:1px solid var(--border-strong);border-radius:7px;background:var(--surface);color:var(--text);font-size:13px;cursor:pointer;transition:all var(--tr)}
.word-tool-btn:hover{background:var(--primary-light);color:var(--primary)}
@media(max-width:560px){
  .word-tool-toolbar{gap:5px}
  .word-tool-select{padding:5px 6px;font-size:12px}
  .word-tool-color-label,.word-tool-btn{width:26px;height:26px}
}
.word-tool-editor{min-height:380px;max-height:56vh;overflow-y:auto;resize:vertical;border:1px solid var(--border-strong);border-radius:10px;background:var(--bg);padding:14px 16px;font-size:14px;line-height:1.7;color:var(--text);margin-bottom:12px}
.word-tool-editor:empty:before{content:attr(data-placeholder);color:var(--text-3)}
.word-tool-editor:focus{outline:2px solid var(--primary);outline-offset:-2px}
.kb-upload-btn{display:block;width:100%;padding:12px;border:1.5px dashed var(--border-strong);border-radius:7px;color:var(--text-2);font-size:13.5px;text-align:center;transition:all var(--tr);margin:0 0 14px;cursor:pointer;box-sizing:border-box}
.kb-upload-btn:hover{border-color:var(--primary);color:var(--primary)}
.kb-doc-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:7px;border:1px solid var(--border);margin-bottom:8px}
.kb-doc-name{flex:1;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.kb-doc-meta{font-size:11px;color:var(--text-3);flex-shrink:0}
.kb-doc-del{width:24px;height:24px;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--text-3);flex-shrink:0}
.kb-doc-del:hover{background:rgba(185,28,28,.08);color:var(--red)}
.kb-empty{text-align:center;color:var(--text-3);font-size:13px;padding:30px 0}
.kb-loading{display:flex;align-items:center;gap:9px;padding:13px 14px;font-size:13px; color:var(--text-2);border:1px solid var(--border);border-radius:7px;margin-bottom:8px}
.kb-loading::before{content:'';width:14px;height:14px;flex:none;border-radius:50%; border:2px solid var(--border);border-top-color:var(--primary); animation:kbspin .7s linear infinite}
@keyframes kbspin{to{transform:rotate(360deg)}}
.auth-card{width:100%;max-width:360px;padding:32px 28px;background:var(--surface);border:1.5px solid var(--border);border-radius:10px;box-shadow:var(--shadow);text-align:center}
.auth-logo{width:48px;height:48px;margin:0 auto 14px;border-radius:10px;background:var(--brand-grad);color:#fff;display:flex;align-items:center;justify-content:center;font-size:22px}
.auth-title{font-size:20px;font-weight:700;margin-bottom:20px}
.auth-tabs{display:flex;gap:4px;background:var(--bg);border-radius:7px;padding:3px;margin-bottom:18px}
.auth-tab{flex:1;padding:8px 0;border-radius:7px;font-size:13.5px;font-weight:500;color:var(--text-3);transition:all var(--tr)}
.auth-tab.active{background:var(--surface);color:var(--text-1);box-shadow:var(--shadow)}
.auth-input{width:100%;padding:11px 14px;margin-bottom:10px;border:1.5px solid var(--border-strong);border-radius:7px;background:var(--bg);font-size:14px;color:var(--text-1);transition:border-color var(--tr)}
.auth-input:focus{border-color:var(--primary)}
.auth-code-row{display:flex;gap:8px}
.auth-code-row .auth-input{flex:1}
.auth-code-btn{flex-shrink:0;padding:0 12px;border-radius:7px;border:1.5px solid var(--border-strong);background:var(--bg);color:var(--text-2);font-size:12.5px;white-space:nowrap;transition:all var(--tr)}
.auth-code-btn:hover:not(:disabled){border-color:var(--primary);color:var(--primary)}
.auth-code-btn:disabled{opacity:.5;cursor:not-allowed}
.auth-submit{width:100%;padding:11px 0;margin-top:6px;border-radius:7px;background:var(--primary);color:#fff;font-size:14.5px;font-weight:600;transition:opacity var(--tr)}
.auth-submit:hover{opacity:.9}
.auth-submit:disabled{opacity:.5;cursor:not-allowed}
.auth-error{color:var(--red);font-size:12.5px;text-align:left;min-height:0;margin:-2px 0 8px;display:none}
.auth-error.show{display:block}
.grp-wrap{max-width:820px;margin:0 auto;padding:8px 24px 24px;width:100%}
.grp-btn{padding:7px 14px;border-radius:7px;border:1px solid var(--border-strong); background:transparent;color:var(--text-2);font-size:13px;cursor:pointer;white-space:nowrap}
.grp-btn:hover{color:var(--text);border-color:var(--primary)}
.grp-btn.primary{background:var(--grp-accent);border-color:var(--grp-accent);color:#fff}
.grp-btn.primary:hover{background:var(--grp-accent-hover);border-color:var(--grp-accent-hover)}
.grp-btn.danger{color:var(--red);border-color:var(--red)}
.grp-card{border:1px solid var(--border);border-radius:10px;padding:14px 16px;margin-bottom:10px; background:var(--bg);cursor:pointer;display:flex;flex-direction:column;justify-content:center; gap:8px;min-height:98px;box-sizing:border-box}
.grp-card-row{display:flex;align-items:center;gap:8px;min-width:0}
.grp-card:hover{border-color:var(--primary);box-shadow:var(--shadow-sm)}
.grp-avatar{width:40px;height:40px;border-radius:11px;flex:none;background:var(--grp-accent); color:#fff;display:flex;align-items:center;justify-content:center;font-size:15px;font-weight:600}
.grp-card-name{font-size:14px;font-weight:600;line-height:1.3; display:flex;align-items:baseline;min-width:0;overflow:hidden}
.grp-name-txt{flex:0 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.grp-card-count{flex:none;margin-left:auto;font-size:11.5px;color:var(--text-3);white-space:nowrap; border:1px solid var(--border);border-radius:4px;padding:2px 8px}
.grp-unread{flex:none;margin-left:10px;min-width:18px;height:18px;padding:0 5px; border-radius:4px;background:var(--red);color:#fff;font-size:11px;line-height:18px; text-align:center;font-weight:600}
.grp-card.grp-new{cursor:default;flex-direction:row;align-items:center}
.grp-card.grp-new .grp-card-row{flex:1;justify-content:flex-end;flex-wrap:wrap}
.grp-card.grp-new .grp-btn{margin-left:0}
.grp-card.grp-new .grp-btn .grp-unread{display:inline-block;margin-left:6px; vertical-align:middle;position:relative;top:-1px}
.grp-rename-btn{flex:none;margin-left:6px;padding:2px 8px;border-radius:7px;font-size:11.5px; border:1px solid var(--border-strong);background:transparent;color:var(--text-3);cursor:pointer}
.grp-rename-btn:hover{border-color:var(--primary);color:var(--primary)}
.grp-rename-btn.danger:hover{border-color:var(--red);color:var(--red)}
.grp-badge{font-size:11px;padding:2px 8px;border-radius:4px; background:var(--grp-erp-light);color:var(--grp-erp);white-space:nowrap}
.grp-badge.plain{background:var(--surface);color:var(--text)}
.grp-empty{text-align:center;color:var(--text-3);font-size:13px;padding:40px 0;line-height:1.9}
.grp-warn{border:1px solid var(--border);border-left:3px solid var(--grp-erp);border-radius:10px; padding:14px 16px;font-size:12.5px;line-height:1.75;color:var(--text-2); background:var(--bg);margin-bottom:10px}
.grp-warn b{color:var(--grp-erp)}
.grp-wrap.chat{max-width:100%;padding:0;width:100%}
.grp-head-inline{display:flex;align-items:center;gap:6px;margin-left:0}
.chat-head-title{font-size:15.5px;font-weight:600;min-width:0;margin-left:4px; white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:42vw}
.grp-back{width:30px;height:30px;flex:none;display:flex;align-items:center;justify-content:center; border:none;background:transparent;color:var(--text-2);cursor:pointer;border-radius:7px; font-size:22px;line-height:1;padding:0 0 3px}
.grp-back:hover{background:var(--surface-2);color:var(--text)}
.grp-chat-title{font-size:15.5px;font-weight:600;min-width:0; white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.grp-msgs{width:100%;padding:0;background:transparent}
.grp-msgs .msg{max-width:800px;margin:0 auto;align-items:flex-start}
.grp-msgs .msg.other{flex-direction:row}
.grp-msgs .msg.other .msg-body{align-items:flex-start;max-width:82%}
.grp-msgs .msg.assistant .msg-bubble{padding-left:14px}
.grp-msgs .msg-avatar{border-radius:10px;overflow:hidden}
.grp-msgs .msg.user .msg-avatar{background:var(--brand-grad)}
.grp-msgs .msg.other .msg-avatar{background:var(--text-3)}
.grp-msgs .msg.assistant .msg-avatar{background:var(--brand-grad)}
.grp-msgs .msg-avatar{display:none}
.grp-avatar-img{width:100%;height:100%;object-fit:cover;display:block}
.grp-msgs .msg-bubble{position:relative;padding:10px 14px; font-size:14.5px;line-height:1.7}
.grp-msgs .msg.other .msg-bubble,.grp-msgs .msg.assistant .msg-bubble,.grp-msgs .msg.user .msg-bubble{border-radius:10px}
.grp-msgs .msg.other .msg-bubble{background:var(--grp-other-bubble); border:1px solid var(--grp-other-border)}
.grp-msgs .msg.other .msg-bubble::before,.grp-msgs .msg.other .msg-bubble::after{content:'';position:absolute;top:11px; width:0;height:0;border-style:solid}
.grp-msgs .msg.other .msg-bubble::before{left:-7px; border-width:6px 7px 6px 0;border-color:transparent var(--grp-other-border) transparent transparent}
.grp-msgs .msg.other .msg-bubble::after{left:-6px; border-width:6px 7px 6px 0;border-color:transparent var(--grp-other-bubble) transparent transparent}
.grp-msgs .msg.user .msg-bubble{background:var(--grp-me-bubble); border:1px solid var(--grp-me-border)}
.grp-msgs .msg.user .msg-bubble::before,.grp-msgs .msg.user .msg-bubble::after{content:'';position:absolute;top:11px; width:0;height:0;border-style:solid}
.grp-msgs .msg.user .msg-bubble::before{right:-7px; border-width:6px 0 6px 7px;border-color:transparent transparent transparent var(--grp-me-border)}
.grp-msgs .msg.user .msg-bubble::after{right:-6px; border-width:6px 0 6px 7px;border-color:transparent transparent transparent var(--grp-me-bubble)}
.grp-msgs .msg.other .msg-bubble::before,.grp-msgs .msg.other .msg-bubble::after,.grp-msgs .msg.user .msg-bubble::before,.grp-msgs .msg.user .msg-bubble::after{display:none}
.grp-msgs .msg-body{gap:3px}
.grp-msgs .msg-avatar{margin-top:0}
.grp-who{font-size:11.5px;color:var(--text-3);display:flex;gap:6px;align-items:center; padding:0 3px}
.msg.user .grp-who{flex-direction:row-reverse}
.msg.assistant .grp-who{color:var(--primary);font-weight:600}
.grp-who-title{background:var(--primary-light);color:var(--primary);padding:1px 7px; border-radius:4px;font-size:10.5px}
.grp-who-time{color:var(--text-3);opacity:.75;font-variant-numeric:tabular-nums}
.grp-day{text-align:center;color:var(--text-3);font-size:11.5px; max-width:800px;margin:0 auto;padding:14px 0 6px;letter-spacing:.5px}
.grp-msg-sql{font-size:11px;color:var(--text-3);font-family:ui-monospace,monospace; word-break:break-all;cursor:pointer;padding:0 4px}
.grp-sys{text-align:center;color:var(--text-3);font-size:12px;padding:10px 0;line-height:1.7; max-width:800px;margin:0 auto}
.grp-composer{background:var(--bg); border:1.5px solid var(--border-strong);border-radius:10px;padding:10px 12px 8px; box-shadow:var(--shadow);transition:border-color var(--tr); display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.grp-composer:focus-within{border-color:var(--primary)}
#grpInput{order:1;flex:0 0 100%;min-width:0;border:none;outline:none;resize:none;background:none; color:var(--text);font-size:15px;line-height:1.6;max-height:180px;min-height:40px; padding:2px 0;font-family:inherit;overflow-y:auto}
#grpInput::placeholder{color:var(--text-3)}
.grp-at{padding:4px 9px;border-radius:7px;border:1.5px solid transparent; background:transparent;color:var(--text-2);font-size:12px;cursor:pointer; white-space:nowrap;flex:none;transition:all var(--tr); display:flex;align-items:center;line-height:1.4}
.grp-at:hover{color:var(--text);border-color:var(--border)}
.grp-at.on{color:#fff;border-color:var(--primary);background:var(--primary)}
.grp-send{order:4;width:34px;height:34px;border-radius:7px;border:none;background:var(--primary);color:#fff; cursor:pointer;display:flex;align-items:center;justify-content:center;flex:none; margin-left:auto;transition:all var(--tr)}
.grp-send:hover{filter:brightness(1.06);transform:scale(1.05)}
.grp-send:disabled{background:var(--border);color:var(--text-3);transform:none;cursor:not-allowed}
.grp-pick{display:flex;gap:10px;margin:4px 0 2px}
.grp-pick-card{flex:1;border:1.5px solid var(--border);border-radius:10px;padding:10px 12px; cursor:pointer;transition:all var(--tr);background:var(--bg)}
.grp-pick-card:hover{border-color:var(--primary)}
.grp-pick-card.on{border-color:var(--primary);background:var(--primary-light)}
.grp-pick-card.off{opacity:.45;cursor:not-allowed}
.grp-pick-card.off:hover{border-color:var(--border)}
.grp-pick-t{font-size:13px;font-weight:600;color:var(--text);margin-bottom:3px}
.grp-pick-d{font-size:11px;color:var(--text-3);line-height:1.5}
.grp-model-bar{margin:0;display:flex;align-items:center;gap:8px; font-size:12px;color:var(--text-3);flex-wrap:wrap}
.grp-model-bar .model-selector{max-width:280px}
.file-chip.grp-working{animation:arch-pulse 1.4s ease infinite}
.grp-more{text-align:center;font-size:12px;color:var(--primary);padding:10px 0;cursor:pointer}
.grp-more:hover{text-decoration:underline}
.grp-attach-wrap{position:relative;flex:none}
.grp-attach-btn{width:28px;height:28px;border:none;background:none;color:var(--text-2); border-radius:7px;cursor:pointer;display:flex;align-items:center;justify-content:center; transition:all var(--tr)}
.grp-attach-btn:hover{background:var(--surface-2);color:var(--text)}
.grp-attach-wrap .attach-dropdown{position:fixed;bottom:auto;left:auto;top:auto}
.grp-file{display:flex;align-items:center;gap:9px;padding:9px 11px;border:1px solid var(--border); border-radius:10px;background:var(--bg);cursor:pointer;text-decoration:none;color:inherit;max-width:280px}
.grp-file:hover{border-color:var(--primary)}
.grp-file-ico{flex:none;color:var(--text-3)}
.grp-file-name{font-size:13px;color:var(--text-1);word-break:break-all;line-height:1.4}
.grp-file-img{max-width:220px;max-height:220px;border-radius:10px;display:block;cursor:pointer}
.grp-file-note{margin-top:6px}
.grp-model-bar .model-selector span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:768px){
  .grp-composer .input-footer{order:1;flex:1 1 auto;min-width:0}
  .grp-composer .grp-send{order:2;margin-left:auto;align-self:center}
  #grpInput{order:3;flex:0 0 100%;min-width:0;min-height:34px}
}
.grp-model-note{background:var(--accent-bg);border:1px solid var(--accent-edge);border-left:3px solid var(--accent);color:var(--accent);border-radius:8px;padding:2px 8px}
@media(max-width:768px){
  .grp-model-note{display:none}
}
.grp-model-ro{display:inline-flex;align-items:center;gap:6px;padding:3px 0; font-size:12px;color:var(--text-3);user-select:none}
.grp-model-dot{width:7px;height:7px;border-radius:50%;flex:none; background:var(--text-3)}
.grp-model-dot.local{background:#22a06b}
.grp-model-dot.cloud{background:#d98324}
.grp-model-ro .grp-model-where{color:var(--text-2)}
.grp-hdr{display:none;align-items:center;gap:2px}
.grp-hdr.on{display:flex}
.sidebar-quick-item{position:relative}
.grp-dot{position:absolute;right:12px;top:50%;transform:translateY(-50%); min-width:17px;height:17px;padding:0 5px;border-radius:4px;background:var(--red); color:#fff;font-size:11px;line-height:17px;text-align:center;font-weight:600}
.grp-no{flex:none;font-size:11.5px;color:var(--text-3);white-space:nowrap; font-variant-numeric:tabular-nums;letter-spacing:.4px}
.grp-no b{font-weight:600;color:var(--text);letter-spacing:.6px}
.kb-upload-window{margin-top:10px;padding-top:10px;border-top:1px solid var(--border); font-size:11.5px;color:var(--text-3);text-align:center;line-height:1.7}
.grp-inv{border:1px solid var(--border);border-left:3px solid var(--primary); border-radius:10px;padding:13px 15px;margin-bottom:10px;background:var(--bg)}
.grp-inv-t{font-size:13.5px;font-weight:600;margin-bottom:5px}
.grp-inv-s{font-size:12px;color:var(--text-3);line-height:1.75;margin-bottom:11px}
.grp-inv-btns{display:flex;gap:8px}
.grp-mem{display:flex;align-items:center;gap:10px;padding:11px 2px;border-bottom:1px solid var(--border)}
.grp-mem:last-child{border-bottom:none}
.grp-mem-main{flex:1;min-width:0}
.grp-mem-name{font-size:13.5px;font-weight:500}
.grp-mem-scope{font-size:11.5px;color:var(--text-3);margin-top:3px;line-height:1.6}
.grp-form{display:flex;flex-direction:column;gap:9px;padding:12px 0 4px}
.grp-form input,.grp-form select{width:100%;padding:9px 11px;border:1px solid var(--border-strong); border-radius:7px;background:var(--bg);color:var(--text);font-size:13.5px;outline:none;font-family:inherit}
.grp-form input:focus,.grp-form select:focus{border-color:var(--primary)}
.grp-form label{font-size:12px;color:var(--text-3);margin-bottom:-4px}
