/* 数智工作台 - 样式（Lighthouse 清爽卡片风） */
* { margin:0; padding:0; box-sizing:border-box; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; }
:root {
  --bg:#eef1f6; --card:#fff; --border:#e5e7eb; --text:#1f2937; --text2:#6b7280; --text3:#9ca3af;
  --primary:#2563eb; --primary-d:#1d4ed8; --primary-bg:#eff6ff;
  --green:#22c55e; --amber:#f59e0b; --red:#ef4444; --purple:#7c3aed;
}
body { background:var(--bg); color:var(--text); font-size:14px; -webkit-font-smoothing:antialiased; }
.hidden { display:none !important; }

/* ===== 登录页 ===== */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#eef2ff 0%,#f5f3ff 100%); padding:20px; }
.login-card { width:380px; background:var(--card); border-radius:16px; padding:36px 32px; box-shadow:0 18px 50px rgba(37,99,235,.12); }
.login-logo { width:52px; height:52px; border-radius:14px; background:linear-gradient(135deg,var(--primary),var(--purple)); display:flex; align-items:center; justify-content:center; font-size:24px; color:#fff; margin:0 auto 14px; }
.login-title { text-align:center; font-size:18px; font-weight:700; margin-bottom:4px; }
.login-sub { text-align:center; font-size:12px; color:var(--text3); margin-bottom:24px; }
.login-field { margin-bottom:14px; }
.login-field label { display:block; font-size:12px; color:var(--text2); margin-bottom:6px; font-weight:500; }
.login-field input { width:100%; height:40px; border:1px solid var(--border); border-radius:9px; padding:0 12px; font-size:14px; outline:none; }
.login-field input:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.login-btn { width:100%; height:42px; border-radius:9px; background:var(--primary); color:#fff; border:none; font-size:14px; font-weight:600; cursor:pointer; margin-top:6px; }
.login-btn:hover { background:var(--primary-d); }
.login-btn:disabled { opacity:.6; cursor:not-allowed; }
.login-err { color:var(--red); font-size:12px; margin-bottom:10px; min-height:16px; text-align:center; }
.login-foot { text-align:center; font-size:11px; color:var(--text3); margin-top:16px; }

/* ===== 顶栏 ===== */
.topbar { display:flex; align-items:center; gap:14px; height:54px; padding:0 16px; background:var(--card); border-bottom:1px solid var(--border); }
.brand { display:flex; align-items:center; gap:10px; font-weight:700; font-size:15px; }
.brand .logo { width:26px; height:26px; border-radius:7px; background:linear-gradient(135deg,var(--primary),var(--purple)); display:flex; align-items:center; justify-content:center; color:#fff; font-size:13px; }
.topbar .spacer { flex:1; }
.model-pill { display:flex; align-items:center; gap:6px; height:30px; padding:0 11px; border:1px solid var(--border); border-radius:7px; background:#f9fafb; font-size:12px; cursor:pointer; white-space:nowrap; }
.model-pill .dot { width:7px; height:7px; border-radius:50%; background:var(--green); }
.avatar { width:30px; height:30px; border-radius:50%; background:#e0e7ff; color:#3730a3; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:600; cursor:pointer; }

/* ===== 布局 ===== */
.layout { display:flex; height:calc(100vh - 54px); }

/* ===== 左侧项目树 ===== */
.sidebar { width:250px; background:var(--card); border-right:1px solid var(--border); overflow-y:auto; flex-shrink:0; padding:10px 0; }
.side-head { display:flex; align-items:center; justify-content:space-between; padding:6px 14px 10px; font-size:12px; color:var(--text3); font-weight:600; letter-spacing:.5px; }
.side-head .plus { cursor:pointer; font-size:15px; color:var(--text2); width:24px; height:24px; border-radius:6px; display:flex; align-items:center; justify-content:center; }
.side-head .plus:hover { background:#f3f4f6; }
.folder { margin-bottom:2px; }
.folder-head { display:flex; align-items:center; gap:8px; padding:8px 14px; cursor:pointer; border-radius:7px; margin:0 8px; }
.folder-head:hover { background:#f9fafb; }
.folder-head .arrow { width:12px; font-size:10px; color:var(--text3); transition:transform .15s; flex-shrink:0; }
.folder-head.open .arrow { transform:rotate(90deg); }
.folder-head .fico { width:26px; height:26px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:13px; flex-shrink:0; }
.folder-head .fname { flex:1; font-size:13px; font-weight:500; color:#374151; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.folder-head .fcnt { font-size:11px; color:var(--text3); background:#f3f4f6; padding:1px 7px; border-radius:9px; }
.folder-body { display:none; }
.folder-head.open + .folder-body { display:block; }
.chat-item { display:flex; align-items:center; gap:7px; padding:7px 14px 7px 12px; cursor:pointer; border-radius:6px; margin:0 8px 0 12px; font-size:13px; color:#4b5563; }
.chat-item:hover { background:#f9fafb; }
.chat-item.active { background:var(--primary-bg); color:var(--primary-d); font-weight:500; }
.chat-item .cico { font-size:12px; flex-shrink:0; }
.chat-item .cname { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-item .del { opacity:0; font-size:12px; color:var(--text3); padding:0 4px; }
.chat-item:hover .del { opacity:1; }
.new-chat { display:flex; align-items:center; gap:6px; padding:5px 14px 5px 12px; cursor:pointer; border-radius:6px; margin:2px 8px 6px 12px; font-size:12px; color:var(--primary); }
.new-chat:hover { background:var(--primary-bg); }
.divider { height:1px; background:var(--border); margin:8px 12px; }

/* ===== 主区聊天 ===== */
.main { flex:1; display:flex; flex-direction:column; min-width:0; }
.chat-head { display:flex; align-items:center; justify-content:space-between; padding:11px 18px; background:var(--card); border-bottom:1px solid var(--border); gap:10px; }
.chat-head .title { font-weight:600; font-size:14px; display:flex; align-items:center; gap:9px; overflow:hidden; }
.chat-head .title .tname { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-head .title .tag { font-size:11px; background:var(--primary-bg); color:var(--primary-d); padding:2px 8px; border-radius:10px; font-weight:500; flex-shrink:0; }
.chat-head .tools { display:flex; gap:8px; flex-shrink:0; }
.btn-sm { height:29px; padding:0 12px; border:1px solid var(--border); border-radius:7px; background:var(--card); font-size:12px; cursor:pointer; color:#374151; }
.btn-sm:hover { background:#f9fafb; }
.btn-primary { background:var(--primary); border-color:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-d); }

.chat-body { flex:1; overflow-y:auto; padding:20px 18px; display:flex; flex-direction:column; gap:16px; }
.empty-chat { text-align:center; color:var(--text3); font-size:13px; padding:40px 20px; line-height:2; }
.msg { display:flex; gap:12px; max-width:780px; }
.msg.user { align-self:flex-end; flex-direction:row-reverse; }
.msg .bubble { padding:11px 15px; border-radius:12px; line-height:1.7; font-size:14px; word-break:break-word; white-space:pre-wrap; }
.msg.user .bubble { background:var(--primary); color:#fff; border-top-right-radius:4px; }
.msg.assistant .bubble { background:var(--card); border:1px solid var(--border); border-top-left-radius:4px; }
.msg .who { font-size:11px; color:var(--text3); margin-bottom:3px; }
.msg .me { text-align:right; }
.msg .ico { width:28px; height:28px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:12px; flex-shrink:0; }
.bubble pre { background:#f6f8fa; border-radius:8px; padding:10px 12px; overflow-x:auto; font-size:12px; margin:6px 0; }
.bubble code { background:#f6f8fa; border-radius:4px; padding:1px 4px; font-size:12px; }
.bubble pre code { background:none; padding:0; }
.bubble table { border-collapse:collapse; margin:6px 0; font-size:12px; }
.bubble th, .bubble td { border:1px solid var(--border); padding:5px 9px; }

.composer { padding:12px 18px 16px; background:var(--card); border-top:1px solid var(--border); position:relative; }
.composer .box { border:1px solid var(--border); border-radius:12px; background:#f9fafb; padding:11px 14px; display:flex; align-items:flex-end; gap:10px; }
.composer .box:focus-within { border-color:var(--primary); background:var(--card); }
.composer textarea { flex:1; border:none; outline:none; background:transparent; resize:none; font-size:14px; line-height:1.6; font-family:inherit; min-height:24px; max-height:150px; }
.composer .actions { display:flex; align-items:center; gap:8px; }
.composer .icon-btn { width:33px; height:33px; border-radius:8px; border:1px solid var(--border); background:var(--card); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:14px; color:var(--text2); }
.composer .send { height:33px; padding:0 17px; border-radius:8px; background:var(--primary); color:#fff; border:none; font-size:13px; font-weight:600; cursor:pointer; }
.composer .send:disabled { opacity:.5; cursor:not-allowed; }
.slash-hint { font-size:11px; color:var(--text3); margin-top:6px; padding-left:4px; }

/* / 命令面板 */
.cmd-panel { position:absolute; bottom:calc(100% - 8px); left:18px; right:18px; max-width:520px; background:var(--card); border:1px solid var(--border); border-radius:12px; box-shadow:0 12px 32px rgba(0,0,0,.14); overflow:hidden; z-index:50; }
.cmd-panel .cmd-head { padding:8px 14px; font-size:11px; color:var(--text3); border-bottom:1px solid #f3f4f6; }
.cmd-item { display:flex; align-items:center; gap:10px; padding:9px 14px; cursor:pointer; font-size:13px; color:#374151; }
.cmd-item:hover, .cmd-item.active { background:var(--primary-bg); }
.cmd-item .cic { font-size:14px; }
.cmd-item .cinfo { flex:1; }
.cmd-item .cname { font-weight:500; }
.cmd-item .cdesc { font-size:11px; color:var(--text3); }

/* ===== 右侧状态 ===== */
.right { width:280px; background:var(--card); border-left:1px solid var(--border); padding:15px; overflow-y:auto; flex-shrink:0; display:flex; flex-direction:column; gap:14px; }
.panel-title { font-size:12px; font-weight:600; display:flex; align-items:center; justify-content:space-between; }
.panel-title .live { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--green); font-weight:500; }
.panel-title .live .pulse { width:7px; height:7px; border-radius:50%; background:var(--green); animation:blink 1.6s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
.stat-row { margin-bottom:11px; }
.stat-row .top { display:flex; justify-content:space-between; font-size:12px; color:#4b5563; margin-bottom:4px; }
.stat-row .top .val { font-weight:600; }
.bar { height:6px; border-radius:3px; background:#f3f4f6; overflow:hidden; }
.bar .fill { height:100%; border-radius:3px; transition:width .5s; }
.fill.green { background:var(--green); } .fill.blue { background:var(--primary); } .fill.amber { background:var(--amber); } .fill.red { background:var(--red); }
.sys-meta { font-size:11px; color:var(--text3); margin-top:3px; line-height:1.7; }

.model-card { border:1px solid var(--border); border-radius:9px; padding:9px 11px; display:flex; align-items:center; gap:9px; }
.model-card .m-ico { width:28px; height:28px; border-radius:7px; background:#ede9fe; display:flex; align-items:center; justify-content:center; font-size:12px; }
.model-card .m-name { font-size:12px; font-weight:600; }
.model-card .m-sub { font-size:11px; color:var(--text3); }
.model-card .m-status { margin-left:auto; width:7px; height:7px; border-radius:50%; background:var(--green); }
.model-card.add { border-style:dashed; justify-content:center; color:var(--primary); cursor:pointer; font-size:12px; }
.foot-info { margin-top:auto; padding-top:6px; font-size:11px; color:var(--text3); line-height:1.8; }

/* ===== 弹窗 ===== */
.modal-mask { position:fixed; inset:0; background:rgba(17,24,39,.5); display:flex; align-items:center; justify-content:center; z-index:100; padding:20px; }
.modal { width:540px; max-width:100%; max-height:90vh; overflow-y:auto; background:var(--card); border-radius:14px; box-shadow:0 20px 50px rgba(0,0,0,.2); }
.modal .m-head { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal .m-head h3 { font-size:16px; }
.modal .m-close { border:none; background:none; font-size:18px; cursor:pointer; color:var(--text2); }
.modal .m-body { padding:20px; }
.modal .m-foot { padding:14px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:10px; }
.field { margin-bottom:14px; }
.field label { display:block; font-size:12px; color:var(--text2); margin-bottom:6px; font-weight:500; }
.field input, .field select { width:100%; height:36px; border:1px solid var(--border); border-radius:8px; padding:0 12px; font-size:13px; outline:none; }
.field input:focus, .field select:focus { border-color:var(--primary); }
.field .hint { font-size:11px; color:var(--text3); margin-top:4px; }
.user-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid #f3f4f6; font-size:13px; }
.user-row .u-name { font-weight:500; flex:1; }
.tag { font-size:11px; padding:2px 8px; border-radius:10px; }
.tag.admin { background:#ede9fe; color:#6d28d9; }
.tag.user { background:#f3f4f6; color:#6b7280; }
.tag.active { background:#dcfce7; color:#15803d; }
.tag.disabled { background:#fee2e2; color:#dc2626; }
.model-form-row { display:flex; gap:8px; align-items:center; padding:8px 0; border-bottom:1px solid #f3f4f6; font-size:13px; }
.model-form-row .m-prov { font-weight:500; width:110px; }
.model-form-row .m-name2 { flex:1; color:var(--text2); }
.model-form-row .m-act { display:flex; gap:6px; }

/* ===== Toast ===== */
.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:#111827; color:#fff; padding:10px 20px; border-radius:10px; font-size:13px; z-index:200; box-shadow:0 8px 24px rgba(0,0,0,.25); max-width:80%; text-align:center; }

/* ===== 移动端适配 ===== */
.sidebar-toggle { display:none; }
@media (max-width: 900px) {
  .right { display:none; }
}
@media (max-width: 768px) {
  .sidebar { position:fixed; left:0; top:54px; bottom:0; z-index:60; transform:translateX(-100%); transition:transform .2s; box-shadow:2px 0 20px rgba(0,0,0,.1); }
  .sidebar.open { transform:translateX(0); }
  .sidebar-toggle { display:flex; align-items:center; justify-content:center; width:32px; height:32px; border:none; background:none; font-size:18px; cursor:pointer; }
  .chat-head .tools .btn-sm { display:none; }
  .chat-head .tools .btn-primary { display:block; }
  .topbar { padding:0 10px; }
  .model-pill .model-label { display:none; }
}
