:root, :root[data-theme="dark"] {
  --bg: #0b0e1a;
  --bg-2: #10142a;
  --panel: #141829;
  --panel-2: #1b2038;
  --line: #262c4a;
  --text: #e8eaf2;
  --muted: #9aa0bd;
  --faint: #666d92;
  --accent: #6c7bff;
  --accent-2: #3ecf8e;
  --warn: #ffb648;
  --danger: #ff6b7d;
  --grad: linear-gradient(135deg, #6c7bff, #9a5bff);
  --glass: rgba(255,255,255,.028);
  --glass-brd: rgba(255,255,255,.06);
  --shadow: 0 12px 40px rgba(0,0,0,.42);
  --radius: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f7fc;
  --bg-2: #eef1fa;
  --panel: #ffffff;
  --panel-2: #f1f4fb;
  --line: #e0e5f2;
  --text: #171b2e;
  --muted: #5c6486;
  --faint: #9299b8;
  --accent: #5566ff;
  --accent-2: #14b877;
  --warn: #d98a13;
  --danger: #e04357;
  --grad: linear-gradient(135deg, #5566ff, #8a4bff);
  --glass: rgba(20,30,80,.02);
  --glass-brd: rgba(20,30,80,.07);
  --shadow: 0 12px 40px rgba(40,50,90,.14);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(900px 500px at 100% -5%, color-mix(in srgb, var(--accent) 12%, transparent), transparent),
    radial-gradient(800px 500px at -5% 110%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  transition: background-color .25s ease, color .25s ease;
}
/* ---------- 左侧栏布局 ---------- */
#app-shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
  width: 210px; flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 18px 14px 46px; border-right: 1px solid var(--line);   /* 底部留白,让 side-foot 高于 footer 条 */
  background: linear-gradient(180deg, #14172a, #0f1220);
  position: sticky; top: 0; height: 100vh;
  transition: width .16s ease;
}
/* 折叠开关 */
.sidebar-toggle {
  margin-left: auto; width: 26px; height: 26px; flex: none; border-radius: 7px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px; line-height: 1;
}
.sidebar-toggle:hover { color: var(--text); border-color: var(--accent); }
.tab-ico { display: inline-block; width: 20px; text-align: center; }
/* 折叠态:窄条,仅图标 */
.sidebar.collapsed { width: 64px; padding-left: 8px; padding-right: 8px; }
.sidebar.collapsed .brand-text, .sidebar.collapsed .tab-label,
.sidebar.collapsed .side-tenant, .sidebar.collapsed .conn-text,
.sidebar.collapsed #user, .sidebar.collapsed #logout-btn { display: none; }
.sidebar.collapsed .brand { justify-content: center; padding: 4px 0 14px; }
.sidebar.collapsed .sidebar-toggle { margin: 0; }
.sidebar.collapsed .tab { text-align: center; padding: 9px 0; }
.sidebar.collapsed .side-foot { align-items: center; }
.sidebar.collapsed .user { justify-content: center; }
.main-col { flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; }
.logo { font-size: 26px; color: var(--accent); }
.sidebar h1 { font-size: 17px; margin: 0; }
.sub { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 14px;
  text-align: left; width: 100%;
}
.tab:hover { background: var(--panel-2); color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.side-tenant { font-size: 11px; color: var(--muted); padding: 0 4px; }
@media (max-width: 720px) {
  #app-shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .tabs { flex-direction: row; flex-wrap: wrap; }
}

main { padding: 22px 24px; }
.view { display: none; }
.view.active { display: block; }
.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.hint { color: var(--muted); font-size: 12px; }

.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.good { background: var(--accent-2); border-color: var(--accent-2); color: #06281c; }
.btn.bad { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 200px; }
.col h3 { margin: 0 0 12px; font-size: 13px; display: flex; justify-content: space-between; color: var(--muted); font-weight: 600; }
.col .count { background: var(--panel-2); border-radius: 20px; padding: 1px 9px; font-size: 12px; }
.card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; margin-bottom: 10px; cursor: pointer;
}
.card:hover { border-color: var(--accent); }
.card .t { font-size: 13px; margin-bottom: 6px; line-height: 1.4; }
.card .m { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px; }
.pill.role { background: rgba(108,123,255,.16); color: #aeb7ff; }

/* status accent bars */
.col[data-s="todo"] h3 { color: #9aa0bd; }
.col[data-s="running"] h3 { color: var(--warn); }
.col[data-s="pending_review"] h3 { color: var(--accent); }
.col[data-s="done"] h3 { color: var(--accent-2); }
.col[data-s="rejected"] h3 { color: var(--danger); }

/* modal */
.modal-backdrop, .drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; z-index: 10;
}
.modal-backdrop { align-items: center; justify-content: center; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; width: 460px; max-width: 92vw; }
.modal h3 { margin: 0 0 16px; }
.modal label, .drawer label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.modal input, .modal select, .modal textarea {
  width: 100%; margin-top: 5px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 9px; font-size: 13px; font-family: inherit;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* drawer */
.drawer-backdrop { justify-content: flex-end; }
.drawer { background: var(--panel); border-left: 1px solid var(--line); width: 640px; max-width: 96vw; height: 100%; overflow-y: auto; padding: 24px; position: relative; }
.drawer-close { position: absolute; top: 16px; right: 18px; background: none; border: none; color: var(--muted); font-size: 26px; cursor: pointer; }
.drawer h2 { margin: 0 40px 4px 0; font-size: 18px; }
.section { margin-top: 22px; }
.section h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.kv { display: flex; gap: 10px; font-size: 13px; margin: 6px 0; }
.kv b { color: var(--muted); min-width: 84px; font-weight: 500; }
.reply-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; font-size: 13px; line-height: 1.6; }
.doc-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; max-height: 440px; overflow-y: auto; font-size: 13px; line-height: 1.65; }
.doc-box h1 { font-size: 17px; margin: 4px 0 10px; }
.doc-box h2 { font-size: 14px; margin: 18px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); color: var(--text); }
.doc-box h3 { font-size: 13px; margin: 14px 0 6px; color: var(--accent-2); }
.doc-box p { margin: 6px 0; color: var(--muted); }
.doc-box ul { margin: 6px 0; padding-left: 20px; }
.doc-box li { margin: 3px 0; }
.doc-box strong { color: var(--text); }
.doc-box code { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 12px; }
.doc-box blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 0 6px 6px 0; color: var(--muted); font-size: 12px; }
.badge { padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.badge.draft { background: rgba(255,182,72,.15); color: var(--warn); }
.badge.delivered { background: rgba(62,207,142,.15); color: var(--accent-2); }

/* trace timeline */
.timeline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 16px; }
.tl-item { position: relative; margin-bottom: 14px; font-size: 12px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.tl-item.tool::before { background: var(--warn); }
.tl-item .ty { color: var(--accent); font-weight: 600; }
.tl-item.tool .ty { color: var(--warn); }
.tl-item pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow-x: auto; margin: 5px 0 0; font-size: 11px; color: var(--muted); }
.verified { color: var(--accent-2); font-size: 12px; }
.verified.bad { color: var(--danger); }

/* 工具/技能清单(可开启) */
.catalog { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin-bottom: 14px; background: var(--panel-2); }
.cat-group { margin-bottom: 8px; }
.cat-group > .cg-h { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin: 8px 2px 5px; }
.cat-item { display: flex; align-items: flex-start; gap: 9px; padding: 6px 6px; border-radius: 7px; cursor: pointer; }
.cat-item:hover { background: var(--panel); }
.cat-item input { margin-top: 3px; accent-color: var(--accent); }
.cat-item .ci-b { flex: 1; min-width: 0; }
.cat-item .ci-n { font-size: 12.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cat-item .ci-k { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--faint); }
.cat-item .ci-d { font-size: 11px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.ci-badge { font-size: 9.5px; border-radius: 20px; padding: 1px 7px; font-weight: 600; }
.ci-badge.skill { color: var(--accent-2); background: rgba(62,207,142,.12); }
.ci-badge.credit { color: var(--warn); background: rgba(255,182,72,.12); }
.ci-badge.mcp { color: var(--accent); background: rgba(108,123,255,.14); }

/* 数字员工花名册 */
.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.emp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.emp-card.inactive { opacity: .6; }
.emp-card .eh { display: flex; align-items: flex-start; gap: 11px; }
.emp-card .eface { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; background: rgba(108,123,255,.16); }
.emp-card .en { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.emp-card .ek { font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; color: var(--muted); }
.emp-card .owner { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; }
.emp-card .owner .oav { width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #7d5bff); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.emp-card .prov { font-size: 11px; color: var(--muted); background: rgba(62,207,142,.1); border: 1px solid rgba(62,207,142,.25); border-radius: 7px; padding: 5px 9px; }
.emp-card .etools { display: flex; flex-wrap: wrap; gap: 6px; }
.emp-card .etool { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.emp-card .prompt-peek { font-size: 11.5px; color: var(--muted); line-height: 1.55; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; max-height: 66px; overflow: hidden; position: relative; }
.emp-card .eactions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.emp-card .status-line { display: flex; align-items: center; gap: 8px; }

.audit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.audit-table th, .audit-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.audit-table th { color: var(--muted); font-weight: 600; }
.audit-table code { color: var(--muted); font-size: 11px; }
.empty { color: var(--muted); font-size: 12px; padding: 6px 2px; }

/* ---------- 登录门 ---------- */
.login-gate {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1a1f3a, var(--bg));
}
.login-card {
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; }
.login-brand .logo { font-size: 28px; color: var(--accent); }
.login-sub { margin: 6px 0 22px; color: var(--muted); font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.login-card input {
  width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; color: var(--text);
}
.login-err { color: var(--danger); font-size: 13px; margin: 2px 0 12px; }
.login-foot { margin: 16px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.btn.block { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 5px 12px; }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

/* ---------- Dashboard ---------- */
.stat-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .sv { font-size: 26px; font-weight: 700; letter-spacing: .3px; }
.stat .sk { margin-top: 4px; font-size: 12px; color: var(--muted); }
.stat.warn .sv { color: var(--warn); }
.stat.good .sv { color: var(--accent-2); }
.stat.cost .sv { color: var(--accent); }
@media (max-width: 900px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel h3 { margin: 0 0 14px; font-size: 14px; }

.status-bars { display: flex; flex-direction: column; gap: 10px; }
.sb-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sb-l { width: 52px; color: var(--muted); }
.sb-bar { flex: 1; height: 10px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.sb-fill { display: block; height: 100%; background: var(--accent); }
.sb-fill.s-done { background: var(--accent-2); }
.sb-fill.s-pending_review { background: var(--warn); }
.sb-fill.s-rejected { background: var(--danger); }
.sb-n { width: 26px; text-align: right; color: var(--muted); }

.dash-roles { display: flex; flex-direction: column; gap: 8px; }
.dr-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.dr-ic { font-size: 16px; width: 22px; text-align: center; }
.dr-n { font-weight: 600; }
.dr-s { margin-left: auto; color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.dot.on { background: var(--accent-2); }
.dot.off { background: var(--muted); }

.dash-list { display: flex; flex-direction: column; }
.dl-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; cursor: default; }
.dl-row:last-child { border-bottom: 0; }
#dash-recent .dl-row { cursor: pointer; }
#dash-recent .dl-row:hover { background: var(--panel-2); }
.dl-t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-m { color: var(--muted); font-size: 12px; }
.dl-act { color: var(--accent); font-size: 12px; min-width: 84px; }
.dl-badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.dl-badge.s-done { color: var(--accent-2); }
.dl-badge.s-pending_review { color: var(--warn); }
.dl-badge.s-rejected { color: var(--danger); }

/* ---------- 系统状态条(P2) ---------- */
.sysbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.chip { font-size: 12px; padding: 6px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.chip.ok { color: var(--accent-2); border-color: rgba(62,207,142,.4); }
.chip.warn { color: var(--warn); border-color: rgba(255,182,72,.4); }
.chip.bad { color: var(--danger); border-color: rgba(255,107,125,.5); }

/* ---------- 全站 footer(版本信息) ---------- */
.app-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 6px 14px; text-align: center;
  font-size: 11px; color: var(--muted);
  background: rgba(15,18,32,.82); border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.app-footer code { color: var(--accent-2); font-size: 11px; }
body { padding-bottom: 30px; }  /* 给 footer 留白 */

/* ---------- 登录/注册切换链接 ---------- */
.login-foot a { color: var(--accent); text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }
.login-card select {
  width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; color: var(--text);
}
.sidebar .user { margin-left: 0; flex-wrap: wrap; }

/* ---------- 技能库(P5-B) ---------- */
.skills-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.kd { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.kd-preset { background: var(--accent); }
.kd-custom { background: var(--accent-2); }
.kd-distilled { background: var(--warn); }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.sk-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; display: flex; flex-direction: column; gap: 8px; }
.sk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sk-name { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.kd-badge { font-size: 10px; padding: 2px 9px; border-radius: 20px; font-weight: 600; flex: none; }
.kd-badge.kd-preset { color: var(--accent); background: rgba(108,123,255,.14); }
.kd-badge.kd-custom { color: var(--accent-2); background: rgba(62,207,142,.14); }
.kd-badge.kd-distilled { color: var(--warn); background: rgba(255,182,72,.14); }
.sk-cat { font-size: 11px; color: var(--muted); }
.sk-desc { font-size: 12.5px; color: var(--text); line-height: 1.5; }
.sk-steps { margin: 2px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.sk-foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; font-size: 11px; color: var(--muted); }
.sk-owner, .sk-src { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }

/* ---------- 产出物料目录(P5-C) ---------- */
.deliv-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.fbtn { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 12.5px; }
.fbtn:hover { border-color: var(--accent); }
.fbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.deliv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.dv-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.dv-card:hover { border-color: var(--accent); }
.dv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dv-type { font-size: 12px; color: var(--muted); }
.dv-title { font-size: 14px; font-weight: 700; line-height: 1.35; }
.dv-meta { font-size: 11px; color: var(--muted); }
.dv-preview { font-size: 12px; color: var(--muted); line-height: 1.5; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; max-height: 84px; overflow: hidden; white-space: pre-wrap; }
.dv-store { font-size: 10px; padding: 1px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.dv-store.gcs { color: var(--accent-2); border-color: rgba(62,207,142,.35); }
.dv-owner { font-size: 10px; color: var(--muted); }

/* ---------- 技能库增强(SKILL.md 编辑/导入/开源库) ---------- */
.modal.modal-wide { width: 620px; }
.sk-form-row { display: flex; gap: 12px; }
.kd-imported { background: #b06cff; }
.kd-library { background: #46c6ff; }
.kd-badge.kd-imported { color: #b06cff; background: rgba(176,108,255,.14); }
.kd-badge.kd-library { color: #46c6ff; background: rgba(70,198,255,.14); }
.sk-md { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 11px; color: var(--muted); line-height: 1.5; max-height: 96px; overflow: hidden; white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; margin: 0; }
.sk-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.sk-ro { font-size: 11px; color: var(--muted); align-self: center; }
.btn.tiny { padding: 4px 10px; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.seg-btn { background: var(--panel-2); border: 0; color: var(--muted); padding: 7px 16px; cursor: pointer; font-size: 13px; }
.seg-btn.active { background: var(--accent); color: #fff; }
.lib-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; margin-bottom: 12px; background: var(--panel-2); }
.lib-repo { font-size: 12px; color: var(--text); margin: 10px 2px 6px; }
.lib-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 4px; border-top: 1px solid var(--line); }
.lib-i-name { font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lib-i-path { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ---------- 对话 Chatbox(P6) ---------- */
.chat-wrap { display: flex; gap: 14px; height: calc(100vh - 66px); }
.chat-sessions { width: 270px; flex: none; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.conv-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.conv-card:hover { border-color: var(--accent); }
.conv-card.on { border-color: var(--accent); background: var(--panel-2); }
.cc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cc-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-live { font-size: 10px; color: var(--accent-2); flex: none; }
.cc-ended { font-size: 10px; color: var(--muted); flex: none; }
.cc-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.cc-owner { color: var(--accent); }
.cc-prev { font-size: 11px; color: var(--muted); margin-top: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.cc-stats { display: flex; gap: 10px; font-size: 11px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.cc-time { font-size: 10px; color: var(--muted); margin-top: 5px; }

.chat-main { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.chat-empty { margin: auto; color: var(--muted); font-size: 13px; padding: 40px; text-align: center; }
#chat-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-title { font-size: 15px; font-weight: 700; }
.chat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 78%; }
.msg.user { align-self: flex-end; }
.msg.assistant { align-self: flex-start; }
.msg-body { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.6; }
.msg.user .msg-body { background: var(--accent); border-color: var(--accent); color: #fff; }
.msg.assistant .msg-body { background: var(--panel-2); }
.msg-body p { margin: 5px 0; } .msg-body h1,.msg-body h2,.msg-body h3 { font-size: 14px; margin: 8px 0 5px; }
.msg-body ul,.msg-body ol { margin: 5px 0; padding-left: 20px; }
.msg-foot { font-size: 10px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.msg.user .msg-foot { justify-content: flex-end; }
.msg-save { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: 10px; }
.msg-save:hover { border-color: var(--accent-2); color: var(--accent-2); }
.chat-costbar { display: flex; gap: 16px; flex-wrap: wrap; padding: 7px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); background: var(--panel-2); }
.chat-costbar b { color: var(--text); }
.cache-chip { padding: 1px 8px; border-radius: 20px; border: 1px solid var(--line); }
.cache-chip.ok { color: var(--accent-2); border-color: rgba(62,207,142,.4); }
.cache-chip.warn { color: var(--warn); border-color: rgba(255,182,72,.4); }
.chat-input { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input textarea { flex: 1; resize: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: 13px; font-family: inherit; }
@media (max-width: 720px) { .chat-wrap { flex-direction: column; height: auto; } .chat-sessions { width: auto; } .chat-main { height: 70vh; } }

/* ---------- Admin · GCS 表单 ---------- */
.gcs-form { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.gcs-form input[type=text], .gcs-form > input { flex: 1; min-width: 180px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.gcs-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.mcp-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.mcp-form input { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.mcp-row code { font-size: 10.5px; color: var(--muted); }
.mcp-row .btn.tiny { margin-left: 6px; }

/* ---------- 富渲染内容(Markdown/表格/图片/视频/mermaid/LaTeX) ---------- */
.md-img { max-width: 100%; border-radius: 8px; margin: 6px 0; display: block; }
.md-video { max-width: 100%; border-radius: 8px; margin: 6px 0; display: block; }
.msg-body table, .doc-box table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 12px; display: block; overflow-x: auto; }
.msg-body th, .msg-body td, .doc-box th, .doc-box td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.msg-body th, .doc-box th { background: var(--panel); color: var(--text); }
.msg-body pre, .doc-box pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 12px; }
.msg-body code, .doc-box code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.msg-body pre code { background: none; border: 0; padding: 0; }
.msg-body .mermaid, .doc-box .mermaid { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 8px 0; overflow-x: auto; text-align: center; }
.msg-body blockquote, .doc-box blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.msg-body .katex, .doc-box .katex { font-size: 1em; }
.msg-body a { color: #aeb7ff; }
.msg.user .msg-body a { color: #fff; text-decoration: underline; }

/* ---------- P8:Logo / 主题 / 连接 / 离线 / 运营分析 / 科技感 ---------- */
.brand-logo { flex: none; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--accent) 45%, transparent)); }
/* 侧栏最上方租户品牌(issue #60):Logo 顶替 Cadre 图标;名称 .plain 去渐变用正文色 */
.brand-logo-img { flex: none; width: 34px; height: 34px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: #fff; }
.sidebar h1.plain { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--text);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar.collapsed .brand-logo-img { width: 28px; height: 28px; }
.login-brand .brand-logo { width: 38px; height: 38px; }

/* 悬浮主题切换 */
.theme-fab { position: fixed; top: 16px; right: 16px; z-index: 60; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--glass-brd); background: var(--panel); color: var(--text); cursor: pointer; font-size: 16px;
  box-shadow: var(--shadow); }
.theme-fab:hover { border-color: var(--accent); }
.btn.ghost.icon { padding: 5px 9px; }

/* 连接状态 */
.conn-row { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); padding: 0 4px; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn-dot.on { background: var(--accent-2); box-shadow: 0 0 8px color-mix(in srgb, var(--accent-2) 70%, transparent); }
.conn-dot.off { background: var(--danger); box-shadow: 0 0 8px color-mix(in srgb, var(--danger) 70%, transparent); }

/* 离线待发送气泡 */
.msg.pending .msg-body { opacity: .7; border-style: dashed; }
.pend-tag { color: var(--warn); }

/* 运营分析趋势 */
.ana-trend { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 8px; position: relative; }
.ana-trend .tb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.tb-bars { flex: 1; display: flex; align-items: flex-end; gap: 2px; width: 100%; justify-content: center; }
.tb-bars span { width: 6px; border-radius: 3px 3px 0 0; }
.tb-dau { background: var(--accent-2); }
.tb-tok { background: var(--accent); }
.tb-x { font-size: 9px; color: var(--faint); white-space: nowrap; }
.tb-legend { position: absolute; top: -2px; right: 0; display: flex; gap: 12px; font-size: 10px; color: var(--muted); }
.tb-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.lg-dau { background: var(--accent-2); } .lg-tok { background: var(--accent); }
#ana-users .user-row { cursor: pointer; }
#ana-users .user-row:hover { background: var(--panel-2); }

/* 科技感刷新:玻璃拟态 + 渐变 */
.sidebar { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, var(--bg-2)), var(--bg)); }
.panel, .stat, .emp-card, .sk-card, .dv-card, .conv-card, .chat-main, .login-card, .modal, .drawer {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
}
.btn.primary { background: var(--grad); border-color: transparent; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 34%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.tab.active { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
.logo { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar h1 { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 关键修复:hidden 属性必须永远生效(否则 display:flex 会盖住页面) ---------- */
[hidden] { display: none !important; }

/* --- P15 流式对话 + 交互控件 --- */
.msg.streaming .typing { animation: cadre-blink 1s steps(2) infinite; }
@keyframes cadre-blink { 50% { opacity: 0; } }
.cadre-form { border:1px solid var(--accent); border-radius:10px; padding:12px; margin:10px 0; background:var(--panel-2); box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.cadre-form .cf-head { display:inline-block; font-size:12px; font-weight:700; color:#fff; background:var(--accent); border-radius:999px; padding:2px 10px; margin-bottom:8px; }
.cadre-form .cf-prompt { font-weight:600; margin-bottom:10px; }
.cadre-form .cf-row { display:flex; flex-direction:column; gap:4px; margin-bottom:8px; }
.cadre-form .cf-label { font-size:12px; opacity:.75; }
.cadre-form input, .cadre-form select, .cadre-form textarea { width:100%; padding:6px 8px; border-radius:6px; border:1px solid var(--line); background:transparent; color:inherit; font:inherit; }
.cadre-form .cf-other { margin-top:4px; }
.cadre-form .cf-actions { display:flex; gap:8px; align-items:center; margin-top:4px; }
.cadre-form.submitted { opacity:.55; pointer-events:none; }
@keyframes cadre-pulse { 0%,100% { box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); } 50% { box-shadow:0 0 0 5px color-mix(in srgb, var(--accent) 26%, transparent); } }
.cadre-form:not(.submitted) { animation: cadre-pulse 2s ease-in-out 2; }
/* 生成中的实时成本 */
.cost-live { color:var(--danger); font-weight:700; }
#chat-newrole { padding:6px 8px; border-radius:8px; border:1px solid var(--line); background:transparent; color:inherit; font:inherit; }

/* 停止按钮态(流式进行中) */
#chat-send.stopping { background:var(--danger); border-color:var(--danger); color:#fff; }
/* 渲染兜底/内联错误 */
.cadre-form-bad, .msg-err { border:1px solid var(--danger); border-radius:8px; padding:8px 10px; margin:6px 0; font-size:13px; color:var(--danger); background:color-mix(in srgb, var(--danger) 10%, transparent); }
.retry-card { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.retry-card .btn { color:var(--text); }
/* 滚动到底按钮(锚定聊天面板) */
#chat-panel { position:relative; }
.chat-scroll-btn { position:absolute; right:18px; bottom:96px; z-index:5; padding:6px 12px; border-radius:16px; border:1px solid var(--line); background:var(--panel-2); color:var(--text); cursor:pointer; box-shadow:0 2px 8px rgba(0,0,0,.18); font-size:13px; }
.chat-scroll-btn[hidden] { display:none !important; }
/* 每个代码块的复制/下载工具条 */
.msg-body pre { position:relative; }
.code-tools { position:absolute; top:6px; right:6px; display:flex; gap:4px; opacity:0; transition:opacity .15s; }
.msg-body pre:hover .code-tools { opacity:.95; }
.code-copy { padding:2px 8px; border-radius:6px; border:1px solid var(--line); background:var(--panel-2); color:var(--text); font-size:11px; cursor:pointer; }
.code-copy:hover { border-color:var(--accent); }
/* 消息级「下载 .md」 */
.msg-dl { margin-left:8px; background:none; border:0; color:var(--muted); font-size:12px; cursor:pointer; padding:0; }
.msg-dl:hover { color:var(--accent); text-decoration:underline; }
/* 媒体下载浮层 */
.media-wrap { position:relative; display:inline-block; max-width:100%; }
.media-dl { position:absolute; top:6px; right:6px; padding:3px 9px; border-radius:8px; border:1px solid var(--line); background:color-mix(in srgb, var(--panel-2) 85%, transparent); color:var(--text); font-size:12px; text-decoration:none; opacity:0; transition:opacity .15s; }
.media-wrap:hover .media-dl { opacity:.95; }
/* 无障碍:键盘焦点可见 */
#chat-text:focus-visible, #chat-send:focus-visible, #chat-newrole:focus-visible, .cadre-form button:focus-visible { outline:2px solid var(--accent-2); outline-offset:2px; }

/* 产出物卡片(cadre-doc):把产出文档与会话闲聊分开,只保存/下载文档 */
.cadre-artifact { border:1px solid var(--line); border-radius:12px; margin:10px 0; overflow:hidden; background:var(--panel); box-shadow:0 1px 0 color-mix(in srgb, var(--accent) 18%, transparent) inset; }
.cadre-artifact .ca-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:8px 12px; background:var(--panel-2); border-bottom:1px solid var(--line); }
.cadre-artifact .ca-title { font-weight:600; }
.cadre-artifact .ca-badge { font-size:11px; padding:1px 8px; border-radius:999px; border:1px solid var(--line); color:var(--accent); }
.cadre-artifact .ca-tools { margin-left:auto; display:inline-flex; gap:6px; }
.cadre-artifact .ca-tools .btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.cadre-artifact .ca-body { padding:10px 14px; }
.cadre-artifact .ca-body > :first-child { margin-top:0; }

/* MCP 服务器卡片(对齐 Claude Code /mcp) */
.mcp-card { border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin-bottom:10px; background:var(--panel-2); }
.mcp-card-top { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.mcp-name { font-weight:600; }
.mcp-name code { font-size:11px; opacity:.7; }
.mcp-actions { margin-left:auto; display:inline-flex; gap:6px; flex-wrap:wrap; }
.mcp-card-url { font-size:12px; color:var(--muted); margin-top:6px; word-break:break-all; }
.mcp-tools { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.mcp-chip { font-size:11px; padding:1px 8px; border-radius:999px; border:1px solid var(--line); color:var(--muted); }
.mcp-chip.ok { color:var(--accent-2); border-color:color-mix(in srgb, var(--accent-2) 45%, transparent); }
.mcp-chip.warn { color:var(--accent); border-color:color-mix(in srgb, var(--accent) 45%, transparent); }
.mcp-chip.bad { color:var(--danger); border-color:color-mix(in srgb, var(--danger) 45%, transparent); }

/* MCP 令牌加密密钥告警条 */
.mcp-keywarn { border-radius:8px; padding:8px 12px; margin-bottom:10px; font-size:13px; border:1px solid var(--line); }
.mcp-keywarn code { padding:1px 5px; border-radius:4px; background:color-mix(in srgb, var(--accent) 14%, transparent); }
.mcp-keywarn.ok { color:var(--accent-2); border-color:color-mix(in srgb, var(--accent-2) 40%, transparent); background:color-mix(in srgb, var(--accent-2) 8%, transparent); }
.mcp-keywarn.warn { color:var(--accent); border-color:color-mix(in srgb, var(--accent) 40%, transparent); background:color-mix(in srgb, var(--accent) 8%, transparent); }
.mcp-keywarn.bad { color:var(--danger); border-color:color-mix(in srgb, var(--danger) 45%, transparent); background:color-mix(in srgb, var(--danger) 10%, transparent); }

/* 站内通知 */
.notif-bell { position:relative; background:transparent; border:1px solid transparent; color:var(--muted); padding:8px 12px; border-radius:9px; cursor:pointer; text-align:left; font-size:14px; }
.notif-bell:hover { background:var(--panel-2); color:var(--text); }
.notif-badge { position:absolute; top:2px; left:22px; background:var(--danger); color:#fff; font-size:10px; border-radius:999px; padding:0 5px; line-height:15px; }
.sidebar.collapsed .notif-bell { text-align:center; padding:8px 0; }
.notif-panel { position:fixed; left:220px; bottom:56px; z-index:70; width:360px; max-width:92vw; max-height:60vh; overflow-y:auto; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); }
.notif-head { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; border-bottom:1px solid var(--line); font-weight:600; }
.notif-item { padding:10px 14px; border-bottom:1px solid var(--line); cursor:pointer; }
.notif-item:hover { background:var(--panel-2); }
.notif-item.unread { border-left:3px solid var(--accent); background:color-mix(in srgb, var(--accent) 6%, transparent); }
.ni-title { font-size:13px; }
.ni-body { font-size:12px; color:var(--muted); margin-top:3px; }
.ni-time { font-size:11px; color:var(--faint); margin-top:4px; }

/* 对话附件 */
.chat-atts { display:flex; flex-wrap:wrap; gap:8px; padding:6px 2px; }
.att-chip { display:inline-flex; align-items:center; gap:6px; font-size:12px; padding:4px 10px; border-radius:999px; border:1px solid var(--line); background:var(--panel-2); }
.att-chip i { color:var(--muted); font-style:normal; }
.att-chip button { background:none; border:0; color:var(--muted); cursor:pointer; padding:0 2px; }
.att-chip button:hover, .att-dl:hover { color:var(--danger); }
.att-thumb { width:22px; height:22px; object-fit:cover; border-radius:4px; }
/* 附件区(issue #64):纵向排布,每个附件独占一行;图片用固定缩略图,点开 lightbox 看原图 */
.msg-atts { display:flex; flex-direction:column; align-items:flex-start; gap:8px; margin-top:8px; }
.msg-att-img { width:180px; height:130px; object-fit:cover; border-radius:10px; border:1px solid var(--line); cursor:zoom-in; display:block; }
#chat-attach { flex:none; }

/* 对话媒体套件(issue #52) */
.msg-att-video { width:320px; max-width:100%; max-height:220px; border-radius:10px; border:1px solid var(--line); background:#000; display:block; }
.att-audio { flex-wrap:wrap; }
.att-audio audio { height:30px; max-width:240px; }
.att-file { cursor:zoom-in; }
img.md-img { cursor:zoom-in; }
.chat-main.dropping { position:relative; outline:2px dashed var(--accent); outline-offset:-6px; }
.chat-main.dropping::after { content:"松开鼠标,把文件作为附件发送 📎"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:15px; color:var(--accent); background:color-mix(in srgb, var(--panel) 82%, transparent); z-index:5; pointer-events:none; border-radius:12px; }
#lightbox { position:fixed; inset:0; z-index:200; display:none; align-items:center; justify-content:center; background:rgba(8,10,14,.92); }
#lightbox.on { display:flex; }
#lightbox .lb-stage { max-width:calc(100vw - 140px); max-height:calc(100vh - 90px); display:flex; align-items:center; justify-content:center; }
#lightbox .lb-stage img, #lightbox .lb-stage video { max-width:100%; max-height:calc(100vh - 90px); border-radius:10px; }
#lightbox .lb-x { position:absolute; top:14px; right:18px; font-size:20px; background:none; border:0; color:#cdd6df; cursor:pointer; }
#lightbox .lb-x:hover { color:#fff; }
#lightbox .lb-nav { position:absolute; top:50%; transform:translateY(-50%); font-size:22px; width:46px; height:64px; border:0; border-radius:10px; background:rgba(255,255,255,.08); color:#e6edf3; cursor:pointer; }
#lightbox .lb-nav:hover { background:rgba(255,255,255,.18); }
#lightbox .lb-prev { left:14px; }
#lightbox .lb-next { right:14px; }
#lightbox .lb-cap { position:absolute; bottom:14px; left:0; right:0; text-align:center; font-size:13px; color:#aeb9c4; }
#lightbox .lb-file { display:flex; flex-direction:column; align-items:center; gap:12px; padding:36px 48px; border:1px solid var(--line); border-radius:14px; background:var(--panel); }
#lightbox .lb-ico { font-size:52px; }
#lightbox .lb-name { font-size:15px; color:var(--text); max-width:60vw; word-break:break-all; text-align:center; }
#lightbox .lb-hint { font-size:12px; color:var(--muted); }

/* 公司知识库 */
.kb-tools { display:flex; gap:8px; margin-bottom:12px; }
.kb-tools input { background:var(--panel-2); border:1px solid var(--line); color:var(--text); border-radius:8px; padding:9px; font-size:13px; }
.kb-hits { margin-bottom:14px; display:flex; flex-direction:column; gap:8px; }
.kb-hit { border:1px solid var(--line); border-left:3px solid var(--accent); border-radius:8px; padding:8px 12px; font-size:13px; background:var(--panel-2); }
.kb-list { display:flex; flex-direction:column; gap:10px; }
.kb-card { border:1px solid var(--line); border-radius:10px; padding:10px 14px; background:var(--panel); }
.kb-top { display:flex; gap:10px; align-items:baseline; flex-wrap:wrap; }
.kb-title { font-weight:600; }
.kb-data-badge { font-size:10px; padding:1px 7px; border-radius:6px; color:var(--accent-2);
  border:1px solid color-mix(in srgb, var(--accent-2) 45%, transparent); }
.kb-meta { font-size:12px; color:var(--muted); }
.kb-foot { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); margin-top:6px; }
.kb-actions { margin-left:auto; display:inline-flex; gap:6px; }
.kb-preview { margin-top:8px; padding:10px; border-radius:8px; background:var(--panel-2); border:1px solid var(--line); font-size:12px; white-space:pre-wrap; max-height:280px; overflow-y:auto; }

/* 注解审批门:工具徽标与批准开关 */
.tool-ro { font-style:normal; font-size:10px; color:var(--accent-2); }
.etool.tool-write { border-color:color-mix(in srgb, var(--warn) 50%, transparent); }
.etool.tool-write.ok { border-color:color-mix(in srgb, var(--accent-2) 50%, transparent); }
.tool-gate { margin-left:4px; font-size:10px; padding:0 6px; border-radius:6px; border:1px solid var(--line); background:transparent; color:var(--muted); cursor:pointer; }
.tool-gate:hover { color:var(--text); border-color:var(--accent); }

/* 租户品牌(issue #48) */
.tenant-logo { height:16px; width:16px; border-radius:4px; object-fit:cover;
  vertical-align:-3px; margin-right:5px; }
.tenant-logo-lg { height:38px; width:38px; border-radius:9px; object-fit:cover;
  border:1px solid var(--line); background:var(--panel-2); }
.brand-form { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.brand-form input[type=text], #tb-name { background:var(--panel-2); border:1px solid var(--line);
  color:var(--text); border-radius:8px; padding:8px; font-size:13px; }

/* 报表页 artifact(issue #38):沙箱 iframe 卡片 */
.cadre-page .ca-frame { width:100%; height:380px; border:1px solid var(--line);
  border-radius:10px; background:#fff; display:block; margin-top:8px; }
.cadre-page.expanded .ca-frame { height:82vh; }

/* 成本报表(issue #35) */
.cost-days { background:var(--panel-2); border:1px solid var(--line); color:var(--text);
  border-radius:8px; padding:4px 8px; font-size:12px; }
.cost-totals { display:flex; gap:16px; flex-wrap:wrap; font-size:13px; color:var(--muted);
  margin-bottom:10px; }
.cost-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width: 900px) { .cost-grid { grid-template-columns:1fr; } }
.cost-report h4 { margin:10px 0 6px; font-size:13px; }
.cost-table td, .cost-table th { text-align:right; }
.cost-table td:first-child, .cost-table th:first-child { text-align:left; }

/* 长期记忆(issue #33) */
.mem-chip { display:inline-block; margin:6px 0; padding:4px 10px; border-radius:999px; font-size:12px;
  border:1px dashed var(--line); color:var(--muted); background:var(--panel-2); }
.mem-list { display:flex; flex-direction:column; gap:6px; max-height:320px; overflow-y:auto; margin-bottom:10px; }
.mem-item { display:flex; align-items:center; gap:8px; padding:7px 10px; border:1px solid var(--line);
  border-radius:8px; background:var(--panel-2); font-size:13px; }
.mem-scope { flex:none; font-size:10px; padding:1px 7px; border-radius:6px;
  border:1px solid var(--line); color:var(--muted); }
.mem-scope.g { color:var(--accent-2); border-color:color-mix(in srgb, var(--accent-2) 45%, transparent); }
.mem-text { flex:1; }
.mem-add { display:flex; gap:8px; align-items:center; margin-bottom:6px; }
.mem-add input[type=text], .mem-add > input:first-child { flex:1; background:var(--panel-2);
  border:1px solid var(--line); color:var(--text); border-radius:8px; padding:8px; font-size:13px; }
.mem-general { display:flex; align-items:center; gap:4px; font-size:12px; color:var(--muted); white-space:nowrap; }

/* 会话共享(issue #29):列表徽标 + 头部开关按钮 */
.cc-shared { font-size:11px; margin-left:4px; }
#chat-share.on { border-color:color-mix(in srgb, var(--accent-2) 55%, transparent); color:var(--accent-2); }

/* 流式起步:首字未到前的「思考中」三点动效(占住气泡,不再一片空白) */
.msg-thinking { display:inline-flex; align-items:center; gap:5px; padding:3px 2px; }
.msg-thinking i { width:7px; height:7px; border-radius:50%; background:var(--muted); opacity:.3;
  animation:thinkdot 1.2s ease-in-out infinite; }
.msg-thinking i:nth-child(2) { animation-delay:.18s; }
.msg-thinking i:nth-child(3) { animation-delay:.36s; }
@keyframes thinkdot { 0%,60%,100% { opacity:.25; transform:translateY(0); }
  30% { opacity:1; transform:translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .msg-thinking i { animation:none; opacity:.6; } }
.msg-none { color:var(--muted); font-size:13px; }

/* 定时例行(issue #25) */
.rt-form { display:flex; flex-direction:column; gap:10px; margin-bottom:14px; padding:14px 16px;
  border:1px solid var(--line); border-radius:10px; background:var(--panel); }
.rt-form label { display:flex; flex-direction:column; gap:4px; font-size:13px; color:var(--muted); }
.rt-form input, .rt-form select, .rt-form textarea { background:var(--panel-2); border:1px solid var(--line);
  color:var(--text); border-radius:8px; padding:9px; font-size:13px; font-family:inherit; }
.rt-form-actions { display:flex; gap:8px; align-items:center; }
.form-err { color:var(--bad, #e5484d); font-size:12px; }

/* MCP 引导空态 */
.mcp-guide { border:1px dashed var(--line); border-radius:10px; padding:14px 16px; background:var(--panel-2); }
.mcp-guide-h { font-weight:700; margin-bottom:8px; }
.mcp-guide-steps { margin:0 0 8px; padding-left:20px; line-height:1.7; font-size:13px; }
.mcp-guide-steps code, .mcp-guide code { background:color-mix(in srgb, var(--accent) 14%, transparent); padding:1px 5px; border-radius:4px; }
#cap-add-mcp { margin-left:8px; }

/* 右侧分区 dock(issue #56):产出物料 + 后台任务 */
.dock { width: 292px; flex: none; display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; height: 100vh; transition: width .16s ease; }
.dock.closed { width: 0; overflow: hidden; border-left: 0; }
.dock-tabs { display: flex; gap: 4px; padding: 12px 12px 0; flex: none; }
.dock-tab { flex: 1; padding: 8px 4px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); cursor: pointer; font-size: 13px; white-space: nowrap; }
.dock-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.dock-body { flex: 1; overflow-y: auto; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.dock-sec { font-size: 12px; color: var(--muted); margin: 8px 0 0; flex: none; }
.dock-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--panel-2); cursor: pointer; flex: none; }
.dock-card:hover { border-color: var(--accent); }
.dock-title { font-size: 13px; line-height: 1.45; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dock-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.dock-toggle { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 60;
  width: 20px; height: 58px; border: 1px solid var(--line); border-right: 0; border-radius: 9px 0 0 9px;
  background: var(--panel); color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.dock-toggle:hover { color: var(--text); border-color: var(--accent); }
@media (max-width: 1100px) {
  .dock { position: fixed; right: 0; top: 0; z-index: 55; height: 100vh; box-shadow: -10px 0 28px rgba(0,0,0,.35); }
  .dock.closed { box-shadow: none; }
}
